LuaLS / LuaLS/lua-language-server

`runtime.version` isn't applied from `.luarc.json`

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

還沒有人認領這個 Issue。

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

描述

How are you using the lua-language-server?

NeoVim

Which OS are you using?

Linux

What is the issue affecting?

Completion

Expected Behaviour

It should look up definitions for LuaJIT (Lua 5.1).

Actual Behaviour

It looks up definitions for Lua 5.4.

Reproduction steps
  1. Having the following .luarc.json in a project:
{
  "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
  "diagnostics": {
    "globals": [ "after_each", "before_each", "describe", "it", "vim" ],
    "disable": [ "redefined-local" ]
  },
  "runtime": {
    "version": "LuaJIT"
  },
  "workspace": {
    "library": [
      "$VIMRUNTIME"
    ],
    "checkThirdParty": false
  }
}
  1. Open Neovim and edit a .lua file
  2. Go to definition for any standard library function
  3. Notice the version of the standard library used
Additional Notes

I'm using Neovim v0.10.1 with the native LSP.

I can reproduce this with a very simple config (no settings):

    lspconfig.lua_ls.setup({})

One important thing to mention is that other settings like diagnostics are properly applied.

Log File

file_home_ignacio_devel_projects_plantuml.nvim.log

貢獻指南

開啟貢獻指南

從這裡開始

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

研究方向

.luarc.json 設定和最小的 lspconfig.lua_ls.setup({}) 進入點開始,接著追蹤 runtime.version 的載入方式,並與正常運作的 diagnostics 設定比較。在使用 LuaJIT 的 Neovim 中重現補全或跳至定義;當標準函式庫定義使用 Lua 5.1 而不是 Lua 5.4 時,即可視為問題已解決。

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

評估

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

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

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