nvim: Move ruff/pyright lsp settings into after/lsp/ dir
This commit is contained in:
parent
de462a270b
commit
07e820ac00
3 changed files with 31 additions and 37 deletions
22
nvim/.config/nvim/after/lsp/basedpyright.lua
Normal file
22
nvim/.config/nvim/after/lsp/basedpyright.lua
Normal 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 = { "*" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
9
nvim/.config/nvim/after/lsp/ruff.lua
Normal file
9
nvim/.config/nvim/after/lsp/ruff.lua
Normal 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,
|
||||
}
|
||||
|
|
@ -137,43 +137,6 @@ local lsp = {
|
|||
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
|
||||
if require("core.util").is_available("arduino") then
|
||||
register("arduino_language_server", {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue