Repository navigation
mac: signature help that knows which argument you are actually in - #237
Merged
Merged
Conversation
`SignatureHelp` was 210 lines beside a 2,500-line completion engine: it found
the command, counted the argument groups you had closed, and emphasised that
many groups into the pattern. Counting is wrong as soon as an optional is
involved, and the doc line said the same sentence whichever argument you were
in. Three changes:
- **Optional-argument awareness.** The active group is now matched by bracket
*kind*, skipping pattern optionals you left out. `\includegraphics{|}`
emphasises `{file}`, not `[keys]`; `\newcommand{\x}{|}` is the body, not the
arity; `\includegraphics[width=2cm]{|}` still lands on `{file}`. A written
`[` the pattern does not list consumes no pattern group, and a trailing `*`
belongs to the starred name rather than counting as an argument.
- **Per-argument help.** `argumentHints` says what each group means, so
`\rule`'s two identical `{dimension}`s read as the width and the height, and
`\includegraphics`'s `[keys]` lists the keys people actually want. It is
keyed by command and indexed by the compiler inventory's own pattern, and
`testArgumentHintsMatchTheInventoryPatterns` asserts one hint per group — the
gate already earned its keep, catching `\providecommand`'s `[default]` group
and a `\addtolength` the compiler does not have.
- **Environments.** `\begin{tabular}{|l|cc|}` is exactly where people need
reminding what `p{width}` and `|` do, and it used to be refused outright.
`environmentSignatures` supplies the shapes the inventory does not carry
(it records environments by name, mode and description only): tabular and
array column specs, float `[htbp]` placement, minipage's three optionals,
minted/listings/TikZ option keys, thebibliography's widest label. Starred
environments share their base signature. `\begin{|}` is still `\begin`'s own
argument — there you are naming the environment, not passing it one.
The panel's doc line now shows the active argument's help, falling back to the
command's documentation, and wraps to at most three lines with the panel sized
to fit rather than truncating a sentence mid-word.
Implementation-Agent: claude-mac-lsp
Commit-Executor: claude-mac-lsp
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
GoKubar
force-pushed
the
agent/mac-signature-help
branch
from
September 14, 2026 00:50
1051374 to
044e2ae
Compare
GoKubar
marked this pull request as ready for review
September 14, 2026 15:48
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.
SignatureHelpwas 210 lines beside a 2,500-line completion engine: it found the command, counted the argument groups you had closed, and emphasised that many groups into the pattern. Counting is wrong the moment an optional is involved, and the doc line said the same sentence whichever argument you were in.1. Optional-argument awareness
The active group is matched by bracket kind, walking the pattern forward and skipping optionals you left out.
*[keys]{file}[keys]❌*[keys]{file}{file}✅{\name}[n]{body}[n]❌[pos][height][inner-pos]{width}A written
[the pattern does not list consumes no pattern group, and a trailing*belongs to the starred name rather than counting as an argument (\DeclareMathOperator*{).2. Per-argument help
argumentHintssays what each group means, so\rule's two identical{dimension}s read as the width and the height, and\includegraphics's[keys]lists the keys people actually reach for. It is keyed by command and indexed by the compiler inventory's own pattern, andtestArgumentHintsMatchTheInventoryPatternsasserts one hint per group — the gate already earned its keep during development, catching\providecommand's[default]group and an\addtolengththe compiler does not have.3. Environments
\begin{tabular}{|l|cc|}is exactly where people need reminding whatp{width}and|do, and it used to be refused outright ("the environment's own arguments are not documented here"). The compiler's inventory records environments by name, mode and description only — no argument shapes — soenvironmentSignaturessupplies them:tabular/array/tabularx/longtablecolumn specs, float[htbp]placement forfigure/table/algorithm,minipage's three optionals,minted/lstlisting/tikzpictureoption keys,thebibliography's widest label, enumitem keys for the list environments. Starred environments share their base signature.\begin{|}is still\begin's own argument — there you are naming the environment, not passing it one.Panel
The doc line shows the active argument's help, falling back to the command's documentation, and wraps to at most three lines with the panel sized to fit rather than truncating a sentence mid-word.
Tests
13 cases in
SignatureHelpTests(6 new groups), including the two drift gates and the existing hosted-panel test.🤖 Generated with Claude Code
https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu