neovim-confs/lua/custom/configs/lspsettings.lua

213 lines
5.3 KiB
Lua
Raw Normal View History

2024-03-12 19:37:42 +01:00
local on_attach = require("plugins.configs.lspconfig").on_attach
local capabilities = require("plugins.configs.lspconfig").capabilities
local M = {}
2024-07-03 13:44:53 +02:00
M.basedpyright = {
on_attach = on_attach,
capabilities = capabilities,
root_dir = vim.loop.cwd,
flags = { debounce_text_changes = 300 },
single_file_support = true,
settings = {
python = {
analysis = {
autoSearchPaths = true,
diagnosticMode = "openFilesOnly",
useLibraryCodeForTypes = true,
typeCheckingMode = "basic",
},
},
},
}
2024-03-12 19:37:42 +01:00
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,
2024-04-20 17:18:13 +02:00
use_spellfile = false,
2024-03-12 19:37:42 +01:00
settings = {
ltex = {
2024-04-20 17:18:13 +02:00
checkFrequency = "save", -- shut up while i'm just editing, see <https://github.com/folke/noice.nvim/issues/166>
2024-03-12 19:37:42 +01:00
-- specific language (such as en-GB or de-DE is recommended, but I
-- want multilingual)
language = "auto",
enabled = {
"bibtex",
"tex",
"latex",
"gitcommit",
"markdown",
"org",
"restructuredtext",
"rsweave",
"quarto",
"rmd",
"context",
2024-04-28 15:13:48 +02:00
-- "html",
-- "xhtml",
2024-03-12 19:37:42 +01:00
},
2024-04-20 17:18:13 +02:00
additionalRules = {
enablePickyRules = true,
2024-04-22 18:59:10 +02:00
-- thats cool, but often adds diagnostics in
-- places where a german might confuse words that are similar
-- between english and german REGARDLESS of context. I seem to use the
-- english words only in the proper contexts, so leaving this on
-- just adds annoying hints like 'Hinweis: "list/NN.*" (English) bedeutet "Liste",
-- "Verzeichnis" (German). Meinten Sie vielleicht 'cunning', 'trick'?'
-- everytime I use the word "list". I liked that this makes the hints be
-- in german regardless of the language I'm working in through...
--motherTongue = "de",
2024-04-20 17:18:13 +02:00
},
-- load token and additional languagetool items later
2024-03-12 19:37:42 +01:00
},
},
}
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,
},
},
},
},
}
2024-03-17 14:51:01 +01:00
-- load secrets
-- the secret module should just return a string with the token
local available, token = require("custom.utils").try_require "custom.secret.languagetool_token"
if available then
M.ltex.languageToolOrg = {
apiKey = token,
username = "accounts@cscherr.de",
languageToolHttpServerUrl = "https://api.languagetoolplus.com/v2/",
}
M.ltex.languageToolHttpServerUrl = "https://api.languagetoolplus.com/v2/"
end
2024-03-12 19:37:42 +01:00
return M