-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
x/tools/gopls: completion doesn't work correctly in some conditions #65529
Comments
This also happens when the source code has syntax errors: missing a comma inside parentheses or accidentally putting a comma inside parentheses. missing comma: package main
import "fmt"
func main() {
value := 0
fmt.Println("value:" val)
} The completion for accidentally putting comma: Similar issue from #58833 package main
import (
"fmt"
"math"
)
func main() {
math.Sqrt(,0)
math.ab
} The completion for |
Change https://go.dev/cl/561417 mentions this issue: |
Thank you. This looks like a duplicate of #58833, right? Thanks for digging into this and working on a fix! As commented on the CL, it would be helpful to explain a theory of how to handle syntax errors. |
Yes, it is. Although the first scenario (max<>) logically doesn't have any syntax errors. |
Thanks. For what it's worth, the first scenario does have syntax errors (e.g. https://go.dev/play/p/lVxgY6Dczjf notes a syntax error). |
I will take a look at the fix. We can keep this issue open since the other issue is about go/parser. |
Change https://go.dev/cl/602855 mentions this issue: |
gopls version
v0.14.2
go env
What did you do?
Completion doesn't work correctly in some conditions.
variable completion after comma:
Demonstration
test.mp4
What did you see happen?
The completion of
max
becamemaxmaximum
.What did you expect to see?
The completion for
max
should bemaximum
.Editor and settings
No response
Logs
No response
The text was updated successfully, but these errors were encountered: