Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings don't seem to be applied when using linter from CLI #2038

Closed
AndreaWalchshoferSCCH opened this issue Mar 28, 2023 · 4 comments
Closed
Labels
bug Something isn't working

Comments

@AndreaWalchshoferSCCH
Copy link
Contributor

AndreaWalchshoferSCCH commented Mar 28, 2023

How are you using the lua-language-server?

Command Line

Which OS are you using?

Windows

What is the issue affecting?

Other

Expected Behaviour

I am using the language-server.exe binary from the release archive for linting in a pipeline.
As I want to use the same linting settings as in the dev environment, I use the --configpath flag for passing the path of the settings file.
e.g. .\language-server\bin\lua-language-server.exe --configpath .\.vscode\settings.json --check .\Coding\Demo\workshop_01

I expect the language-server.exe to apply these settings and e.g. not report for a diagnostic I turned off in the settings file.

Actual Behaviour

In all of my attempts (using settings.json from .vscode, setting up a .luarc.json with the same settings) I couldn't get the tool to use the settings file.
So no settings were applied, and also the log files were saying that no settings were loaded:

[17:59:24.472][warn] [#0:script\config\loader.lua:116]: No config?	nil
[17:59:24.472][warn] [#0:script\config\loader.lua:116]: No config?	nil
[17:59:24.472][info] [#0:script\provider\provider.lua:61]: Load config from client	fallback
[17:59:24.472][info] [#0:script\provider\provider.lua:62]: nil

Reproduction steps

  1. Prepare lua-language-server.exe
  2. Prepare lua source that will result in a diagnostic problem
  3. Prepare settings file that will disable the diagnostic that would find a problem from step 2
  4. Execute the binary supplying (2) with the --check flag and (3) with the --configpath flag

Additional Notes

I tried following the Wiki pages to find out why the settings I try to use are not applied, but I am not sure if I use the flag wrong (wrong flag, wrong syntax, wrong settings format?) or if the language-server itself just does not use it due to some bug.
I also use the --logpath flag similarly and don't have any problems with that.

Log File

No response

@sumneko sumneko added bug Something isn't working question User has a question and removed bug Something isn't working labels Mar 29, 2023
@sumneko
Copy link
Collaborator

sumneko commented Mar 29, 2023

Should be --configpath=.\.vscode\settings.json

I cannot reproduce it

Can you find Load config from specified in log?

@sumneko sumneko added Info Needed More information is required and removed question User has a question labels Mar 29, 2023
@AndreaWalchshoferSCCH
Copy link
Contributor Author

No, my logs only say "Load config from client fallback"

I created a smaller repository showcasing my issue here: https://github.com/AndreaWalchshoferSCCH/lls-cli-issue-sample - maybe you can reproduce it this way?

@AndreaWalchshoferSCCH
Copy link
Contributor Author

We've done some additional experiments/rework of our scripts now, and have found a way where it looks like its working correctly.
For us, the solution is to use absolute paths (starting $PSScriptRoot in our case).
I don't know if there's a way to help users find the issue why their configuration isn't loaded? But maybe even just this issue with the comments helps someone in the future.

@nikbrunner
Copy link

I have the same issue. The absolute path @AndreaWalchshoferSCCH worked:

.luarc.json file does not get found.

lua-language-server --check ./lua --checklevel=Warning --logpath . --configpath .luarc.json
Diagnosis complete, 65 problems found, see ./check.json

But this works

lua-language-server --check ./lua --checklevel=Warning --logpath . --configpath /Users/nikolausbrunner/Documents/dev/repos/terra-theme/terra.nvim/.luarc.json
Diagnosis completed, no problems found

Both commands were run on the root directory from the project.

@sumneko sumneko added bug Something isn't working and removed Info Needed More information is required labels Apr 24, 2023
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue May 1, 2024
Changelog:

## 3.8.3
`2024-4-23`
* `FIX` server may crash when the workspace is using a non-English path.

## 3.8.2
`2024-4-23`
* This is a fake version only for the new version of VSCode, with a core of 3.8.0.

## 3.8.1
`2024-4-23`
* This is a fake version only for the old version of VSCode, with a core of `3.7.4`. Starting from the next minor version, the version requirement for VSCode will be raised to prevent users still using the old version of VSCode from updating to the new version and experiencing compatibility issues.

## 3.8.0
`2024-4-22`
* `NEW` supports tuple type (@[lizho])
  ```lua
  ---@type [string, number, boolean]
  local t

  local x = t[1] --> x is `string`
  local y = t[2] --> y is `number`
  local z = t[3] --> z is `boolean`
  ```
* `NEW` generic pattern (@[fesily])
  ```lua
  ---@Generic T
  ---@param t Cat.`T`
  ---@return T
  local function f(t) end

  local t = f('Smile') --> t is `Cat.Smile`
  ```
* `NEW` alias and enums supports attribute `partial`
  ```lua
  ---@alias Animal Cat

  ---@alias(partial) Animal Dog

  ---@type Animal
  local animal --> animal is `Cat|Dog` here
  ```

  ```lua
  ---@enum(key) ErrorCodes
  local codes1 = {
      OK = 0,
      ERROR = 1,
      FATAL = 2,
  }

  ---@enum(key, partial) ErrorCodes
  local codes2 = {
      WARN = 3,
      INFO = 4,
  }

  ---@type ErrorCodes
  local code

  code = 'ERROR' --> OK
  code = 'WARN'  --> OK

  ```
* `NEW` plugin: add `OnTransFormAst` interface (@[fesily])
* `NEW` plugin: add `OnNodeCompileFunctionParam` interface (@[fesily])
* `NEW` plugin: add `ResolveRequire` interface (@[Artem Dzhemesiuk])
* `NEW` plugin: support multi plugins (@[fesily])
  + setting: `Lua.runtime.plugin` can be `string|string[]`
  + setting: `Lua.runtime.pluginArgs` can be `string[]|table<string, string>`
* `NEW` CLI: `--doc` add option `--doc_out_path <PATH>` (@[Andreas Matthias])
* `NEW` CLI: `--doc_update`, update an existing `doc.json` without using `--doc` again (@[Andreas Matthias])
* `NEW` CLI: `--trust_all_plugins`, this is potentially unsafe for normal use and meant for usage in CI environments only (@[Paul Emmerich])
* `CHG` CLI: `--check` will run plugins (@[Daniel Farrell])
* `FIX` diagnostic: `discard-returns` not works in some blocks (@clay-golem)
* `FIX` rename in library files

## 3.7.4
`2024-1-5`
* `FIX` rename to unicode with `Lua.runtime.unicodeName = true`

## 3.7.3
`2023-11-14`
* `FIX` can not infer arg type in some cases.

## 3.7.2
`2023-11-9`
* `FIX` [#2407]

[#2407]: LuaLS/lua-language-server#2407

## 3.7.1
`2023-11-7`
* `FIX` [#2299]
* `FIX` [#2335]

[#2299]: LuaLS/lua-language-server#2299
[#2335]: LuaLS/lua-language-server#2335

## 3.7.0
`2023-8-24`
* `NEW` support `---@type` and `--[[@as]]` for return statement
* `NEW` commandline parameter `--force-accept-workspace`: allowing the use of the root directory or home directory as the workspace
* `NEW` diagnostic: `inject-field`
* `NEW` `---@enum` supports attribute `key`
  ```lua
  ---@enum (key) AnimalType
  local enum = {
    Cat = 1,
    Dog = 2,
  }

  ---@param animal userdata
  ---@param atp AnimalType
  ---@return boolean
  local function isAnimalType(animal, atp)
    return API.isAnimalType(animal, enum[atp])
  end

  assert(isAnimalType(animal, 'Cat'))
  ```
* `NEW` `---@class` supports attribute `exact`
  ```lua
  ---@Class (exact) Point
  ---@field x number
  ---@field y number
  local m = {}
  m.x = 1 -- OK
  m.y = 2 -- OK
  m.z = 3 -- Warning
  ```

* `FIX` wrong hover and signature for method with varargs and overloads
* `FIX` [#2155]
* `FIX` [#2224]
* `FIX` [#2252]
* `FIX` [#2267]

[#2155]: LuaLS/lua-language-server#2155
[#2224]: LuaLS/lua-language-server#2224
[#2252]: LuaLS/lua-language-server#2252
[#2267]: LuaLS/lua-language-server#2267

## 3.6.25
`2023-7-26`
* `FIX` [#2214]

[#2214]: LuaLS/lua-language-server#2214

## 3.6.24
`2023-7-21`
* `NEW` diagnostic: `missing-fields`
* `FIX` shake of `codeLens`
* `FIX` [#2145]

[#2145]: LuaLS/lua-language-server#2145

## 3.6.23
`2023-7-7`
* `CHG` signature: narrow by inputed literal

## 3.6.22
`2023-6-14`
* `FIX` [#2038]
* `FIX` [#2042]
* `FIX` [#2062]
* `FIX` [#2083]
* `FIX` [#2088]
* `FIX` [#2110]
* `FIX` [#2129]

[#2038]: LuaLS/lua-language-server#2038
[#2042]: LuaLS/lua-language-server#2042
[#2062]: LuaLS/lua-language-server#2062
[#2083]: LuaLS/lua-language-server#2083
[#2088]: LuaLS/lua-language-server#2088
[#2110]: LuaLS/lua-language-server#2110
[#2129]: LuaLS/lua-language-server#2129
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants