emacs-lsp / lsp-mode

Emacs client/library for the Language Server Protocol
https://emacs-lsp.github.io/lsp-mode
GNU General Public License v3.0
4.81k stars 892 forks source link

Executing a code action with an embedded TextEdit does not undo #1356

Open alanz opened 4 years ago

alanz commented 4 years ago

Describe the bug

If I execute a code action with an included edit, I cannot use undo to back it out.

To Reproduce Install haskell-ide from https://github.com/alanz/ide/tree/61bf55959066b0fe0a2a414b5d7451b707ce387f (which is https://github.com/alanz/ide/tree/plugins-play), using either stack install or cabal new-install

Enable this exe for use in haskell by

(use-package lsp-haskell
 :ensure t
 :config
 (setq lsp-haskell-process-path-hie "haskell-ide")
 (setq lsp-haskell-process-args-hie '())
 ;; Comment/uncomment this line to see interactions between lsp client/server.
 ;;(setq lsp-log-io t)
)

Open a haskell file, and activate the canned code action, which inserts a comment at the top of the file.

Expected behavior

The comment gets added, and I can use undo to remove it Instead, it gets added but I cannot undo.

Which Language Server did you use

haskell/ide

OS Debian testing.

yyoncho commented 4 years ago

I am unable to reprodouce with emacs 26/27 and jdtls/typescript language servers. Which emacs version do you use?

alanz commented 4 years ago

I am using GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.11) of 2019-09-09, modified by Debian.

It could be that the edit itself is a bit weird, it replaces the first line with another one. Let me do my own investigation (when I have time). So that at least I generate logs.