LuaLS / LuaLS/lua-language-server

How to apply different libraries to different files?

未關閉
#2,157 12 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

question
主要語言
Lua
星號
4.4k
分支
442
PR 合併指標
30 天內沒有已合併 PR

描述

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

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

首先閱讀相關 issue #119,並將其中的討論與 file1.lua、file2.lua、addon1/library/annotations1.lua 和 addon2/library/annotations2.lua 中的範例進行比較。確定 language server 是否支援為每個檔案選取不同的程式庫,並識別所涉及的設定或實作區域。當依檔案區分的行為已獲得支援並記錄在文件中,或其限制已獲得清楚說明時,即視為完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
lua
領域
devtools
Issue 類型
功能
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。