Sublime Forum

LSP: Rename with external code changes not working

#1

LSP: Rename with LSP: Typescript

What I’m doing:

  1. LSP: Rename touching several paths (10+)
  2. Save changes
  3. Change to external terminal, git checkout (revert) all changes
  4. Focus back to Sublime, trigger LSP: Rename action again to re-do it
  5. LSP: Rename only detects 2 paths (current folder)
  6. Restart sublime
  7. LSP: Rename now detects all 10+ paths again

It seems Sublime (or the language server) does not pick up the external file changes until I restart Sublime.

I’m on Linux. Monorepo setup imported as a single project in Sublime:

// rootFolder saved as a project

rootFolder/package1
rootFolder/package2
rootFolder/package3

If I delete a folder from the terminal Sublime will instantly pick up the changes even if it’s not in focus, so certain external actions are picked up by Sublime.

Edit,

The same thing happens if I do LSP: Rename, perform the rename action, then select the thing I just renamed and do LSP: Rename again. It will only pick up the current package folder, not all files in the project.

0 Likes

#2

If I delete a folder from the terminal Sublime will instantly pick up the changes even if it’s not in focus, so certain external actions are picked up by Sublime.

There is no ST API for a plugin to know that a file has been deleted though. So either the LSP server detect the change by itself, or it thinks the file is still there.

0 Likes

#3

Would it be more appropriate to report this on the Sublime LSP github project? As in, it’s not some issue with Sublime failing to “inform” the LSP, but rather the LSP failing to pick up file changes that Sublime makes (in the case where I run the LSP: Rename command twice in a row for the same property, and the second run fails to pick up the changes made last time I ran the command)

0 Likes

#4

The file monitoring issue exists since the first day of LSP was created so I would expect there is already an existing issue on GitHub for it but maybe I am wrong.

Feature request to ST

API for monitoring files creation, rename, deletion etc… (is this filed before?)

Workaround

https://packagecontrol.io/packages/LSP-file-watcher-chokidar (maybe)

0 Likes

#5

Thanks for the links, that seems to be what’s behind the issues I’m having. I’ll test that workaround.

Interestingly, Sublime/the LSP will instantly pick up when I delete files containing typedefinitions from the terminal, and starts to report errors in my files.

0 Likes