Repository navigation
fix: help with a language server whose template lists only socket modes, and name every listed socket mode in the hint - #2132
Open
lagergren wants to merge 3 commits into
Conversation
…rver whose template lists only socket modes A template can say that its language server talks LSP only over a socket, by listing only socket modes in `transports`, but nothing used that: no hint, no warning for stdio, and without a `socket` the New Language Server dialog selected stdio, over which such a language server can't talk. - A grey hint below the transport, "This language server talks LSP only over a socket.", in the dialog and on the settings page of a language server created from a bundled template. - Stdio gives the warning "The template says this language server talks LSP only over a socket" on the stdio button. It is asWarning().withOKEnabled(), so OK and Apply still save. - Without a `socket`, the dialog selects Socket for it, in the first socket mode of `transports`, with an Auto port (attach: no port yet). - Unchanged: a template without `transports`, or with stdio and a socket mode; a template's own `socket`; and saved settings, which keep their transport (a saved stdio shows with the warning, and Apply saves it). Part of redhat-developer#1947.
… lists only socket modes to stdio
An installer's command is taken to be for the standard input and output
unless it takes ${port}, so a language server which LSP4IJ starts over a
socket was switched to stdio by one without it. A language server whose
template lists only socket modes can't talk over stdio, so it couldn't
start at all afterwards.
- forInstalledCommand(command, supportedTransports) keeps the transport of
such a language server, and switches any other as before. The
one-argument forInstalledCommand is unchanged.
- The installer of a language server, at its start or from its settings,
finds its template by its id among the bundled ones, as the settings page
does. The New Language Server dialog uses the template it loaded,
imported ones included.
- With an Auto port, the kept socket can't start until the command takes
${port}: a warning says so, with the action which opens the settings, and
the dialog shows its error "With an Auto port, the command must take the
port as ${port}". A fixed port, which the command may name itself, gets
no warning.
Part of redhat-developer#1947.
…ly the first
The hint below the socket modes took the first entry of `transports`
which isn't stdio, so a template which lists both startAndConnect and
startAndAccept, each with its own argument, named only the first: after
choosing the other mode, whose argument the command then gets, the hint
still named the first one's.
- Each socket mode which the template lists has its hint, in the order of
the list, with the wording of the hint as before: "This language server
takes the port as {argument}, with "{mode}".", or "This language server
supports "{mode}"." without an argument.
- A mode listed twice has the hint of its first entry, whose argument the
command gets when the mode is chosen.
- A template which lists one socket mode shows the same hint as before.
Part of redhat-developer#1947.
|
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 17 minutes. View limit details
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #1947.
Please merge with "Rebase and merge", not "Squash and merge". Each of the three commits is one behaviour change, and its title says what users will notice, so a rebase merge puts each in the release notes.
What
Two sections of #1947:
transports, but nothing used that:socket, the New Language Server dialog selected stdio;${port}switched such a language server to stdio (forInstalledCommand), where it can't talk, so it couldn't start afterwards. That happens both when the server starts and from the dialog, also with a fixed port, where the command may name the port itself.transports. A template that listsstartAndConnectandstartAndAcceptnamed only the first. Choosing the second swapped its argument into the command, while the hint kept naming the first one's.No bundled template lists only socket modes, or two socket modes, so this is for imported and plugin templates.
Change
asWarning().withOKEnabled(), so OK and Apply still save.socket, the dialog selects Socket in the first listed socket mode, with an Auto port (attach: no port yet). This happens inloadFromTemplateonly, so saved settings never change.UserDefinedTransport.forInstalledCommand(command, supportedTransports)keeps the transport of a language server whose template lists only socket modes. The one-argument method is unchanged.UICommandLineUpdaterfinds the template by its id among the bundled ones, as the settings page does. The dialog uses the template it loaded.${port}. A notification says so, with the action that opens the settings, and the dialog shows its existing${port}error. A fixed port, which the command may name itself, gets no warning.Docs: the Socket and Transports sections of
UserDefinedLanguageServerTemplate.md, and the installer paragraph ofUserDefinedLanguageServer.md.Behaviour changes
${port}no longer switches such a language server to stdio, on which it can't talk. It keeps its socket, and with an Auto port a warning says that its command needs${port}.Backward compatibility
transports, or with stdio and a socket mode, behaves as before. That is every bundled template.socketis kept.forInstalledCommand(String, List<TransportSupport>)andTransportSupport.talksOnlyOverASocket(List).transportsin an export, but not with such a server.Test
TransportFieldsTest,NewLanguageServerDialogTransportTest,LanguageServerViewTransportTest,UICommandLineUpdaterTransportTestandUserDefinedTransportTest: the hint, the stdio warning, the default Socket, a saved stdio, the installer with an Auto and a fixed port, and every listed socket mode. The settings-page and installer tests add a socket-only template to the bundled ones for the test, as none is bundled.main, its new tests fail: 6 (and the dialog's installer test, which needs the default Socket) for the first commit, 4 for the second, 2 for the third.