-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/gopls: how to disable diagnostics publish? #37875
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
Thank you for filing a gopls issue! Please take a look at the Troubleshooting guide, and make sure that you have provided all of the relevant information here. |
I don't use lsp-mode, but maybe this: https://github.com/emacs-lsp/lsp-mode/blob/master/lsp-go.el#L145-L148 is what you want? |
I have set it to nil. It had no effect. Then in lsp-mode.el I see that it is not used for gopls client. It is only used for the other two: bingo and go-langserver. https://github.com/emacs-lsp/lsp-mode/blob/6113e321b107915375e7f3fa8e9f85242f7fc874/lsp-go.el#L87 |
I don't think there is a way to disable diagnostics. You can set Can you give more details on the lag you are seeing? How big is your workspace? Is gopls using a lot of CPU? How did you determine there are too many diagnostics? Do you have RPC debugging enabled in Emacs (printing out all the back-and-forth kills performance in Emacs)? |
I used to use gocode with company-go in emacs before. It works well and smoothly. But it is not supported now. So I switched to lsp-mode. I have used lsp-mode for saveral monthes. It never works smoothly. The lag includes two:
The cpu usage just now:
My workspace contains about 20 files. But it imports many packages. I have added some debug message in lsp-mode.el and see that, there are ten of more lsp messages arrived after I input one char in go-mode buffer. Only one of them is completion result. All others are diagnostics messages and most of them are not for the file I'm editing and most of them are empty. lsp-mode has to parse all of the above messages after user inputs every char. I think this may be the cause of the lag. So I want to disable diagnostic. Or is it possible for gopls to only publish diagnostics for the file is being edited? |
@netjune: What version of |
I'm using gopls 0.2.2.
The 0.3.3 crashes for one of my workspace. So I go back to 0.2.2. |
We're not supporting |
It crashes occasionally. And I don't work on that workspace now. I will do it when I go back to that workspace. |
I'm using v0.3.4 now. It doesn't crash until now. Maybe the crash bug in 0.3.3 has been fixed in 0.3.4. |
With 0.3.4 there is another problem. There are too many See https://github.com/netjune/temp_files/blob/master/gopls-3.log |
Beside the lag, I still want an option to turn off diagnostics. I have a directory where I put all my small demo apps. They have names like: demo_foo.go, demo_bar.go... Each of them is a standalone app which has a main function. And they have many global variables and functions with same name. Then the diagnostics is not too usefull. I want to turn off it. |
Change https://golang.org/cl/226371 mentions this issue: |
Thanks for reporting this! I just mailed a change that should remove those extra log lines.
As @muirdm said, this is not possible as a configuration through |
This change adds a helper function that checks if the context is canceled, and if so, doesn't log the error. Tried to use it everywhere in internal/lsp where it fits, which resulted in changing a few pieces of error handling throughout. Updates golang/go#37875 Change-Id: I59cbc6f893e3b70cf84524d9944ff7f4b4febd78 Reviewed-on: https://go-review.googlesource.com/c/tools/+/226371 Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Cottrell <iancottrell@google.com> Reviewed-by: Heschi Kreinick <heschi@google.com>
I'm using gopls with lsp-mode in emacs. It lags too much. In the log I see that, there are too many diagnostics messages. I want to disable diagnostics and don't know how to do that.
Is there an option to control it?
The text was updated successfully, but these errors were encountered: