-
Notifications
You must be signed in to change notification settings - Fork 641
Block completions in invalid positions #903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This scared me enough to go look, but it seemingly doesn't actually do anything formatting related; I'm not sure why it lives there in Strada... |
3c129e8
to
68d21e7
Compare
Planning on doing the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Ports logic to block completions in invalid positions (inside strings, regex, template literals, identifiers definitions, numeric literals, JSX text, bigints) and adds supporting utilities.
- Adds
isCompletionListBlocker
with helper predicates to early-exit completion list generation. - Stubs out
isInComment
and updates tests for comment/regex cases (currently commented). - Introduces
ContainsExclusive
onTextRange
and new AST utilities (IsUnterminatedNode
,IsRegularExpressionLiteral
, etc.).
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
internal/ls/utilities.go | Stubbed isInComment with placeholder comment |
internal/ls/completions_test.go | Added test cases for invalid completion positions (many commented out) |
internal/ls/completions.go | Implemented isCompletionListBlocker and helper functions |
internal/core/text.go | Added TextRange.ContainsExclusive |
internal/checker/utilities.go | Removed isJsxOpeningLikeElement and isObjectLiteralElementLike , updated call sites |
internal/ast/utilities.go | Added IsUnterminatedNode , IsInitializedProperty , IsJsxOpeningLikeElement |
internal/ast/ast.go | Added IsRegularExpressionLiteral |
Comments suppressed due to low confidence (1)
internal/ls/completions_test.go:1977
- Test cases for comment locations are commented out pending
isInComment
implementation. Once implemented, un-comment or add tests to verify completions are blocked inside comments and regex literals.
// !!! isInComment
Is this still the case or are you looking for a review now? |
Sorry, I wasn't clear in my original comment, I meant I'm planning on doing that in a separate PR, so yes, looking for a review. |
Ports the code that blocks completions in positions such as inside strings when the possible strings aren't constrained by the context.
Completions not yet blocked inside comments because
isInComment
is not ported yet (it lives in the formatter 😬)