From 6c304556f8ca23e483fc038bfa55563cff6d595a Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Sat, 7 Dec 2024 19:17:53 +0530 Subject: [PATCH] nvim: lsp-utils: Miscellaneous clean ups - Drop bash language server. We do not want to run JS/TS based garbage. Now that we do not need to do any official work on JS/TS, we can get rid of all npm/yarn/pnpm shit. - Remove settings for inlay hints for TS server as lot of idiots writing TS do not provide type annotations all the time. ts_ls is also not useful at providing type hints, so inlay hints have never been useful. - Prevent clangd from running on single files. --- nvim/.config/nvim/lua/lsp-utils.lua | 58 ++--------------------------- 1 file changed, 3 insertions(+), 55 deletions(-) diff --git a/nvim/.config/nvim/lua/lsp-utils.lua b/nvim/.config/nvim/lua/lsp-utils.lua index b9661ae..590c0fb 100644 --- a/nvim/.config/nvim/lua/lsp-utils.lua +++ b/nvim/.config/nvim/lua/lsp-utils.lua @@ -77,31 +77,6 @@ end local default_capabilities = vim.lsp.protocol.make_client_capabilities() -function M.bashls_config() - local root_directory = vim.fn.getcwd() - - return { - name = "bashls", - cmd = { 'bash-language-server', 'start' }, - capabilities = default_capabilities, - root_dir = root_directory, - filetypes = { 'sh' }, - single_file_support = true, - settings = { - bashIde = { - -- Glob pattern for finding and parsing shell script files in the workspace. - -- Used by the background analysis features across files. - - -- Prevent recursive scanning which will cause issues when opening a file - -- directly in the home directory (e.g. ~/foo.sh). - -- - -- Default upstream pattern is "**/*@(.sh|.inc|.bash|.command)". - globPattern = vim.env.GLOB_PATTERN or '*@(.sh|.inc|.bash|.command)', - }, - }, - } -end - function M.clangd_config() local root_files = { '.clangd', '.clang-tidy', '.clang-format', 'compile_commands.json', 'compile_flags.txt' } local clangd_cmd = { "clangd", "--background-index", "--pch-storage=memory", "--clang-tidy", "--header-insertion=never" } @@ -117,7 +92,7 @@ function M.clangd_config() capabilities = clangd_caps, root_dir = root_directory, filetypes = { 'c', 'cpp' }, - single_file_support = true, + single_file_support = false, } end @@ -317,39 +292,12 @@ function M.tsserver_config() local root_directory = get_root_directory(root_files) return { - name = "tsserver", + name = "ts_ls", cmd = { "typescript-language-server", "--stdio" }, - -- Support Yarn PnP - -- hostInfo with init_options is required to allow yarn pnp sdk to - -- identify editor and patch paths appropriately. init_options = { hostInfo = 'neovim' }, capabilities = default_capabilities, root_dir = root_directory, - filetypes = file_types, - settings = { - typescript = { - inlayHints = { - includeInlayParameterNameHints = 'all', - includeInlayParameterNameHintsWhenArgumentMatchesName = false, - includeInlayFunctionParameterTypeHints = true, - includeInlayVariableTypeHints = true, - includeInlayPropertyDeclarationTypeHints = true, - includeInlayFunctionLikeReturnTypeHints = true, - includeInlayEnumMemberValueHints = true, - } - }, - javascript = { - inlayHints = { - includeInlayParameterNameHints = 'all', - includeInlayParameterNameHintsWhenArgumentMatchesName = false, - includeInlayFunctionParameterTypeHints = true, - includeInlayVariableTypeHints = true, - includeInlayPropertyDeclarationTypeHints = true, - includeInlayFunctionLikeReturnTypeHints = true, - includeInlayEnumMemberValueHints = true, - } - } - } + filetypes = file_types } end