[LSP] Fix texlab config
This commit is contained in:
		| @@ -1,212 +1,209 @@ | ||||
| return { | ||||
| 	-- lsp configuration | ||||
| 	"neovim/nvim-lspconfig", | ||||
| 	event = { "BufReadPre", "BufNewFile" }, | ||||
| 	dependencies = { | ||||
| 		"hrsh7th/cmp-nvim-lsp", | ||||
| 		{ "antosha417/nvim-lsp-file-operations", config = true }, | ||||
| 		"mfussenegger/nvim-jdtls", | ||||
| 	}, | ||||
| 	config = function() | ||||
| 		local lsp = vim.lsp | ||||
| 		local enable = vim.lsp.enable | ||||
|     -- lsp configuration | ||||
|     "neovim/nvim-lspconfig", | ||||
|     event = { "BufReadPre", "BufNewFile" }, | ||||
|     dependencies = { | ||||
|         "hrsh7th/cmp-nvim-lsp", | ||||
|         { "antosha417/nvim-lsp-file-operations", config = true }, | ||||
|         "mfussenegger/nvim-jdtls", | ||||
|     }, | ||||
|     config = function() | ||||
|         local lsp = vim.lsp | ||||
|         local enable = vim.lsp.enable | ||||
|  | ||||
| 		local capabilities = require("lsp-options").capabilities | ||||
| 		local on_attach = require("lsp-options").on_attach | ||||
|         local capabilities = require("lsp-options").capabilities | ||||
|         local on_attach = require("lsp-options").on_attach | ||||
|  | ||||
| 		-- Change the Diagnostic symbols in the sign column (gutter) | ||||
| 		local signs = { Error = " ", Warn = " ", Hint = "", Info = " " } | ||||
| 		for type, icon in pairs(signs) do | ||||
| 			local hl = "DiagnosticSign" .. type | ||||
| 			vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) | ||||
| 		end | ||||
|         -- Change the Diagnostic symbols in the sign column (gutter) | ||||
|         local signs = { Error = " ", Warn = " ", Hint = "", Info = " " } | ||||
|         for type, icon in pairs(signs) do | ||||
|             local hl = "DiagnosticSign" .. type | ||||
|             vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) | ||||
|         end | ||||
|  | ||||
| 		-- ┌                                               ┐ | ||||
| 		-- │                     Bash                      │ | ||||
| 		-- └                                               ┘ | ||||
| 		lsp.config("bashls", { | ||||
| 			capabilities = capabilities, | ||||
| 			on_attach = on_attach, | ||||
| 		}) | ||||
|         -- ┌                                               ┐ | ||||
|         -- │                     Bash                      │ | ||||
|         -- └                                               ┘ | ||||
|         lsp.config("bashls", { | ||||
|             capabilities = capabilities, | ||||
|             on_attach = on_attach, | ||||
|         }) | ||||
|  | ||||
| 		-- ┌                                               ┐ | ||||
| 		-- │                 C, Cpp, objc                  │ | ||||
| 		-- └                                               ┘ | ||||
| 		lsp.config("clangd", { | ||||
| 			cmd = { | ||||
| 				"clangd", | ||||
| 				"--suggest-missing-includes", | ||||
| 				"--clang-tidy", | ||||
| 			}, | ||||
| 			filetypes = { "c", "cpp", "objc", "objcpp", "cuda", "proto", "ino" }, | ||||
| 			capabilities = capabilities, | ||||
| 			on_attach = on_attach, | ||||
| 		}) | ||||
|         -- ┌                                               ┐ | ||||
|         -- │                 C, Cpp, objc                  │ | ||||
|         -- └                                               ┘ | ||||
|         lsp.config("clangd", { | ||||
|             cmd = { | ||||
|                 "clangd", | ||||
|                 "--suggest-missing-includes", | ||||
|                 "--clang-tidy", | ||||
|             }, | ||||
|             filetypes = { "c", "cpp", "objc", "objcpp", "cuda", "proto", "ino" }, | ||||
|             capabilities = capabilities, | ||||
|             on_attach = on_attach, | ||||
|         }) | ||||
|  | ||||
| 		-- ┌                                               ┐ | ||||
| 		-- │                     Rust                      │ | ||||
| 		-- └                                               ┘ | ||||
| 		lsp.config("rust_analyzer", { | ||||
| 			settings = { | ||||
| 				["rust-analyzer"] = { | ||||
| 					diagnostics = { | ||||
| 						enable = true, | ||||
| 					}, | ||||
| 				}, | ||||
| 			}, | ||||
| 			capabilities = capabilities, | ||||
| 			on_attach = on_attach, | ||||
| 		}) | ||||
|         -- ┌                                               ┐ | ||||
|         -- │                     Rust                      │ | ||||
|         -- └                                               ┘ | ||||
|         lsp.config("rust_analyzer", { | ||||
|             settings = { | ||||
|                 ["rust-analyzer"] = { | ||||
|                     diagnostics = { | ||||
|                         enable = true, | ||||
|                     }, | ||||
|                 }, | ||||
|             }, | ||||
|             capabilities = capabilities, | ||||
|             on_attach = on_attach, | ||||
|         }) | ||||
|  | ||||
| 		-- ┌                                               ┐ | ||||
| 		-- │                HTML, CSS, JSON                │ | ||||
| 		-- └                                               ┘ | ||||
| 		lsp.config("cssls", { | ||||
| 			capabilities = capabilities, | ||||
| 			on_attach = on_attach, | ||||
| 		}) | ||||
|         -- ┌                                               ┐ | ||||
|         -- │                HTML, CSS, JSON                │ | ||||
|         -- └                                               ┘ | ||||
|         lsp.config("cssls", { | ||||
|             capabilities = capabilities, | ||||
|             on_attach = on_attach, | ||||
|         }) | ||||
|  | ||||
| 		lsp.config("html", { | ||||
| 			capabilities = capabilities, | ||||
| 			on_attach = on_attach, | ||||
| 		}) | ||||
|         lsp.config("html", { | ||||
|             capabilities = capabilities, | ||||
|             on_attach = on_attach, | ||||
|         }) | ||||
|  | ||||
| 		lsp.config("jsonls", { | ||||
| 			capabilities = capabilities, | ||||
| 			on_attach = on_attach, | ||||
| 		}) | ||||
|         lsp.config("jsonls", { | ||||
|             capabilities = capabilities, | ||||
|             on_attach = on_attach, | ||||
|         }) | ||||
|  | ||||
| 		-- ┌                                               ┐ | ||||
| 		-- │                      LUA                      │ | ||||
| 		-- └                                               ┘ | ||||
| 		lsp.config("lua_ls", { | ||||
| 			capabilities = capabilities, | ||||
| 			on_attach = on_attach, | ||||
| 			settings = { | ||||
| 				Lua = { | ||||
| 					-- make the language server recognize "vim" global | ||||
| 					diagnostics = { | ||||
| 						globals = { "vim" }, | ||||
| 					}, | ||||
| 					workspace = { | ||||
| 						-- make language server aware of runtime files | ||||
| 						library = { | ||||
| 							[vim.fn.expand("$VIMRUNTIME/lua")] = true, | ||||
| 							[vim.fn.stdpath("config") .. "/lua"] = true, | ||||
| 						}, | ||||
| 					}, | ||||
| 				}, | ||||
| 			}, | ||||
| 		}) | ||||
|         -- ┌                                               ┐ | ||||
|         -- │                      LUA                      │ | ||||
|         -- └                                               ┘ | ||||
|         lsp.config("lua_ls", { | ||||
|             capabilities = capabilities, | ||||
|             on_attach = on_attach, | ||||
|             settings = { | ||||
|                 Lua = { | ||||
|                     -- make the language server recognize "vim" global | ||||
|                     diagnostics = { | ||||
|                         globals = { "vim" }, | ||||
|                     }, | ||||
|                     workspace = { | ||||
|                         -- make language server aware of runtime files | ||||
|                         library = { | ||||
|                             [vim.fn.expand("$VIMRUNTIME/lua")] = true, | ||||
|                             [vim.fn.stdpath("config") .. "/lua"] = true, | ||||
|                         }, | ||||
|                     }, | ||||
|                 }, | ||||
|             }, | ||||
|         }) | ||||
|  | ||||
| 		-- ┌                                               ┐ | ||||
| 		-- │                   Markdown                    │ | ||||
| 		-- └                                               ┘ | ||||
| 		lsp.config("marksman", { | ||||
| 			capabilities = capabilities, | ||||
| 			on_attach = on_attach, | ||||
| 		}) | ||||
|         -- ┌                                               ┐ | ||||
|         -- │                   Markdown                    │ | ||||
|         -- └                                               ┘ | ||||
|         lsp.config("marksman", { | ||||
|             capabilities = capabilities, | ||||
|             on_attach = on_attach, | ||||
|         }) | ||||
|  | ||||
| 		-- ┌                                               ┐ | ||||
| 		-- │                    Python                     │ | ||||
| 		-- └                                               ┘ | ||||
| 		lsp.config("pyright", { | ||||
| 			capabilities = capabilities, | ||||
| 			on_attach = on_attach, | ||||
| 		}) | ||||
|         -- ┌                                               ┐ | ||||
|         -- │                    Python                     │ | ||||
|         -- └                                               ┘ | ||||
|         lsp.config("pyright", { | ||||
|             capabilities = capabilities, | ||||
|             on_attach = on_attach, | ||||
|         }) | ||||
|  | ||||
| 		-- ┌                                               ┐ | ||||
| 		-- │                      Vue                      │ | ||||
| 		-- └                                               ┘ | ||||
| 		lsp.config("vue_ls", { | ||||
| 			capabilities = capabilities, | ||||
| 			on_attach = on_attach, | ||||
| 			filetypes = { | ||||
| 				"vue", | ||||
| 			}, | ||||
| 		}) | ||||
|         -- ┌                                               ┐ | ||||
|         -- │                      Vue                      │ | ||||
|         -- └                                               ┘ | ||||
|         lsp.config("vue_ls", { | ||||
|             capabilities = capabilities, | ||||
|             on_attach = on_attach, | ||||
|             filetypes = { | ||||
|                 "vue", | ||||
|             }, | ||||
|         }) | ||||
|  | ||||
| 		-- ┌                                               ┐ | ||||
| 		-- │               TS, JS, TSX, JSX                │ | ||||
| 		-- └                                               ┘ | ||||
| 		lsp.config("ts_ls", { | ||||
| 			capabilities = capabilities, | ||||
| 			on_attach = on_attach, | ||||
| 			init_options = { | ||||
| 				plugins = { | ||||
| 					{ | ||||
| 						name = "@vue/typescript-plugin", | ||||
| 						location = "/usr/lib/node_modules/@vue/typescript-plugin", | ||||
| 						languages = { "javascript", "typescript", "vue" }, | ||||
| 					}, | ||||
| 				}, | ||||
| 			}, | ||||
| 			filetypes = { | ||||
| 				"javascript", | ||||
| 				"typescript", | ||||
| 				"typescriptreact", | ||||
| 				"javascriptreact", | ||||
| 				"vue", | ||||
| 			}, | ||||
| 		}) | ||||
|         -- ┌                                               ┐ | ||||
|         -- │               TS, JS, TSX, JSX                │ | ||||
|         -- └                                               ┘ | ||||
|         lsp.config("ts_ls", { | ||||
|             capabilities = capabilities, | ||||
|             on_attach = on_attach, | ||||
|             init_options = { | ||||
|                 plugins = { | ||||
|                     { | ||||
|                         name = "@vue/typescript-plugin", | ||||
|                         location = "/usr/lib/node_modules/@vue/typescript-plugin", | ||||
|                         languages = { "javascript", "typescript", "vue" }, | ||||
|                     }, | ||||
|                 }, | ||||
|             }, | ||||
|             filetypes = { | ||||
|                 "javascript", | ||||
|                 "typescript", | ||||
|                 "typescriptreact", | ||||
|                 "javascriptreact", | ||||
|                 "vue", | ||||
|             }, | ||||
|         }) | ||||
|  | ||||
| 		-- ┌                                               ┐ | ||||
| 		-- │                      ASM                      │ | ||||
| 		-- └                                               ┘ | ||||
| 		lsp.config("asm_lsp", { | ||||
| 			on_attach = on_attach, | ||||
| 			capabilities = capabilities, | ||||
| 		}) | ||||
|         -- ┌                                               ┐ | ||||
|         -- │                      ASM                      │ | ||||
|         -- └                                               ┘ | ||||
|         lsp.config("asm_lsp", { | ||||
|             on_attach = on_attach, | ||||
|             capabilities = capabilities, | ||||
|         }) | ||||
|  | ||||
| 		-- ┌                                               ┐ | ||||
| 		-- │                     LaTeX                     │ | ||||
| 		-- └                                               ┘ | ||||
| 		lsp.config("texlab", { | ||||
| 			cmd = { "texlab" }, | ||||
| 			filetypes = { "tex", "latex", "bib" }, | ||||
| 			root_dir = function(fname) | ||||
| 				return vim.loop.cwd() | ||||
| 			end, | ||||
| 		}) | ||||
|         -- ┌                                               ┐ | ||||
|         -- │                     LaTeX                     │ | ||||
|         -- └                                               ┘ | ||||
|         lsp.config("texlab", { | ||||
|             capabilities = capabilities, | ||||
|             on_attach = on_attach, | ||||
|         }) | ||||
|  | ||||
| 		-- ┌                                               ┐ | ||||
| 		-- │                    Verilog                    │ | ||||
| 		-- └                                               ┘ | ||||
| 		local lspconfutil = require("lspconfig/util") | ||||
| 		local root_pattern = lspconfutil.root_pattern("veridian.yml", ".git", ".xpr") | ||||
| 		local verilog_root_dir = function() | ||||
| 			local filename = lspconfutil.path.join(vim.loop.cwd(), fname) | ||||
| 			return root_pattern(filename) or lspconfutil.path.dirname(filename) | ||||
| 		end | ||||
| 		lsp.config("veridian", { | ||||
| 			capabilities = capabilities, | ||||
| 			on_attach = on_attach, | ||||
| 			root_dir = verilog_root_dir, | ||||
| 		}) | ||||
|         -- ┌                                               ┐ | ||||
|         -- │                    Verilog                    │ | ||||
|         -- └                                               ┘ | ||||
|         local lspconfutil = require("lspconfig/util") | ||||
|         local root_pattern = lspconfutil.root_pattern("veridian.yml", ".git", ".xpr") | ||||
|         local verilog_root_dir = function() | ||||
|             local filename = lspconfutil.path.join(vim.loop.cwd(), fname) | ||||
|             return root_pattern(filename) or lspconfutil.path.dirname(filename) | ||||
|         end | ||||
|         lsp.config("veridian", { | ||||
|             capabilities = capabilities, | ||||
|             on_attach = on_attach, | ||||
|             root_dir = verilog_root_dir, | ||||
|         }) | ||||
|  | ||||
| 		lsp.config("verible", { | ||||
| 			-- cmd = { 'verible-verilog-ls', '--rules_config=/home/janis/.config/nvim/util/verible-conf.json' }, | ||||
| 			cmd = { "verible-verilog-ls", "--rules=-no-trailing-spaces", "" }, | ||||
| 			capabilities = capabilities, | ||||
| 			on_attach = on_attach, | ||||
| 			root_dir = verilog_root_dir, | ||||
| 		}) | ||||
|         lsp.config("verible", { | ||||
|             -- cmd = { 'verible-verilog-ls', '--rules_config=/home/janis/.config/nvim/util/verible-conf.json' }, | ||||
|             cmd = { "verible-verilog-ls", "--rules=-no-trailing-spaces", "" }, | ||||
|             capabilities = capabilities, | ||||
|             on_attach = on_attach, | ||||
|             root_dir = verilog_root_dir, | ||||
|         }) | ||||
|  | ||||
| 		--          ╭───────────────────────────────────────────────╮ | ||||
| 		--          │              Enable the configs               │ | ||||
| 		--          ╰───────────────────────────────────────────────╯ | ||||
| 		enable("bashls") | ||||
| 		enable("clangd") | ||||
| 		enable("rust_analyzer") | ||||
| 		enable("marksman") | ||||
| 		enable("vue_ls") | ||||
| 		enable("ts_ls") | ||||
| 		enable("texlab") | ||||
| 		enable("asm_lsp") | ||||
| 		enable("jsonls") | ||||
| 		enable("cssls") | ||||
| 		enable("html") | ||||
| 		enable("lua_ls") | ||||
| 		enable("pyright") | ||||
| 	end, | ||||
|         --          ╭───────────────────────────────────────────────╮ | ||||
|         --          │              Enable the configs               │ | ||||
|         --          ╰───────────────────────────────────────────────╯ | ||||
|         enable("bashls") | ||||
|         enable("clangd") | ||||
|         enable("rust_analyzer") | ||||
|         enable("marksman") | ||||
|         enable("vue_ls") | ||||
|         enable("ts_ls") | ||||
|         enable("texlab") | ||||
|         enable("asm_lsp") | ||||
|         enable("jsonls") | ||||
|         enable("cssls") | ||||
|         enable("html") | ||||
|         enable("lua_ls") | ||||
|         enable("pyright") | ||||
|     end, | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user