Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Renamed file considered deleted inside directory junction

Aperta
#3,279 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
lua, neovim
Ambito
tooling

Direzione di ricerca

Riproduci il problema su Windows con una configurazione di NeoVim archiviata tramite una giunzione di directory, quindi leggi script/filewatch.lua:18 e segui la gestione della ridenominazione mostrata nei log. Il lavoro è completato quando il salvataggio di init.lua non fa più trattare al language server il percorso della giunzione come eliminato, mentre hover e go-to-definition continuano a funzionare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

How are you using the lua-language-server?

NeoVim

Which OS are you using?

Windows

What is the issue affecting?

Other

Expected Behaviour

LS correctly works with files inside directory junction or symlinks.

Actual Behaviour

LS functionality stops working after saving such a file in editor.

Reproduction steps
  1. Enable LuaLS in NeoVim.
  2. Put NeoVim config files inside directory junction. E.g. I have init.lua file in directory C:\dev\dotfiles\nvim and I've created the junction to that directory in C:\Users\RobotComp.ru\AppData\Local\nvim. NVim reads config files from C:\Users\RobotComp.ru\AppData\Local\nvim.
  3. Open init.lua in NVim, change something and save it with :w command.
  4. After that, any interactions with LS stop working (hover, go to definition, etc.)
  5. If I re-edit file with :e % command, everything starts working again.
Additional Notes

I did some research and found the following.

When saving init.lua, NVim renames it several times (to init.lua~ and back). Don't know why.
The logs (see error.log) show that the filewatch(rename) function is called on LS, which calls isExists().
And although the file exists, isExists() returns false, so the file is considered deleted, and the LS "forgets" about it.

More specifically, the problem occurs in script/filewatch.lua:18:

if res :string():gsub('^%w+:', string.lower)
~= path:string():gsub('^%w+:', string.lower) then
return false
end

Here, it turns out that res contains the actual path to the file (C:\dev\dotfiles\nvim\init.lua), and path contains the path with the junction (C:\Users\RobotComp.ru\AppData\Local\nvim\init.lua).

Commenting out these lines makes everything work correctly (see fixed.log). However, I didn't make a PR with such changes because I didn't fully understand why this path comparison was needed at all. It seems like it fixes some other bug?

Thanks in advance :)

Log File

[00:20:20.415][debug][#0:script\filewatch.lua:98]: filewatch: rename C:\Users\RobotComp.ru\AppData\Local\nvim\init.lua
[00:20:20.415][debug][#0:script\filewatch.lua:98]: filewatch: modify C:\Users\RobotComp.ru\AppData\Local\nvim\init.lua
[00:20:20.415][debug][#0:script\filewatch.lua:98]: filewatch: rename C:\Users\RobotComp.ru\AppData\Local\nvim\init.lua~
[00:20:20.415][debug][#0:script\workspace\workspace.lua:592]: FileChangeType.Deleted file:///c%3A/Users/RobotComp.ru/AppData/Local/nvim/init.lua
[00:20:20.416][debug][#0:script\workspace\workspace.lua:592]: FileChangeType.Deleted file:///c%3A/Users/RobotComp.ru/AppData/Local/nvim/init.lua~

error.log
fixed.log

Lingua principale
Lua
Stelle
4.4k
Fork
442
Merge medio
8g 9h
PR unite (30g)
1

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di LuaLS/lua-language-server

Tutte le issue di LuaLS/lua-language-server

Issue simili

Altre issue su Lua

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.