nvim-config

Log | Files | Refs | Submodules | README

commit 3e734f8fda644a9f50d68c083427cd1182aef772
parent 4ced375f6d1d95753e021c142b9758025f101064
Author: Thomas Vigouroux <tomvig38@gmail.com>
Date:   Wed,  3 Nov 2021 10:10:16 +0100

Update lsp and ts config

Diffstat:
Mlua/lsp_config.lua | 51++++++++++++++++++++++++++++++++++++++-------------
Mlua/plugins.lua | 5+++++
Mlua/ts_config.lua | 4+---
3 files changed, 44 insertions(+), 16 deletions(-)

diff --git a/lua/lsp_config.lua b/lua/lsp_config.lua @@ -1,16 +1,16 @@ local lsp = require'lspconfig' vim.cmd[[packadd nvim-lspconfig]] -vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( - vim.lsp.diagnostic.on_publish_diagnostics, { - -- Enable underline, use default values - underline = true, - virtual_text = true, - -- Disable a feature - update_in_insert = false, - severity_sort = true - } -) + +vim.diagnostic.config { + virtual_text = { + severity = { + min = vim.diagnostic.severity.WARN + } + }, + severity_sort = true, + signs = false +} local function on_attach(client, bufnr) local function buf_set_keymap(lhs, rhs) @@ -35,9 +35,11 @@ local function on_attach(client, bufnr) buf_set_keymap('<Leader>s', 'require"telescope.builtin".lsp_dynamic_workspace_symbols()') vim.api.nvim_buf_call(bufnr, function() - vim.api.nvim_command [[autocmd CursorHold <buffer> lua vim.lsp.diagnostic.show_line_diagnostics{focusable = false}]] - vim.api.nvim_command [[autocmd CursorHold <buffer> lua pcall(vim.lsp.buf.document_highlight)]] - vim.api.nvim_command [[autocmd CursorMoved <buffer> lua pcall(vim.lsp.buf.clear_references)]] + vim.api.nvim_command [[autocmd CursorHold <buffer> lua pcall(vim.lsp.diagnostic.show_position_diagnostics, {focusable = false})]] + if client.supports_method('textDocument/documentHighlight') then + vim.api.nvim_command [[autocmd CursorHold <buffer> lua pcall(vim.lsp.buf.document_highlight)]] + vim.api.nvim_command [[autocmd CursorMoved <buffer> lua pcall(vim.lsp.buf.clear_references)]] + end end) end @@ -57,6 +59,29 @@ for _,lname in ipairs(default_lsps) do lsp[lname].setup { capabilities = capabilities, on_attach = on_attach } end +require("grammar-guard").init() + +lsp.grammar_guard.setup { + on_attach = on_attach, + capabilities = capabilities, + settings = { + ltex = { + enabled = { "latex", "tex", "bib", "markdown" }, + language = "auto", + diagnosticSeverity = "information", + setenceCacheSize = 2000, + additionalRules = { + enablePickyRules = true, + motherTongue = "fr", + }, + trace = { server = "verbose" }, + dictionary = {}, + disabledRules = {}, + hiddenFalsePositives = {}, + }, + }, +} + local sumneko_root_path = vim.fn.expand('$HOME')..'/src/lua-language-server' local sumneko_binary = sumneko_root_path.."/bin/Linux/lua-language-server" diff --git a/lua/plugins.lua b/lua/plugins.lua @@ -49,6 +49,10 @@ return require"packer".startup(function(use) -- LSP related use 'neovim/nvim-lspconfig' use 'nvim-lua/lsp-status.nvim' + use { + "brymer-meneses/grammar-guard.nvim", + requires = "neovim/nvim-lspconfig" + } -- Treesitter related localuse 'nvim-treesitter/nvim-treesitter' @@ -84,4 +88,5 @@ return require"packer".startup(function(use) -- sunjon <3 use 'sunjon/extmark-toy.nvim' + use 'tamarin-prover/editors' end) diff --git a/lua/ts_config.lua b/lua/ts_config.lua @@ -1,7 +1,5 @@ local parser_config = require "nvim-treesitter.parsers".get_parser_configs() -if parser_config.vim then - parser_config.vim.install_info.url = "~/projects/ts/tree-sitter-viml" -else +if not parser_config.vim then parser_config.vim = { install_info = { url = "https://github.com/vigoux/tree-sitter-viml",