Renamed file considered deleted inside directory junction
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 48/100
Piste de recherche
Reproduisez le problème sous Windows avec une configuration NeoVim stockée via une jonction de répertoire, puis lisez script/filewatch.lua:18 et suivez la gestion du renommage montrée dans les logs. C’est terminé lorsque l’enregistrement de init.lua n’amène plus le language server à traiter le chemin de la jonction comme supprimé, tandis que hover et go-to-definition continuent de fonctionner.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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
- Enable LuaLS in NeoVim.
- Put NeoVim config files inside directory junction. E.g. I have
init.luafile in directoryC:\dev\dotfiles\nvimand I've created the junction to that directory inC:\Users\RobotComp.ru\AppData\Local\nvim. NVim reads config files fromC:\Users\RobotComp.ru\AppData\Local\nvim. - Open
init.luain NVim, change something and save it with:wcommand. - After that, any interactions with LS stop working (hover, go to definition, etc.)
- 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~
- Langage dominant
- Lua
- Étoiles
- 4.4k
- Forks
- 442
- Merge moyen
- 8 j 9 h
- PR mergées (30 j)
- 1
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de LuaLS/lua-language-server
-
enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
LuaLS/lua-language-server#1776 ·
-
泛型for迭代器的类型推导漏掉了带__call的类 Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 65/100
LuaLS/lua-language-server#3463 · 5 commentaires ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 55/100
LuaLS/lua-language-server#3461 ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 68/100
LuaLS/lua-language-server#3460 · 1 commentaire · 1 réaction ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 68/100
LuaLS/lua-language-server#3459 · 1 réaction ·
Toutes les issues de LuaLS/lua-language-server
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
openSUSE/python-rpm-macros#219 ·
-
bug mini.bracketed
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
accessibility bug typst
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
quarto-dev/quarto-cli#14947 · 2 commentaires ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
HenrikBengtsson/CBI-software#134 ·
-
Nmap
Difficulté 1/5 Moins d'une heure Accessibilité débutants 85/100