From 6f5b485f7703621e5c49192bd9f5001f636140b7 Mon Sep 17 00:00:00 2001 From: "iliya.saroukha" <iliya.saroukhanian@etu.hesge.ch> Date: Fri, 21 Feb 2025 13:56:12 +0100 Subject: [PATCH] feat: tinymist lsp config and replacing pylsp with basedpyright --- lua/plugins/nvim-lspconfig.lua | 37 ++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/lua/plugins/nvim-lspconfig.lua b/lua/plugins/nvim-lspconfig.lua index 5b84c58..c13aa26 100644 --- a/lua/plugins/nvim-lspconfig.lua +++ b/lua/plugins/nvim-lspconfig.lua @@ -169,9 +169,32 @@ return { -- LSP Configuration & Plugins local servers = { clangd = {}, gopls = {}, - pylsp = {}, + basedpyright = {}, rust_analyzer = {}, marksman = {}, + tinymist = { + on_attach = function(client, bufnr) + client.server_capabilities.documentFormattingProvider = true + + if client.server_capabilities.documentFormattingProvider then + -- Set up an autocommand to format on save + vim.api.nvim_create_autocmd("BufWritePre", { + buffer = bufnr, + callback = function() + vim.lsp.buf.format({ async = false }) -- Synchronous formatting + end, + }) + end + end, + capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()), + -- offset_encoding = "utf-8", + settings = { + exportPdf = "onSave", + outputPath = "$root/target/$dir/$name", + formatterMode = "typstfmt", + formatterPrintWidth = 80, + } + }, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- -- Some languages (like typescript) have entire language plugins that can be useful: @@ -209,14 +232,20 @@ return { -- LSP Configuration & Plugins -- for you, so that they are available from within Neovim. local ensure_installed = vim.tbl_keys(servers or {}) vim.list_extend(ensure_installed, { + 'bashls', 'clangd', + 'docker_compose_language_service', + 'dockerls', 'gopls', + 'intelephense', 'lua_ls', 'marksman', - 'pylsp', - 'rust-analyzer', + 'basedpyright', + 'rust_analyzer', + 'stylua', + 'tinymist', + 'ts_ls', 'zls', - 'stylua', -- Used to format Lua code }) require('mason-tool-installer').setup { ensure_installed = ensure_installed } -- GitLab