-
Notifications
You must be signed in to change notification settings - Fork 595
Port global completions #858
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
base: main
Are you sure you want to change the base?
Conversation
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
This PR ports global completions by updating the logic to use the symbols gathered via tryGetGlobalSymbols. Key changes include:
- Introducing the use of maps.Copy in scanner initialization.
- Refactoring utility functions (e.g. in ls/utilities.go and symbol_display.go) and renaming some checker functions to their exported forms.
- Adding a new test setup for processing marker ranges.
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
internal/scanner/scanner.go | Uses maps.Copy to copy token text mappings during initialization. |
internal/ls/utilities.go | Adds and refactors helper functions for token scanning and child traversal. |
internal/ls/symbol_display.go | Modifies the logic determining local variable/function context. |
internal/ls/testsetup.go | Introduces new test setup and marker parsing functions. |
internal/checker/* | Renames several internal checker functions to exported forms and updates calls accordingly. |
internal/astnav/tokens.go, internal/ast/* | Adjustments to AST utilities and token visitor functions to support new patterns. |
Comments suppressed due to low confidence (2)
internal/ls/symbol_display.go:290
- The change from using 'continue' to 'break' in the loop over parent nodes may alter the original iteration logic used to determine local variable/function context. Please verify that breaking out of the loop upon encountering a SourceFile or ModuleBlock is the intended behavior for all cases.
for ; !ast.IsFunctionBlock(parent); parent = parent.Parent { if parent.Kind == ast.KindSourceFile || parent.Kind == ast.KindModuleBlock { break } }
internal/scanner/scanner.go:6
- The introduction of maps.Copy to copy token mappings is a clean use of the new Go functionality; please ensure that our build and runtime environments support the required Go version.
import (
"fmt"
"iter"
"maps"
"strconv"
263cc4d
to
a101a6e
Compare
Are there any notable deviations from Strada that should get special attention in a code review? |
Good question. I don't think there are any for this PR, at least not that I can think of. I'll try to keep that in mind and call it out on future PRs. |
// there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed | ||
return false | ||
|
||
case ast.KindForStatement, |
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.
case ast.KindForStatement, | |
// Add a corresponding case to ast.go if modifying this | |
case ast.KindForStatement, |
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.
??
This PR ports global completions, a.k.a. completions you get from symbols collected by
tryGetGlobalSymbols
.