diff options
author | Michael Smith <mikesmiffy128@gmail.com> | 2024-07-15 20:05:47 +0100 |
---|---|---|
committer | Michael Smith <mikesmiffy128@gmail.com> | 2024-07-15 20:05:47 +0100 |
commit | 522d56557b00246286d803425751a4334f3a94a5 (patch) | |
tree | 23ca335a3526197c2a6327ce10bfd58411b0a609 /start/lspconfig-0.1.3/lua/lspconfig.lua | |
parent | a7b72fc27edac2305dbf0af807981bd703835b25 (diff) |
indent-blankline is probably old because I've actually been using it for
ages, but I have a strict if-it-ain't-broke policy, so I'm not going to
update it.
lspconfig *was* broke though with nvim 0.10, so now it's fixed.
Diffstat (limited to 'start/lspconfig-0.1.3/lua/lspconfig.lua')
-rw-r--r-- | start/lspconfig-0.1.3/lua/lspconfig.lua | 92 |
1 files changed, 0 insertions, 92 deletions
diff --git a/start/lspconfig-0.1.3/lua/lspconfig.lua b/start/lspconfig-0.1.3/lua/lspconfig.lua deleted file mode 100644 index 8404632..0000000 --- a/start/lspconfig-0.1.3/lua/lspconfig.lua +++ /dev/null @@ -1,92 +0,0 @@ -local configs = require 'lspconfig.configs' - -local M = { - util = require 'lspconfig.util', -} - -M._root = {} - -function M.available_servers() - return vim.tbl_keys(configs) -end - --- Called from plugin/lspconfig.vim because it requires knowing that the last --- script in scriptnames to be executed is lspconfig. -function M._root._setup() - M._root.commands = { - LspInfo = { - function() - require 'lspconfig.ui.lspinfo'() - end, - '-nargs=0', - description = '`:LspInfo` Displays attached, active, and configured language servers', - }, - LspStart = { - function(server_name) - if server_name then - if configs[server_name] then - configs[server_name].launch() - end - else - local buffer_filetype = vim.bo.filetype - for _, config in pairs(configs) do - for _, filetype_match in ipairs(config.filetypes or {}) do - if buffer_filetype == filetype_match then - config.launch() - end - end - end - end - end, - '-nargs=? -complete=custom,v:lua.lsp_complete_configured_servers', - description = '`:LspStart` Manually launches a language server.', - }, - LspStop = { - function(cmd_args) - for _, client in ipairs(M.util.get_clients_from_cmd_args(cmd_args)) do - client.stop() - end - end, - '-nargs=? -complete=customlist,v:lua.lsp_get_active_client_ids', - description = '`:LspStop` Manually stops the given language client(s).', - }, - LspRestart = { - function(cmd_args) - for _, client in ipairs(M.util.get_clients_from_cmd_args(cmd_args)) do - client.stop() - vim.defer_fn(function() - configs[client.name].launch() - end, 500) - end - end, - '-nargs=? -complete=customlist,v:lua.lsp_get_active_client_ids', - description = '`:LspRestart` Manually restart the given language client(s).', - }, - } - - M.util.create_module_commands('_root', M._root.commands) -end - -local mt = {} -function mt:__index(k) - if configs[k] == nil then - local success, config = pcall(require, 'lspconfig.server_configurations.' .. k) - if success then - configs[k] = config - else - vim.notify( - string.format( - '[lspconfig] Cannot access configuration for %s. Ensure this server is listed in ' - .. '`server_configurations.md` or added as a custom server.', - k - ), - vim.log.levels.WARN - ) - -- Return a dummy function for compatibility with user configs - return { setup = function() end } - end - end - return configs[k] -end - -return setmetatable(M, mt) |