80percent working state python
This commit is contained in:
@@ -1,14 +1,10 @@
|
||||
return {
|
||||
"mfussenegger/nvim-lint",
|
||||
event = {
|
||||
"BufReadPre",
|
||||
"BufNewFile",
|
||||
},
|
||||
config = function()
|
||||
local lint = require("lint")
|
||||
|
||||
lint.linters_by_ft = {
|
||||
python = { "flake8" },
|
||||
python = { "ruff" },
|
||||
}
|
||||
|
||||
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
|
||||
@@ -24,5 +20,4 @@ return {
|
||||
lint.try_lint()
|
||||
end, { desc = "Trigger linting for current file" })
|
||||
end,
|
||||
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
return {
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
config = function()
|
||||
require("mason-lspconfig").setup({
|
||||
-- Configure which LSP servers to automatically install
|
||||
ensure_installed = {
|
||||
"basedpyright",
|
||||
"flake8",
|
||||
"json-lsp",
|
||||
"lua-language-server",
|
||||
"marksman",
|
||||
"ruff",
|
||||
"shfmt",
|
||||
"sylua"
|
||||
},
|
||||
})
|
||||
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
-- Disable inlay hints for basedpyright
|
||||
lspconfig.basedpyright.setup({
|
||||
settings = {
|
||||
python = {
|
||||
analysis = {
|
||||
inlayHints = {
|
||||
enabled = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
end,
|
||||
--- idk but this fixed it lol
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
inlay_hints = { enabled = false },
|
||||
},
|
||||
}
|
||||
}
|
||||
106
lua/plugins/python.lua
Normal file
106
lua/plugins/python.lua
Normal file
@@ -0,0 +1,106 @@
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = { ensure_installed = { "ninja", "rst" } },
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
inlay_hints = { enabled = false },
|
||||
servers = {
|
||||
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,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = function(_, opts)
|
||||
local servers = { "basedpyright", "ruff" }
|
||||
for _, server in ipairs(servers) do
|
||||
opts.servers[server] = opts.servers[server] or {}
|
||||
opts.servers[server].enabled = server == "basedpyright"
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-neotest/neotest",
|
||||
optional = true,
|
||||
dependencies = {
|
||||
"nvim-neotest/neotest-python",
|
||||
},
|
||||
opts = {
|
||||
adapters = {
|
||||
["neotest-python"] = {
|
||||
-- Example settings for the adapter
|
||||
-- runner = "pytest",
|
||||
-- python = ".venv/bin/python",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
optional = true,
|
||||
dependencies = {
|
||||
"mfussenegger/nvim-dap-python",
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>dPt", function() require('dap-python').test_method() end, desc = "Debug Method", ft = "python" },
|
||||
{ "<leader>dPc", function() require('dap-python').test_class() end, desc = "Debug Class", ft = "python" },
|
||||
},
|
||||
config = function()
|
||||
if vim.fn.has("win32") == 1 then
|
||||
require("dap-python").setup(LazyVim.get_pkg_path("debugpy", "/venv/Scripts/pythonw.exe"))
|
||||
else
|
||||
require("dap-python").setup(LazyVim.get_pkg_path("debugpy", "/venv/bin/python"))
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
"linux-cultist/venv-selector.nvim",
|
||||
branch = "regexp",
|
||||
cmd = "VenvSelect",
|
||||
enabled = function()
|
||||
return LazyVim.has("telescope.nvim")
|
||||
end,
|
||||
opts = {
|
||||
settings = {
|
||||
options = {
|
||||
notify_user_on_venv_activation = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
ft = "python",
|
||||
keys = { { "<leader>cv", "<cmd>:VenvSelect<cr>", desc = "Select VirtualEnv", ft = "python" } },
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
opts = function(_, opts)
|
||||
opts.auto_brackets = opts.auto_brackets or {}
|
||||
table.insert(opts.auto_brackets, "python")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"jay-babu/mason-nvim-dap.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
handlers = {
|
||||
python = function() end, -- Avoid messing up DAP adapters provided by nvim-dap-python
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user