LuaLS / LuaLS/lua-language-server
Support for module-style includes?
まだ誰も着手していません。
- 主要言語
- Lua
- スター
- 4.4k
- フォーク
- 442
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
### How are you using the lua-language-server?
Other
### Which OS are you using?
Windows
### What is the issue affecting?
Diagnostics/Syntax Checking
### Expected Behaviour
Lua files from my project are found automatically without adding a workspace library path.
### Actual Behaviour
Incorrect diagnostics due to LSP seemingly being unable to find the lua files in the path. Also go to definition and such don't work.
### Reproduction steps
.
### Additional Notes
I have a lot of files in my project which I import like so:
```lua
import 'game.physics'
import 'game.ball.request'
import 'game.world'
```
Note that we use `import` instead of `require`. It doesn't do anything special regarding the paths, and I have the following setting:
```json
"Lua.runtime.special": {
"import" : "require"
}
```
These paths are relative to the workspace, plus some folders. The actual paths are like so:
```
/src/script-game/game/physics.lua
/src/script-game/game/ball/request.lua
/src/script-game/game/world.lua
```
From reading the documentation, it seems like the default `Lua.runtime.path` should pick these files up no problem, but I get diagnostics like "Undefined global "physics"", and I can't go to definition or get completions for those files (details omitted, sorry):

---
If I then add a config for `Lua.workspace.library`, I can make it work:
```
"Lua.workspace.library": [
"\\src\\script-game"
],
```
But this feels wrong. These are my files and they're part of my project. I shouldn't need to add them as a library path, should I? Additionally, I could only get it to work as an absolute path, so I need to update this whenever I switch projects. I tried "src/script-game" and "src\\script-game" and both reverted back to the broken behaviour.
Am I missing something? Do I need to set something custom in `Lua.runtime.path`?
### Log File
Unfortunately I can't provide this as most of it is under NDA.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、issue に記載されている Lua.runtime.path、Lua.workspace.library、Lua.runtime.special の設定を比較します。特に import を require にマッピングした場合を確認してください。src/script-game 配下のプロジェクト相対インポートを再現し、絶対ライブラリパスなしで診断、定義へ移動、補完が機能することを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- lua
- 領域
- tooling
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100