Files
lazy_config/lua/plugins/langs/python/nvim-lspconfig.lua
2026-01-12 11:38:14 -05:00

60 lines
1.6 KiB
Lua

-- INFO: for local ruff config
local os_info = require("os_info")
local config_path
-- Determine the config path based on the OS
if os_info.is_linux then
config_path = os.getenv("HOME") .. "/.config/nvim/config_files/ruff.toml"
elseif os_info.is_windows then
config_path = os.getenv("LOCALAPPDATA") .. "\\nvim\\ruff.toml"
end
return {
{
"neovim/nvim-lspconfig",
opts = {
inlay_hints = { enabled = false },
servers = {
ruff = {
cmd_env = { RUFF_TRACE = "messages" },
init_options = {
settings = {
logLevel = "error",
configuration = config_path, -- Use the dynamically set config_path
configurationPreference = "filesystemFirst",
},
},
keys = {
{
"<leader>co",
LazyVim.lsp.action["source.organizeImports"],
desc = "Organize Imports",
},
},
},
basedpyright = {
cmd_env = { RUFF_TRACE = "messages" },
init_options = {
settings = {
logLevel = "error",
},
},
},
},
-- setup = {
-- basedpyright = function()
-- LazyVim.lsp.on_attach(function(client, _)
-- client.server_capabilities.hoverProvider = true
-- end, "basedpyright")
-- },
setup = {
basedpyright = function()
require("snacks").util.lsp.on({ name = "basedpyright" }, function(_, client)
client.server_capabilities.hoverProvider = true
end)
end,
},
},
},
}