LuaLS / LuaLS/lua-language-server

How to apply different libraries to different files?

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

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

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. リポジトリをフォークし、ブランチを切って変更します。
  4. 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 を短くまとめたダイジェスト。