-
Notifications
You must be signed in to change notification settings - Fork 585
Port more of member completions + tests #833
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 adds more unit tests for member completions while improving several completion‐related helper functions and message clarity. Key changes include:
- Refining the implementation of findChildOfKind in utilities.go (with updated parameter naming and token‐scanning logic) and marking functions for signature help.
- Adding a temporary test setup file for marker parsing in testsetup.go and updating the error message in languageservice.go.
- Renaming internal functions in astnav/tokens.go and introducing ForEachChildAndJSDoc in ast/utilities.go to support more comprehensive AST traversal.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
internal/ls/utilities.go | Updated findChildOfKind with improved naming and token scanning logic. |
internal/ls/testsetup.go | Introduced temporary test setup for marker parsing in unit tests. |
internal/ls/languageservice.go | Enhanced error message to include the file name. |
internal/ls/completions.go | Renamed deprecation function and adjusted text-edit/commit characters logic. |
internal/astnav/tokens.go | Renamed visitEachChildAndJSDoc to exported VisitEachChildAndJSDoc. |
internal/ast/utilities.go | Added ForEachChildAndJSDoc to handle complete child traversal including JSDoc. |
Comments suppressed due to low confidence (6)
internal/ls/utilities.go:85
- Renaming the parameter from 'node' to 'containingNode' improves clarity; ensure that all references within the function remain consistent.
func findChildOfKind(containingNode *ast.Node, kind ast.Kind, sourceFile *ast.SourceFile) *ast.Node {
internal/ls/completions.go:1250
- The duplicate declaration of 'textEdit' has been removed and the text edit adjustment logic for member completions is restructured; verify that this change is fully covered by unit tests.
return &lsproto.CompletionItem{
internal/astnav/tokens.go:137
- Renaming 'visitEachChildAndJSDoc' to 'VisitEachChildAndJSDoc' for export consistency is appropriate; ensure that its usage is reflected in all affected call sites.
VisitEachChildAndJSDoc(current, sourceFile, nodeVisitor)
internal/ls/testsetup.go:64
- [nitpick] Ensure that the new test setup implementation covers all marker parsing scenarios, including edge cases with multiple files or unusual marker formats.
testFileInfo := parseFileContent(currentFileContent, fileName, &markerPositions, &markers)
internal/ast/utilities.go:2796
- The new ForEachChildAndJSDoc function provides a tidy way to traverse child nodes along with JSDoc comments; verify that its behavior is as expected for all AST node variants.
func ForEachChildAndJSDoc(node *Node, sourceFile *SourceFile, v Visitor) bool {
internal/ls/languageservice.go:69
- The updated error message now includes the file name, which improves debuggability; verify that this aligns with the project's logging standards.
panic("file not found: " + fileName)
Follow-up of #811.
In this PR:
findChildOfKind
, which was needed for the tuple completion case.The code in
ls/testsetup.go
is temporary while we don't have real fourslash test infra, and is used for parsing markers in the unit tests. I got it from @navya9singh's signature help branch. I also tested the scenarios in the unit tests in vscode.