Skip to content
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

After I save a file, LSP updates the file but does not refresh the buffer #444

Open
joe-humphreys opened this issue Jul 18, 2023 · 1 comment

Comments

@joe-humphreys
Copy link

Describe the bug
Every time I save a Java file, LSP's save hooks run, which usually results in the file being changed on disk. However, the buffer where I am visiting the file does not get refreshed. So when I go to make further changes, I get a message <filename> changed on disk; really edit the buffer? (y, n, r or C-h). Effectively, that means every time I save, I have to wait a moment and then hit 'r' before doing further edits, which is very distracting.

To Reproduce

  1. Open a java file.
  2. Go to any line with code on it and add a few spaces at the beginning of the line.
  3. Save the file
  4. Begin typing

Expected behavior
If a background process changes a file I've got open in a buffer, the changes should just show up immediately in the buffer, without prompting me to revert.

Logs
Content of Messages buffer with lsp-print-io set to t:
LSP :: Disconnected
LSP :: Connected to [jdtls:15943 /home/joh/git/mailific/mailific-spf].
Saving file /home/joh/git/mailific/mailific-spf/src/main/java/net/mailific/spf/Spf.java...
Wrote /home/joh/git/mailific/mailific-spf/src/main/java/net/mailific/spf/Spf.java
Spf.java changed on disk; really edit the buffer? (y, n, r or C-h) r
LSP :: Disconnected
LSP :: Connected to [jdtls:15943 /home/joh/git/mailific/mailific-spf].
ask-user-about-supersession-threat: File reverted: ~/git/mailific/mailific-spf/src/main/java/net/mailific/spf/Spf.java

@sincebyte
Copy link

It seems do not caused by lsp-java. I can't find a hook named lsp-save-hook.
did other file have this error eithor when you save them? If so check your emacs self setting maybe help .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants