Skip to content

Config file "extend" not working from language server #13261

@jakeanq

Description

@jakeanq

I don't seem to be able to include a config file from another config file when using the language server, however it works fine from the command line.

Example

This is fairly arbitrary...

ruff_config1.toml:

[lint]
select = ["F401", "F821", "ANN"]

ruff_config2.toml:

extend = "./ruff_config1.toml"
[lint]
ignore = ["F401"]

ruff_test.py:

import typing

print(lemurs)

def x():
    return 10

When I run this with ruff check I get the expected output:

$ ruff check ruff_test.py --config ~/ruff_configs/ruff_config2.toml --output-format concise
ruff_test.py:3:7: F821 Undefined name `lemurs`
ruff_test.py:5:5: ANN201 Missing return type annotation for public function `x`
Found 2 errors.
No fixes available (1 hidden fix can be enabled with the `--unsafe-fixes` option).

(note that F821 is a default rule)

However with the following Neovim LSP config:

lc = require'lspconfig'
lc.ruff.setup{
  init_options = {
    settings = {
      configuration = "~/ruff_configs/ruff_config2.toml"
    }
  }
}

I see the F821 violation (this is enabled by default and indicates that checking is working) and I don't see the F401 violation (expected, indicating that ruff_config2.toml is being loaded, since that rule is enabled by default) but I don't see the ANN201 violation, indicating that ruff_config1.toml was not loaded.

I have also tried changing the extend path to use an absolute path or a path based on an environment variable, but it doesn't seem to make a difference.

Replicated with ruff 0.6.2 and 0.6.3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggreat writeupA wonderful example of a quality contributionserverRelated to the LSP server

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions