LuaLS / LuaLS/lua-language-server

How to apply different libraries to different files?

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

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

question
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?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

MacOS

What is the issue affecting?

Libraries

Expected Behaviour

Same variables refer to different definitions, depending on file

Actual Behaviour

Same variables do not refer to different definitions, depending on file

Reproduction steps

Create several libraries with different definitions for some global

Additional Notes

Hi!

This is a question and not a bug report. Imagine, that I have several lua files with global variable named SomeVar:

file1.lua

print(SomeVar.X)

file2.lua

print(SomeVar.Y)

and there are two different files with annotations:
addon1/library/annotations1.lua

---@class TSomeVar1
---@field X integer
SomeVar = {}

addon2/library/annotations2.lua

---@class TSomeVar2
---@field Y integer
SomeVar = {}

Is there any way to specify that for file "file1.lua" first library should be used, and for "file2.lua" second library should be used?
I think that similar question was referred in this issue https://github.com/LuaLS/lua-language-server/issues/119
But I cannot run many language servers, because number of files can grow very large

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 việc đọc issue liên quan #119 và so sánh phần thảo luận của issue đó với các ví dụ trong file1.lua, file2.lua, addon1/library/annotations1.lua và addon2/library/annotations2.lua. Xác định liệu language server có hỗ trợ chọn các thư viện khác nhau cho từng tệp hay không, đồng thời xác định khu vực cấu hình hoặc triển khai liên quan. Được xem là hoàn thành khi hành vi theo từng tệp được hỗ trợ và ghi lại trong tài liệu, hoặc giới hạn của nó được giải thích rõ ràng.

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
Tính năng
Độ 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.