Renamed file considered deleted inside directory junction
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 48/100
Rechercherichtung
Reproduziere das Problem unter Windows mit einer NeoVim-Konfiguration, die über eine Verzeichnisverknüpfung gespeichert wird, lies dann script/filewatch.lua:18 und folge der in den Logs gezeigten Behandlung der Umbenennung. Erledigt ist es, wenn das Speichern von init.lua den Language Server nicht mehr dazu veranlasst, den Pfad der Verzeichnisverknüpfung als gelöscht zu behandeln, während Hover und Go-to-Definition weiterhin funktionieren.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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~
- Vorherrschende Sprache
- Lua
- Sterne
- 4.4k
- Forks
- 442
- Ø Merge
- 8 T. 9 Std.
- Gemergte PRs (30 T.)
- 1
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus LuaLS/lua-language-server
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
LuaLS/lua-language-server#1776 ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 65/100
LuaLS/lua-language-server#3463 · 5 Kommentare ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 55/100
LuaLS/lua-language-server#3461 ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
LuaLS/lua-language-server#3460 · 1 Kommentar · 1 Reaktion ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
LuaLS/lua-language-server#3459 · 1 Reaktion ·
Alle Issues in LuaLS/lua-language-server
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
HenrikBengtsson/CBI-software#134 ·
-
Nmap
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 85/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
secondlife/slua#96 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100