Skip to content

Show a syntax option's real minimum abbreviation in hover, completion, and sight parse --json - #391

Merged
jbearak merged 3 commits into
mainfrom
fix/syntax-option-min-abbreviation
Nov 5, 2026
Merged

jbearak merged 3 commits into
mainfrom
fix/syntax-option-min-abbreviation

Conversation

@jbearak

@jbearak jbearak commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

Hover and sight parse --json gave a syntax option's minimum abbreviation as a single letter: D for Detail, c for cache, C for noCONStant. Those spellings are wrong, and for cache and noCONStant Stata rejects them.

The parser now follows StataMP 18. Stata lowercases only the leading capitals, and keeps the rest of the name as written:

  • the leading capitals, in lowercase: Detail → d, NOLOg → nolo, CACHE → cache, MyOption → m (typed up to myOption, never myoption);
  • for an option without an argument that starts with no, the no plus the capitals after it: noCONStant → nocons (nocon is rejected);
  • without leading capitals, the whole name as written: cache, myOPTion, and noABc(string). An option with an argument is never negatable.

syntax_option_spelling (new, src/utils/syntax-option-name.ts) holds this rule. The parser and command_macro_writes (#390) both read it, which replaces their separate copies.

Completion widened clashing abbreviations without checking these minimums. With syntax [, cache capture] it offered ca for both options, and showed no completions once cac was typed. It now never goes below an option's minimum (found in review).

Decision: schema_version for parse --json stays at 1. min_abbreviation still means the minimum abbreviation; it was wrong before. docs/cli.md now defines it. The golden file changes D→d and L→l.

Proof: every rule above probed on StataMP 18; tests/unit/syntax-option-name.test.ts checks the probed cases. New tests in tests/unit/syntax-option-parsing.test.ts and tests/unit/user-program-option-completion.test.ts fail without the fix. Typecheck, lint, and bun test ./tests pass.

Follow-up, not changed here: syntax [, saveAs(string)] defines the local saveAs, but syntax_option_local_name still lowercases it to saveas.

Reviewed with sol-loop: 3 rounds with gpt-6.1-sol. Sol verdict: approved

Created with Claude Opus 5.5 in T3 Code.

@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Next included review available in 30 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 65 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Team
  • Run ID: 7d146840-6663-442d-8019-2900ab3a994a
Commits

Reviewing files that changed from the base of the PR and between 959f4b0 and 8235d49.

Files selected for processing: 10

  • docs/cli.md
  • src/analyzer/command-macro-writes.ts
  • src/parser/index.ts
  • src/providers/completion.ts
  • src/utils/syntax-option-name.ts
  • tests/fixtures/cli-json/expected/parse.json
  • tests/property/syntax-command-parsing.prop.test.ts
  • tests/unit/syntax-option-name.test.ts
  • tests/unit/syntax-option-parsing.test.ts
  • tests/unit/user-program-option-completion.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

jbearak and others added 2 commits November 5, 2026 16:06
…arse --json

The parser took one letter as a syntax option's minimum abbreviation:
`D` for Detail, `c` for cache, `C` for noCONStant. In StataMP 18 the
minimum is the leading capitals in lowercase (`d`, `nolo` for NOLOg,
`cache` for CACHE), after the `no` of noCONStant (`nocons`); without
leading capitals the whole name as written (`cache`, `myOption`).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jbearak
jbearak force-pushed the fix/syntax-option-min-abbreviation branch from 7f4c983 to 9a6e44e Compare November 5, 2026 21:07
…'s mid-name capitals

StataMP 18 lowercases only a syntax option's leading capitals:
MyOption is typed `m` … `myOption`, not `myoption`, and noABc(string)
is typed `noABc`, since only an option without an argument is
negatable. syntax_option_spelling now gives an option's full
spelling, minimum, and local, and both the parser and macro-write
matching read the minimum from it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jbearak
jbearak merged commit b92a853 into main Nov 5, 2026
16 checks passed
@jbearak
jbearak deleted the fix/syntax-option-min-abbreviation branch November 5, 2026 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant