Repository navigation
Treat #d, #del, and other abbreviations of #delimit like #delimit - #412
Merged
Merged
Conversation
Stata 18 accepts any abbreviation of #delimit down to #d, and base ado files use #del ; widely. Sight only knew the full word, so after #d ; it kept ending statements at line breaks and reported false errors. One shared pattern (src/utils/delimit-directive.ts) now recognizes the keyword, exact-case and as a whole word, for the lexer, parser, alignment detector, and Send to Stata. The lexer takes it only where a command can start or at the start of a line, so a factor-variable interaction such as i.a#d stays an operator. The pretty-printer keeps the spelling as written.
The TextMate grammar and hover read the d of #d and #de as describe. A grammar rule now colors #delimit and each abbreviation as a directive, and hover shows nothing on the directive, as for #delimit.
Contributor
This was referenced Nov 19, 2026
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.
Stata accepts any abbreviation of
#delimitdown to#d. Base ado files use#del ;a lot. Sight only recognized the full word, so after#d ;or#del ;it kept ending statements at line breaks and reported false errors:missing_open_brace,code_follows_open_brace,brace_not_alone, and undefined-macro warnings forsyntaxlocals such as`if'.Now
#d,#de,#del,#deli,#delimand#delimiact exactly like#delimit. Matching is exact-case, so#D ;and#define ;are still not directives. One shared pattern insrc/utils/delimit-directive.tsreplaces the lexer'sstartsWith('delimit')check and the three copies of the;-mode regex (parser, alignment detector, and the helper that Send to Stata uses). Other changes:i.a#dan operator. One side effect: a mid-linex#delimitis now an interaction too, which is how Stata reads it. Before this change it was a directive.#d ;is no longer rewritten to#delimit ;.din#dand#deasdescribe, and hover showeddescribehelp there. A grammar rule now colors every spelling,#delimitincluded, as a directive, and hover shows nothing on the directive, the same as it did for#delimit.Proof: on main, the issue's two repros give 5 and 4 issues with
#d/#deland 0 with#delimit. On this branch every spelling gives 0. The newtests/unit/delimit-abbreviation.test.tscovers tokens, AST, diagnostics, both formatter modes, Send to Stata, the grammar and hover: run against the oldsrc, 23 tests fail, and against the old grammar and hover, 8. All four gates pass when run separately (check:line-endings,typecheck,bun test ./testswith 9903 passing and 0 failing, andlint).sol-loop was skipped: this run was told not to start subagents.
Created with Claude Opus 5.5 in Claude Code (T3 Code).
Summary by CodeRabbit
#delimitdirectives, including forms such as#dand#de.