LuaLS / LuaLS/lua-language-server

Non-deterministic behavior when there are multiple parent folders with .luarc.json.

オープン
#2,169 コメント 3 件 リアクション 3 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug
主要言語
Lua
スター
4.4k
フォーク
442
PR マージ指標
30日以内にマージされた PR はありません

説明

### How are you using the lua-language-server?

NeoVim

### Which OS are you using?

Linux

### What is the issue affecting?

Diagnostics/Syntax Checking

### Expected Behaviour

When the language server processes a Lua file, it should use the .luarc.json file that is closest (in the chain of parent folders) to the file being opened. So in this case:
```
dir1
|- .luarc.json
\_ dir2
|- .luarc.json
\_ code.lua
```
Opening code.lua should use dir2/.luarc.json.

### Actual Behaviour

Non-deterministic behavior: sometimes it uses dir1/.luarc.json and sometimes it uses dir2/.luarc.json. This is a big problem e.g. in cases where those two files specify different versions of Lua.

### Reproduction steps

Create the directory/file structure above, specifying different version of Lua in each one, then put some code in code.lua that is sensitive to the version, then run lua-language-server (I run it through Neovim) on code.lua, and observe sometimes it assumes one version of Lua and other times it uses the other.

Deleting dir1/.luarc.json then eliminates the non-deterministic behavior and it always uses dir2/.luarc.json.

### Additional Notes

_No response_

### Log File

_No response_

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、2つの .luarc.json ファイルを含むディレクトリ構造を再現し、Neovim で code.lua を開きます。lua-language-server が設定ファイルをどのように検出するかを追跡し、異なる Lua バージョンを設定した状態で繰り返し実行した結果を比較します。最も近い親ディレクトリの設定が一貫して選択され、再現時に非決定的な診断が表示されなくなれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
lua
領域
devtools
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。