[UPDATE] split python config to the plugin level and added os specific ruff file
This commit is contained in:
53
lua/plugins/langs/python/nvim-lspconfig.lua
Normal file
53
lua/plugins/langs/python/nvim-lspconfig.lua
Normal file
@@ -0,0 +1,53 @@
|
||||
-- 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/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")
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
13
lua/plugins/langs/python/venv-selector.lua
Normal file
13
lua/plugins/langs/python/venv-selector.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
return {
|
||||
"linux-cultist/venv-selector.nvim",
|
||||
lazy = false,
|
||||
branch = "regexp", -- This is the regexp branch, use this for the new version
|
||||
keys = {
|
||||
{ "<leader>cv", "<cmd>:VenvSelect<cr>", desc = "Select VirtualEnv", ft = "python" },
|
||||
},
|
||||
opts = {
|
||||
settings = {
|
||||
options = { notify_user_on_venv_activation = true },
|
||||
},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user