LSP: add full-mode call and constructor signature help

Chiusa
#1,979 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Una pull request collegata è già stata integrata.

  • #1982 di @nickna — integrata

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
csharp, typescript

Direzione di ricerca

Start with the existing SignatureHelpHandler and the referenced work in #1391, #1975–#1978; this issue depends on those proofs and cursor-analysis changes. Read the existing decorator signature-help behavior and the acceptance tests described in the issue, then trace the handler's analysis snapshot and candidate-signature data. Done means full-mode call and constructor help meets the listed signature, editing, position, mode, and stdio tests without regressing decorator help.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

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 #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 #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 #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 SemanticSignatureHelpService joins 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 checked any and 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 #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.mjs passed 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((1 is not repaired by the current parser. An inner call remains unavailable if an enclosing call fails before argument checking (for example, pair(identity<number>( when pair requires two arguments). Neither case invents facts or substitutes outer signatures.
  • Comments, raw JSX text, unrelated callback bodies, malformed literals and new C without 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. Checklists remain open pending the aggregate PR and merge.

PR and release status

The implementation is committed on codex/standalone-editor-core and is included in PR #1982. Local verification is complete; required GitHub CI is executing. This ticket remains open pending CI and merge. The checklist describes delivery acceptance rather than a claim that this work has been released.

Lingua principale
C#
Stelle
156
Fork
4
Merge medio
13h 33m
PR unite (30g)
45

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nickna/SharpTS

Tutte le issue di nickna/SharpTS

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.