nvim: Move ruff/pyright lsp settings into after/lsp/ dir

This commit is contained in:
Marty Oehme 2025-06-10 14:55:45 +02:00
parent de462a270b
commit 07e820ac00
Signed by: Marty
GPG key ID: 4E535BC19C61886E
3 changed files with 31 additions and 37 deletions

View file

@ -0,0 +1,22 @@
-- ensure python virtualenv is determined automatically on lsp start
-- we primarily use pyright for cmp lsp completion & hover info
return {
on_attach = function(client, _)
require("core.util").set_python_env()
local python_path, _ = vim.fn.expand(require("core.util").get_python_venv_bin(client.config.root_dir))
client.config.settings.python = {} or client.config.settings.python
client.config.settings.python.pythonPath = python_path
end,
settings = {
-- disable imports and linting since, using ruff for it
pyright = {
disableOrganizeImports = true,
},
python = {
analysis = {
-- ignore all files, use ruff for linting
ignore = { "*" },
},
},
},
}

View file

@ -0,0 +1,9 @@
return {
on_attach = function(client, _)
require("core.util").set_python_env()
client.server_capabilities.hoverProvider = false -- we use pyright for hover info
local python_path, _ = vim.fn.expand(require("core.util").get_python_venv_bin(client.config.root_dir))
client.config.settings.python = {} or client.config.settings.python
client.config.settings.python.pythonPath = python_path
end,
}

View file

@ -137,43 +137,6 @@ local lsp = {
end, end,
}) })
local python_path
-- ensure python virtualenv is determined automatically on lsp start
-- we primarily use pyright for cmp lsp completion & hover info
register("basedpyright", {
on_attach = function(client, _)
require("core.util").set_python_env()
if python_path == nil then
python_path, _ = vim.fn.expand(require("core.util").get_python_venv_bin(client.config.root_dir))
end
client.config.settings.python = {} or client.config.settings.python
client.config.settings.python.pythonPath = python_path
end,
settings = {
-- disable imports and linting since, using ruff for it
pyright = {
disableOrganizeImports = true,
},
python = {
analysis = {
-- ignore all files, use ruff for linting
ignore = { "*" },
},
},
},
})
register("ruff", {
on_attach = function(client, _)
require("core.util").set_python_env()
client.server_capabilities.hoverProvider = false -- we use pyright for hover info
if python_path == nil then
python_path, _ = vim.fn.expand(require("core.util").get_python_venv_bin(client.config.root_dir))
end
client.config.settings.python = {} or client.config.settings.python
client.config.settings.python.pythonPath = python_path
end,
})
-- set up arduino with the help of arduino.nvim plugin -- set up arduino with the help of arduino.nvim plugin
if require("core.util").is_available("arduino") then if require("core.util").is_available("arduino") then
register("arduino_language_server", { register("arduino_language_server", {