LuaLS / LuaLS/lua-language-server
Renamed file considered deleted inside directory junction
まだ誰も着手していません。
- 主要言語
- Lua
- スター
- 4.4k
- フォーク
- 442
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
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~
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
ディレクトリ ジャンクションを通して保存された NeoVim 設定で Windows 上の問題を再現し、その後 script/filewatch.lua:18 を読み、ログに示されているリネーム処理を追ってください。init.lua を保存しても language server がジャンクションのパスを削除済みとして扱わなくなり、hover と go-to-definition が引き続き機能すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- lua, neovim
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 48/100