Open mnewt opened 4 years ago
It repeatedly logs warnings and pops open the
*Warnings*
buffer. If I close the*Warnings*
buffer, it just opens it up again. I presume there is a capability mismatch between Godot and lsp.
The issue is that servers from time to time introduce new notifications and we have to adjust lsp-mode accordingly.
company
completion doesn't work whencompany-box-mode
is enabled. I think I've narrowed down the problem to what happens inlsp-completion--exit-fn
. It goes something like this:
@kiennq is using company-box - maybe we will need logs from the server to figure out this issue. In is in general strange issue, because company-box should be compatible with other frontends.
- What can we do to fix the warnings?
The easy fix is to bind this notifications to nil - see https://github.com/yyoncho/lsp-mode/blob/master/clients/lsp-hack.el#L47
Warning (lsp-mode): Unknown notification: nil
This indicates more serious issues, mostly due to lsp-mode
is being wrongly compiled and installed.
You should probably reinstall lsp-mode
for this.
company completion doesn't work when
company-box-mode
is enabled. I think I've narrowed down the problem to what happens inlsp-completion--exit-fn
. It goes something like this:
I'm using a fork of company-box
and haven't experience thing like that.
Can you narrow down the log to right before and after problem happens (maybe before/after a few key strokes is also fine)?
Well, if it not happens without company-box
, I suspect that this is problem of company-box
, it does check the candidate item to get completion kind, and may be setting insert-text?
to wrong value accidentally.
This indicates more serious issues, mostly due to lsp-mode is being wrongly compiled and installed. You should probably reinstall lsp-mode for this.
I'm a bit stymied by that. I've reproduced the issue with emacs -Q
and a fresh installation of lsp-mode
. I've never seen an error like that from any other major mode while running lsp. However, if no one else sees this issue then I guess we should table it.
Can you narrow down the log to right before and after problem happens
That gist was narrowed down to a few keystrokes. I just did another one. Here were my steps
(setq lsp-log-io t)
vel
into the buffer and wait for the counsel-box
to appear (multiple second pause--the pause only happens when lsp-log-io
is t)(setq lsp-log-io nil)
Result: at least 50,000 lines. 100,000 if I cancel the counsel-box
by pressing C-g
.
Is there something I could do differently to narrow this down? Most of that appears to be happening as a direct result of company-capf
.
Editing to add gist link: https://gist.github.com/mnewt/20339c243dba4a5138c1354e3a0c78fa#file-lsp-log-2
I've taken a look at this, indeed no insertText
is set.
Did this problem only happen with company-box
? If you disable company-box
will it still happens?
The insert-text
can be intentionally to be ""
to indicate deleting, so blindly assign it back to nil
is not good, IMO.
Did this problem only happen with company-box? If you disable company-box will it still happens?
Correct. Invoking company-complete-selection
with normal company-mode
completes and fills in the selection. Invoking it with company-box-mode
enabled erases the selection, including the part I typed before the company completion popped up. It does seem that in my setup insertText
gets set to ""
only when company-box-mode
AND gdscript-mode
are enabled.
I'm also seeing this lsp warning issue.
Is there a way to disable the warning buffer from popping up everytime?
@sebastiencs for company-box
support. It seems that company-box
somehow alternates selected completion item's properties?
@kiennq @mnewt company-box
doesn't alter the candidates properties. I will take a look
I'm also seeing this lsp warning issue.
Is there a way to disable the warning buffer from popping up everytime?
@hnmurz
Someone should bind the missing notification handlers to no-op like this - https://github.com/yyoncho/lsp-mode/blob/master/clients/lsp-hack.el#L47
@yyoncho Thanks, I did try to add a notification handler:
(lsp-register-client
(make-lsp-client :new-connection (lsp-gdscript-tcp-connect-to-port)
:major-modes '(gdscript-mode)
:server-id 'gdscript
;; Ignore unsupported messages.
:notification-handlers (lsp-ht ("executeCommand" 'ignore))))
But I still get this in *Messages*
:
(error "Method not found: executeCommand")
And this in *Warnings*
:
Warning (lsp-mode): Unknown notification: gdscript/capabilities
Warning (lsp-mode): Unknown notification: nil
Warning (lsp-mode): Unknown notification: nil
Did I do what you had in mind?
You have to use "gdscript/capabilities" as a key to get rid of that notification. For the one with nil name, I will need the input of lsp--on-notification which you can get when you do M-x trace-function RET lsp--on-notification RET
That's great, I added gdscript/capabilities. I'm learning!
Here's an example of trace output when the nil notification pops up:
(fn ERROR)"] #6# nil #7# (nil) (nil) :error lsp--merge-results -map cl-rest lsp--cur-workspace] 6 #3#] :error lsp--request-cleanup-hooks] 3 #8#] #6# (24405 27911 264223 0) (24405 27911 264293 0)))) nil #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) (gdscript-mode) nil 0 gdscript nil nil nil nil nil nil nil nil nil nil nil nil #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) nil nil nil) nil #<process gdscript::tcp> #<process gdscript::tcp> (#<buffer Player.gd>) nil nil nil initialized #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) nil 0 nil restart #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ())) #s(hash-table size 3 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("jsonrpc" "2.0" "method" "textDocument/publishDiagnostics" "params" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("diagnostics" [#s(hash-table size 5 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("code" -1 "message" "Expected \"(\" after the identifier (syntax: \"func <identifier>([arguments]):\" )." "range" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("end" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("character" 7 "line" 22)) "start" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("character" 0 "line" 22)))) "severity" 1 "source" "gdscript"))] "uri" "file:///Users/mn/Dropbox/Matt/code/Finnland/Player.gd")))))
1 <- lsp--on-notification: [nil 0 0 500000 nil lsp--on-idle (#<buffer Player.gd>) idle 0]
I wish I could say it's plain to me what the problem is, but I'm afraid it's not. Perhaps you could translate for me?
By the way @yyoncho thank you for this amazing project that works shockingly well the vast majority of the time and for taking the time to help me with my problem!
I wish I could say it's plain to me what the problem is, but I'm afraid it's not. Perhaps you could translate for me?
This doesn't seem to the notification that is causing the issue since it is "textDocument/publishDiagnostics"
.
Coming in late to the thread, but Im having the warnings issues as well.
Someone should bind the missing notification handlers to no-op like this - https://github.com/yyoncho/lsp-mode/blob/master/clients/lsp-hack.el#L47
It looks like you already have this on a branch @yyoncho. Is there a reason that this can't just be opened as a PR to upstream it? If not, what needs to be done so that it can?
FWIW, Im also seeing the following in the Output console in Godot...
modules/gdscript/language_server/gdscript_extend_parser.cpp:476 - Index p_position.character = 0 is out of bounds (line.size() = 0).
modules/gdscript/language_server/gdscript_extend_parser.cpp:476 - Index p_position.character = 0 is out of bounds (line.size() = 0).
Ok, Ive got some custom code in my emacs config that is suppressing notifications for...
"gdscript/capabilities"
"textDocument/publishDiagnostics"
"executeCommand"
but I am still getting several...
Warning (lsp-mode): Unknown notification: nil
Is there a way to globally silence calls to warn
inside lsp-gdscript until upstream contributions can be made to clean this up? (Im happy to help make these contributions if someone can help me figure out what needs to be done. Even happy to hop on a video call and pair through it) This is making the gdscript lsp completely unusable for me ass the Unknown notification: nil
is constantly popping up.
friendly ping to @mnewt and @yyoncho. Anything I can do to be helpful here?
Output from trace-function
on lsp--on-notification
when I get the Unknown notification: nil
warning...
I wasnt sure what section of this would be relevant so I took a large sampling of the *trace-output*
buffer while I was reproducing this issue. (I wrapped this in a <details>
and <summary>
for convenience.)
There were some issues on the side of Godot's language server. In particular, in the past, with some specification not being respected. I sponsored someone to fix these issues.
Could you try with the recently released Godot 3.3 and see if you still have the same problems?
EDIT: I can confirm two warnings are still here at least: gdscript/capabilities and the nil notification.
lsp
with GDScript mostly works fine but has two visible issues:Problem 1
It repeatedly logs warnings and pops open the
*Warnings*
buffer. If I close the*Warnings*
buffer, it just opens it up again. I presume there is a capability mismatch between Godot and lsp. Example*Warnings*
entries:lsp-log: https://gist.github.com/mnewt/20339c243dba4a5138c1354e3a0c78fa
The first warning will pop up when
lsp
is started and the subsequent warnings will pop up from time to time while editing.Problem 2
company
completion doesn't work whencompany-box-mode
is enabled. I think I've narrowed down the problem to what happens inlsp-completion--exit-fn
. It goes something like this:lsp-completion-item
plist entry has inside it:label
and:insert-text?
company-mode
is enabled butcompany-box-mode
is not,:insert-text?
is nil.company-mode
andcompany-box-mode
are enabled,:insert-text?
is""
, solsp-completion--exit-fn
inserts that blank string.I've confirmed that inserting this in
lsp-completion--exit-fn
does indeed cause the candidate to be inserted as expected:Questions
*Warnings*
buffer to not pop up every time one occurs?lsp
orcompany-box
? Can you clarify what is going on there?Reproduction Steps:
emacs -Q
Now, open a GDScript file and try to insert a completion using company, e.g.:
And do
M-x company-complete
, thenM-x company-complete-selection
Versions
lsp: 7.0.1 (commit 1185a48)
GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin19.6.0, NS appkit-1894.60 Version 10.15.6 (Build 19G2021)) of 2020-08-29
Godot 3.2.2