From 2673b3ce1e92788ed1a8936f33eb821ffef4d315 Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Tue, 12 Mar 2024 19:37:42 +0100 Subject: [PATCH] lspsettings --- lua/custom/configs/lspconfig.lua | 96 ++-------------- lua/custom/configs/lspsettings.lua | 169 +++++++++++++++++++++++++++++ spell/en.utf-8.add | 1 + spell/en.utf-8.add.spl | Bin 3867 -> 3927 bytes 4 files changed, 178 insertions(+), 88 deletions(-) create mode 100644 lua/custom/configs/lspsettings.lua 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 3eef9d43392d06d63541a8948efaab5096d28a89..24b986498648d03e967bb1edaf264b1e6a08e72f 100644 GIT binary patch delta 684 zcmX9*O=}ZT6n*!-WRgjf7EK|B*4D3Dqt=9iq(T)+jasmUqI6+Vm?V>C>@*W+Cj9`Z zg6>`13Tk$x3ri3`3L@%%aH%Vy3zu%(xNxE8MIQ6!an5 zsLj73r&I47vZxFx2{pyJ=+)tlLmsdy41f(bXtnDsT5bduyZj_NOhtYjy`KGPQ9w=T zs!)n4UDDEJ_PO6E(I($A#_~VPQOowiRRz3#cSXmDOxV=Yy0)vla1AGVbq5^i4`(qC%NhkS>7=x(eu8!K#zGMF?e{&)%pW1RrNQJj;`6*J~|#y+2MPML)rNy%vN{r zBZrSE=?+O4M|eANo?QNx$W55zkmt*G-O*;Q=dV)%3-dTpkik0I&;}L!wXt~P`RP^apK78PtHi`?cfJw>zQQymoA>q};6nMaey`)+D+yx<`QbQxYuj-|4J qvb~@5lEQ9xGI1ySnRRA%H-cax zSZpE6ZI-c6!6sHp3b9LJXQLq4*eP~aq96!*CVB9`3tQbif4$^1z1aW&?g<5)@#KmF{)cz9W)T=JYz&G+~Fnuuod+e<(;vHFOrWJ z@IgxP6|}{Tmn)y@M$LAEzM{r(yB*ny&D!WO>cf_Dg8?(#_t1@0e#v_>EyRyZA1vkl14i|Br72}Wi z$rUWh+vFlw@H@EyU)EETsLFO~Vm$0A&FSgQ4#fgK)8j58kH(TbO%-rN-lQ&|DL+!B za)R=ey4`R%Ki_h_9o^p{C)$?9=#r(q@|dwNlxykZlV}t3S*bB28g_MJr#7LP$K+AE zf|2Z}$7ifrk^{C57!L(hp%Euxp=xtlY)$^A7p6mx{vvIcGb6BX*6e5(w;b1_