LuaLS / LuaLS/lua-language-server

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

Open
#2,852 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
4.4k
Forks
442
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the .luarc.json configuration and the minimal lspconfig.lua_ls.setup({}) entry point, then trace how runtime.version is loaded compared with the working diagnostics settings. Reproduce completion or go-to-definition in Neovim with LuaJIT, and consider the issue resolved when standard-library definitions use Lua 5.1 rather than Lua 5.4.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, neovim
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.