diff --git a/lua/custom/configs/lspconfig.lua b/lua/custom/configs/lspconfig.lua index 3e30794..93d9858 100644 --- a/lua/custom/configs/lspconfig.lua +++ b/lua/custom/configs/lspconfig.lua @@ -2,6 +2,7 @@ local on_attach = require("plugins.configs.lspconfig").on_attach local capabilities = require("plugins.configs.lspconfig").capabilities 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 local servers = { @@ -10,11 +11,9 @@ local servers = { "tsserver", "clangd", "pyright", - -- "rust_analyzer", -- rustaceanvim wants to do that, but the builtin thing has better integration! "bashls", "cmake", "yamlls", - "textlsp", "texlab", } @@ -25,91 +24,12 @@ for _, lsp in ipairs(servers) do } end -lspconfig.rust_analyzer.setup { - on_attach = on_attach, - settings = { - ["rust-analyzer"] = { - check = { - command = "clippy", - }, - imports = { - granularity = { - group = "module", - }, - prefix = "self", - }, - cargo = { - buildScripts = { - enable = true, - }, - }, - procMacro = { - enable = true, - }, - }, - }, +local server_with_settings = { + -- "textlsp", + "ltex", + "rust_analyzer", } -local ltex_table = { - on_attach = on_attach, - capabilities = capabilities, - 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, - }, - }, - }, - }, -} +for _, lsp in ipairs(server_with_settings) do + lspconfig[lsp].setup(lspsettings[lsp]) +end diff --git a/lua/custom/configs/lspsettings.lua b/lua/custom/configs/lspsettings.lua new file mode 100644 index 0000000..f66f3ff --- /dev/null +++ b/lua/custom/configs/lspsettings.lua @@ -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 = "", + -- check_text = { + -- on_open = false, + -- on_save = false, + -- on_change = false, + -- }, + -- model = "gpt-3.5-turbo", + -- max_token = 16, + -- }, + -- grammarbot = { + -- enabled = false, + -- 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 diff --git a/spell/en.utf-8.add b/spell/en.utf-8.add index 5ba36f5..eacef56 100644 --- a/spell/en.utf-8.add +++ b/spell/en.utf-8.add @@ -302,3 +302,4 @@ LoggerBuilder libpt T2000 TINF22CS +Fliegendes/! diff --git a/spell/en.utf-8.add.spl b/spell/en.utf-8.add.spl index 3eef9d4..24b9864 100644 Binary files a/spell/en.utf-8.add.spl and b/spell/en.utf-8.add.spl differ