Open dschrempf opened 5 months ago
I am getting a slightly different error message.
In my case, the stack shows one more function call (lsp--line-character-to-point(nil nil)
) that results in:
wrong-type-argument number-or-marker-p nil
... instead of:
wrong-type-argument hash-table-p nil
... as reported in the original bug report.
In case that it matters: I am using emacs-lsp-booster
as well.
Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
lsp--line-character-to-point(nil nil)
lsp--position-to-point(nil)
lsp--range-to-region(nil)
lsp--get-symbol-to-rename()
byte-code("\300\301 !C\207" [lsp--read-rename lsp--get-symbol-to-rename] 2)
command-execute(lsp-rename)
LSP :: lsp-mode 20240610.524, Emacs 29.3, gnu/linux
"clientInfo": {
"name": "emacs",
"version": "GNU Emacs 29.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, cairo version 1.18.0)"
}
[Trace - 09:52:52 AM] Sending request 'textDocument/prepareRename - (68)'.
Params: {
"textDocument": {
"uri": "file:///<REDACTED>/Repositories/Assessment.hs"
},
"position": {
"line": 739,
"character": 19
}
}
[Trace - 09:52:52 AM] Received response 'textDocument/prepareRename - (68)' in 1ms.
Result: {
"defaultBehavior": true
}
[Trace - 09:52:54 AM] Sending request 'textDocument/codeAction - (69)'.
Params: {
"textDocument": {
"uri": "file:///<REDACTED>/Repositories/Assessment.hs"
},
"range": {
"start": {
"line": 739,
"character": 19
},
"end": {
"line": 739,
"character": 19
}
},
"context": {
"diagnostics": []
}
}
[Trace - 09:52:54 AM] Received response 'textDocument/codeAction - (69)' in 81ms.
Result: []
Getting the same error for typescript lsp
wrong-type-argument hash-table-p nil
is that also known or should I make a seperate issue for that?
I do not get this error with ts-ls.
I do not get this error with ts-ls.
It works on classes but not on variables
const role = this.userRole();
Here for example I want to rename role to foobar and it gives me the wrong-type-argument error
Hm, I can not reproduce.
running into the same problem. (setq lsp-rename-use-prepare nil)
appears to fix this issue, though. I think the problem is that haskell-language-server
isn't sending back an actual symbol when sending textDocument/prepareRename
. the flag I just mentioned makes lsp-mode just read the symbol at point instead of trying to get it from the language server.
The current LSP-spec says the following:
If { defaultBehavior: boolean } is returned (since 3.16) the rename position is valid and the client should use its default behavior to compute the rename range.
The trace @vst posted contains the following:
[Trace - 09:52:52 AM] Received response 'textDocument/prepareRename - (68)' in 1ms.
Result: {
"defaultBehavior": true
}
I think lsp-mode
has to compute the symbol at point in this case.
Thank you for the bug report
lsp-mode
related packages.M-x lsp-start-plain
Bug description
When trying to
lsp-rename
a symbol in Haskell (Haskell Language Server,lsp-haskell
), I get the following error:(wrong-type-argument hash-table-p nil)
(see also backtrace below).The
lsp-mode
logs indicate the language server is not giving a proper response. Is that so?Steps to reproduce
See above.
Expected behavior
Symbol can be renamed.
Which Language Server did you use?
Haskell Language Server with
lsp-haskell
.OS
Linux
Error callstack
Anything else?
No response