lspsettings

This commit is contained in:
Christoph J. Scherr 2024-03-12 19:37:42 +01:00
parent b3d2cc179c
commit 2673b3ce1e
Signed by: PlexSheep
GPG Key ID: 7CDD0B14851A08EF
4 changed files with 178 additions and 88 deletions

View File

@ -2,6 +2,7 @@ local on_attach = require("plugins.configs.lspconfig").on_attach
local capabilities = require("plugins.configs.lspconfig").capabilities local capabilities = require("plugins.configs.lspconfig").capabilities
local lspconfig = require "lspconfig" local lspconfig = require "lspconfig"
local lspsettings = require "custom.configs.lspsettings"
-- if you just want default config for the servers then put them in a table -- if you just want default config for the servers then put them in a table
local servers = { local servers = {
@ -10,11 +11,9 @@ local servers = {
"tsserver", "tsserver",
"clangd", "clangd",
"pyright", "pyright",
-- "rust_analyzer", -- rustaceanvim wants to do that, but the builtin thing has better integration!
"bashls", "bashls",
"cmake", "cmake",
"yamlls", "yamlls",
"textlsp",
"texlab", "texlab",
} }
@ -25,91 +24,12 @@ for _, lsp in ipairs(servers) do
} }
end end
lspconfig.rust_analyzer.setup { local server_with_settings = {
on_attach = on_attach, -- "textlsp",
settings = { "ltex",
["rust-analyzer"] = { "rust_analyzer",
check = {
command = "clippy",
},
imports = {
granularity = {
group = "module",
},
prefix = "self",
},
cargo = {
buildScripts = {
enable = true,
},
},
procMacro = {
enable = true,
},
},
},
} }
local ltex_table = { for _, lsp in ipairs(server_with_settings) do
on_attach = on_attach, lspconfig[lsp].setup(lspsettings[lsp])
capabilities = capabilities, end
settings = {
ltex = {
-- specific language (such as en-GB or de-DE is recommended, but I
-- want multilingual)
language = "en-GB",
enabled = {
-- I'm writing in german but the commands are in english,
-- does not really work
"bibtex",
"tex",
"latex",
"gitcommit",
"markdown",
"org",
"restructuredtext",
"rsweave",
"quarto",
"rmd",
"context",
"html",
"xhtml",
},
},
},
}
-- lspconfig.ltex.setup(ltex_table)
lspconfig.textlsp.setup {
on_attach = on_attach,
capabilities = capabilities,
filetypes = {
"bibtex",
"tex",
"latex",
"gitcommit",
"markdown",
"org",
"restructuredtext",
"rsweave",
"quarto",
"rmd",
"context",
"html",
"xhtml",
},
settings = {
textLSP = {
analysers = {
languagetool = {
check_text = {
on_change = false,
on_open = true,
on_save = true,
},
enabled = false,
},
},
},
},
}

View File

@ -0,0 +1,169 @@
local on_attach = require("plugins.configs.lspconfig").on_attach
local capabilities = require("plugins.configs.lspconfig").capabilities
local M = {}
M.rust_analyzer = {
on_attach = on_attach,
capabilities = capabilities,
settings = {
["rust-analyzer"] = {
check = {
command = "clippy",
},
imports = {
granularity = {
group = "module",
},
prefix = "self",
},
cargo = {
buildScripts = {
enable = true,
},
},
procMacro = {
enable = true,
},
},
},
}
M.ltex = {
on_attach = on_attach,
capabilities = capabilities,
settings = {
ltex = {
-- specific language (such as en-GB or de-DE is recommended, but I
-- want multilingual)
language = "auto",
enabled = {
-- I'm writing in german but the commands are in english,
-- does not really work
"bibtex",
"tex",
"latex",
"gitcommit",
"markdown",
"org",
"restructuredtext",
"rsweave",
"quarto",
"rmd",
"context",
"html",
"xhtml",
},
},
},
}
M.textlsp = {
on_attach = on_attach,
capabilities = capabilities,
filetypes = {
"bibtex",
"tex",
"latex",
"gitcommit",
"markdown",
"org",
"restructuredtext",
"rsweave",
"quarto",
"rmd",
"context",
"html",
"xhtml",
},
settings = {
textLSP = {
analysers = {
languagetool = {
enabled = true,
check_text = {
on_open = true,
on_save = true,
on_change = false,
},
},
gramformer = {
-- gramformer dependency needs to be installed manually
enabled = true,
gpu = false,
check_text = {
on_open = false,
on_save = true,
on_change = false,
},
},
hf_checker = {
enabled = false,
gpu = false,
quantize = 32,
model = "pszemraj/flan-t5-large-grammar-synthesis",
min_length = 40,
check_text = {
on_open = false,
on_save = true,
on_change = false,
},
},
hf_instruction_checker = {
enabled = true,
gpu = false,
quantize = 32,
model = "grammarly/coedit-large",
min_length = 40,
check_text = {
on_open = false,
on_save = true,
on_change = false,
},
},
hf_completion = {
enabled = true,
gpu = false,
quantize = 32,
model = "bert-base-multilingual-cased",
topk = 5,
},
-- openai = {
-- enabled = false,
-- api_key = "<MY_API_KEY>",
-- check_text = {
-- on_open = false,
-- on_save = false,
-- on_change = false,
-- },
-- model = "gpt-3.5-turbo",
-- max_token = 16,
-- },
-- grammarbot = {
-- enabled = false,
-- api_key = "<MY_API_KEY>",
-- -- longer texts are split, this parameter sets the maximum number of splits per analysis
-- input_max_requests = 1,
-- check_text = {
-- on_open = false,
-- on_save = false,
-- on_change = false,
-- },
-- },
},
documents = {
-- org = {
-- org_todo_keywords = {
-- "TODO",
-- "IN_PROGRESS",
-- "DONE",
-- },
-- },
txt = {
parse = true,
},
},
},
},
}
return M

View File

@ -302,3 +302,4 @@ LoggerBuilder
libpt libpt
T2000 T2000
TINF22CS TINF22CS
Fliegendes/!

Binary file not shown.