Skip to content

feat: support per-signature activeParameter, and render the current signatures after a retrigger - #1734

Merged
angelozerr merged 1 commit into
redhat-developer:mainfrom
lagergren:feat/signature-help-active-parameter
Oct 20, 2026
Merged

angelozerr merged 1 commit into
redhat-developer:mainfrom
lagergren:feat/signature-help-active-parameter

Conversation

@lagergren

Copy link
Copy Markdown
Collaborator

Signature help now takes a signature's own activeParameter, and shows each overload as the latest reply describes it. This is the follow-up #1712 left out, since LSP4IJ did not advertise activeParameterSupport.

Problem

  • SignatureInformation.activeParameter was ignored. The popup highlighted the signature help's activeParameter, or the first parameter, in every overload, also when the overload said which of its parameters is active. LSP4IJ did not advertise signatureInformation.activeParameterSupport, so a server could not rely on it either.
  • The popup keeps the SignatureInformation objects of the reply that opened it. updateParameterInfo stores each later reply in the LSPSignatureHelperPsiElement, but updateUI rendered the original objects, so an overload's parameters, their labels and its active parameter stayed as the first reply described them.

Why

SignatureInformation, activeParameter: "The index of the active parameter. If provided, this is used in place of SignatureHelp.activeParameter." The client capability activeParameterSupport: "The client supports the activeParameter property on SignatureInformation literal."

Change

  • ClientCapabilitiesFactory advertises signatureHelp.signatureInformation.activeParameterSupport.
  • LSPParameterInfoHandler.updateUI highlights the signature's activeParameter when it has one, and the signature help's otherwise.
  • updateUI renders an overload from the latest reply stored in the parameter owner: the signature there with the same label. Without exactly one, it renders the shown signature as before.

Validation

LSPParameterInfoHandlerTest, four new tests:

Test main With the change
the capability is advertised fails: expected:<true> but was:<null> passes
a signature's own active parameter is highlighted fails: first highlighted passes: second
after a retrigger, the shown overload renders the latest reply fails: first, second passes: first: Int, second: String, with second: String highlighted
without an overload of the same label, the shown signature is rendered passes passes

./gradlew check: 607 tests, 0 failures, the 3 existing skips.

Not included

  • Overloads are matched by label, so a server that changes an overload's label between replies has that overload shown as the first reply described it.
  • LSP 3.18's explicit null, no active parameter, cannot be told from an absent activeParameter with LSP4J's Integer; it falls back to the signature help's, as an absent one does.

…ignatures after a retrigger

Signature help takes a signature's own activeParameter, which LSP uses in place of the signature
help's when it is provided (since 3.16), and renders each overload as the latest reply describes
it.

- ClientCapabilitiesFactory advertises
  signatureHelp.signatureInformation.activeParameterSupport.
- LSPParameterInfoHandler.updateUI highlights the signature's activeParameter when it has one,
  and the signature help's otherwise.
- The popup keeps the SignatureInformation objects of the reply that opened it, while
  updateParameterInfo stores each later reply in the LSPSignatureHelperPsiElement. updateUI now
  renders an overload from that latest reply, the signature there with the same label; without
  exactly one, it renders the shown signature as before. Parameters, their labels and the
  signature's activeParameter therefore follow a retrigger.

Tests (LSPParameterInfoHandlerTest): the capability is advertised; a signature's activeParameter
is highlighted; after a retrigger the shown overload renders the latest reply's parameters and
active parameter; without an overload of the same label the shown signature is rendered. On main
the first three fail (expected:<true> but was:<null>; " first" highlighted instead of
" second"; the old " first,  second" rendered). ./gradlew check: 607 tests, 0 failures, the 3
existing skips.
@coderabbitai

coderabbitai Bot commented Oct 20, 2026

Copy link
Copy Markdown

Warning

Review limit reached

This 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 14 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a2c11a8b-5e9b-4659-a042-d098c04dc5ad
📥 Commits

Reviewing files that changed from the base of the PR and between f827bb0 and 6ce184c.

📒 Files selected for processing: 3
  • src/main/java/com/redhat/devtools/lsp4ij/features/signatureHelp/LSPParameterInfoHandler.java
  • src/main/java/com/redhat/devtools/lsp4ij/internal/capabilities/ClientCapabilitiesFactory.java
  • src/test/java/com/redhat/devtools/lsp4ij/features/signatureHelp/LSPParameterInfoHandlerTest.java

Comment @coderabbitai help to get the list of available commands.

@angelozerr angelozerr added enhancement New feature or request signatureHelp labels Oct 20, 2026
@angelozerr angelozerr added this to the 0.21.1 milestone Oct 20, 2026
@angelozerr angelozerr moved this to In Progress in Java Tooling Oct 20, 2026
@angelozerr

Copy link
Copy Markdown
Contributor

LGTM, thanks @lagergren !

@angelozerr
angelozerr merged commit 94f48a7 into redhat-developer:main Oct 20, 2026
7 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Java Tooling Oct 20, 2026
@lagergren
lagergren deleted the feat/signature-help-active-parameter branch October 26, 2026 21:43
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request signatureHelp

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants