You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Go's LSP server, an eglot-rename operation on a package name causes the server to respond with a directory rename. In other words, the workspace-edit's document-change's old and new URIs both refer to directories. This causes eglot--apply-workspace-edit to fail.
# Install gopls
$ go install golang.org/x/tools/gopls@latest
# create Go package
$ cat a/a.go
package a
# Run Emacs with eglot
# M-x find-file a/a.go
# position over "a" in package a.
# M-x eglot-rename
# Choose new name "b".
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
expand-file-name(nil)
find-file-noselect(nil)
#f(compiled-function (prepared) #<bytecode -0xf6d62cc7c939f10>)(((("/Users/adonovan/w/xtools/a/a.go" [(:range (:start (:line 0 :character 8) :end (:line 0 :character 10)) :newText "b")] 11) (nil nil nil))))
eglot--apply-workspace-edit((:documentChanges [(:textDocument (:version 11 :uri "file:///Users/adonovan/w/xtools/a/a.go") :edits [(:range (:start (:line 0 :character 8) :end (:line 0 :character 10)) :newText "b")]) (:kind "rename" :oldUri "file:///Users/adonovan/w/xtools/a" :newUri "file:///Users/adonovan/w/xtools/b")]) eglot-rename)
eglot-rename("b")
funcall-interactively(eglot-rename "b")
call-interactively(eglot-rename record nil)
command-execute(eglot-rename record)
execute-extended-command(nil "eglot-rename" "eglot-ren")
funcall-interactively(execute-extended-command nil "eglot-rename" "eglot-ren")
call-interactively(execute-extended-command nil nil)
command-execute(execute-extended-command)
The text was updated successfully, but these errors were encountered:
As far as I know, Eglot does not send any resourceOperations among its client capabilities, so it is a mistake from the server to send a rename workspace edit (e.g.: (:kind "rename" :oldUri ...). Maybe the client should handle the situation better, though.
In Go's LSP server, an
eglot-rename
operation on a package name causes the server to respond with a directory rename. In other words, the workspace-edit's document-change's old and new URIs both refer to directories. This causes eglot--apply-workspace-edit to fail.The text was updated successfully, but these errors were encountered: