-
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: The completion feature of gopls has high latency when dealing with very large packages. #69631
Comments
Thanks. There is currently a hard speed-limit for this completion, based on the fact that we cannot start streaming partial results (at least for VS Code: microsoft/vscode#105870), and therefore must await type checking of this very large package. However, I'm currently working on a series of optimizations that will help a bit, getting us closer to the theoretical speed limit. You might try installing gopls at master ( I'm also curious if your vim lsp client has partial results support. Is that something you could investigate? |
Thank you for your reply. I am on a long vacation. When I come back, I will try the code on the master.
ok i will try it. |
From a code perspective, both nvim and VSCode currently do not support the 'Partial Result Progress' function for "completion". The following is the "PartialResultParams" parameter that is not specified by both nvim and VSCode when sending "completion" requests. nvim: vscode: |
@findleyr |
@pand5a sorry for the slow response. Type checking is required to resolve the lexical scope of the current package. We could theoretically go faster if we only type checked the current function body+declarations, but we don't support that (it would require quite a hack around the current type checker APIs). |
Okay, I understand. Thank you very much. |
@findleyr Could you provide an idea or approach for a hack? I'd like to implement it myself for temporary personal use, Thanks. |
Saghen/blink.cmp#395 (comment) |
gopls version
golang.org/x/tools/gopls v0.16.2
go env
What did you do?
The completion feature of gopls has high latency when dealing with very large packages. Below are the completion latencies observed in the sql package of the cockroachdb source code.
The code statistics for the sql package in cockroachdb are as follows:
The distribution of the main function latencies in gopls completion is as follows:
The most time-consuming part is ** check.go:1614: elapsed 385.05347ms, check.Files, 288 **, which takes around 385 milliseconds. Adding other operations, the total latency reaches 489.202836ms. This results in noticeable lag during use.
What did you see happen?
During each completion, a TypeCheck is performed on the package containing the currently modified file, and this process is very time-consuming for large packages.
What did you expect to see?
Is it possible to only re-parse the current file during completion, rather than performing a TypeCheck on the entire package? This would allow completion to be completed in milliseconds even for large packages.
Editor and settings
nvim
Logs
No response
The text was updated successfully, but these errors were encountered: