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

file-notify-add-watch watch a directory doesn't work when backup file disabled or edit file in vscode? #3296

Open
2 of 3 tasks
jadestrong opened this issue Jan 4, 2022 · 2 comments
Labels

Comments

@jadestrong
Copy link
Contributor

jadestrong commented Jan 4, 2022

Thank you for the bug report

  • I am using the latest version of lsp-mode related packages.
  • I checked FAQ and Troubleshooting sections
  • You may also try reproduce the issue using clean environment using the following command: M-x lsp-start-plain

Bug description

I use doom-emacs and rust-analyzer, when edit the Cargo.toml file in doom-emacs or vscode it will not trigger the workspace/didChangeWatchedFiles event.

lsp-mode use file-notify-add-watch to watch a directory change to trigger workspace/didChangeWatchedFiles.
image

It works in vanilla Emacs because it enabled backup file feature, when edit and save a file will trigger a create or rename or delete event .
When disable this feature such as doom-emacs or edit the file in vscode, it only change the file content, only trigger a file change event, so directory change event will not work as expect.

Steps to reproduce

doomemacs/doomemacs#5630
brotzeit/rustic#322
image
When edit and save Cargo.toml file in doom-emacs and vscode, only file change event:
image
When edit in vanilla Emacs:
image

Expected behavior

When edit Cargo.toml in vscode or emacs without backup file, can also reload rust-analyzer

Which Language Server did you use?

rust-analyzer

OS

MacOS

Error callstack

No response

Anything else?

No response

@jadestrong jadestrong added the bug label Jan 4, 2022
@laampui
Copy link
Contributor

laampui commented Jan 25, 2022

Screenshot_2022-01-25_20-20-07

similar issue: #facebook/create-react-app#9056

same here...

@danp
Copy link

danp commented Mar 18, 2024

Running into this myself, on macOS. Maybe related to me using backup-by-copying t that I learned from #3516 / #4112? Not sure.

It does seem less than ideal that file-notify-add-watch can't detect changes to existing files, at least the way it's ending up working on macOS. There was some talk about improving in this bug but it was closed.

Is there something else lsp-mode could do? Would having (optional) support for using an external process for watching directories/files for changes help at all? At least then there would be a way to plug something in that can detect all creates/changes/deletes, I think.

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

No branches or pull requests

3 participants