Repository navigation
LSP: add full-mode call and constructor signature help #1979
Description
Parent epic: #1390. Depends on #1391, #1392, #1975, #1976, #1977 annotation/public-callable proof and #1978 checked cursor analysis.
Outcome
In full mode, ordinary function/method calls and new expressions show checker-backed parameter signatures while the user types, including an unfinished f( or new C( buffer. Existing decorator signature help remains available in both modes.
Signature proof boundaries
- Join the innermost parser-owned invocation to frozen facts by exact document/AST owner. Use the fresh configured cursor graph from LSP: add full-mode lexical and member completion for live editing #1978 for unfinished argument lists; never check a cached parse-only AST or reuse stale callee proof.
- Candidate annotations must be proven at their existing checker resolution/construction decisions. Preserve exact proof through aliases, preparatory cache reuse and signature instantiation. Source-owner checks alone do not prove source-less returned callables; unresolved names must not become fabricated any parameters. Legitimate checked any remains valid.
- Show only available public candidates in original deterministic order. A filtered/unavailable selected candidate clears selection. Recovered/hole-bearing calls, ambiguous candidates and runtime constructors whose checker validates only the implementation have no semantic active signature.
- Count only parser-owned top-level commas and apply each signature's rest position. Do not split text, rerun overload matching, or select a nearest arity. Missing client capability objects must initialize safely.
Work
- Add mode-aware semantic fallback to the existing SignatureHelpHandler. Preserve existing SharpTS-specific behavior; interop-only must not serve ordinary TypeScript signatures or start their analysis.
- Use cursor-local recovery and source delimiter/argument ranges from Parser: provide precise source ranges and bounded editor recovery #1391 to find the innermost supported call/new expression, without splitting argument text on commas.
- Render source/local/imported functions, callable values, supported class methods and constructors using captured candidate signatures, generic instantiations and selected signature from Checker: expose bounded semantic queries for editor features #1976.
- Show public overloads in deterministic order and omit implementation-only signatures. Set activeSignature only for a complete checker selection; a client's first-signature presentation fallback does not establish a semantic winner.
- Compute activeParameter correctly for nested calls, generic type arguments, optional/rest parameters, comments, template literals and trailing/incomplete arguments.
- Honor signature-help client label-offset and active-parameter capabilities, cancellation and snapshot currentness.
- Use the same bounded renderer and analysis snapshot as hover/completion. Existing CLR/decorator help stays intact; new CLR call help is included only where the checker exposes authoritative candidates/selection, with unavailable cases explicitly documented.
Acceptance and verification
- Exact signature/parameter tests cover functions, methods, constructors, callable aliases, imported functions, overloads, generic inference and optional/rest arguments.
- Live editing tests cover f(, f(a, , nested calls, partial new expressions and incomplete files without crashing or reusing stale types.
- Position tests cover commas inside nested expressions/templates/type arguments, TSX files, Unicode and line endings.
- Ambiguous/unresolved calls do not fabricate a selected overload; no implementation signature leaks into public overload results.
- Real stdio requests verify mode boundaries, trigger/retrigger behavior, cancellation and dirty dependency overlays.
- Existing decorator signature tests remain green; unchanged requests reuse semantic analysis.
Non-goals
Parameter-name inlay hints, a separate overload resolver, executing calls, signature rewriting, or requiring all reflected CLR overload cases for the first delivery.
Implemented and verified on codex/standalone-editor-core
- Full-mode
SemanticSignatureHelpServicejoins the innermost parser-owned call/new list to frozen invocation facts by exact owner identity. Decorator help remains first in both modes. Missing capability objects initialize safely; parameter label offsets and per-signature active parameters follow negotiation. - Candidate proof follows existing signature construction/resolution, exact source owners, explicit invocation type arguments and callee/receiver annotations. Alias/preparatory reuse and existing substitution retain that proof by reference. Known unavailable annotations cannot display fabricated
any; legitimate checkedanyand independently proven public overloads remain available. An unavailable instantiation may retain its proven formal declaration, without a selected signature. - The bounded renderer retains original candidate ordinals and public overload order. Instantiated parameter names come only from the exact original signature with a matching parameter count. Parser top-level commas, exact UTF-16 label slices and each candidate's rest position drive parameter presentation; no additional overload matching or inference runs.
- Unfinished argument lists use the fresh configured cursor graph from LSP: add full-mode lexical and member completion for live editing #1978. A completed call cannot cold-retry simply because the caret precedes an existing argument. Recovered calls, holes, unavailable candidates and runtime constructors without a public winner do not claim selection. Cancellation and final input/currentness validation remain mandatory.
- Release build passed with zero warnings/errors. The change adds 115 cases (63 service, 17 handler, 25 candidate eligibility and 10 renderer cases); 147 focused tests and 3,433 affected tests passed. Pinned TypeScript smoke passed 32 corpus cases/17 harness tests; targeted Test262 passed 9/9.
node scripts/test-semantic-signatures.mjspassed four real stdio clients (full/interop-only, negotiated label/parameter capabilities on/off), initialized without hover/completion capabilities. It covers unfinished/nested calls, public versus selected overloads, generic/template/comment commas, completed literal arguments, private/optional/ambient constructor calls, UTF-16 labels, dirty dependency/close behavior, decorator priority, available CLR candidates and actual cancellation with fresh-request survival. Completion, hover and shared-analysis stdio regressions also passed.
Explicit limits
- An unfinished grouping such as
f((1is not repaired by the current parser. An inner call remains unavailable if an enclosing call fails before argument checking (for example,pair(identity<number>(whenpairrequires two arguments). Neither case invents facts or substitutes outer signatures. - Comments, raw JSX text, unrelated callback bodies, malformed literals and
new Cwithout an argument-list delimiter return no ordinary signature help. - Generic proof covers captured callable owners and signature-owned annotations; shared outer generic-interface constraint/default metadata is not separately tracked. This delivery does not claim complete generic-constraint provenance.
Implementation and replay commands are documented in language-server.md and editor-semantic-queries.md. Delivery acceptance is verified on the PR branch; this ticket remains open pending merge.
PR and release status
Implementation and delivery verification are complete in PR #1982, final head 666e197a37a3bf90871a511efc273da9ac985000. The required CI matrix, including Ubuntu/Windows editor contracts and Gate, and the applicable GUI packaging/native checks passed on that head. Checklists record verified implementation on the PR branch. This ticket remains open until merge; this is not a released-version claim.
Activity
Deliver verified standalone editor support (#1390) (#1982)