LuaLS / LuaLS/lua-language-server

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

Đang mở
#2,169 3 bình luận 3 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

bug
Ngôn ngữ chính
Lua
Star
4.4k
Fork
442
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách tái tạo cấu trúc thư mục với hai tệp .luarc.json và mở code.lua bằng Neovim. Theo dõi cách lua-language-server phát hiện các tệp cấu hình và so sánh các lần chạy lặp lại với những phiên bản Lua được cấu hình khác nhau. Hoàn tất khi cấu hình của thư mục cha gần nhất luôn được chọn nhất quán và bản tái hiện không còn hiển thị các chẩn đoán không xác định.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
lua
Lĩnh vực
devtools
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.