Repository navigation
fix: render signatures without parameter metadata and single parameters - #1712
Merged
angelozerr merged 2 commits intoOct 18, 2026
Merged
Conversation
LSPParameterInfoHandler#updateUI had two rendering bugs: - A SignatureInformation without parameters threw a NullPointerException from parameters.size(). The parameters property is optional in LSP, so a server may legitimately omit it. Show the signature label instead, with nothing highlighted, because the signature may still take arguments. An empty parameter list still shows "no parameters". - When IntelliJ asks for a single parameter (isSingleParameterInfo), the parameter name was never appended, so the popup showed an empty "<b></b>". Append the name, escaped, because this presentation is HTML.
angelozerr
reviewed
Oct 18, 2026
More tests for the parameter popup found two rendering bugs: - The single-parameter presentation appended the ", " separator after the current parameter whenever it was not the last one, so it showed "<b>first</b>, ". The separator is now only added to the full list. - A current parameter outside the signature's parameters highlighted nothing, and the single-parameter presentation was empty. LSP says an active parameter outside signatures[activeSignature].parameters defaults to 0, so it now falls back to the first parameter. Tests: the single-parameter presentation shows only the current one of several parameters, renders parameters given as label offsets (escaped), and an out-of-range current parameter falls back to the first one.
Contributor
|
LGTM Thanks @lagergren ! |
This was referenced Oct 28, 2026
angelozerr
pushed a commit
that referenced
this pull request
Nov 4, 2026
* docs: describe the 0.30.0 LSP and DAP changes that the docs miss Several changes merged for 0.30.0 changed behavior that the docs describe, or added behavior that they don't. LSPSupport.md still said that pull diagnostics don't support related documents, which #1723 changed. LSP: - LSPSupport.md, Pull Diagnostics: previousResultId, and the relatedDocuments of either kind of report (#1723, #1735), in place of "It doesn't support the related documents." - LSPSupport.md, Inline Completion: the trigger kind and the selected completion item (#1715). - LSPSupport.md, Signature Help: the retrigger, the active parameter of each signature, and signatures without parameters (#1712, #1734). - LSPSupport.md, Formatting: a file without an open editor (#1707). - LSPSupport.md, new Did Change Watched Files section: the directories outside the project that watchers name, and the watchers of a stopped server (#1742). The support list links to it. - UserGuide.md, Formatting: the Do not format patterns (#1817). - UserDefinedLanguageServer.md, Configuration tab: null properties (#1710, #1847) and invalid JSON (#1828). - DeveloperGuide.md, Workspace Configuration: null members of createSettings() (#1710, #1847). DAP, dap/UserGuide.md: - Exception breakpoint: the hint built from exceptionInfo (#1761). The screenshot of the stop at the exception moves back after the example it shows; the Smart Step Into section had come between them. - Large variables: a page with fewer children than asked for is the last one (#1851). Validation: each statement was checked against the code at d1a281d: DocumentContentSynchronizer.refreshPullDiagnostic, LSPInlineCompletionProvider.createParams, LSPParameterInfoHandler, ClientCapabilitiesFactory, AbstractLSPFormattingService.canFormat, LSPFormattingSupport, FileSystemWatchRoots, LanguageServerPanel .validateJsonFields, JsonSettingsTypeAdapterFactory, DAPClient.getExceptionHint and DAPVariableChildren. The other changes merged for 0.30.0 are already documented, by their own PRs, #1784 and #1810, or change nothing that the docs describe. Limits: docs only, no new screenshots, no build run. * docs: say that the JSON fields of a language server are read leniently CodeRabbit noted that "must be valid JSON" is stricter than what LSP4IJ accepts. The dialog's check (LanguageServerPanel.jsonError, JsonParser.parseString) and the readers at run time (SettingsHelper.parseJson, JsonParser.parseReader for the initialization options, experimental and installer, Gson.fromJson for the client configuration and workspace folders) all read leniently. The paragraph now says which JSON is accepted and which isn't. Validation: probed Gson 2.15.0's JsonParser.parseString and Gson.fromJson. Both accept // and /* */ and # comments, unquoted names and single-quoted strings, and both reject a trailing comma, a missing brace and an unescaped backslash, such as in C:\Users.
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.
Summary
Why?
Three cases in
LSPParameterInfoHandler#updateUIproduce no usable or wrong output for valid server responses.parametersthrows. In LSP,SignatureInformation.parametersis optional (parameters?: ParameterInformation[]), so a server may send a signature with only its label.updateUIcallsparameters.size()and fails withNullPointerException: Cannot invoke "java.util.List.size()" because "parameters" is null.ParameterInfoUIContext#isSingleParameterInfo()), the name is appended only in the non-single branch, so the handler renders<b></b>: an empty popup. When the current parameter is not the last one, it also appends the list's,separator after it.signatures[activeSignature].parametersdefaults to 0 if the active signature has parameters." LSP4IJ applies the default only when the value is omitted, so an out-of-range value highlights no parameter, and the single-parameter presentation is empty.How?
parameters, show the signature label and highlight nothing. "No parameters" would be wrong here, because the signature may still take arguments; the server simply did not describe them. A signature with an emptyparameterslist still shows IntelliJ's "no parameters" text, as before.<b>tags. That presentation is HTML (setupRawUIComponentPresentation), so the name, and the label when there are no parameters, is escaped: a label such asitems: List<T>would otherwise be read as a tag. The,separator is only added in the full parameter list.Implications
Signatures without parameter metadata now show their label instead of failing, the single-parameter popup shows the current parameter alone, and an out-of-range active parameter highlights the first one. Rendering of signatures with an in-range parameter is unchanged.
Changes
LSPParameterInfoHandler#updateUI.LSPParameterInfoHandlerTest), rendering throughupdateUI: a signature withoutparameters, also as a single parameter with characters that need escaping; an emptyparameterslist keeps "no parameters"; the current parameter is highlighted, including with label offsets; the single-parameter presentation includes the parameter, escaped, shows only the current one of several, and handles label offsets; and an out-of-range current parameter falls back to the first one.Manual verification
To reproduce, have a server answer
textDocument/signatureHelpwith a signature that has alabelbut noparameters, then trigger parameter info. Without this change, rendering fails with the exception above; with it, the label is shown. I did not run this by hand; the tests above cover it.Automated checks completed:
cbe50d3d, 4 of the first 7 tests fail: the two missing-parameter tests with theNullPointerExceptionabove, and the two single-parameter tests, which render<b></b>. The other 3 pass on both and show the rest of the rendering is unchanged.<b>first</b>,) in two of them, and no highlight for an out-of-range parameter in the third. All 10 pass with this change../gradlew check --rerun-tasks --no-build-cache: 500 tests passed, 3 existing skips, no failures or errors. Run withjava.io.tmpdirunder the home directory, since the default macOS temporary directory gives unrelatedVfsRootAccessfailures with and without this change.