moved language setups to its own folder
This commit is contained in:
124
lua/plugins/langs/go.lua
Normal file
124
lua/plugins/langs/go.lua
Normal file
@@ -0,0 +1,124 @@
|
||||
return {
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
servers = {
|
||||
gopls = {
|
||||
settings = {
|
||||
gopls = {
|
||||
gofumpt = true,
|
||||
codelenses = {
|
||||
gc_details = false,
|
||||
generate = true,
|
||||
regenerate_cgo = true,
|
||||
run_govulncheck = true,
|
||||
test = true,
|
||||
tidy = true,
|
||||
upgrade_dependency = true,
|
||||
vendor = true,
|
||||
},
|
||||
hints = {
|
||||
assignVariableTypes = true,
|
||||
compositeLiteralFields = true,
|
||||
compositeLiteralTypes = true,
|
||||
constantValues = true,
|
||||
functionTypeParameters = true,
|
||||
parameterNames = true,
|
||||
rangeVariableTypes = true,
|
||||
},
|
||||
analyses = {
|
||||
fieldalignment = true,
|
||||
nilness = true,
|
||||
unusedparams = true,
|
||||
unusedwrite = true,
|
||||
useany = true,
|
||||
},
|
||||
usePlaceholders = true,
|
||||
completeUnimported = true,
|
||||
staticcheck = true,
|
||||
directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },
|
||||
semanticTokens = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
setup = {
|
||||
gopls = function(_, opts)
|
||||
-- workaround for gopls not supporting semanticTokensProvider
|
||||
-- https://github.com/golang/go/issues/54531#issuecomment-1464982242
|
||||
LazyVim.lsp.on_attach(function(client, _)
|
||||
if not client.server_capabilities.semanticTokensProvider then
|
||||
local semantic = client.config.capabilities.textDocument.semanticTokens
|
||||
client.server_capabilities.semanticTokensProvider = {
|
||||
full = true,
|
||||
legend = {
|
||||
tokenTypes = semantic.tokenTypes,
|
||||
tokenModifiers = semantic.tokenModifiers,
|
||||
},
|
||||
range = true,
|
||||
}
|
||||
end
|
||||
end, "gopls")
|
||||
-- end workaround
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
-- Ensure Go tools are installed
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = { ensure_installed = { "goimports", "gofumpt" } },
|
||||
},
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
go = { "goimports", "gofumpt" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
optional = true,
|
||||
dependencies = {
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = { ensure_installed = { "delve" } },
|
||||
},
|
||||
{
|
||||
"leoluz/nvim-dap-go",
|
||||
opts = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"nvim-neotest/neotest",
|
||||
optional = true,
|
||||
dependencies = {
|
||||
"fredrikaverpil/neotest-golang",
|
||||
},
|
||||
opts = {
|
||||
adapters = {
|
||||
["neotest-golang"] = {
|
||||
-- Here we can set options for neotest-golang, e.g.
|
||||
-- go_test_args = { "-v", "-race", "-count=1", "-timeout=60s" },
|
||||
dap_go_enabled = true, -- requires leoluz/nvim-dap-go
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Filetype icons
|
||||
{
|
||||
"echasnovski/mini.icons",
|
||||
opts = {
|
||||
file = {
|
||||
[".go-version"] = { glyph = "", hl = "MiniIconsBlue" },
|
||||
},
|
||||
filetype = {
|
||||
gotmpl = { glyph = "", hl = "MiniIconsGrey" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
136
lua/plugins/langs/python.lua
Normal file
136
lua/plugins/langs/python.lua
Normal file
@@ -0,0 +1,136 @@
|
||||
return {
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
inlay_hints = { enabled = false },
|
||||
servers = {
|
||||
ruff = {
|
||||
cmd_env = { RUFF_TRACE = "messages" },
|
||||
init_options = {
|
||||
settings = {
|
||||
logLevel = "error",
|
||||
configuration = os.getenv("LOCALAPPDATA") .. "/nvim/ruff.toml",
|
||||
},
|
||||
},
|
||||
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,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"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" or server == "ruff"
|
||||
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 = {
|
||||
search = {
|
||||
-- windows escaping sucks
|
||||
cwd = { command = "$FD Scripts//python.exe$ $CWD --full-path --color never -HI -a -L" },
|
||||
},
|
||||
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