(chore): Fixed outdated LS
This commit is contained in:
		
							parent
							
								
									1b291b1253
								
							
						
					
					
						commit
						d0d17c5418
					
				
					 1 changed files with 57 additions and 57 deletions
				
			
		|  | @ -1,48 +1,48 @@ | ||||||
| -- import lspconfig plugin safely | -- import lspconfig plugin safely | ||||||
| local lspconfig_status, lspconfig = pcall(require, "lspconfig") | local lspconfig_status, lspconfig = pcall(require, "lspconfig") | ||||||
| if not lspconfig_status then | if not lspconfig_status then | ||||||
|   return | 	return | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| -- import cmp-nvim-lsp plugin safely | -- import cmp-nvim-lsp plugin safely | ||||||
| local cmp_nvim_lsp_status, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") | local cmp_nvim_lsp_status, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") | ||||||
| if not cmp_nvim_lsp_status then | if not cmp_nvim_lsp_status then | ||||||
|   return | 	return | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| -- import typescript plugin safely | -- import typescript plugin safely | ||||||
| local typescript_setup, typescript = pcall(require, "typescript") | local typescript_setup, typescript = pcall(require, "typescript") | ||||||
| if not typescript_setup then | if not typescript_setup then | ||||||
|   return | 	return | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| local keymap = vim.keymap -- for conciseness | local keymap = vim.keymap -- for conciseness | ||||||
| 
 | 
 | ||||||
| -- enable keybinds only for when lsp server available | -- enable keybinds only for when lsp server available | ||||||
| local on_attach = function(client, bufnr) | local on_attach = function(client, bufnr) | ||||||
|   -- keybind options | 	-- keybind options | ||||||
|   local opts = { noremap = true, silent = true, buffer = bufnr } | 	local opts = { noremap = true, silent = true, buffer = bufnr } | ||||||
| 
 | 
 | ||||||
|   -- set keybinds | 	-- set keybinds | ||||||
|   keymap.set("n", "gf", "<cmd>Lspsaga lsp_finder<CR>", opts) -- show definition, references | 	keymap.set("n", "gf", "<cmd>Lspsaga lsp_finder<CR>", opts) -- show definition, references | ||||||
|   keymap.set("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts) -- got to declaration | 	keymap.set("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts) -- got to declaration | ||||||
|   keymap.set("n", "gd", "<cmd>Lspsaga peek_definition<CR>", opts) -- see definition and make edits in window | 	keymap.set("n", "gd", "<cmd>Lspsaga peek_definition<CR>", opts) -- see definition and make edits in window | ||||||
|   keymap.set("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts) -- go to implementation | 	keymap.set("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts) -- go to implementation | ||||||
|   keymap.set("n", "<leader>ca", "<cmd>Lspsaga code_action<CR>", opts) -- see available code actions | 	keymap.set("n", "<leader>ca", "<cmd>Lspsaga code_action<CR>", opts) -- see available code actions | ||||||
|   keymap.set("n", "<leader>rn", "<cmd>Lspsaga rename<CR>", opts) -- smart rename | 	keymap.set("n", "<leader>rn", "<cmd>Lspsaga rename<CR>", opts) -- smart rename | ||||||
|   keymap.set("n", "<leader>D", "<cmd>Lspsaga show_line_diagnostics<CR>", opts) -- show  diagnostics for line | 	keymap.set("n", "<leader>D", "<cmd>Lspsaga show_line_diagnostics<CR>", opts) -- show  diagnostics for line | ||||||
|   keymap.set("n", "<leader>d", "<cmd>Lspsaga show_cursor_diagnostics<CR>", opts) -- show diagnostics for cursor | 	keymap.set("n", "<leader>d", "<cmd>Lspsaga show_cursor_diagnostics<CR>", opts) -- show diagnostics for cursor | ||||||
|   keymap.set("n", "[d", "<cmd>Lspsaga diagnostic_jump_prev<CR>", opts) -- jump to previous diagnostic in buffer | 	keymap.set("n", "[d", "<cmd>Lspsaga diagnostic_jump_prev<CR>", opts) -- jump to previous diagnostic in buffer | ||||||
|   keymap.set("n", "]d", "<cmd>Lspsaga diagnostic_jump_next<CR>", opts) -- jump to next diagnostic in buffer | 	keymap.set("n", "]d", "<cmd>Lspsaga diagnostic_jump_next<CR>", opts) -- jump to next diagnostic in buffer | ||||||
|   keymap.set("n", "K", "<cmd>Lspsaga hover_doc<CR>", opts) -- show documentation for what is under cursor | 	keymap.set("n", "K", "<cmd>Lspsaga hover_doc<CR>", opts) -- show documentation for what is under cursor | ||||||
|   keymap.set("n", "<leader>o", "<cmd>LSoutlineToggle<CR>", opts) -- see outline on right hand side | 	keymap.set("n", "<leader>o", "<cmd>LSoutlineToggle<CR>", opts) -- see outline on right hand side | ||||||
| 
 | 
 | ||||||
|   -- typescript specific keymaps (e.g. rename file and update imports) | 	-- typescript specific keymaps (e.g. rename file and update imports) | ||||||
|   if client.name == "tsserver" then | 	if client.name == "tsserver" then | ||||||
|     keymap.set("n", "<leader>rf", ":TypescriptRenameFile<CR>") -- rename file and update imports | 		keymap.set("n", "<leader>rf", ":TypescriptRenameFile<CR>") -- rename file and update imports | ||||||
|     keymap.set("n", "<leader>oi", ":TypescriptOrganizeImports<CR>") -- organize imports (not in youtube nvim video) | 		keymap.set("n", "<leader>oi", ":TypescriptOrganizeImports<CR>") -- organize imports (not in youtube nvim video) | ||||||
|     keymap.set("n", "<leader>ru", ":TypescriptRemoveUnused<CR>") -- remove unused variables (not in youtube nvim video) | 		keymap.set("n", "<leader>ru", ":TypescriptRemoveUnused<CR>") -- remove unused variables (not in youtube nvim video) | ||||||
|   end | 	end | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| -- used to enable autocompletion (assign to every lsp server config) | -- used to enable autocompletion (assign to every lsp server config) | ||||||
|  | @ -52,60 +52,60 @@ local capabilities = cmp_nvim_lsp.default_capabilities() | ||||||
| -- (not in youtube nvim video) | -- (not in youtube nvim video) | ||||||
| local signs = { Error = " ", Warn = " ", Hint = "ﴞ ", Info = " " } | local signs = { Error = " ", Warn = " ", Hint = "ﴞ ", Info = " " } | ||||||
| for type, icon in pairs(signs) do | for type, icon in pairs(signs) do | ||||||
|   local hl = "DiagnosticSign" .. type | 	local hl = "DiagnosticSign" .. type | ||||||
|   vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) | 	vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| -- configure html server | -- configure html server | ||||||
| lspconfig["html"].setup({ | lspconfig["html"].setup({ | ||||||
|   capabilities = capabilities, | 	capabilities = capabilities, | ||||||
|   on_attach = on_attach, | 	on_attach = on_attach, | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| -- configure typescript server with plugin | -- configure typescript server with plugin | ||||||
| typescript.setup({ | typescript.setup({ | ||||||
|   server = { | 	server = { | ||||||
|     capabilities = capabilities, | 		capabilities = capabilities, | ||||||
|     on_attach = on_attach, | 		on_attach = on_attach, | ||||||
|   }, | 	}, | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| -- configure css server | -- configure css server | ||||||
| lspconfig["cssls"].setup({ | lspconfig["cssls"].setup({ | ||||||
|   capabilities = capabilities, | 	capabilities = capabilities, | ||||||
|   on_attach = on_attach, | 	on_attach = on_attach, | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| -- configure tailwindcss server | -- configure tailwindcss server | ||||||
| lspconfig["tailwindcss"].setup({ | lspconfig["tailwindcss"].setup({ | ||||||
|   capabilities = capabilities, | 	capabilities = capabilities, | ||||||
|   on_attach = on_attach, | 	on_attach = on_attach, | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| -- configure emmet language server | -- configure emmet language server | ||||||
| lspconfig["emmet_ls"].setup({ | lspconfig["emmet_ls"].setup({ | ||||||
|   capabilities = capabilities, | 	capabilities = capabilities, | ||||||
|   on_attach = on_attach, | 	on_attach = on_attach, | ||||||
|   filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" }, | 	filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" }, | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| -- configure lua server (with special settings) | -- configure lua server (with special settings) | ||||||
| lspconfig["sumneko_lua"].setup({ | lspconfig["lua_ls"].setup({ | ||||||
|   capabilities = capabilities, | 	capabilities = capabilities, | ||||||
|   on_attach = on_attach, | 	on_attach = on_attach, | ||||||
|   settings = { -- custom settings for lua | 	settings = { -- custom settings for lua | ||||||
|     Lua = { | 		Lua = { | ||||||
|       -- make the language server recognize "vim" global | 			-- make the language server recognize "vim" global | ||||||
|       diagnostics = { | 			diagnostics = { | ||||||
|         globals = { "vim" }, | 				globals = { "vim" }, | ||||||
|       }, | 			}, | ||||||
|       workspace = { | 			workspace = { | ||||||
|         -- make language server aware of runtime files | 				-- make language server aware of runtime files | ||||||
|         library = { | 				library = { | ||||||
|           [vim.fn.expand("$VIMRUNTIME/lua")] = true, | 					[vim.fn.expand("$VIMRUNTIME/lua")] = true, | ||||||
|           [vim.fn.stdpath("config") .. "/lua"] = true, | 					[vim.fn.stdpath("config") .. "/lua"] = true, | ||||||
|         }, | 				}, | ||||||
|       }, | 			}, | ||||||
|     }, | 		}, | ||||||
|   }, | 	}, | ||||||
| }) | }) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Blake Ridgway
						Blake Ridgway