-
Notifications
You must be signed in to change notification settings - Fork 797
slow file save and code action when using the language server #299
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
Comments
@LukeMauldin Thanks for the detailed bug report and the trace. Interesting that you couldn't reproduce it with vim-go. What were the previous messages before the message
I wonder whether the |
Here is a list of the trace statements from VSCode:
For vim-go, I set |
Thanks @LukeMauldin ! It looks like this is the client-side logging enabled with ( Also, with I don't know how to do it in |
Hi @LukeMauldin, it looks like vim-go has enabled daemon mode for gopls (a feature that I added), and I suspect the logs you're looking at are the daemon logs, which don't contain logs of your individual session and so are mostly (or entirely) empty most of the time. I hadn't really stopped to consider how confusing that could be... filed https://golang.org/issue/40105 to improve this behavior. All this to say, I don't think |
client trace:
server trace:
|
I made the changes you requested to my ~/.vimrc file and restarted. I do get the log file in /tmp but it is empty. .vimrc:
|
Ah, sorry, you also need So
I'm not currently using vim-go, but I'm confirming this now... |
Below the a similar edit in vim-go. Notice there are no symbol messages to
|
@LukeMauldin Thank you so much for being patient and providing the trace. From vim-go trace, I don't see Let's investigate why |
I am attaching a cpu profile web trace. And below is the Trace for code/Action
|
@LukeMauldin Thank you so much again.
|
Where do I put that configuration information? I tried putting it in my VSCode settings JSON file and it is grayed out, like it isn't supported? |
Yep - that's actually fine - it will still work. |
Change https://golang.org/cl/241321 mentions this issue: |
The discussion on golang/vscode-go#299 has uncovered the fact that go/printer is very expensive, and we're calling it frequently on file changes. Analyzers whose suggested fixes require the original file content are generally posing issues; this is being discussed on golang/go#40110. Updates golang/vscode-go#299 Change-Id: I5cb370c9cb508203e463e7243fc781e75876fe30 Reviewed-on: https://go-review.googlesource.com/c/tools/+/241321 Run-TryBot: Rebecca Stambler <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Heschi Kreinick <[email protected]>
Change https://golang.org/cl/241322 mentions this issue: |
The discussion on golang/vscode-go#299 has uncovered the fact that go/printer is very expensive, and we're calling it frequently on file changes. Analyzers whose suggested fixes require the original file content are generally posing issues; this is being discussed on golang/go#40110. Updates golang/vscode-go#299 Change-Id: I5cb370c9cb508203e463e7243fc781e75876fe30 Reviewed-on: https://go-review.googlesource.com/c/tools/+/241321 Run-TryBot: Rebecca Stambler <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Heschi Kreinick <[email protected]> (cherry picked from commit d5a7453) Reviewed-on: https://go-review.googlesource.com/c/tools/+/241322
I made the change and from my initial testing, it appears to be working much better. Thank you for helping me resolve the issue so quickly!
|
Glad to hear it's working better! I believe that |
gopls went through many iterations around the fillstruct support, and now the feature offered by default and is pretty stable. I am closing this issue now. Thanks for your cooperation @LukeMauldin and gopls devs. |
What version of Go, VS Code & VS Code Go extension are you using?
go version
to get version of Goo version go1.14.2 linux/amd64
code -v
orcode-insiders -v
to get version of VS Code or VS Code Insidersgo env
to get the go development environment detailsShare the Go related settings you have added/edited
Describe the bug
I am experiencing extreme slowness and high CPU usage when saving a
.go
file after modification. I am experiencing it primarily in one project. The project itself is about 10K lines of Go code. It has a relatively small number of dependencies that total about 20K lines of Go code, including some CGO code. During the time that VSCode is waiting,top
says thatgopls
is using between 600%-800% of CPU. No other tasks are taking much time.Actions such as auto-complete and Go to Definition are fast (complete in around 1 second or less). However, when I save a file, I get a notification from VSCode that it is "Saving the file: Getting code actions from Go". I have turned on
gopls
tracing and I see messages like the following:I cannot share the full
gopls
log because it contains company sensitive symbols. The best I can tell, the bug is related to VSCode askinggopls
for an updated list of symbols. I have tried to reproduce the error in Vim withgopls
+ vim-go and I cannot reproduce the error in the environment. To me, that tells me the error is related to the VSCode Go plugin + gopls and not strictly a gopls bug.I have been able to duplicate it on multiple machines and my primarily development machine is relatively fast. CPU: Intel(R) Xeon(R) E-2186M and RAM: 32GB
The text was updated successfully, but these errors were encountered: