feat: update ls configs

This commit is contained in:
2024-06-12 09:06:56 +02:00
parent b404648928
commit ee7cfb9410
7 changed files with 255 additions and 119 deletions
+16
View File
@@ -1,3 +1,5 @@
local utils = require("utils")
return { return {
enable = true, enable = true,
dependencies = { dependencies = {
@@ -7,6 +9,20 @@ return {
name = "bash-language-server", name = "bash-language-server",
dependencies = { dependencies = {
{ name = "shellcheck", }, { name = "shellcheck", },
{ name = "shfmt", },
},
},
keymaps = {
{
mode = "n",
lhs = "<leader>lf",
rhs = function()
utils.format({
cmd = { "shfmt", "-s", "-i", "4", "-" },
stdin = true,
stdout = true,
})
end,
}, },
}, },
lspconfig = { lspconfig = {
+1 -1
View File
@@ -5,7 +5,7 @@
-- https://github.com/iamcco/coc-diagnostic/blob/master/src/config.ts -- https://github.com/iamcco/coc-diagnostic/blob/master/src/config.ts
return { return {
enable = true, enable = false,
dependencies = { dependencies = {
"npm", "npm",
}, },
+2 -5
View File
@@ -12,15 +12,12 @@ return {
"composer.lock", "composer.lock",
"vendor", "vendor",
}, },
mason = { mason = "intelephense",
name = "intelephense",
-- version = "",
},
lspconfig = { lspconfig = {
filetypes = { filetypes = {
"php", "php",
}, },
cmd = { "intelephense", "--stdio", }, cmd = { "intelephense", "--stdio" },
single_file_support = true, single_file_support = true,
settings = { settings = {
intelephense = { intelephense = {
+90 -9
View File
@@ -1,17 +1,89 @@
local utils = require("utils")
---@type ServerConfig
return { return {
enable = false, enable = false,
dependencies = { dependencies = { "python3" },
"python3", mason = { "jedi-language-server" },
linters = {
{
cmd = {
"flake8",
"--max-line-length=100",
"--max-doc-length=100",
"--format",
"%(row)d,%(col)d,%(code).1s: %(text)s",
"-",
},
stdin = true,
stdout = true,
pattern = "^(%d+),(%d+),(%w): (.*)",
groups = { "lnum", "col", "severity", "message" },
source = "flake8",
severity_map = {
E = vim.diagnostic.severity.ERROR,
W = vim.diagnostic.severity.WARN,
B = vim.diagnostic.severity.HINT,
F = vim.diagnostic.severity.HINT,
D = vim.diagnostic.severity.INFO,
},
},
}, },
mason = { keymaps = {
name = "jedi-language-server", {
-- version = "", mode = "n",
lhs = "<leader>lf",
rhs = function()
utils.format({
cmd = {
"black",
"--line-length",
"100",
"--stdin-filename",
"%filename%",
"--quiet",
"-",
},
stdin = true,
stdout = true,
})
utils.format({
cmd = {
"isort",
"--quiet",
"-",
},
stdin = true,
stdout = true,
})
end,
},
{
mode = "x",
lhs = "<leader>lf",
rhs = function()
utils.format({
cmd = {
"black",
"--line-length",
"100",
"--stdin-filename",
"%filename%",
"--quiet",
"--line-ranges=%row_start%-%row_end%",
"-",
},
stdin = true,
stdout = true,
})
end,
},
}, },
lspconfig = { lspconfig = {
filetypes = { filetypes = {
"python", "python",
}, },
cmd = { "jedi-language-server", }, cmd = { "jedi-language-server" },
single_file_support = true, single_file_support = true,
-- For more info see: -- For more info see:
-- - https://github.com/pappasam/jedi-language-server#configuration -- - https://github.com/pappasam/jedi-language-server#configuration
@@ -40,9 +112,18 @@ return {
-- If you manually set this option, it overrides the default. -- If you manually set this option, it overrides the default.
-- Setting it to an empty array will result in no ignored folders. -- Setting it to an empty array will result in no ignored folders.
ignoreFolders = { ignoreFolders = {
".nox", ".tox", ".venv", "__pycache__", "venv", ".nox",
"artifacts", "config", ".vscode", ".pytest_cache", ".tox",
"build", "scripts", "incoax_tests.egg-info", ".venv",
"__pycache__",
"venv",
"artifacts",
"config",
".vscode",
".pytest_cache",
"build",
"scripts",
"incoax_tests.egg-info",
"node_modules", "node_modules",
}, },
}, },
+51 -16
View File
@@ -1,39 +1,74 @@
-- spec: https://luals.github.io/wiki/settings/ -- spec: https://luals.github.io/wiki/settings/
local utils = require("utils")
---@type ServerConfig ---@type ServerConfig
return { return {
enable = true, enable = true,
dependencies = { "cargo" },
mason = { mason = {
name = "lua-language-server", "lua-language-server",
-- version = "", post_install = { { cmd = { "cargo", "install", "stylua", "--features", "lua54" } } },
},
keymaps = {
{
mode = "n",
lhs = "<leader>lf",
rhs = function()
utils.format({
cmd = { "stylua", "-" },
stdin = true,
stdout = true,
})
end,
},
{
mode = "x",
lhs = "<leader>lf",
rhs = function()
utils.format({
cmd = {
"stylua",
"-",
"--range-start",
"%byte_start%",
"--range-end",
"%byte_end%",
},
stdin = true,
stdout = true,
})
end,
},
}, },
lspconfig = { lspconfig = {
filetypes = { filetypes = { "lua" },
"lua", cmd = { "lua-language-server" },
},
cmd = { "lua-language-server", },
single_file_support = true, single_file_support = true,
settings = { settings = {
Lua = { Lua = {
completion = { completion = { showWord = "Disable" },
showWord = "Disable",
},
diagnostics = { diagnostics = {
disable = { "missing-fields", }, -- disable = { "missing-fields" },
}, },
runtime = { runtime = {
version = "LuaJIT", version = "LuaJIT",
path = { path = {
"lua/?.lua", -- "?.lua",
"lua/?/init.lua", "?.lua",
"?/lua/?.lua", "?/init.lua",
"?/lua/?/init.lua", -- "?.lua",
-- "lua/?.lua",
-- "lua/?/init.lua",
-- "?/lua/?.lua",
-- "?/lua/?/init.lua",
}, },
-- pathStrict = true,
}, },
workspace = { workspace = {
library = { library = {
vim.env.VIMRUNTIME, vim.env.VIMRUNTIME,
"/usr/share/lua/5.3", "~/repos/awesome-code-doc",
"/usr/share/awesome/lib",
vim.fn.stdpath("data") .. "/lazy", vim.fn.stdpath("data") .. "/lazy",
}, },
checkThirdParty = false, checkThirdParty = false,
@@ -47,7 +82,7 @@ return {
semicolon = "Disable", semicolon = "Disable",
setType = true, setType = true,
}, },
telemetry = { enable = false, }, telemetry = { enable = false },
}, },
}, },
}, },
-88
View File
@@ -1,88 +0,0 @@
-- spec: https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md
--- @type ServerConfig
return {
enable = true,
dependencies = {
"python3",
},
mason = {
name = "python-lsp-server",
post_install = {
{
command = "./venv/bin/pip",
-- command = "sh",
args = {
-- "install",
-- "python-lsp-black",
-- "python-lsp-isort",
"--version",
-- "-c",
-- "./venv/bin/pip --version",
},
},
-- {
-- command = "./venv/bin/pip",
-- args = { "alsdkfjhaklsdfjhl", },
-- },
},
},
lspconfig = {
filetypes = {
"python",
},
cmd = { "pylsp", },
single_file_support = true,
settings = {
pylsp = {
configurationSources = { "flake8", },
plugins = {
autopep8 = {
enabled = false,
},
black = {
enabled = true,
line_length = 100,
},
flake8 = {
enabled = true,
exclude = { ".venv", "build/", },
filename = { "*.py", },
-- B - flake8-bugbear https://github.com/PyCQA/flake8-bugbear
-- C - only one violation, C901. mccabe https://github.com/PyCQA/mccabe
-- D - flake8-docstrings (pydocstyle) http://www.pydocstyle.org/en/stable/error_codes.html
-- E - pycodestyle https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes
-- F - flake8 https://flake8.pycqa.org/en/latest/user/error-codes.html
-- W - pycodestyle https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes
select = {
"B", "B902", "B903", "B904", "C", "E", "F", "W",
},
ignore = {
"B950", "D201", "D203", "D205", "D301", "D400", "E133", "E203", "W503",
},
maxLineLength = 100,
maxDocLength = 100,
},
isort = {
enabled = true,
},
mccabe = {
enabled = false,
},
pycodestyle = {
enabled = false,
},
pydocstyle = {
enabled = false,
},
pyflakes = {
enabled = false,
},
yapf = {
enabled = false,
},
},
},
},
},
}
+95
View File
@@ -0,0 +1,95 @@
local utils = require("utils")
---@type ServerConfig
return {
enable = true,
mason = { "pyright" },
linters = {
{
cmd = {
"flake8",
"--max-line-length=100",
"--max-doc-length=100",
"--format",
"%(row)d,%(col)d,%(code).1s: %(text)s",
"-",
},
stdin = true,
stdout = true,
pattern = "^(%d+),(%d+),(%w): (.*)",
groups = { "lnum", "col", "severity", "message" },
source = "flake8",
severity_map = {
E = vim.diagnostic.severity.ERROR,
W = vim.diagnostic.severity.WARN,
B = vim.diagnostic.severity.HINT,
F = vim.diagnostic.severity.HINT,
D = vim.diagnostic.severity.INFO,
},
},
},
keymaps = {
{
mode = "n",
lhs = "<leader>lf",
rhs = function()
utils.format({
cmd = {
"black",
"--line-length",
"100",
"--stdin-filename",
"%filename%",
"--quiet",
"-",
},
stdin = true,
stdout = true,
})
utils.format({
cmd = {
"isort",
"--quiet",
"-",
},
stdin = true,
stdout = true,
})
end,
},
{
mode = "x",
lhs = "<leader>lf",
rhs = function()
utils.format({
cmd = {
"black",
"--line-length",
"100",
"--stdin-filename",
"%filename%",
"--quiet",
"--line-ranges=%row_start%-%row_end%",
"-",
},
stdin = true,
stdout = true,
})
end,
},
},
lspconfig = {
filetypes = { "python" },
cmd = { "pyright-langserver", "--stdio" },
single_file_support = true,
settings = {
python = {
analysis = {
autoSearchPaths = true,
diagnosticMode = "openFilesOnly",
useLibraryCodeForTypes = true,
},
},
},
},
}