-
-
Notifications
You must be signed in to change notification settings - Fork 912
importing packages hangs emacs in lsp-go #903
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
Can you do toggle-debug-on-quit and press C-g when emacs hangs and paste the callstack? |
Debugger entered--Lisp error: (quit)
process-send-string(#<process gopls> "Content-Length: 194\15\n\15\n{\"jsonrpc\":\"2.0\",\"method\":\"...")
lsp--send-no-wait("Content-Length: 194\15\n\15\n{\"jsonrpc\":\"2.0\",\"method\":\"..." #<process gopls>)
lsp--send-request-async((:jsonrpc "2.0" :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///Users/vincent/go/src/dpim/cli/ui/deploy.go") :position (:line 15 :character 12)) :id 370) #f(compiled-function (highlights) #<bytecode 0x1fe9cadcc065>) nil nil nil)
lsp-request-async("textDocument/documentHighlight" (:textDocument (:uri "file:///Users/vincent/go/src/dpim/cli/ui/deploy.go") :position (:line 15 :character 12)) #f(compiled-function (highlights) #<bytecode 0x1fe9cadcc065>))
lsp--document-highlight()
#f(compiled-function () #<bytecode 0x1fe9cc41a531>)()
apply(#f(compiled-function () #<bytecode 0x1fe9cc41a531>) nil)
timer-event-handler([t 0 0 200000 nil #f(compiled-function () #<bytecode 0x1fe9cc41a531>) nil idle 0])
process-send-string(#<process gopls> "Content-Length: 151\15\n\15\n{\"jsonrpc\":\"2.0\",\"method\":\"...")
lsp--send-no-wait("Content-Length: 151\15\n\15\n{\"jsonrpc\":\"2.0\",\"method\":\"..." #<process gopls>)
lsp--send-request-async((:jsonrpc "2.0" :method "textDocument/documentLink" :params (:textDocument (:uri "file:///Users/vincent/go/src/dpim/cli/ui/deploy.go")) :id 369) #f(compiled-function (links) #<bytecode 0x1fe9cba11ff1>) alive nil nil)
lsp-request-async("textDocument/documentLink" (:textDocument (:uri "file:///Users/vincent/go/src/dpim/cli/ui/deploy.go")) #f(compiled-function (links) #<bytecode 0x1fe9cba11ff1>) :mode alive)
lsp--update-document-links(#<buffer deploy.go>)
apply(lsp--update-document-links #<buffer deploy.go>)
timer-event-handler([t 0 0 100000 nil lsp--update-document-links (#<buffer deploy.go>) idle 0])
no signature help for file:///Users/vincent/go/src/dpim/cli/ui/deploy.go:15:1 : cannot find an enclosing function
no signature help for file:///Users/vincent/go/src/dpim/cli/ui/deploy.go:14:20 : cannot find an enclosing function
no signature help for file:///Users/vincent/go/src/dpim/cli/ui/deploy.go:15:1 : cannot find an enclosing function
no signature help for file:///Users/vincent/go/src/dpim/cli/ui/deploy.go:15:2 : cannot find an enclosing function
Buffer switched - ignoring reponse. Method textDocument/hover |
AFAIK process-send-string is async and it should not block. Can you confirm that you get this call stack each time you press C-g when emacs hangs in lsp-mode? Also, are you able to reproduce the issue if you disable lsp-enable-symbol-highlighting ? Can you check the process explorer for processes that are taking the system resources? Does the hanging disappear if you wait some time? If it disappears, can you provide a performance report? Were you able to isolate some steps to reproduce? |
This time I got this backtrace: Debugger entered--Lisp error: (quit)
company-dabbrev--search("\\(?:\\sw\\)+" 0.1 all)
company-dabbrev(candidates "git")
apply(company-dabbrev (candidates "git"))
company-call-backend-raw(candidates "git")
company--fetch-candidates("git")
company-calculate-candidates("git" nil)
company--begin-new()
company--perform()
company-auto-begin()
company-idle-begin(#<buffer deploy.go> #<window 3 on deploy.go> 908 304)
apply(company-idle-begin (#<buffer deploy.go> #<window 3 on deploy.go> 908 304))
timer-event-handler([t 23823 36130 975307 nil company-idle-begin (#<buffer deploy.go> #<window 3 on deploy.go> 908 304) nil 0]) I suspect the server is hung. Because after I press Updated: It only exists in a big go project with many modules. |
If the server is hung, this should not hang emacs since lsp-mode is doing async calls. To investigate further, can you exclude company-dabbrev from the company backends? We have to find out the root cause. |
I use I noticed the messages below while typing `import "github.com/xxx" LSP :: no import for ""
LSP :: no import for "g"
LSP :: no import for "gi"
LSP :: no import for "git"
LSP :: no import for "gith"
LSP :: no import for "githu"
LSP :: no import for "github"
LSP :: no import for "github"
LSP :: no import for "github."
LSP :: no import for "github.c"
LSP :: no import for "github.co"
LSP :: no import for "github.com" It seems very slow to search. Is it related? |
Once you have removed company-dabbrev you should reproduce the issue and do C-g until we find out what is causing the issue. Also, can you post a performance report?
I am not familiar with gopls internals. |
Could be golang/go#32750. |
Thanks for the information, @muirrn . It's definitely the same issue. |
The usptream issue has been closed. @seagle0128 can you confirm this is resolved with latest gopls? |
Yep, I can confirm the issue has been resolved. Close it. Thanks! |
When
import
some packages withlsp-go
andgopls
, the Emacs hangs.The text was updated successfully, but these errors were encountered: