Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open
#444 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
emacs-lisp, java

Research direction

Reproduce the issue with a Java file by adding spaces, saving, and typing immediately afterward. Trace the LSP save hooks and buffer refresh behavior; done means background file changes appear in the open buffer without the supersession prompt or manually reverting.

Written by the indexing model from the issue text.

Description

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

Dominant language
Emacs Lisp
Stars
696
Forks
97
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from emacs-lsp/lsp-java

All issues in emacs-lsp/lsp-java

Similar issues

More DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.