Repository navigation
feat: the socket transport of a language server is no longer experimental - #1964
Conversation
|
Warning Review limit reachedThis review ran on the open-source allowance, not this organization's plan, because the pull request author doesn't have an assigned seat. Waiting won't change this — ask an organization admin to assign them a seat, or add seats in Billing if every seat is already assigned, then retry. Next included review available in 31 minutes. View limit details
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1964 +/- ##
==========================================
- Coverage 48.32% 48.31% -0.02%
==========================================
Files 809 809
Lines 32500 32500
Branches 5015 6623 +1608
==========================================
- Hits 15706 15702 -4
- Misses 14294 14299 +5
+ Partials 2500 2499 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@coderabbitai review |
Action not completed
|
…ntal The transport is labelled Socket instead of Socket (experimental), and the user guide, the template docs and the README no longer call the socket transport, a template's `socket` or its `transports` experimental. The Java API for plugins stays @ApiStatus.Experimental for now (SocketStreamConnectionProvider, UserDefinedSocketStreamConnectionProvider, UserDefinedTransport, TransportSupport), since redhat-developer#1947 and redhat-developer#1951 may still change it. Fixes redhat-developer#1955
ad2ad69 to
56e4ad0
Compare
The socket transport left 'experimental' in 0.30.0 (redhat-developer#1964), and its Java API now does too: SocketStreamConnectionProvider, UserDefinedSocketStreamConnectionProvider, UserDefinedTransport and TransportSupport lose @ApiStatus.Experimental, and their javadoc and the developer guide no longer say that the API may change.
…sable a language server (#1977) * fix: connect to ::1 too when a socket has no host Without a host, LSP4IJ connected to 127.0.0.1 only. A language server which listens on localhost may get ::1 only, as Node.js does where the system resolves localhost to ::1 first, and LSP4IJ then failed to attach, or waited a minute before it failed to connect to a language server which it started. Without a host, LSP4IJ now connects to the loopback address of the JVM and then to the other one, and with a host, to each of its addresses in turn, as a client does. An IP address as the host is taken as it is. Part of #1951 * fix: say so when failed starts disable a language server After 20 failed starts in a row, LSP4IJ disabled a language server, and only the Language Servers view showed it, while the notification of the last failed start stayed. That notification now gives way to one which says that the language server is disabled, with the error of its last start, an action which enables and starts it again, and Show Logs. Part of #1944 * fix: share the connect timeout across the addresses of a host, and bound the port probe An attach to a host with two addresses which drop packets waited for the timeout once per address, 20 seconds instead of the documented 10. The addresses now share the one timeout. The probe before a start on a fixed port, which checks that no process listens there already, had no timeout and couldn't be stopped; it now connects as an attach does, within its timeout, and stop() closes it. * fix: enable and start only the instance which failed starts disabled For a definition with several instances, Enable and Start restarted the instance with restart(), which connects the open files of the whole definition again, and so started the other instances which were stopped. It now starts that instance on its own, as LanguageServerManager does for a root, and keeps restart() for a language server without instances. * docs: the socket transport's API is no longer experimental The socket transport left 'experimental' in 0.30.0 (#1964), and its Java API now does too: SocketStreamConnectionProvider, UserDefinedSocketStreamConnectionProvider, UserDefinedTransport and TransportSupport lose @ApiStatus.Experimental, and their javadoc and the developer guide no longer say that the API may change. * test: wait for the language server which a feature of the open file starts The test of the notification when failed starts disable a language server looked the language server up right after it opened the file, while a feature of the file starts it in the background: on a slow CI runner it wasn't there yet, and the test failed with 'No value present'. The test now waits until it is there. * fix: keep socket retries within the start timeout, and report a timeout as one Each attempt to connect to a language server which this provider starts now gets only the time which is left of the start, so that a late retry no longer runs past the start timeout. When the start times out during an attempt, the start fails with "didn't accept a connection within", as when it times out between attempts. When one address refuses the connection and a later one doesn't answer, the connection now fails with the timeout rather than the refusal, so that an attach no longer reports "Nothing listens" where something may listen.
…ed (#1985) * fix: connect to ::1 too when a socket has no host Without a host, LSP4IJ connected to 127.0.0.1 only. A language server which listens on localhost may get ::1 only, as Node.js does where the system resolves localhost to ::1 first, and LSP4IJ then failed to attach, or waited a minute before it failed to connect to a language server which it started. Without a host, LSP4IJ now connects to the loopback address of the JVM and then to the other one, and with a host, to each of its addresses in turn, as a client does. An IP address as the host is taken as it is. Part of #1951 * fix: say so when failed starts disable a language server After 20 failed starts in a row, LSP4IJ disabled a language server, and only the Language Servers view showed it, while the notification of the last failed start stayed. That notification now gives way to one which says that the language server is disabled, with the error of its last start, an action which enables and starts it again, and Show Logs. Part of #1944 * fix: pause between the restarts of a language server whose start failed Each feature of the open files starts the language server, so one whose start failed at once, as an attach to a language server which doesn't run yet, was restarted at each of their calls: its 20 restarts were used up within a second, with as many errors, and then it was disabled. The first restart is still at once; from the second on, a start waits 1 s after the last restart, then 2 s, 4 s, and so on up to 30 s, so that the 20 restarts take about 7.5 minutes. A restart by the user, as from the Language Servers view or the notification, doesn't wait. The test of the notification when failed starts disable a language server moves next to the restart tests, which can switch the pause off. Part of #1944 * fix: count only the failed restarts of the last 10 minutes A language server was disabled after its 20th restart since it was created or last restarted by the user, however far apart they were, so one which crashes now and then, as once a day, ended up disabled. Only the restarts within the last 10 minutes count now, and the pause before the next one depends on them. A language server which keeps failing is still disabled: its 20 restarts, with their pauses, take about 7.5 minutes. Part of #1944 * test: switch off the restart pause where a test drives an instance to too many failed starts Part of #1944 * fix: share the connect timeout across the addresses of a host, and bound the port probe An attach to a host with two addresses which drop packets waited for the timeout once per address, 20 seconds instead of the documented 10. The addresses now share the one timeout. The probe before a start on a fixed port, which checks that no process listens there already, had no timeout and couldn't be stopped; it now connects as an attach does, within its timeout, and stop() closes it. * fix: enable and start only the instance which failed starts disabled For a definition with several instances, Enable and Start restarted the instance with restart(), which connects the open files of the whole definition again, and so started the other instances which were stopped. It now starts that instance on its own, as LanguageServerManager does for a root, and keeps restart() for a language server without instances. * docs: the socket transport's API is no longer experimental The socket transport left 'experimental' in 0.30.0 (#1964), and its Java API now does too: SocketStreamConnectionProvider, UserDefinedSocketStreamConnectionProvider, UserDefinedTransport and TransportSupport lose @ApiStatus.Experimental, and their javadoc and the developer guide no longer say that the API may change. * test: wait for the language server which a feature of the open file starts The test of the notification when failed starts disable a language server looked the language server up right after it opened the file, while a feature of the file starts it in the background: on a slow CI runner it wasn't there yet, and the test failed with 'No value present'. The test now waits until it is there. * fix: keep socket retries within the start timeout, and report a timeout as one Each attempt to connect to a language server which this provider starts now gets only the time which is left of the start, so that a late retry no longer runs past the start timeout. When the start times out during an attempt, the start fails with "didn't accept a connection within", as when it times out between attempts. When one address refuses the connection and a later one doesn't answer, the connection now fails with the timeout rather than the refusal, so that an attach no longer reports "Nothing listens" where something may listen. * docs: keep the javadoc of setConnectionExecutor on that method The restart pause methods went in between the javadoc of setConnectionExecutor and the method, which left that javadoc on nothing. * fix: fail a request for the language server in the pause after a failed restart In the pause, start() starts nothing, and getInitializedServer() gave no server, as a normal result. A feature turned that into an empty result, and kept it until the file changed, so it didn't ask again once the pause was over. A restart which fails gives a failed result, which a feature doesn't keep. getInitializedServer() now fails with the error of the last start in the pause too, and so does it for a start which fails before start() returns, which gave no server until now. * fix: fail the connection of a file in the pause after a failed restart too The connection of a file starts the language server itself, and gave no language server when that start started nothing, as in the pause. That happens when the language server stops, and fails to start again, between a feature's request for it and the connection of the file: the feature then kept an empty result, as before the last commit. The connection now fails with the error of the last start too, as getInitializedServer() does. * test: a feature asks again after a failed result for an unchanged file The pause after a failed restart relies on it: a request for the language server fails then, so that a feature asks again once the pause is over, while it keeps an empty result until the file changes. The javadoc of failCodeLenses no longer says that a start which fails before start() returns gives no language server, since it now gives its error.
…nnects to LSP4IJ (#1986) * fix: connect to ::1 too when a socket has no host Without a host, LSP4IJ connected to 127.0.0.1 only. A language server which listens on localhost may get ::1 only, as Node.js does where the system resolves localhost to ::1 first, and LSP4IJ then failed to attach, or waited a minute before it failed to connect to a language server which it started. Without a host, LSP4IJ now connects to the loopback address of the JVM and then to the other one, and with a host, to each of its addresses in turn, as a client does. An IP address as the host is taken as it is. Part of #1951 * fix: say so when failed starts disable a language server After 20 failed starts in a row, LSP4IJ disabled a language server, and only the Language Servers view showed it, while the notification of the last failed start stayed. That notification now gives way to one which says that the language server is disabled, with the error of its last start, an action which enables and starts it again, and Show Logs. Part of #1944 * fix: listen on both loopback addresses for a language server which connects to LSP4IJ LSP4IJ listened on 127.0.0.1 only, so a language server which connects to localhost and gets ::1, as Node.js may, couldn't connect, and LSP4IJ waited a minute before it failed. It now listens on the same port on both loopback addresses, and takes the first connection. Without that port free on ::1, or without IPv6, it listens on the loopback address of the JVM only, as before. Part of #1951 * fix: share the connect timeout across the addresses of a host, and bound the port probe An attach to a host with two addresses which drop packets waited for the timeout once per address, 20 seconds instead of the documented 10. The addresses now share the one timeout. The probe before a start on a fixed port, which checks that no process listens there already, had no timeout and couldn't be stopped; it now connects as an attach does, within its timeout, and stop() closes it. * fix: enable and start only the instance which failed starts disabled For a definition with several instances, Enable and Start restarted the instance with restart(), which connects the open files of the whole definition again, and so started the other instances which were stopped. It now starts that instance on its own, as LanguageServerManager does for a root, and keeps restart() for a language server without instances. * docs: the socket transport's API is no longer experimental The socket transport left 'experimental' in 0.30.0 (#1964), and its Java API now does too: SocketStreamConnectionProvider, UserDefinedSocketStreamConnectionProvider, UserDefinedTransport and TransportSupport lose @ApiStatus.Experimental, and their javadoc and the developer guide no longer say that the API may change. * test: wait for the language server which a feature of the open file starts The test of the notification when failed starts disable a language server looked the language server up right after it opened the file, while a feature of the file starts it in the background: on a slow CI runner it wasn't there yet, and the test failed with 'No value present'. The test now waits until it is there. * fix: keep socket retries within the start timeout, and report a timeout as one Each attempt to connect to a language server which this provider starts now gets only the time which is left of the start, so that a late retry no longer runs past the start timeout. When the start times out during an attempt, the start fails with "didn't accept a connection within", as when it times out between attempts. When one address refuses the connection and a later one doesn't answer, the connection now fails with the timeout rather than the refusal, so that an attach no longer reports "Nothing listens" where something may listen.
As discussed in #1962 and asked in #1955, the socket transport is no longer experimental for users in 0.30.0:
Socketinstead ofSocket (experimental).socketor itstransportsexperimental.The Java API for plugins stays
@ApiStatus.Experimentalfor now, together with its sentence in the developer guide. That coversSocketStreamConnectionProvider,UserDefinedSocketStreamConnectionProvider,UserDefinedTransportandTransportSupport. Dropping it promises plugin developers a stable API, and #1947 and #1951 may still change it. That's a separate decision.The screenshots
SocketTransport.pngandSocketTransportModes.pngstill show the old label. They can be retaken with the next change to that dialog.The tests refer to the label by its bundle key, so none change. The settings and launching tests pass, including
TransportFieldsTest,LanguageServerViewTransportTestandNewLanguageServerDialogTransportTest: 94 tests, 0 failures.Fixes #1955