LuaLS / LuaLS/lua-language-server

Not loading .luarc.json when using vscode or vim-lsp

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

還沒有人認領這個 Issue。

Info Needed
主要語言
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?

Windows

### What is the issue affecting?

Diagnostics/Syntax Checking

### Expected Behaviour

When I add a `.luarc.json` file next to my vscode `.code-workspace` file, the values from my `.luarc.json` can control the configuration of lua-ls.

### Actual Behaviour

The `.luarc.json` file is ignored in both vscode (v1.79.2) and gvim (9.0.1626).

### Reproduction steps

1. Create a `.luarc.json` and disable lowercase-global
2. Open a file with a lowercase global in vscode or gvim
3. See error `[sumneko-lua-language-server] Lua Diagnostics.:Information:lowercase-global:Global variable in lowercase initial.`

Following the format in the project's [`.luarc.json` file](https://github.com/LuaLS/lua-language-server/blob/master/.luarc.json) and the instructions on [the wiki](https://github.com/LuaLS/lua-language-server/wiki/Configuration-File#luarcjson). (Possibly those instructions aren't clear enough and there's something I'm setting up incorrectly.)

### Additional Notes

Here's the contents of my entire repro project (`find . -type f -exec head -n10000 {} +`):

```
==> ./data/.luarc.json <==
{
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
"diagnostics": {
"disable": [
"lowercase-global"
]
},
"runtime": {
"version": "Lua 5.4",
"path": [
"script/?.lua",
"script/?/init.lua",
"test/?.lua",
"test/?/init.lua",
"script/meta/?.lua"
],
"pathStrict": true
}
}

==> ./data/proj.code-workspace <==
{
"folders": [
{
"path": "scripts"
}
],
"settings": {
"debug.allowBreakpointsEverywhere": true
},
"extensions": {
"recommendations": [
"dwenegar.vscode-luacheck",
"sumneko.lua"
]
},
}

==> ./data/scripts/file.lua <==
okayglobal = 10

print(okayglobal)
```

### Log File

Log file from using gvim with prabirshrestha/vim-lsp and mattn/vim-lsp-settings:
~[file_C_code_project_data_scripts.log](https://github.com/LuaLS/lua-language-server/files/11886742/file_C_code_project_data_scripts.log)~ oops, from changelog.md, it looks like that gvim lua-ls version is 1.8.1.

Updated lsp (`:LspInstallServer sumneko-lua-language-server`) and changelog.md now says 3.0.0. Here's the log for that: [file_C_code_project_data_scripts.log](https://github.com/LuaLS/lua-language-server/files/11886953/file_C_code_project_data_scripts.log)

I tried to get the vscode log, but there was no log folder in `%homepath%\.vscode\extensions\sumneko.lua-3.2.3\server` and there were no other sumneko or lua-ls folders in `extensions/`. My vscode lua-ls version is v3.6.22.

貢獻指南

開啟貢獻指南

從這裡開始

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

研究方向

在 VS Code 或 gvim 中,使用提供的 data/.luarc.json、data/proj.code-workspace 及 data/scripts/file.lua 設定重現該報告。檢查是否發現工作區相鄰的設定,並將其套用至 Lua 診斷;完成的條件是在所述的用戶端設定中停用 lowercase-global 後,所報告的診斷會被抑制。

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

評估

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

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

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