Skip to content

Read nobreak and break as prefixes, so nobreak { opens a block whose locals stay visible - #401

Merged
jbearak merged 5 commits into
mainfrom
fix/nobreak-prefix
Nov 6, 2026
Merged

jbearak merged 5 commits into
mainfrom
fix/nobreak-prefix

Conversation

@jbearak

@jbearak jbearak commented Nov 6, 2026

Copy link
Copy Markdown
Owner

nobreak { wasn't read as a block. nobreak and break weren't known prefixes, so nobreak { parsed as a command nobreak followed by a stray {. The block's body was then misread: locals set inside it were reported as undefined after the }, which is common in base ados (nobreak { local rc = _rc } … exit rc'`).

Checked in StataMP 18:

  • nobreak {, break {, capture noisily break { and quietly nobreak { open blocks whose locals are visible after }.
  • nobreak local s = 10 and break local t = 11 work as prefixes.
  • nobreak * note and break * note are comments.
  • nobrea, brea and NOBREAK are unrecognized, so neither word has an abbreviation.

Both words are now prefixes everywhere Sight skips prefixes:

  • the parser and lexer (PREFIX_COMMANDS, which feeds the star-comment rule too);
  • loop expansion and command position (SINGLE_LINE_PREFIX_COMMANDS);
  • completion (commands, options and frame subcommands after the prefix);
  • hover;
  • the mixed-model || exemption;
  • c_local program-call detection;
  • the do/run/include call-site pattern;
  • the console highlighter and Windows browse rewrite.

Not changed: Stata rejects nobreak:, but Sight still accepts it without a diagnostic. There's no diagnostic for misused prefix colons, and adding one is a separate change.

Proof: on Stata's 3,780 base ados, 5,195 diagnostics are removed, including 4,048 false UNDEFINED_MACRO, 805 OUT_OF_SCOPE_SYMBOL, 322 OPEN_BRACE_ALONE and 12 false "Missing end". 66 are added:

  • 14 EMBEDDED_BLOCK_ENDS_PROGRAM, from a separate lexer bug: mata : or mata: /// one-liners inside the newly read nobreak blocks. A follow-up PR fixes it.
  • 23 accurate "used before it is defined", such as a macro used before the syntax that defines it.
  • The rest are existing syntax rules reaching code that used to be misparsed.

Each new test fails on the commit before it. Typecheck, lint, and bun test ./tests pass.

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

Created with Claude Opus 5.5 in T3 Code.

@coderabbitai

coderabbitai Bot commented Nov 6, 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 29 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 71 included PR review attempts over the past 7 days set your current allowance at 1 review 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: 1c118cfa-5ddb-4f85-9110-1f9e2466db83
Commits

Reviewing files that changed from the base of the PR and between eeaeb83 and 279f2a4.

Files selected for processing: 17

  • docs/send-to-stata.md
  • src/console/automation/browse-alias.ts
  • src/console/highlighter.ts
  • src/providers/completion.ts
  • src/providers/diagnostics.ts
  • src/providers/hover.ts
  • src/providers/operator-sequence-diagnostics.ts
  • src/utils/stata-call-patterns.ts
  • src/utils/stata-prefix-commands.ts
  • tests/unit/console/automation-backend.test.ts
  • tests/unit/console/text-processing.test.ts
  • tests/unit/diagnostics-provider.test.ts
  • tests/unit/directive-parser-classify-call-line.test.ts
  • tests/unit/directive-parser.test.ts
  • tests/unit/frame-subcommand.test.ts
  • tests/unit/hover.test.ts
  • tests/unit/nobreak-prefix.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@jbearak
jbearak merged commit f962176 into main Nov 6, 2026
16 checks passed
@jbearak
jbearak deleted the fix/nobreak-prefix branch November 6, 2026 02:43
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