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 摘要。