Repository navigation
Report the Sight directive in each comment in sight parse --json, so other tools don't reimplement the directive grammar - #353
Merged
Conversation
Add a directive field to every comment object (null for an ordinary comment or a directive Sight does not honor where it stands) and a file-level comments list for comments no statement reports. The analyzer's comment-directive rules (ignore, ignore-next, declarations, variables, and the trivia walk) move to src/directive-parser/comment-directives.ts so the analyzer and the CLI call the same functions. Forward, backward, standalone, and working-directory directives come from DirectiveParser.
Contributor
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. Next included review available in 6 minutes. View limit details
|
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.
do2r translates Stata to R and rewrites each Sight directive as the matching Raven directive. Until now
sight parse --jsonreported comments only as raw text. To do the rewrite, do2r would have had to copy Sight's directive grammar: the@lsp-aliases, the optional colon, quoting, and which placements count (header-only rules, trailing-comment rules, block comments).Now every comment object has a
directivefield. It holds the directive Sight actually honors there, read by the editor's own code. It isnullfor an ordinary comment and for a directive Sight ignores where it stands. The kinds aredeclare(local, global, variables, scalar, matrix, program),ignoreandignore_next,forward,backward(run-byis kept asrun),standalone, andworking_directory.ignoreandignore_nextcarry atarget_range: the code whose diagnostics Sight suppresses. A new top-levelcommentslist holds the comments no statement reports, so a file that is only header comments no longer loses them. The change is additive only, andschema_versionstays 1. docs/cli.md documents it under "Directives".To keep the CLI and the editor from drifting apart, the analyzer's comment-directive rules (
ignore,ignore-next, declarations,variables, and the trivia walk) moved tosrc/directive-parser/comment-directives.ts. The analyzer and the CLI both call that module. The forward, backward,standalone, and working-directory directives come fromDirectiveParser. Existing directive tests pass unchanged.Proof:
ignoreand declarations, andsight graphforforward,backward, andstandalone. With either CLI rule removed, these tests fail.sight parse --jsonoutput on the fixture matches the golden file.bun test ./testspass. The exception is the local-Stata help-coverage test, which also fails on main on this machine.Reviewed with sol-loop: 1 round with gpt-6.1-sol. Sol verdict: approved
Created with Claude Opus 5.5 in Claude Code (T3 Code).