diff options
| author | Michael Lingelbach <m.j.lbach@gmail.com> | 2021-07-03 14:45:08 -0700 |
|---|---|---|
| committer | Michael Lingelbach <m.j.lbach@gmail.com> | 2021-07-03 15:49:27 -0700 |
| commit | ec11b85df73cce4edb2925cb7f1d0e8db3a07b1c (patch) | |
| tree | 77d533dc9606ca7e9b30d1a96baebf3de325d2a8 /lua | |
| parent | [docgen] Update CONFIG.md (diff) | |
| download | nvim-lspconfig-ec11b85df73cce4edb2925cb7f1d0e8db3a07b1c.tar nvim-lspconfig-ec11b85df73cce4edb2925cb7f1d0e8db3a07b1c.tar.gz nvim-lspconfig-ec11b85df73cce4edb2925cb7f1d0e8db3a07b1c.tar.bz2 nvim-lspconfig-ec11b85df73cce4edb2925cb7f1d0e8db3a07b1c.tar.lz nvim-lspconfig-ec11b85df73cce4edb2925cb7f1d0e8db3a07b1c.tar.xz nvim-lspconfig-ec11b85df73cce4edb2925cb7f1d0e8db3a07b1c.tar.zst nvim-lspconfig-ec11b85df73cce4edb2925cb7f1d0e8db3a07b1c.zip | |
ci: lint and format with stylua
Diffstat (limited to 'lua')
91 files changed, 1642 insertions, 1595 deletions
diff --git a/lua/lspconfig.lua b/lua/lspconfig.lua index 798f6234..7d6ae4cf 100644 --- a/lua/lspconfig.lua +++ b/lua/lspconfig.lua @@ -1,7 +1,7 @@ -local configs = require 'lspconfig/configs' +local configs = require "lspconfig/configs" local M = { - util = require 'lspconfig/util'; + util = require "lspconfig/util", } local script_path = M.util.script_path() @@ -18,31 +18,31 @@ function M._root._setup() M._root.commands = { LspInfo = { function() - require('lspconfig/lspinfo')() - end; - "-nargs=0"; - description = '`:LspInfo` Displays attached, active, and configured language servers'; - }; + require "lspconfig/lspinfo"() + end, + "-nargs=0", + description = "`:LspInfo` Displays attached, active, and configured language servers", + }, LspStart = { function(server_name) if server_name then - require('lspconfig')[server_name].autostart() + require("lspconfig")[server_name].autostart() else local buffer_filetype = vim.bo.filetype for client_name, config in pairs(configs) do if config.filetypes then for _, filetype_match in ipairs(config.filetypes) do if buffer_filetype == filetype_match then - require('lspconfig')[client_name].autostart() + require("lspconfig")[client_name].autostart() end end end end end - end; - "-nargs=? -complete=custom,v:lua.lsp_complete_configured_servers"; - description = '`:LspStart` Manually launches a language server.'; - }; + end, + "-nargs=? -complete=custom,v:lua.lsp_complete_configured_servers", + description = "`:LspStart` Manually launches a language server.", + }, LspStop = { function(client_id) if not client_id then @@ -53,10 +53,10 @@ function M._root._setup() client.stop() end end - end; - "-nargs=? -complete=customlist,v:lua.lsp_get_active_client_ids"; - description = '`:LspStop` Manually stops the given language client.'; - }; + end, + "-nargs=? -complete=customlist,v:lua.lsp_get_active_client_ids", + description = "`:LspStop` Manually stops the given language client.", + }, LspRestart = { function(client_id) local clients @@ -64,21 +64,21 @@ function M._root._setup() if client_id == nil then clients = vim.lsp.buf_get_clients(0) else - clients = {vim.lsp.get_client_by_id(tonumber(client_id))} + clients = { vim.lsp.get_client_by_id(tonumber(client_id)) } end for _, client in ipairs(clients) do local client_name = client.name client.stop() vim.defer_fn(function() - require('lspconfig')[client_name].autostart() + require("lspconfig")[client_name].autostart() end, 500) end - end; - "-nargs=? -complete=customlist,v:lua.lsp_get_active_client_ids"; - description = '`:LspRestart` Manually restart the given language client.'; - }; - }; + end, + "-nargs=? -complete=customlist,v:lua.lsp_get_active_client_ids", + description = "`:LspRestart` Manually restart the given language client.", + }, + } M.util.create_module_commands("_root", M._root.commands) end @@ -88,7 +88,7 @@ function mt:__index(k) if configs[k] == nil then -- dofile is used here as a performance hack to increase the speed of calls to setup({}) -- dofile does not cache module lookups, and requires the absolute path to the target file - pcall(dofile, script_path .. 'lspconfig/' .. k .. ".lua") + pcall(dofile, script_path .. "lspconfig/" .. k .. ".lua") end return configs[k] end diff --git a/lua/lspconfig/_lspui.lua b/lua/lspconfig/_lspui.lua index ba465221..a79b9293 100644 --- a/lua/lspconfig/_lspui.lua +++ b/lua/lspconfig/_lspui.lua @@ -34,12 +34,12 @@ function win_float.default_opts(options) local left = math.floor((vim.o.columns - width) / 2) local opts = { - relative = 'editor', - row = top, - col = left, - width = width, - height = height, - style = 'minimal' + relative = "editor", + row = top, + col = left, + width = width, + height = height, + style = "minimal", } return opts @@ -60,12 +60,12 @@ function win_float.percentage_range_window(col_range, row_range, options) win_opts.relative = "editor" local height_percentage, row_start_percentage - if type(row_range) == 'number' then + if type(row_range) == "number" then assert(row_range <= 1) assert(row_range > 0) height_percentage = row_range row_start_percentage = (1 - height_percentage) / 2 - elseif type(row_range) == 'table' then + elseif type(row_range) == "table" then height_percentage = row_range[2] - row_range[1] row_start_percentage = row_range[1] else @@ -73,15 +73,15 @@ function win_float.percentage_range_window(col_range, row_range, options) end win_opts.height = math.ceil(vim.o.lines * height_percentage) - win_opts.row = math.ceil(vim.o.lines * row_start_percentage) + win_opts.row = math.ceil(vim.o.lines * row_start_percentage) local width_percentage, col_start_percentage - if type(col_range) == 'number' then + if type(col_range) == "number" then assert(col_range <= 1) assert(col_range > 0) width_percentage = col_range col_start_percentage = (1 - width_percentage) / 2 - elseif type(col_range) == 'table' then + elseif type(col_range) == "table" then width_percentage = col_range[2] - col_range[1] col_start_percentage = col_range[1] else @@ -91,21 +91,21 @@ function win_float.percentage_range_window(col_range, row_range, options) win_opts.col = math.floor(vim.o.columns * col_start_percentage) win_opts.width = math.floor(vim.o.columns * width_percentage) win_opts.border = { - {" ", "NormalFloat"}, - {" ", "NormalFloat"}, - {" ", "NormalFloat"}, - {" ", "NormalFloat"}, - {" ", "NormalFloat"}, - {" ", "NormalFloat"}, - {" ", "NormalFloat"}, - {" ", "NormalFloat"} + { " ", "NormalFloat" }, + { " ", "NormalFloat" }, + { " ", "NormalFloat" }, + { " ", "NormalFloat" }, + { " ", "NormalFloat" }, + { " ", "NormalFloat" }, + { " ", "NormalFloat" }, + { " ", "NormalFloat" }, } local bufnr = options.bufnr or vim.api.nvim_create_buf(false, true) local win_id = vim.api.nvim_open_win(bufnr, true, win_opts) vim.api.nvim_win_set_buf(win_id, bufnr) - vim.cmd('setlocal nocursorcolumn') + vim.cmd "setlocal nocursorcolumn" return { bufnr = bufnr, diff --git a/lua/lspconfig/als.lua b/lua/lspconfig/als.lua index dd0138b1..8940dd12 100644 --- a/lua/lspconfig/als.lua +++ b/lua/lspconfig/als.lua @@ -1,21 +1,21 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' -local server_name = 'als' -local bin_name = 'ada_language_server' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" +local server_name = "als" +local bin_name = "ada_language_server" -if vim.fn.has('win32') == 1 then - bin_name = 'ada_language_server.exe' +if vim.fn.has "win32" == 1 then + bin_name = "ada_language_server.exe" end configs[server_name] = { default_config = { - cmd = {bin_name}; - filetypes = {"ada"}; + cmd = { bin_name }, + filetypes = { "ada" }, -- *.gpr and *.adc would be nice to have here - root_dir = util.root_pattern("Makefile", ".git"); - }; + root_dir = util.root_pattern("Makefile", ".git"), + }, docs = { - package_json = "https://raw.githubusercontent.com/AdaCore/ada_language_server/master/integration/vscode/ada/package.json"; + package_json = "https://raw.githubusercontent.com/AdaCore/ada_language_server/master/integration/vscode/ada/package.json", description = [[ https://github.com/AdaCore/ada_language_server @@ -33,11 +33,11 @@ require('lspconfig').als.setup{ } } ``` -]]; +]], default_config = { - root_dir = [[util.root_pattern("Makefile", ".git")]]; - }; - }; -}; + root_dir = [[util.root_pattern("Makefile", ".git")]], + }, + }, +} -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/angularls.lua b/lua/lspconfig/angularls.lua index ff9dc8ec..4acec89c 100644 --- a/lua/lspconfig/angularls.lua +++ b/lua/lspconfig/angularls.lua @@ -1,7 +1,7 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" -local server_name = 'angularls' +local server_name = "angularls" -- Angular requires a node_modules directory to probe for @angular/language-service and typescript -- in order to use your projects configured versions. @@ -9,7 +9,7 @@ local server_name = 'angularls' local function get_probe_dir(root_dir) local project_root = util.find_node_modules_ancestor(root_dir) - return project_root and (project_root .. '/node_modules') or '' + return project_root and (project_root .. "/node_modules") or "" end local default_probe_dir = get_probe_dir(vim.fn.getcwd()) @@ -17,28 +17,32 @@ local default_probe_dir = get_probe_dir(vim.fn.getcwd()) configs[server_name] = { default_config = { cmd = { - 'ngserver', - '--stdio', - '--tsProbeLocations', default_probe_dir, - '--ngProbeLocations', default_probe_dir - }; - filetypes = {'typescript', 'html', 'typescriptreact', 'typescript.tsx'}; + "ngserver", + "--stdio", + "--tsProbeLocations", + default_probe_dir, + "--ngProbeLocations", + default_probe_dir, + }, + filetypes = { "typescript", "html", "typescriptreact", "typescript.tsx" }, -- Check for angular.json or .git first since that is the root of the project. -- Don't check for tsconfig.json or package.json since there are multiple of these -- in an angular monorepo setup. - root_dir = util.root_pattern('angular.json', '.git'); - }; + root_dir = util.root_pattern("angular.json", ".git"), + }, on_new_config = function(new_config, new_root_dir) local new_probe_dir = get_probe_dir(new_root_dir) -- We need to check our probe directories because they may have changed. new_config.cmd = { - 'ngserver', - '--stdio', - '--tsProbeLocations', new_probe_dir, - '--ngProbeLocations', new_probe_dir + "ngserver", + "--stdio", + "--tsProbeLocations", + new_probe_dir, + "--ngProbeLocations", + new_probe_dir, } - end; + end, docs = { description = [[ https://github.com/angular/vscode-ng-language-service @@ -58,9 +62,9 @@ require'lspconfig'.angularls.setup{ end, } ``` - ]]; + ]], default_config = { - root_dir = [[root_pattern("angular.json", ".git")]]; - }; - } + root_dir = [[root_pattern("angular.json", ".git")]], + }, + }, } diff --git a/lua/lspconfig/bashls.lua b/lua/lspconfig/bashls.lua index 2f87d7e0..5990f104 100644 --- a/lua/lspconfig/bashls.lua +++ b/lua/lspconfig/bashls.lua @@ -1,31 +1,31 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "bashls" configs[server_name] = { default_config = { - cmd = {"bash-language-server", "start"}; + cmd = { "bash-language-server", "start" }, cmd_env = { -- 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)". - GLOB_PATTERN = vim.env.GLOB_PATTERN or "*@(.sh|.inc|.bash|.command)" + GLOB_PATTERN = vim.env.GLOB_PATTERN or "*@(.sh|.inc|.bash|.command)", }, - filetypes = {"sh"}; - root_dir = util.path.dirname; - }; + filetypes = { "sh" }, + root_dir = util.path.dirname, + }, docs = { description = [[ https://github.com/mads-hartmann/bash-language-server Language server for bash, written using tree sitter in typescript. -]]; +]], default_config = { - root_dir = "vim's starting directory"; - }; - }; -}; + root_dir = "vim's starting directory", + }, + }, +} -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/beancount.lua b/lua/lspconfig/beancount.lua index cfd56872..fdbdd3f1 100644 --- a/lua/lspconfig/beancount.lua +++ b/lua/lspconfig/beancount.lua @@ -1,34 +1,33 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "beancount" local bin_name = "beancount-langserver" configs[server_name] = { default_config = { - cmd = {bin_name}; - filetypes = {"beancount"}; + cmd = { bin_name }, + filetypes = { "beancount" }, root_dir = function(fname) - return util.find_git_ancestor(fname) or util.path.dirname(fname) - end; + return util.find_git_ancestor(fname) or util.path.dirname(fname) + end, init_options = { -- this is the path to the beancout journal file journalFile = "", -- this is the path to the pyton binary with beancount installed pythonPath = "python3", - }; - }; + }, + }, docs = { description = [[ https://github.com/polarmutex/beancount-language-server#installation See https://github.com/polarmutex/beancount-language-server#configuration for configuration options -]]; +]], default_config = { - root_dir = [[root_pattern("elm.json")]]; - }; - }; + root_dir = [[root_pattern("elm.json")]], + }, + }, } -- vim:et ts=2 sw=2 - diff --git a/lua/lspconfig/ccls.lua b/lua/lspconfig/ccls.lua index 68cf2d47..120253c3 100644 --- a/lua/lspconfig/ccls.lua +++ b/lua/lspconfig/ccls.lua @@ -1,14 +1,14 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" configs.ccls = { default_config = { - cmd = {"ccls"}; - filetypes = {"c", "cpp", "objc", "objcpp"}; + cmd = { "ccls" }, + filetypes = { "c", "cpp", "objc", "objcpp" }, root_dir = function(fname) return util.root_pattern("compile_commands.json", "compile_flags.txt", ".git")(fname) or util.path.dirname(fname) - end; - }; + end, + }, docs = { description = [[ https://github.com/MaskRay/ccls/wiki @@ -35,10 +35,10 @@ lspconfig.ccls.setup { ``` -]]; +]], default_config = { - root_dir = [[root_pattern("compile_commands.json", "compile_flags.txt", ".git") or dirname]]; - }; - }; + root_dir = [[root_pattern("compile_commands.json", "compile_flags.txt", ".git") or dirname]], + }, + }, } -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/clangd.lua b/lua/lspconfig/clangd.lua index 4d769e13..c5f756bc 100644 --- a/lua/lspconfig/clangd.lua +++ b/lua/lspconfig/clangd.lua @@ -1,54 +1,60 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" -- https://clangd.llvm.org/extensions.html#switch-between-sourceheader local function switch_source_header(bufnr) bufnr = util.validate_bufnr(bufnr) local params = { uri = vim.uri_from_bufnr(bufnr) } - vim.lsp.buf_request(bufnr, 'textDocument/switchSourceHeader', params, function(err, _, result) - if err then error(tostring(err)) end - if not result then print ("Corresponding file cannot be determined") return end - vim.api.nvim_command('edit '..vim.uri_to_fname(result)) + vim.lsp.buf_request(bufnr, "textDocument/switchSourceHeader", params, function(err, _, result) + if err then + error(tostring(err)) + end + if not result then + print "Corresponding file cannot be determined" + return + end + vim.api.nvim_command("edit " .. vim.uri_to_fname(result)) end) end local root_pattern = util.root_pattern("compile_commands.json", "compile_flags.txt", ".git") local default_capabilities = vim.tbl_deep_extend( - 'force', - util.default_config.capabilities or vim.lsp.protocol.make_client_capabilities(), { - textDocument = { - completion = { - editsNearCursor = true - } - }, - offsetEncoding = {"utf-8", "utf-16"} -}); + "force", + util.default_config.capabilities or vim.lsp.protocol.make_client_capabilities(), + { + textDocument = { + completion = { + editsNearCursor = true, + }, + }, + offsetEncoding = { "utf-8", "utf-16" }, + } +) configs.clangd = { default_config = { - cmd = {"clangd", "--background-index"}; - filetypes = {"c", "cpp", "objc", "objcpp"}; + cmd = { "clangd", "--background-index" }, + filetypes = { "c", "cpp", "objc", "objcpp" }, root_dir = function(fname) - local filename = util.path.is_absolute(fname) and fname - or util.path.join(vim.loop.cwd(), fname) + local filename = util.path.is_absolute(fname) and fname or util.path.join(vim.loop.cwd(), fname) return root_pattern(filename) or util.path.dirname(filename) - end; + end, on_init = function(client, result) if result.offsetEncoding then client.offset_encoding = result.offsetEncoding end - end; - capabilities = default_capabilities; - }; + end, + capabilities = default_capabilities, + }, commands = { ClangdSwitchSourceHeader = { function() switch_source_header(0) - end; - description = "Switch between source/header"; - }; - }; + end, + description = "Switch between source/header", + }, + }, docs = { description = [[ https://clangd.llvm.org/installation.html @@ -58,13 +64,13 @@ https://clangd.llvm.org/installation.html clangd relies on a [JSON compilation database](https://clang.llvm.org/docs/JSONCompilationDatabase.html) specified as compile_commands.json or, for simpler projects, a compile_flags.txt. For details on how to automatically generate one using CMake look [here](https://cmake.org/cmake/help/latest/variable/CMAKE_EXPORT_COMPILE_COMMANDS.html). -]]; +]], default_config = { - root_dir = [[root_pattern("compile_commands.json", "compile_flags.txt", ".git") or dirname]]; - on_init = [[function to handle changing offsetEncoding]]; - capabilities = [[default capabilities, with offsetEncoding utf-8]]; - }; - }; + root_dir = [[root_pattern("compile_commands.json", "compile_flags.txt", ".git") or dirname]], + on_init = [[function to handle changing offsetEncoding]], + capabilities = [[default capabilities, with offsetEncoding utf-8]], + }, + }, } configs.clangd.switch_source_header = switch_source_header diff --git a/lua/lspconfig/clojure_lsp.lua b/lua/lspconfig/clojure_lsp.lua index f1ec6932..df7f7419 100644 --- a/lua/lspconfig/clojure_lsp.lua +++ b/lua/lspconfig/clojure_lsp.lua @@ -1,22 +1,21 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" configs.clojure_lsp = { default_config = { - cmd = {"clojure-lsp"}; - filetypes = {"clojure", "edn"}; - root_dir = util.root_pattern("project.clj", "deps.edn", ".git"); - }; + cmd = { "clojure-lsp" }, + filetypes = { "clojure", "edn" }, + root_dir = util.root_pattern("project.clj", "deps.edn", ".git"), + }, docs = { description = [[ https://github.com/snoe/clojure-lsp Clojure Language Server -]]; +]], default_config = { - root_dir = [[root_pattern("project.clj", "deps.edn", ".git")]]; - }; - }; + root_dir = [[root_pattern("project.clj", "deps.edn", ".git")]], + }, + }, } -- vim:et ts=2 sw=2 - diff --git a/lua/lspconfig/cmake.lua b/lua/lspconfig/cmake.lua index 42e83329..17039563 100644 --- a/lua/lspconfig/cmake.lua +++ b/lua/lspconfig/cmake.lua @@ -1,27 +1,27 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" configs.cmake = { default_config = { - cmd = {"cmake-language-server"}; - filetypes = {"cmake"}; + cmd = { "cmake-language-server" }, + filetypes = { "cmake" }, root_dir = function(fname) return util.root_pattern(".git", "compile_commands.json", "build")(fname) or util.path.dirname(fname) - end; + end, init_options = { buildDirectory = "build", - } - }; + }, + }, docs = { description = [[ https://github.com/regen100/cmake-language-server CMake LSP Implementation -]]; +]], default_config = { - root_dir = [[root_pattern(".git", "compile_commands.json", "build") or dirname]]; - }; - }; -}; + root_dir = [[root_pattern(".git", "compile_commands.json", "build") or dirname]], + }, + }, +} -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/codeqlls.lua b/lua/lspconfig/codeqlls.lua index 4339733f..5a3f6e83 100644 --- a/lua/lspconfig/codeqlls.lua +++ b/lua/lspconfig/codeqlls.lua @@ -1,51 +1,53 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "codeqlls" -local root_pattern = util.root_pattern("qlpack.yml") +local root_pattern = util.root_pattern "qlpack.yml" configs[server_name] = { - default_config = { - cmd = {"codeql", "execute", "language-server", "--check-errors", "ON_CHANGE", "-q"}; - filetypes = {'ql'}; - root_dir = function(fname) - return root_pattern(fname) or util.path.dirname(fname) - end; - log_level = vim.lsp.protocol.MessageType.Warning; - before_init = function(initialize_params) - initialize_params['workspaceFolders'] = {{ - name = 'workspace', - uri = initialize_params['rootUri'] - }} - end; - settings = { - search_path = vim.empty_dict() - }; - }; - docs = { - description = [[ + default_config = { + cmd = { "codeql", "execute", "language-server", "--check-errors", "ON_CHANGE", "-q" }, + filetypes = { "ql" }, + root_dir = function(fname) + return root_pattern(fname) or util.path.dirname(fname) + end, + log_level = vim.lsp.protocol.MessageType.Warning, + before_init = function(initialize_params) + initialize_params["workspaceFolders"] = { + { + name = "workspace", + uri = initialize_params["rootUri"], + }, + } + end, + settings = { + search_path = vim.empty_dict(), + }, + }, + docs = { + description = [[ Reference: https://help.semmle.com/codeql/codeql-cli.html Binaries: https://github.com/github/codeql-cli-binaries - ]]; - default_config = { - settings = { - search_path = [[list containing all search paths, eg: '~/codeql-home/codeql-repo']]; - }; - }; - }; - on_new_config = function(config) - if type(config.settings.search_path) == 'table' and not vim.tbl_isempty(config.settings.search_path) then - local search_path = "--search-path=" - for _, path in ipairs(config.settings.search_path) do - search_path = search_path..vim.fn.expand(path)..":" - end - config.cmd = {"codeql", "execute", "language-server", "--check-errors", "ON_CHANGE", "-q", search_path} - else - config.cmd = {"codeql", "execute", "language-server", "--check-errors", "ON_CHANGE", "-q"} - end - end; + ]], + default_config = { + settings = { + search_path = [[list containing all search paths, eg: '~/codeql-home/codeql-repo']], + }, + }, + }, + on_new_config = function(config) + if type(config.settings.search_path) == "table" and not vim.tbl_isempty(config.settings.search_path) then + local search_path = "--search-path=" + for _, path in ipairs(config.settings.search_path) do + search_path = search_path .. vim.fn.expand(path) .. ":" + end + config.cmd = { "codeql", "execute", "language-server", "--check-errors", "ON_CHANGE", "-q", search_path } + else + config.cmd = { "codeql", "execute", "language-server", "--check-errors", "ON_CHANGE", "-q" } + end + end, } diff --git a/lua/lspconfig/configs.lua b/lua/lspconfig/configs.lua index 087b9ddf..e8ad78f0 100644 --- a/lua/lspconfig/configs.lua +++ b/lua/lspconfig/configs.lua @@ -1,4 +1,4 @@ -local util = require 'lspconfig/util' +local util = require "lspconfig/util" local api, validate, lsp = vim.api, vim.validate, vim.lsp local tbl_extend = vim.tbl_extend @@ -6,17 +6,17 @@ local configs = {} function configs.__newindex(t, config_name, config_def) validate { - name = {config_name, 's'}; - default_config = {config_def.default_config, 't'}; - on_new_config = {config_def.on_new_config, 'f', true}; - on_attach = {config_def.on_attach, 'f', true}; - commands = {config_def.commands, 't', true}; + name = { config_name, "s" }, + default_config = { config_def.default_config, "t" }, + on_new_config = { config_def.on_new_config, "f", true }, + on_attach = { config_def.on_attach, "f", true }, + commands = { config_def.commands, "t", true }, } if config_def.commands then for k, v in pairs(config_def.commands) do validate { - ['command.name'] = {k, 's'}; - ['command.fn'] = {v[1], 'f'}; + ["command.name"] = { k, "s" }, + ["command.fn"] = { v[1], "f" }, } end else @@ -32,18 +32,18 @@ function configs.__newindex(t, config_name, config_def) function M.setup(config) validate { - cmd = {config.cmd, 't', default_config.cmd ~= nil}; - root_dir = {config.root_dir, 'f', default_config.root_dir ~= nil}; - filetypes = {config.filetype, 't', true}; - on_new_config = {config.on_new_config, 'f', true}; - on_attach = {config.on_attach, 'f', true}; - commands = {config.commands, 't', true}; + cmd = { config.cmd, "t", default_config.cmd ~= nil }, + root_dir = { config.root_dir, "f", default_config.root_dir ~= nil }, + filetypes = { config.filetype, "t", true }, + on_new_config = { config.on_new_config, "f", true }, + on_attach = { config.on_attach, "f", true }, + commands = { config.commands, "t", true }, } if config.commands then for k, v in pairs(config.commands) do validate { - ['command.name'] = {k, 's'}; - ['command.fn'] = {v[1], 'f'}; + ["command.name"] = { k, "s" }, + ["command.fn"] = { v[1], "f" }, } end end @@ -52,16 +52,12 @@ function configs.__newindex(t, config_name, config_def) local trigger if config.filetypes then - trigger = "FileType "..table.concat(config.filetypes, ',') + trigger = "FileType " .. table.concat(config.filetypes, ",") else trigger = "BufReadPost *" end if not (config.autostart == false) then - api.nvim_command(string.format( - "autocmd %s lua require'lspconfig'[%q].manager.try_add()" - , trigger - , config.name - )) + api.nvim_command(string.format("autocmd %s lua require'lspconfig'[%q].manager.try_add()", trigger, config.name)) end local get_root_dir = config.root_dir @@ -72,11 +68,13 @@ function configs.__newindex(t, config_name, config_def) vim.notify(string.format("Autostart for %s failed: matching root directory not detected.", config_name)) return end - api.nvim_command(string.format( - "autocmd %s lua require'lspconfig'[%q].manager.try_add_wrapper()" - , "BufReadPost " .. root_dir .. "/*" - , config.name - )) + api.nvim_command( + string.format( + "autocmd %s lua require'lspconfig'[%q].manager.try_add_wrapper()", + "BufReadPost " .. root_dir .. "/*", + config.name + ) + ) for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do local buf_dir = api.nvim_buf_get_name(bufnr) if buf_dir:sub(1, root_dir:len()) == root_dir then @@ -103,12 +101,12 @@ function configs.__newindex(t, config_name, config_def) local make_config = function(_root_dir) local new_config = vim.tbl_deep_extend("keep", vim.empty_dict(), config) - new_config = vim.tbl_deep_extend('keep', new_config, default_config) + new_config = vim.tbl_deep_extend("keep", new_config, default_config) new_config.capabilities = new_config.capabilities or lsp.protocol.make_client_capabilities() - new_config.capabilities = vim.tbl_deep_extend('keep', new_config.capabilities, { + new_config.capabilities = vim.tbl_deep_extend("keep", new_config.capabilities, { workspace = { - configuration = true; - } + configuration = true, + }, }) if config_def.on_new_config then @@ -120,12 +118,14 @@ function configs.__newindex(t, config_name, config_def) new_config.on_init = util.add_hook_after(new_config.on_init, function(client, _result) function client.workspace_did_change_configuration(settings) - if not settings then return end + if not settings then + return + end if vim.tbl_isempty(settings) then - settings = {[vim.type_idx]=vim.types.dictionary} + settings = { [vim.type_idx] = vim.types.dictionary } end - return client.notify('workspace/didChangeConfiguration', { - settings = settings; + return client.notify("workspace/didChangeConfiguration", { + settings = settings, }) end if not vim.tbl_isempty(new_config.settings) then @@ -139,13 +139,15 @@ function configs.__newindex(t, config_name, config_def) if bufnr == api.nvim_get_current_buf() then M._setup_buffer(client.id, bufnr) else - api.nvim_command(string.format( - "autocmd BufEnter <buffer=%d> ++once lua require'lspconfig'[%q]._setup_buffer(%d,%d)" - , bufnr - , config_name - , client.id - , bufnr - )) + api.nvim_command( + string.format( + "autocmd BufEnter <buffer=%d> ++once lua require'lspconfig'[%q]._setup_buffer(%d,%d)", + bufnr, + config_name, + client.id, + bufnr + ) + ) end end) @@ -159,7 +161,7 @@ function configs.__newindex(t, config_name, config_def) function manager.try_add(bufnr) bufnr = bufnr or api.nvim_get_current_buf() - if vim.api.nvim_buf_get_option(bufnr, 'filetype') == 'nofile' then + if vim.api.nvim_buf_get_option(bufnr, "filetype") == "nofile" then return end local root_dir = get_root_dir(api.nvim_buf_get_name(bufnr), bufnr) @@ -170,7 +172,7 @@ function configs.__newindex(t, config_name, config_def) end function manager.try_add_wrapper(bufnr) - local buftype = vim.api.nvim_buf_get_option(bufnr, 'filetype') + local buftype = vim.api.nvim_buf_get_option(bufnr, "filetype") for _, filetype in ipairs(config.filetypes) do if buftype == filetype then manager.try_add(bufnr) diff --git a/lua/lspconfig/crystalline.lua b/lua/lspconfig/crystalline.lua index acd0d8fd..15bb17a7 100644 --- a/lua/lspconfig/crystalline.lua +++ b/lua/lspconfig/crystalline.lua @@ -1,24 +1,22 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" configs.crystalline = { default_config = { - cmd = {'crystalline'}, - filetypes = {'crystal'}, + cmd = { "crystalline" }, + filetypes = { "crystal" }, root_dir = function(fname) - return util.root_pattern('shard.yml')(fname) or - util.find_git_ancestor(fname) or - util.path.dirname(fname) - end + return util.root_pattern "shard.yml"(fname) or util.find_git_ancestor(fname) or util.path.dirname(fname) + end, }, docs = { - description = [[ + description = [[ https://github.com/elbywan/crystalline Crystal language server. ]], - default_config = { - root_dir = [[root_pattern('shard.yml', '.git') or dirname]] - } - } + default_config = { + root_dir = [[root_pattern('shard.yml', '.git') or dirname]], + }, + }, } diff --git a/lua/lspconfig/cssls.lua b/lua/lspconfig/cssls.lua index 5f1bf173..bb189111 100644 --- a/lua/lspconfig/cssls.lua +++ b/lua/lspconfig/cssls.lua @@ -1,24 +1,24 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "cssls" local bin_name = "vscode-css-language-server" -local root_pattern = util.root_pattern("package.json") +local root_pattern = util.root_pattern "package.json" configs[server_name] = { default_config = { - cmd = {bin_name, "--stdio"}; - filetypes = {"css", "scss", "less"}; + cmd = { bin_name, "--stdio" }, + filetypes = { "css", "scss", "less" }, root_dir = function(fname) return root_pattern(fname) or vim.loop.os_homedir() - end; + end, settings = { css = { validate = true }, scss = { validate = true }, - less = { validate = true } - }; - }; + less = { validate = true }, + }, + }, docs = { description = [[ @@ -41,11 +41,11 @@ require'lspconfig'.cssls.setup { capabilities = capabilities, } ``` -]]; +]], default_config = { - root_dir = [[root_pattern("package.json")]]; - }; - }; + root_dir = [[root_pattern("package.json")]], + }, + }, } -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/dartls.lua b/lua/lspconfig/dartls.lua index d7ca9458..e7da8665 100644 --- a/lua/lspconfig/dartls.lua +++ b/lua/lspconfig/dartls.lua @@ -1,26 +1,26 @@ -local util = require 'lspconfig/util' -local configs = require 'lspconfig/configs' +local util = require "lspconfig/util" +local configs = require "lspconfig/configs" local server_name = "dartls" local bin_name = "dart" local find_dart_sdk_root_path = function() - if vim.fn["executable"]("flutter") == 1 then - local flutter_path = vim.fn["resolve"](vim.fn["exepath"]("flutter")) + if vim.fn["executable"] "flutter" == 1 then + local flutter_path = vim.fn["resolve"](vim.fn["exepath"] "flutter") local flutter_bin = vim.fn["fnamemodify"](flutter_path, ":h") - return flutter_bin.."/cache/dart-sdk/bin/dart" - elseif vim.fn["executable"]("dart") == 1 then - return vim.fn["resolve"](vim.fn["exepath"]("dart")) + return flutter_bin .. "/cache/dart-sdk/bin/dart" + elseif vim.fn["executable"] "dart" == 1 then + return vim.fn["resolve"](vim.fn["exepath"] "dart") else - return '' + return "" end end local analysis_server_snapshot_path = function() local dart_sdk_root_path = vim.fn["fnamemodify"](find_dart_sdk_root_path(), ":h") - local snapshot = dart_sdk_root_path.."/snapshots/analysis_server.dart.snapshot" + local snapshot = dart_sdk_root_path .. "/snapshots/analysis_server.dart.snapshot" - if vim.fn["has"]("win32") == 1 or vim.fn["has"]("win64") == 1 then + if vim.fn["has"] "win32" == 1 or vim.fn["has"] "win64" == 1 then snapshot = snapshot:gsub("/", "\\") end @@ -29,27 +29,27 @@ end configs[server_name] = { default_config = { - cmd = {bin_name, analysis_server_snapshot_path(), "--lsp"}; - filetypes = {"dart"}; - root_dir = util.root_pattern("pubspec.yaml"); + cmd = { bin_name, analysis_server_snapshot_path(), "--lsp" }, + filetypes = { "dart" }, + root_dir = util.root_pattern "pubspec.yaml", init_options = { onlyAnalyzeProjectsWithOpenFiles = false, suggestFromUnimportedLibraries = true, closingLabels = false, outline = false, - flutterOutline = false - }; - }; + flutterOutline = false, + }, + }, docs = { - package_json = "https://raw.githubusercontent.com/Dart-Code/Dart-Code/master/package.json"; + package_json = "https://raw.githubusercontent.com/Dart-Code/Dart-Code/master/package.json", description = [[ https://github.com/dart-lang/sdk/tree/master/pkg/analysis_server/tool/lsp_spec Language server for dart. -]]; +]], default_config = { - root_dir = [[root_pattern("pubspec.yaml")]]; - }; - }; -}; + root_dir = [[root_pattern("pubspec.yaml")]], + }, + }, +} -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/denols.lua b/lua/lspconfig/denols.lua index df8214b6..2f74f38c 100644 --- a/lua/lspconfig/denols.lua +++ b/lua/lspconfig/denols.lua @@ -1,5 +1,5 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local lsp = vim.lsp local server_name = "denols" @@ -27,19 +27,25 @@ local function buf_cache(bufnr) params["referrer"] = { uri = vim.uri_from_bufnr(bufnr) } params["uris"] = {} lsp.buf_request(bufnr, "deno/cache", params, function(err) - if err then error(tostring(err)) end + if err then + error(tostring(err)) + end end) end local function virtual_text_document_handler(uri, result) - if not result then return nil end + if not result then + return nil + end for client_id, res in pairs(result) do local lines = vim.split(res.result, "\n") local bufnr = vim.uri_to_bufnr(deno_uri_to_uri(uri)) local current_buf = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false) - if #current_buf ~= 0 then return nil end + if #current_buf ~= 0 then + return nil + end vim.api.nvim_buf_set_lines(bufnr, 0, -1, nil, lines) vim.api.nvim_buf_set_option(bufnr, "readonly", true) @@ -60,14 +66,16 @@ local function virtual_text_document(uri) end local function denols_handler(err, method, result) - if not result or vim.tbl_isempty(result) then return nil end + if not result or vim.tbl_isempty(result) then + return nil + end for _, res in pairs(result) do local uri = res.uri or res.targetUri if string.sub(uri, 1, 6) == "deno:/" then virtual_text_document(uri) - res['uri'] = deno_uri_to_uri(uri) - res['targetUri'] = deno_uri_to_uri(uri) + res["uri"] = deno_uri_to_uri(uri) + res["targetUri"] = deno_uri_to_uri(uri) end end @@ -81,59 +89,59 @@ local function denols_definition() end local function denols_references(context) - vim.validate { context = { context, 't', true } } + vim.validate { context = { context, "t", true } } local params = lsp.util.make_position_params() params.context = context or { - includeDeclaration = true; + includeDeclaration = true, } params[vim.type_idx] = vim.types.dictionary params.textDocument.uri = uri_to_deno_uri(params.textDocument.uri) - lsp.buf_request(0, 'textDocument/references', params) + lsp.buf_request(0, "textDocument/references", params) end configs[server_name] = { default_config = { - cmd = {"deno", "lsp"}; - filetypes = {"javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx"}; - root_dir = util.root_pattern("package.json", "tsconfig.json", ".git"); + cmd = { "deno", "lsp" }, + filetypes = { "javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx" }, + root_dir = util.root_pattern("package.json", "tsconfig.json", ".git"), init_options = { - enable = true; - lint = false; - unstable = false; - }; + enable = true, + lint = false, + unstable = false, + }, handlers = { - ["textDocument/definition"] = denols_handler; - ["textDocument/references"] = denols_handler; - }; - }; + ["textDocument/definition"] = denols_handler, + ["textDocument/references"] = denols_handler, + }, + }, commands = { DenolsDefinition = { - denols_definition; - description = "Jump to definition. This handle deno:/ schema in deno:// buffer." - }; + denols_definition, + description = "Jump to definition. This handle deno:/ schema in deno:// buffer.", + }, DenolsReferences = { function() - denols_references({ includeDeclaration = true }) - end; - description = "List references. This handle deno:/ schema in deno:// buffer." - }; + denols_references { includeDeclaration = true } + end, + description = "List references. This handle deno:/ schema in deno:// buffer.", + }, DenolsCache = { function() buf_cache(0) - end; - description = "Cache a module and all of its dependencies." - }; - }; + end, + description = "Cache a module and all of its dependencies.", + }, + }, docs = { description = [[ https://github.com/denoland/deno Deno's built-in language server -]]; +]], default_config = { - root_dir = [[root_pattern("package.json", "tsconfig.json", ".git")]]; - }; - }; + root_dir = [[root_pattern("package.json", "tsconfig.json", ".git")]], + }, + }, } configs.denols.definition = denols_definition diff --git a/lua/lspconfig/dhall_lsp_server.lua b/lua/lspconfig/dhall_lsp_server.lua index 5e74d139..a2c5b1b2 100644 --- a/lua/lspconfig/dhall_lsp_server.lua +++ b/lua/lspconfig/dhall_lsp_server.lua @@ -1,11 +1,11 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" -configs.dhall_lsp_server ={ +configs.dhall_lsp_server = { default_config = { - cmd = {"dhall-lsp-server"}; - filetypes = {"dhall"}; - root_dir = util.root_pattern(".git", vim.fn.getcwd()); + cmd = { "dhall-lsp-server" }, + filetypes = { "dhall" }, + root_dir = util.root_pattern(".git", vim.fn.getcwd()), docs = { description = [[ https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-lsp-server @@ -17,10 +17,10 @@ language server for dhall cabal install dhall-lsp-server ``` prebuilt binaries can be found [here](https://github.com/dhall-lang/dhall-haskell/releases). -]]; +]], default_config = { - root_dir = [[root_pattern(".git", vim.fn.getcwd())]]; - }; - } - } + root_dir = [[root_pattern(".git", vim.fn.getcwd())]], + }, + }, + }, } diff --git a/lua/lspconfig/diagnosticls.lua b/lua/lspconfig/diagnosticls.lua index b82a5f90..6b865ba0 100644 --- a/lua/lspconfig/diagnosticls.lua +++ b/lua/lspconfig/diagnosticls.lua @@ -1,12 +1,12 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "diagnosticls" local bin_name = "diagnostic-languageserver" configs[server_name] = { default_config = { - cmd = {bin_name, "--stdio"}, + cmd = { bin_name, "--stdio" }, filetypes = {}, root_dir = util.path.dirname, }, @@ -15,11 +15,11 @@ configs[server_name] = { https://github.com/iamcco/diagnostic-languageserver Diagnostic language server integrate with linters. -]]; +]], default_config = { filetypes = "Empty by default, override to add filetypes", - root_dir = "Vim's starting directory"; - init_options = "Configuration from https://github.com/iamcco/diagnostic-languageserver#config--document"; - }; - }; + root_dir = "Vim's starting directory", + init_options = "Configuration from https://github.com/iamcco/diagnostic-languageserver#config--document", + }, + }, } diff --git a/lua/lspconfig/dockerls.lua b/lua/lspconfig/dockerls.lua index feb5e105..dcf80b90 100644 --- a/lua/lspconfig/dockerls.lua +++ b/lua/lspconfig/dockerls.lua @@ -1,15 +1,15 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "dockerls" local bin_name = "docker-langserver" configs[server_name] = { default_config = { - cmd = {bin_name, "--stdio"}; - filetypes = {"Dockerfile", "dockerfile"}; - root_dir = util.root_pattern("Dockerfile"); - }; + cmd = { bin_name, "--stdio" }, + filetypes = { "Dockerfile", "dockerfile" }, + root_dir = util.root_pattern "Dockerfile", + }, docs = { description = [[ https://github.com/rcjsuen/dockerfile-language-server-nodejs @@ -18,11 +18,11 @@ https://github.com/rcjsuen/dockerfile-language-server-nodejs ```sh npm install -g dockerfile-language-server-nodejs ``` - ]]; + ]], default_config = { - root_dir = [[root_pattern("Dockerfile")]]; - }; - }; -}; + root_dir = [[root_pattern("Dockerfile")]], + }, + }, +} -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/dotls.lua b/lua/lspconfig/dotls.lua index 0aa198e4..90ddde7e 100644 --- a/lua/lspconfig/dotls.lua +++ b/lua/lspconfig/dotls.lua @@ -1,22 +1,21 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "dotls" local bin_name = "dot-language-server" local root_files = { - '.git', + ".git", } configs[server_name] = { default_config = { - cmd = {bin_name, "--stdio"}; - filetypes = {"dot"}; + cmd = { bin_name, "--stdio" }, + filetypes = { "dot" }, root_dir = function(filename) - return util.root_pattern(unpack(root_files))(filename) or - util.path.dirname(filename) - end; - }; + return util.root_pattern(unpack(root_files))(filename) or util.path.dirname(filename) + end, + }, docs = { description = [[ https://github.com/nikeee/dot-language-server @@ -25,8 +24,8 @@ https://github.com/nikeee/dot-language-server ```sh npm install -g dot-language-server ``` - ]]; - }; -}; + ]], + }, +} -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/efm.lua b/lua/lspconfig/efm.lua index 97ce744f..cde64424 100644 --- a/lua/lspconfig/efm.lua +++ b/lua/lspconfig/efm.lua @@ -1,27 +1,26 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "efm" local bin_name = "efm-langserver" - configs[server_name] = { default_config = { - cmd = {bin_name}; + cmd = { bin_name }, root_dir = function(fname) - return util.root_pattern(".git")(fname) or util.path.dirname(fname) - end; - }; + return util.root_pattern ".git"(fname) or util.path.dirname(fname) + end, + }, docs = { description = [[ https://github.com/mattn/efm-langserver General purpose Language Server that can use specified error message format generated from specified command. -]]; +]], default_config = { - root_dir = [[util.root_pattern(".git")(fname) or util.path.dirname(fname)]]; - }; - }; + root_dir = [[util.root_pattern(".git")(fname) or util.path.dirname(fname)]], + }, + }, } -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/elixirls.lua b/lua/lspconfig/elixirls.lua index 950608a4..6aab6ab4 100644 --- a/lua/lspconfig/elixirls.lua +++ b/lua/lspconfig/elixirls.lua @@ -1,17 +1,17 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "elixirls" configs[server_name] = { default_config = { - filetypes = {"elixir", "eelixir"}; + filetypes = { "elixir", "eelixir" }, root_dir = function(fname) - return util.root_pattern("mix.exs", ".git")(fname) or vim.loop.os_homedir() - end; - }; - docs = { - package_json = "https://raw.githubusercontent.com/JakeBecker/vscode-elixir-ls/master/package.json"; - description = [[ + return util.root_pattern("mix.exs", ".git")(fname) or vim.loop.os_homedir() + end, + }, + docs = { + package_json = "https://raw.githubusercontent.com/JakeBecker/vscode-elixir-ls/master/package.json", + description = [[ https://github.com/elixir-lsp/elixir-ls `elixir-ls` can be installed by following the instructions [here](https://github.com/elixir-lsp/elixir-ls#building-and-running). @@ -34,11 +34,11 @@ require'lspconfig'.elixirls.setup{ ... } ``` -]]; - default_config = { - root_dir = [[root_pattern("mix.exs", ".git") or vim.loop.os_homedir()]]; - }; - }; +]], + default_config = { + root_dir = [[root_pattern("mix.exs", ".git") or vim.loop.os_homedir()]], + }, + }, } -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/elmls.lua b/lua/lspconfig/elmls.lua index 9e692353..415d5eb3 100644 --- a/lua/lspconfig/elmls.lua +++ b/lua/lspconfig/elmls.lua @@ -1,5 +1,5 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local lsp = vim.lsp local api = vim.api @@ -7,29 +7,29 @@ local server_name = "elmls" local bin_name = "elm-language-server" local default_capabilities = lsp.protocol.make_client_capabilities() -default_capabilities.offsetEncoding = {"utf-8", "utf-16"} -local elm_root_pattern = util.root_pattern("elm.json") +default_capabilities.offsetEncoding = { "utf-8", "utf-16" } +local elm_root_pattern = util.root_pattern "elm.json" configs[server_name] = { default_config = { - cmd = {bin_name}; + cmd = { bin_name }, -- TODO(ashkan) if we comment this out, it will allow elmls to operate on elm.json. It seems like it could do that, but no other editor allows it right now. - filetypes = {"elm"}; + filetypes = { "elm" }, root_dir = function(fname) - local filetype = api.nvim_buf_get_option(0, 'filetype') - if filetype == 'elm' or (filetype == 'json' and fname:match("elm%.json$")) then + local filetype = api.nvim_buf_get_option(0, "filetype") + if filetype == "elm" or (filetype == "json" and fname:match "elm%.json$") then return elm_root_pattern(fname) end - end; + end, init_options = { elmPath = "elm", elmFormatPath = "elm-format", elmTestPath = "elm-test", elmAnalyseTrigger = "change", - }; - }; + }, + }, docs = { - package_json = "https://raw.githubusercontent.com/elm-tooling/elm-language-client-vscode/master/package.json"; + package_json = "https://raw.githubusercontent.com/elm-tooling/elm-language-client-vscode/master/package.json", description = [[ https://github.com/elm-tooling/elm-language-server#installation @@ -37,12 +37,11 @@ If you don't want to use Nvim to install it, then you can use: ```sh npm install -g elm elm-test elm-format @elm-tooling/elm-language-server ``` -]]; +]], default_config = { - root_dir = [[root_pattern("elm.json")]]; - }; - }; + root_dir = [[root_pattern("elm.json")]], + }, + }, } -- vim:et ts=2 sw=2 - diff --git a/lua/lspconfig/erlangls.lua b/lua/lspconfig/erlangls.lua index 8e7a6e8b..d8e3703e 100644 --- a/lua/lspconfig/erlangls.lua +++ b/lua/lspconfig/erlangls.lua @@ -1,15 +1,14 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' - +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" configs.erlangls = { default_config = { - cmd = { "erlang_ls" }; - filetypes = { "erlang" }; + cmd = { "erlang_ls" }, + filetypes = { "erlang" }, root_dir = function(fname) return util.root_pattern("rebar.config", "erlang.mk", ".git")(fname) or util.path.dirname(fname) - end; - }; + end, + }, docs = { description = [[ https://erlang-ls.github.io @@ -24,9 +23,9 @@ Installation instruction can be found [here](https://github.com/erlang-ls/erlang Installation requirements: - [Erlang OTP 21+](https://github.com/erlang/otp) - [rebar3 3.9.1+](https://github.com/erlang/rebar3) -]]; +]], default_config = { - root_dir = [[root_pattern('rebar.config', 'erlang.mk', '.git') or util.path.dirname(fname)]] - } - }; + root_dir = [[root_pattern('rebar.config', 'erlang.mk', '.git') or util.path.dirname(fname)]], + }, + }, } diff --git a/lua/lspconfig/flow.lua b/lua/lspconfig/flow.lua index 5e0abab3..de2b7984 100644 --- a/lua/lspconfig/flow.lua +++ b/lua/lspconfig/flow.lua @@ -1,14 +1,14 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" configs.flow = { default_config = { - cmd = {"npx", "--no-install", "flow","lsp"}; - filetypes = {"javascript", "javascriptreact", "javascript.jsx"}; - root_dir = util.root_pattern(".flowconfig"); - }; + cmd = { "npx", "--no-install", "flow", "lsp" }, + filetypes = { "javascript", "javascriptreact", "javascript.jsx" }, + root_dir = util.root_pattern ".flowconfig", + }, docs = { - package_json = "https://raw.githubusercontent.com/flowtype/flow-for-vscode/master/package.json"; + package_json = "https://raw.githubusercontent.com/flowtype/flow-for-vscode/master/package.json", description = [[ https://flow.org/ https://github.com/facebook/flow @@ -21,10 +21,10 @@ See below for lsp command options. ```sh npx flow lsp --help ``` - ]]; + ]], default_config = { - root_dir = [[root_pattern(".flowconfig")]]; - }; - }; -}; + root_dir = [[root_pattern(".flowconfig")]], + }, + }, +} -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/fortls.lua b/lua/lspconfig/fortls.lua index 7a66c703..ad9725c4 100644 --- a/lua/lspconfig/fortls.lua +++ b/lua/lspconfig/fortls.lua @@ -1,25 +1,25 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" configs.fortls = { default_config = { - cmd = {"fortls"}; - filetypes = {"fortran"}; - root_dir = util.root_pattern(".fortls"); + cmd = { "fortls" }, + filetypes = { "fortran" }, + root_dir = util.root_pattern ".fortls", settings = { nthreads = 1, - }; - }; + }, + }, docs = { - package_json = "https://raw.githubusercontent.com/hansec/vscode-fortran-ls/master/package.json"; + package_json = "https://raw.githubusercontent.com/hansec/vscode-fortran-ls/master/package.json", description = [[ https://github.com/hansec/fortran-language-server Fortran Language Server for the Language Server Protocol - ]]; + ]], default_config = { - root_dir = [[root_pattern(".fortls")]]; - }; - }; -}; + root_dir = [[root_pattern(".fortls")]], + }, + }, +} -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/fsautocomplete.lua b/lua/lspconfig/fsautocomplete.lua index 35d04986..57dcfdcb 100644 --- a/lua/lspconfig/fsautocomplete.lua +++ b/lua/lspconfig/fsautocomplete.lua @@ -1,17 +1,17 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "fsautocomplete" configs[server_name] = { default_config = { - cmd = {'dotnet', 'fsautocomplete', '--background-service-enabled'}; - root_dir = util.root_pattern('*.sln', '*.fsproj', '.git'); - filetypes = {'fsharp'}; + cmd = { "dotnet", "fsautocomplete", "--background-service-enabled" }, + root_dir = util.root_pattern("*.sln", "*.fsproj", ".git"), + filetypes = { "fsharp" }, init_options = { - AutomaticWorkspaceInit = true; - }; - }; + AutomaticWorkspaceInit = true, + }, + }, docs = { description = [[ https://github.com/fsharp/FsAutoComplete @@ -30,7 +30,7 @@ You may also need to configure the filetype as Vim defaults to Forth for `*.fs` This is automatically done by plugins such as [PhilT/vim-fsharp](https://github.com/PhilT/vim-fsharp), [fsharp/vim-fsharp](https://github.com/fsharp/vim-fsharp), and [adelarsq/neofsharp.vim](https://github.com/adelarsq/neofsharp.vim). - ]]; - }; + ]], + }, } -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/gdscript.lua b/lua/lspconfig/gdscript.lua index 2fe0699f..3e0ea264 100644 --- a/lua/lspconfig/gdscript.lua +++ b/lua/lspconfig/gdscript.lua @@ -1,22 +1,22 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" configs.gdscript = { default_config = { - cmd = {"nc", "localhost", "6008"}; - filetypes = {"gd", "gdscript", "gdscript3"}; - root_dir = util.root_pattern("project.godot", ".git"); - }; + cmd = { "nc", "localhost", "6008" }, + filetypes = { "gd", "gdscript", "gdscript3" }, + root_dir = util.root_pattern("project.godot", ".git"), + }, docs = { description = [[ https://github.com/godotengine/godot Language server for GDScript, used by Godot Engine. -]]; +]], default_config = { - root_dir = [[util.root_pattern("project.godot", ".git")]]; - }; - }; -}; + root_dir = [[util.root_pattern("project.godot", ".git")]], + }, + }, +} -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/ghcide.lua b/lua/lspconfig/ghcide.lua index ddbcdd04..376543f2 100644 --- a/lua/lspconfig/ghcide.lua +++ b/lua/lspconfig/ghcide.lua @@ -1,12 +1,12 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" configs.ghcide = { default_config = { - cmd = { "ghcide", "--lsp" }; - filetypes = { "haskell", "lhaskell" }; - root_dir = util.root_pattern("stack.yaml", "hie-bios", "BUILD.bazel", "cabal.config", "package.yaml"); - }; + cmd = { "ghcide", "--lsp" }, + filetypes = { "haskell", "lhaskell" }, + root_dir = util.root_pattern("stack.yaml", "hie-bios", "BUILD.bazel", "cabal.config", "package.yaml"), + }, docs = { description = [[ @@ -14,10 +14,10 @@ https://github.com/digital-asset/ghcide A library for building Haskell IDE tooling. "ghcide" isn't for end users now. Use "haskell-language-server" instead of "ghcide". -]]; +]], default_config = { - root_dir = [[root_pattern("stack.yaml", "hie-bios", "BUILD.bazel", "cabal.config", "package.yaml")]]; - }; - }; -}; + root_dir = [[root_pattern("stack.yaml", "hie-bios", "BUILD.bazel", "cabal.config", "package.yaml")]], + }, + }, +} -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/gopls.lua b/lua/lspconfig/gopls.lua index 08eacc15..9c9c2bbb 100644 --- a/lua/lspconfig/gopls.lua +++ b/lua/lspconfig/gopls.lua @@ -1,12 +1,12 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" configs.gopls = { default_config = { - cmd = {"gopls"}; - filetypes = {"go", "gomod"}; - root_dir = util.root_pattern("go.mod", ".git"); - }; + cmd = { "gopls" }, + filetypes = { "go", "gomod" }, + root_dir = util.root_pattern("go.mod", ".git"), + }, -- on_new_config = function(new_config) end; -- on_attach = function(client, bufnr) end; docs = { @@ -14,10 +14,10 @@ configs.gopls = { https://github.com/golang/tools/tree/master/gopls Google's lsp server for golang. -]]; +]], default_config = { - root_dir = [[root_pattern("go.mod", ".git")]]; - }; - }; + root_dir = [[root_pattern("go.mod", ".git")]], + }, + }, } -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/graphql.lua b/lua/lspconfig/graphql.lua index 55b3445b..aa84413d 100644 --- a/lua/lspconfig/graphql.lua +++ b/lua/lspconfig/graphql.lua @@ -1,14 +1,14 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" -local server_name = 'graphql' -local bin_name = 'graphql-lsp' +local server_name = "graphql" +local bin_name = "graphql-lsp" configs[server_name] = { default_config = { - cmd = {bin_name, 'server', '-m', 'stream'}, - filetypes = {'graphql'}, - root_dir = util.root_pattern('.git', '.graphqlrc'), + cmd = { bin_name, "server", "-m", "stream" }, + filetypes = { "graphql" }, + root_dir = util.root_pattern(".git", ".graphqlrc"), }, docs = { diff --git a/lua/lspconfig/groovyls.lua b/lua/lspconfig/groovyls.lua index 34e913cf..329fb36a 100644 --- a/lua/lspconfig/groovyls.lua +++ b/lua/lspconfig/groovyls.lua @@ -1,5 +1,5 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local name = "groovyls" local bin_name = "groovy-language-server-all.jar" @@ -7,11 +7,13 @@ local bin_name = "groovy-language-server-all.jar" configs[name] = { default_config = { cmd = { - "java", "-jar", bin_name + "java", + "-jar", + bin_name, }, - filetypes = {"groovy"}; - root_dir = util.root_pattern(".git") or vim.loop.os_homedir(); - }; + filetypes = { "groovy" }, + root_dir = util.root_pattern ".git" or vim.loop.os_homedir(), + }, docs = { description = [[ https://github.com/prominic/groovy-language-server.git @@ -31,15 +33,17 @@ require'lspconfig'.groovyls.setup{ ... } ``` -]]; +]], default_config = { cmd = { - "java", "-jar", bin_name + "java", + "-jar", + bin_name, }, - filetypes = {"groovy"}; - root_dir = [[root_pattern(".git") or vim.loop.os_homedir()]]; - }; - }; + filetypes = { "groovy" }, + root_dir = [[root_pattern(".git") or vim.loop.os_homedir()]], + }, + }, } -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/haxe_language_server.lua b/lua/lspconfig/haxe_language_server.lua index 8660ea1e..24d1cd73 100644 --- a/lua/lspconfig/haxe_language_server.lua +++ b/lua/lspconfig/haxe_language_server.lua @@ -1,20 +1,20 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" configs.haxe_language_server = { default_config = { - cmd = {"haxe-language-server"}; - filetypes = {"haxe"}; - root_dir = util.root_pattern("*.hxml"); + cmd = { "haxe-language-server" }, + filetypes = { "haxe" }, + root_dir = util.root_pattern "*.hxml", settings = { haxe = { - executable = "haxe"; - }; - }; + executable = "haxe", + }, + }, init_options = { - displayArguments = {"build.hxml"}; - }; - }; + displayArguments = { "build.hxml" }, + }, + }, docs = { description = [[ https://github.com/vshaxe/haxe-language-server @@ -42,7 +42,7 @@ your project's root directory. If your file is named something different, specify it using the `init_options.displayArguments` setting. ]], default_config = { - root_dir = [[root_pattern("*.hxml")]]; - }; - } + root_dir = [[root_pattern("*.hxml")]], + }, + }, } diff --git a/lua/lspconfig/health.lua b/lua/lspconfig/health.lua index ae7bfac3..a9666b6e 100644 --- a/lua/lspconfig/health.lua +++ b/lua/lspconfig/health.lua @@ -1,21 +1,21 @@ local M = {} function M.check_health() - local configs = require 'lspconfig/configs' + local configs = require "lspconfig/configs" for _, top_level_config in pairs(configs) do -- Only check configs that have a make_config function. if not (top_level_config.make_config == nil) then -- the folder needs to exist - local config = top_level_config.make_config(".") + local config = top_level_config.make_config "." local status, cmd = pcall(vim.lsp._cmd_parts, config.cmd) if not status then - vim.fn['health#report_error'](string.format("%s: config.cmd error, %s", config.name, cmd)) + vim.fn["health#report_error"](string.format("%s: config.cmd error, %s", config.name, cmd)) else if not (vim.fn.executable(cmd) == 1) then - vim.fn['health#report_error'](string.format("%s: The given command %q is not executable.", config.name, cmd)) + vim.fn["health#report_error"](string.format("%s: The given command %q is not executable.", config.name, cmd)) else - vim.fn['health#report_info'](string.format("%s: configuration checked.", config.name)) + vim.fn["health#report_info"](string.format("%s: configuration checked.", config.name)) end end end diff --git a/lua/lspconfig/hie.lua b/lua/lspconfig/hie.lua index f57326dc..4efff0f1 100644 --- a/lua/lspconfig/hie.lua +++ b/lua/lspconfig/hie.lua @@ -1,15 +1,15 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" configs.hie = { default_config = { - cmd = {"hie-wrapper", "--lsp"}; - filetypes = {"haskell"}; - root_dir = util.root_pattern("stack.yaml", "package.yaml", ".git"); - }; + cmd = { "hie-wrapper", "--lsp" }, + filetypes = { "haskell" }, + root_dir = util.root_pattern("stack.yaml", "package.yaml", ".git"), + }, docs = { - package_json = "https://raw.githubusercontent.com/alanz/vscode-hie-server/master/package.json"; + package_json = "https://raw.githubusercontent.com/alanz/vscode-hie-server/master/package.json", description = [[ https://github.com/haskell/haskell-ide-engine @@ -27,12 +27,12 @@ init_options = { } } ``` - ]]; + ]], default_config = { - root_dir = [[root_pattern("stack.yaml", "package.yaml", ".git")]]; - }; - }; -}; + root_dir = [[root_pattern("stack.yaml", "package.yaml", ".git")]], + }, + }, +} -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/hls.lua b/lua/lspconfig/hls.lua index 27bdac26..2a6ce5ee 100644 --- a/lua/lspconfig/hls.lua +++ b/lua/lspconfig/hls.lua @@ -1,36 +1,36 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" configs.hls = { default_config = { - cmd = {"haskell-language-server-wrapper", "--lsp"}; - filetypes = {"haskell", "lhaskell"}; - root_dir = util.root_pattern("*.cabal", "stack.yaml", "cabal.project", "package.yaml", "hie.yaml"); + cmd = { "haskell-language-server-wrapper", "--lsp" }, + filetypes = { "haskell", "lhaskell" }, + root_dir = util.root_pattern("*.cabal", "stack.yaml", "cabal.project", "package.yaml", "hie.yaml"), settings = { languageServerHaskell = { - formattingProvider = "ormolu"; - }; - }; - lspinfo = function (cfg) + formattingProvider = "ormolu", + }, + }, + lspinfo = function(cfg) -- return "specific" if cfg.settings.languageServerHaskell.logFile or false then - return "logfile: "..cfg.settings.languageServerHaskell.logFile + return "logfile: " .. cfg.settings.languageServerHaskell.logFile end return "" - end; - }; + end, + }, docs = { description = [[ https://github.com/haskell/haskell-language-server Haskell Language Server - ]]; + ]], default_config = { - root_dir = [[root_pattern("*.cabal", "stack.yaml", "cabal.project", "package.yaml", "hie.yaml")]]; - }; - }; -}; + root_dir = [[root_pattern("*.cabal", "stack.yaml", "cabal.project", "package.yaml", "hie.yaml")]], + }, + }, +} -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/html.lua b/lua/lspconfig/html.lua index e69b8a2a..095d70bf 100644 --- a/lua/lspconfig/html.lua +++ b/lua/lspconfig/html.lua @@ -1,25 +1,24 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "html" local bin_name = "vscode-html-language-server" -local root_pattern = util.root_pattern("package.json") +local root_pattern = util.root_pattern "package.json" configs[server_name] = { default_config = { - cmd = {bin_name, "--stdio"}; - filetypes = {"html"}; + cmd = { bin_name, "--stdio" }, + filetypes = { "html" }, root_dir = function(fname) return root_pattern(fname) or vim.loop.os_homedir() - end; - settings = {}; + end, + settings = {}, init_options = { - embeddedLanguages = { css= true, javascript= true }, - configurationSection = { 'html', 'css', 'javascript' }, - } - - }; + embeddedLanguages = { css = true, javascript = true }, + configurationSection = { "html", "css", "javascript" }, + }, + }, docs = { description = [[ https://github.com/hrsh7th/vscode-langservers-extracted @@ -41,8 +40,8 @@ require'lspconfig'.html.setup { capabilities = capabilities, } ``` -]]; - }; +]], + }, } -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/intelephense.lua b/lua/lspconfig/intelephense.lua index 08861d5d..2b358c78 100644 --- a/lua/lspconfig/intelephense.lua +++ b/lua/lspconfig/intelephense.lua @@ -1,21 +1,21 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "intelephense" local bin_name = "intelephense" configs[server_name] = { default_config = { - cmd = {bin_name, "--stdio"}; - filetypes = {"php"}; - root_dir = function (pattern) - local cwd = vim.loop.cwd(); - local root = util.root_pattern("composer.json", ".git")(pattern); + cmd = { bin_name, "--stdio" }, + filetypes = { "php" }, + root_dir = function(pattern) + local cwd = vim.loop.cwd() + local root = util.root_pattern("composer.json", ".git")(pattern) -- prefer cwd if root is a descendant - return util.path.is_descendant(cwd, root) and cwd or root; - end; - }; + return util.path.is_descendant(cwd, root) and cwd or root + end, + }, docs = { description = [[ https://intelephense.com/ @@ -24,16 +24,16 @@ https://intelephense.com/ ```sh npm install -g intelephense ``` -]]; +]], default_config = { - root_dir = [[root_pattern("composer.json", ".git")]]; + root_dir = [[root_pattern("composer.json", ".git")]], init_options = [[{ storagePath = Optional absolute path to storage dir. Defaults to os.tmpdir(). globalStoragePath = Optional absolute path to a global storage dir. Defaults to os.homedir(). licenceKey = Optional licence key or absolute path to a text file containing the licence key. clearCache = Optional flag to clear server state. State can also be cleared by deleting {storagePath}/intelephense -- See https://github.com/bmewburn/intelephense-docs#initialisation-options - }]]; + }]], settings = [[{ intelephense = { files = { @@ -41,9 +41,9 @@ npm install -g intelephense }; }; -- See https://github.com/bmewburn/intelephense-docs#configuration-options - }]]; - }; - }; + }]], + }, + }, } -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/java_language_server.lua b/lua/lspconfig/java_language_server.lua index 261e96d5..b52b43df 100644 --- a/lua/lspconfig/java_language_server.lua +++ b/lua/lspconfig/java_language_server.lua @@ -1,15 +1,15 @@ -local lspconfig = require('lspconfig') -local configs = require('lspconfig/configs') +local lspconfig = require "lspconfig" +local configs = require "lspconfig/configs" -local name = 'java_language_server' +local name = "java_language_server" configs[name] = { default_config = { - cmd = {}; - filetypes = {'java'}; - root_dir = lspconfig.util.root_pattern('build.gradle', 'pom.xml', '.git'); - settings = {} - }; + cmd = {}, + filetypes = { "java" }, + root_dir = lspconfig.util.root_pattern("build.gradle", "pom.xml", ".git"), + settings = {}, + }, docs = { description = [[ https://github.com/georgewfraser/java-language-server @@ -17,6 +17,6 @@ https://github.com/georgewfraser/java-language-server Java language server Point `cmd` to `lang_server_linux.sh` or the equivalent script for macOS/Windows provided by java-language-server -]] - } +]], + }, } diff --git a/lua/lspconfig/jdtls.lua b/lua/lspconfig/jdtls.lua index 61eee49b..5ebf2ee8 100644 --- a/lua/lspconfig/jdtls.lua +++ b/lua/lspconfig/jdtls.lua @@ -1,12 +1,12 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' -local handlers = require 'vim.lsp.handlers' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" +local handlers = require "vim.lsp.handlers" local path = util.path local server_name = "jdtls" local cmd = { - util.path.join(tostring(vim.fn.getenv("JAVA_HOME")), "/bin/java"), + util.path.join(tostring(vim.fn.getenv "JAVA_HOME"), "/bin/java"), "-Declipse.application=org.eclipse.jdt.ls.core.id1", "-Dosgi.bundles.defaultStartLevel=4", "-Declipse.product=org.eclipse.jdt.ls.core.product", @@ -15,17 +15,16 @@ local cmd = { "-Xms1g", "-Xmx2G", "-jar", - tostring(vim.fn.getenv("JAR")), + tostring(vim.fn.getenv "JAR"), "-configuration", - tostring(vim.fn.getenv("JDTLS_CONFIG")), + tostring(vim.fn.getenv "JDTLS_CONFIG"), "-data", - tostring(vim.fn.getenv("WORKSPACE")), + tostring(vim.fn.getenv "WORKSPACE"), "--add-modules=ALL-SYSTEM", "--add-opens java.base/java.util=ALL-UNNAMED", "--add-opens java.base/java.lang=ALL-UNNAMED", } - --- The presence of one of these files indicates a root directory. -- -- We search for configuration files of the most common Java build systems. We @@ -34,16 +33,15 @@ local cmd = { local root_files = { -- Single-module projects { - 'build.xml', -- Ant - 'pom.xml', -- Maven - 'settings.gradle', -- Gradle - 'settings.gradle.kts', -- Gradle + "build.xml", -- Ant + "pom.xml", -- Maven + "settings.gradle", -- Gradle + "settings.gradle.kts", -- Gradle }, -- Multi-module projects - {'build.gradle', 'build.gradle.kts'}, + { "build.gradle", "build.gradle.kts" }, } - --- Callback function for the `language/status` notification. -- -- The server sends a non-standard notification when the status of the language @@ -51,9 +49,9 @@ local root_files = { -- starting up. local function on_language_status(_, _, result) local command = vim.api.nvim_command - command('echohl ModeMsg') + command "echohl ModeMsg" command(string.format('echo "%s"', result.message)) - command('echohl None') + command "echohl None" end -- If the text document version is 0, set it to nil instead so that Neovim @@ -75,22 +73,24 @@ configs[server_name] = { default_config = { cmd = cmd, cmd_env = { - JAR=vim.fn.getenv("JAR"), - GRADLE_HOME=vim.fn.getenv("GRADLE_HOME"), + JAR = vim.fn.getenv "JAR", + GRADLE_HOME = vim.fn.getenv "GRADLE_HOME", }, - filetypes = { "java" }; + filetypes = { "java" }, root_dir = function(fname) for _, patterns in ipairs(root_files) do local root = util.root_pattern(unpack(patterns))(fname) - if root then return root end + if root then + return root + end end return vim.fn.getcwd() - end; + end, init_options = { - workspace = path.join { vim.loop.os_homedir(), "workspace" }; - jvm_args = {}; - os_config = nil; - }; + workspace = path.join { vim.loop.os_homedir(), "workspace" }, + jvm_args = {}, + os_config = nil, + }, handlers = { -- Due to an invalid protocol implementation in the jdtls we have to -- conform these to be spec compliant. @@ -99,33 +99,33 @@ configs[server_name] = { -- CodeAction in org.eclipse.lsp4j -> https://github.com/eclipse/lsp4j/blob/master/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/CodeAction.java -- Command in LSP -> https://microsoft.github.io/language-server-protocol/specification#command -- CodeAction in LSP -> https://microsoft.github.io/language-server-protocol/specification#textDocument_codeAction - ['textDocument/codeAction'] = function(a, b, actions) - for _,action in ipairs(actions) do + ["textDocument/codeAction"] = function(a, b, actions) + for _, action in ipairs(actions) do -- TODO: (steelsojka) Handle more than one edit? -- if command is string, then 'ation' is Command in java format, -- then we add 'edit' property to change to CodeAction in LSP and 'edit' will be executed first - if action.command == 'java.apply.workspaceEdit' then + if action.command == "java.apply.workspaceEdit" then action.edit = fix_zero_version(action.edit or action.arguments[1]) - -- if command is table, then 'action' is CodeAction in java format - -- then we add 'edit' property to change to CodeAction in LSP and 'edit' will be executed first - elseif type(action.command) == 'table' and action.command.command == 'java.apply.workspaceEdit' then + -- if command is table, then 'action' is CodeAction in java format + -- then we add 'edit' property to change to CodeAction in LSP and 'edit' will be executed first + elseif type(action.command) == "table" and action.command.command == "java.apply.workspaceEdit" then action.edit = fix_zero_version(action.edit or action.command.arguments[1]) end end - handlers['textDocument/codeAction'](a, b, actions) - end; + handlers["textDocument/codeAction"](a, b, actions) + end, - ['textDocument/rename'] = function(a, b, workspace_edit) - handlers['textDocument/rename'](a, b, fix_zero_version(workspace_edit)) - end; + ["textDocument/rename"] = function(a, b, workspace_edit) + handlers["textDocument/rename"](a, b, fix_zero_version(workspace_edit)) + end, - ['workspace/applyEdit'] = function(a, b, workspace_edit) - handlers['workspace/applyEdit'](a, b, fix_zero_version(workspace_edit)) - end; + ["workspace/applyEdit"] = function(a, b, workspace_edit) + handlers["workspace/applyEdit"](a, b, fix_zero_version(workspace_edit)) + end, - ['language/status'] = vim.schedule_wrap(on_language_status) - }; - }; + ["language/status"] = vim.schedule_wrap(on_language_status), + }, + }, docs = { package_json = "https://raw.githubusercontent.com/redhat-developer/vscode-java/master/package.json", description = [[ @@ -146,9 +146,9 @@ export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:/bin/java::") export JDTLS_CONFIG=/path/to/eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/repository/config_linux export WORKSPACE=$HOME/workspace ``` - ]]; + ]], default_config = { - root_dir = [[root_pattern(".git")]]; - }; - }; + root_dir = [[root_pattern(".git")]], + }, + }, } diff --git a/lua/lspconfig/jedi_language_server.lua b/lua/lspconfig/jedi_language_server.lua index 5fd6cbfc..57ba99c5 100644 --- a/lua/lspconfig/jedi_language_server.lua +++ b/lua/lspconfig/jedi_language_server.lua @@ -1,22 +1,22 @@ -local configs = require 'lspconfig/configs' +local configs = require "lspconfig/configs" configs.jedi_language_server = { default_config = { - cmd = {"jedi-language-server"}; - filetypes = {"python"}; + cmd = { "jedi-language-server" }, + filetypes = { "python" }, root_dir = function(fname) return vim.fn.getcwd() - end; - }; + end, + }, docs = { description = [[ https://github.com/pappasam/jedi-language-server `jedi-language-server`, a language server for Python, built on top of jedi - ]]; + ]], default_config = { - root_dir = "vim's starting directory"; - }; - }; -}; + root_dir = "vim's starting directory", + }, + }, +} -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/jsonls.lua b/lua/lspconfig/jsonls.lua index cef595ce..20c2753b 100644 --- a/lua/lspconfig/jsonls.lua +++ b/lua/lspconfig/jsonls.lua @@ -1,21 +1,21 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "jsonls" local bin_name = "vscode-json-language-server" configs[server_name] = { default_config = { - cmd = {bin_name, "--stdio"}; - filetypes = {"json"}; + cmd = { bin_name, "--stdio" }, + filetypes = { "json" }, init_options = { - provideFormatter = true; - }; - root_dir = util.root_pattern(".git", vim.fn.getcwd()); - }; + provideFormatter = true, + }, + root_dir = util.root_pattern(".git", vim.fn.getcwd()), + }, docs = { -- this language server config is in VSCode built-in package.json - package_json = "https://raw.githubusercontent.com/microsoft/vscode/master/extensions/json-language-features/package.json"; + package_json = "https://raw.githubusercontent.com/microsoft/vscode/master/extensions/json-language-features/package.json", description = [[ https://github.com/hrsh7th/vscode-langservers-extracted @@ -39,11 +39,11 @@ require'lspconfig'.jsonls.setup { } } ``` -]]; +]], default_config = { - root_dir = [[root_pattern(".git", vim.fn.getcwd())]]; - }; - }; + root_dir = [[root_pattern(".git", vim.fn.getcwd())]], + }, + }, } -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/julials.lua b/lua/lspconfig/julials.lua index e10c282b..d6cc351c 100644 --- a/lua/lspconfig/julials.lua +++ b/lua/lspconfig/julials.lua @@ -1,11 +1,12 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local cmd = { "julia", "--startup-file=no", "--history-file=no", - "-e", [[ + "-e", + [[ using Pkg; Pkg.instantiate() using LanguageServer; using SymbolServer; @@ -16,25 +17,25 @@ local cmd = { server = LanguageServer.LanguageServerInstance(stdin, stdout, project_path, depot_path); server.runlinter = true; run(server); - ]] -}; + ]], +} configs.julials = { default_config = { - cmd = cmd; + cmd = cmd, on_new_config = function(new_config, _) - local server_path = vim.fn.system("julia --startup-file=no -q -e 'print(Base.find_package(\"LanguageServer\"))'") + local server_path = vim.fn.system "julia --startup-file=no -q -e 'print(Base.find_package(\"LanguageServer\"))'" local new_cmd = vim.deepcopy(cmd) - table.insert(new_cmd, 2, "--project="..server_path:sub(0,-19)) + table.insert(new_cmd, 2, "--project=" .. server_path:sub(0, -19)) new_config.cmd = new_cmd end, - filetypes = {'julia'}; + filetypes = { "julia" }, root_dir = function(fname) return util.find_git_ancestor(fname) or vim.fn.getcwd() - end; - }; + end, + }, docs = { - package_json = "https://raw.githubusercontent.com/julia-vscode/julia-vscode/master/package.json"; + package_json = "https://raw.githubusercontent.com/julia-vscode/julia-vscode/master/package.json", description = [[ https://github.com/julia-vscode/julia-vscode @@ -80,8 +81,8 @@ julia -e 'print(Base.find_package("LanguageServer"))' Note: the directory passed to `--project=...` should terminate with src, not LanguageServer.jl. - ]]; - }; + ]], + }, } --- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/kotlin_language_server.lua b/lua/lspconfig/kotlin_language_server.lua index 9b3280fe..baa96e22 100644 --- a/lua/lspconfig/kotlin_language_server.lua +++ b/lua/lspconfig/kotlin_language_server.lua @@ -6,43 +6,41 @@ --- https://github.com/udalov/kotlin-vim (recommended) --- Note that there is no LICENSE specified yet. -local util = require 'lspconfig/util' -local configs = require 'lspconfig/configs' +local util = require "lspconfig/util" +local configs = require "lspconfig/configs" local bin_name = "kotlin-language-server" -if vim.fn.has('win32') == 1 then - bin_name = bin_name..".bat" +if vim.fn.has "win32" == 1 then + bin_name = bin_name .. ".bat" end - --- The presence of one of these files indicates a project root directory -- -- These are configuration files for the various build systems supported by -- Kotlin. I am not sure whether the language server supports Ant projects, -- but I'm keeping it here as well since Ant does support Kotlin. local root_files = { - 'settings.gradle', -- Gradle (multi-project) - 'settings.gradle.kts', -- Gradle (multi-project) - 'build.xml', -- Ant - 'pom.xml', -- Maven + "settings.gradle", -- Gradle (multi-project) + "settings.gradle.kts", -- Gradle (multi-project) + "build.xml", -- Ant + "pom.xml", -- Maven } local fallback_root_files = { - 'build.gradle', -- Gradle - 'build.gradle.kts', -- Gradle + "build.gradle", -- Gradle + "build.gradle.kts", -- Gradle } configs.kotlin_language_server = { default_config = { - filetypes = { "kotlin" }; + filetypes = { "kotlin" }, root_dir = function(fname) - return util.root_pattern(unpack(root_files))(fname) or - util.root_pattern(unpack(fallback_root_files))(fname) - end; - cmd = { bin_name }; - }; + return util.root_pattern(unpack(root_files))(fname) or util.root_pattern(unpack(fallback_root_files))(fname) + end, + cmd = { bin_name }, + }, docs = { - package_json = "https://raw.githubusercontent.com/fwcd/vscode-kotlin/master/package.json"; + package_json = "https://raw.githubusercontent.com/fwcd/vscode-kotlin/master/package.json", description = [[ A kotlin language server which was developed for internal usage and released afterwards. Maintaining is not done by the original author, @@ -51,10 +49,10 @@ configs.kotlin_language_server = { It is builded via gradle and developed on github. Source and additional description: https://github.com/fwcd/kotlin-language-server - ]]; + ]], default_config = { - root_dir = [[root_pattern("settings.gradle")]]; - cmd = {"kotlin-language-server"}; + root_dir = [[root_pattern("settings.gradle")]], + cmd = { "kotlin-language-server" }, capabilities = [[ smart code completion, diagnostics, @@ -72,9 +70,9 @@ configs.kotlin_language_server = { Copyright (c) 2016 George Fraser Copyright (c) 2018 fwcd - ]]; - }; - }; + ]], + }, + }, } -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/lean3ls.lua b/lua/lspconfig/lean3ls.lua index 9280c3f0..083f4f0c 100644 --- a/lua/lspconfig/lean3ls.lua +++ b/lua/lspconfig/lean3ls.lua @@ -1,20 +1,22 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" configs.lean3ls = { default_config = { - cmd = {"lean-language-server", "--stdio", "--", "-M", "4096", "-T", "100000" }; - filetypes = {"lean3"}; + cmd = { "lean-language-server", "--stdio", "--", "-M", "4096", "-T", "100000" }, + filetypes = { "lean3" }, root_dir = function(fname) - return util.root_pattern("leanpkg.toml")(fname) or util.find_git_ancestor(fname) or util.path.dirname(fname) - end; + return util.root_pattern "leanpkg.toml"(fname) or util.find_git_ancestor(fname) or util.path.dirname(fname) + end, on_new_config = function(config, root) - if not util.path.is_file(root .. "/leanpkg.toml") then return end + if not util.path.is_file(root .. "/leanpkg.toml") then + return + end if not config.cmd_cwd then config.cmd_cwd = root end - end; - }; + end, + }, docs = { description = [[ https://github.com/leanprover/lean-client-js/tree/master/lean-language-server @@ -26,10 +28,10 @@ Once Lean is installed, you can install the Lean 3 language server by running ```sh npm install -g lean-language-server ``` - ]]; + ]], default_config = { - root_dir = [[root_pattern("leanpkg.toml") or root_pattern(".git") or path.dirname]]; - }; - }; + root_dir = [[root_pattern("leanpkg.toml") or root_pattern(".git") or path.dirname]], + }, + }, } -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/leanls.lua b/lua/lspconfig/leanls.lua index aa5153ca..946275dd 100644 --- a/lua/lspconfig/leanls.lua +++ b/lua/lspconfig/leanls.lua @@ -1,20 +1,22 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" configs.leanls = { default_config = { - cmd = {"lean", "--server"}; - filetypes = {"lean"}; + cmd = { "lean", "--server" }, + filetypes = { "lean" }, root_dir = function(fname) - return util.root_pattern("leanpkg.toml")(fname) or util.find_git_ancestor(fname) or util.path.dirname(fname) - end; + return util.root_pattern "leanpkg.toml"(fname) or util.find_git_ancestor(fname) or util.path.dirname(fname) + end, on_new_config = function(config, root) - if not util.path.is_file(root .. "/leanpkg.toml") then return end + if not util.path.is_file(root .. "/leanpkg.toml") then + return + end if not config.cmd_cwd then config.cmd_cwd = root end - end; - }; + end, + }, docs = { description = [[ https://github.com/leanprover/lean4 @@ -24,10 +26,10 @@ Lean installation instructions can be found The Lean 4 language server is built-in with a Lean 4 install (and can be manually run with, e.g., `lean --server`). - ]]; + ]], default_config = { - root_dir = [[root_pattern("leanpkg.toml") or root_pattern(".git") or path.dirname]]; - }; - }; + root_dir = [[root_pattern("leanpkg.toml") or root_pattern(".git") or path.dirname]], + }, + }, } -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/lspinfo.lua b/lua/lspconfig/lspinfo.lua index 34320e46..02b5fff0 100644 --- a/lua/lspconfig/lspinfo.lua +++ b/lua/lspconfig/lspinfo.lua @@ -1,13 +1,13 @@ -local configs = require 'lspconfig/configs' -local lspui = require 'lspconfig/_lspui' +local configs = require "lspconfig/configs" +local lspui = require "lspconfig/_lspui" -return function () +return function() -- These options need to be cached before switching to the floating -- buffer. local buf_clients = vim.lsp.buf_get_clients() local clients = vim.lsp.get_active_clients() local buffer_filetype = vim.bo.filetype - local buffer_dir = vim.fn.expand('%:p:h') + local buffer_dir = vim.fn.expand "%:p:h" local win_info = lspui.percentage_range_window(0.8, 0.7) local bufnr, win_id = win_info.bufnr, win_info.win_id @@ -20,27 +20,30 @@ return function () end local header = { - "Configured servers: "..table.concat(vim.tbl_keys(configs), ', '), - "Neovim logs at: "..(vim.lsp.get_log_path()), + "Configured servers: " .. table.concat(vim.tbl_keys(configs), ", "), + "Neovim logs at: " .. (vim.lsp.get_log_path()), "", - tostring(#vim.tbl_keys(buf_clients)).." client(s) attached to this buffer: "..table.concat(buf_client_names, ', '), + tostring(#vim.tbl_keys(buf_clients)) .. " client(s) attached to this buffer: " .. table.concat( + buf_client_names, + ", " + ), } vim.list_extend(buf_lines, header) local function trim_whitespace(cmd) local trimmed_cmd = {} for _, str in pairs(cmd) do - table.insert(trimmed_cmd, str:match'^%s*(.*)') + table.insert(trimmed_cmd, str:match "^%s*(.*)") end return trimmed_cmd end local function remove_newlines(cmd) cmd = trim_whitespace(cmd) - cmd = table.concat(cmd, ' ') - cmd = vim.split(cmd, '\n') + cmd = table.concat(cmd, " ") + cmd = vim.split(cmd, "\n") cmd = trim_whitespace(cmd) - cmd = table.concat(cmd, ' ') + cmd = table.concat(cmd, " ") return cmd end @@ -52,32 +55,32 @@ return function () end return { "", - indent.."Client: "..client.name.." (id "..tostring(client.id)..")", - indent.."\troot: "..client.workspaceFolders[1].name, - indent.."\tfiletypes: "..table.concat(client.config.filetypes or {}, ', '), - indent.."\tcmd: "..remove_newlines(client.config.cmd), - indent.."\t"..server_specific_info, - "" + indent .. "Client: " .. client.name .. " (id " .. tostring(client.id) .. ")", + indent .. "\troot: " .. client.workspaceFolders[1].name, + indent .. "\tfiletypes: " .. table.concat(client.config.filetypes or {}, ", "), + indent .. "\tcmd: " .. remove_newlines(client.config.cmd), + indent .. "\t" .. server_specific_info, + "", } end for _, client in pairs(buf_clients) do - local client_info = make_client_info(client) - vim.list_extend(buf_lines, client_info) + local client_info = make_client_info(client) + vim.list_extend(buf_lines, client_info) end local active_section_header = { "", - tostring(#clients).." active client(s): ", + tostring(#clients) .. " active client(s): ", } vim.list_extend(buf_lines, active_section_header) for _, client in pairs(clients) do - local client_info = make_client_info(client) - vim.list_extend(buf_lines, client_info) + local client_info = make_client_info(client) + vim.list_extend(buf_lines, client_info) end local matching_config_header = { "", - "Clients that match the filetype "..buffer_filetype..":", + "Clients that match the filetype " .. buffer_filetype .. ":", } local cmd_not_found_msg = "False. Please check your path and ensure the server is installed" vim.list_extend(buf_lines, matching_config_header) @@ -98,36 +101,36 @@ return function () for _, filetype_match in pairs(config.filetypes) do if buffer_filetype == filetype_match then local matching_config_info = { - indent.."", - indent.."Config: "..config.name, - indent.."\tcmd: "..cmd, - indent.."\tcmd is executable: ".. cmd_is_executable, - indent.."\tidentified root: "..(config.get_root_dir(buffer_dir) or "None"), - indent.."\tcustom handlers: "..table.concat(vim.tbl_keys(config.handlers), ", "), + indent .. "", + indent .. "Config: " .. config.name, + indent .. "\tcmd: " .. cmd, + indent .. "\tcmd is executable: " .. cmd_is_executable, + indent .. "\tidentified root: " .. (config.get_root_dir(buffer_dir) or "None"), + indent .. "\tcustom handlers: " .. table.concat(vim.tbl_keys(config.handlers), ", "), } - vim.list_extend(buf_lines, matching_config_info) + vim.list_extend(buf_lines, matching_config_info) end end else - local matching_config_info = { - "", - "Config: "..config.name, - "\tfiletype: ".."No filetypes defined, please define filetypes in setup().", - } - vim.list_extend(buf_lines, matching_config_info) + local matching_config_info = { + "", + "Config: " .. config.name, + "\tfiletype: " .. "No filetypes defined, please define filetypes in setup().", + } + vim.list_extend(buf_lines, matching_config_info) end end buf_lines = vim.lsp.util._trim(buf_lines, {}) - vim.api.nvim_buf_set_lines(bufnr, 0, -1, true, buf_lines ) - vim.api.nvim_buf_set_option(bufnr,'modifiable',false) - vim.api.nvim_buf_set_option(bufnr,'filetype','lspinfo') - local configs_pattern = '\\%(' .. table.concat(vim.tbl_keys(configs), '\\|') .. '\\)' - vim.cmd('syntax match Title /\\%(Client\\|Config\\):.*\\zs' .. configs_pattern .. '/') - vim.cmd('syntax match Identifier /filetypes:.*\\zs\\<' .. buffer_filetype .. '\\>/') - vim.fn.matchadd("Error", - "No filetypes defined, please define filetypes in setup().\\|".. - "cmd not defined\\|" .. - cmd_not_found_msg) - vim.api.nvim_buf_set_keymap(bufnr, 'n', '<esc>', '<cmd>bd<CR>', { noremap = true}) - vim.lsp.util.close_preview_autocmd({"BufHidden", "BufLeave"}, win_id) -end; + vim.api.nvim_buf_set_lines(bufnr, 0, -1, true, buf_lines) + vim.api.nvim_buf_set_option(bufnr, "modifiable", false) + vim.api.nvim_buf_set_option(bufnr, "filetype", "lspinfo") + local configs_pattern = "\\%(" .. table.concat(vim.tbl_keys(configs), "\\|") .. "\\)" + vim.cmd("syntax match Title /\\%(Client\\|Config\\):.*\\zs" .. configs_pattern .. "/") + vim.cmd("syntax match Identifier /filetypes:.*\\zs\\<" .. buffer_filetype .. "\\>/") + vim.fn.matchadd( + "Error", + "No filetypes defined, please define filetypes in setup().\\|" .. "cmd not defined\\|" .. cmd_not_found_msg + ) + vim.api.nvim_buf_set_keymap(bufnr, "n", "<esc>", "<cmd>bd<CR>", { noremap = true }) + vim.lsp.util.close_preview_autocmd({ "BufHidden", "BufLeave" }, win_id) +end diff --git a/lua/lspconfig/metals.lua b/lua/lspconfig/metals.lua index 8384472b..7fcb187a 100644 --- a/lua/lspconfig/metals.lua +++ b/lua/lspconfig/metals.lua @@ -1,24 +1,24 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "metals" local bin_name = "metals" configs[server_name] = { default_config = { - cmd = {bin_name}; - filetypes = {"scala"}; - root_dir = util.root_pattern("build.sbt", "build.sc", "build.gradle", "pom.xml"); - message_level = vim.lsp.protocol.MessageType.Log; + cmd = { bin_name }, + filetypes = { "scala" }, + root_dir = util.root_pattern("build.sbt", "build.sc", "build.gradle", "pom.xml"), + message_level = vim.lsp.protocol.MessageType.Log, init_options = { - statusBarProvider = "show-message", - isHttpEnabled = true, - compilerOptions = { - snippetAutoIndent = false - } - }; - }; + statusBarProvider = "show-message", + isHttpEnabled = true, + compilerOptions = { + snippetAutoIndent = false, + }, + }, + }, docs = { - description = [[ + description = [[ https://scalameta.org/metals/ Scala language server with rich IDE features. @@ -40,9 +40,9 @@ cs bootstrap \ -r sonatype:snapshots \ -o /usr/local/bin/metals -f ``` -]]; +]], default_config = { - root_dir = [[util.root_pattern("build.sbt", "build.sc", "build.gradle", "pom.xml")]]; - }; - }; -}; + root_dir = [[util.root_pattern("build.sbt", "build.sc", "build.gradle", "pom.xml")]], + }, + }, +} diff --git a/lua/lspconfig/nimls.lua b/lua/lspconfig/nimls.lua index 4fa6a8ad..63267d14 100644 --- a/lua/lspconfig/nimls.lua +++ b/lua/lspconfig/nimls.lua @@ -1,27 +1,25 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" configs.nimls = { default_config = { - cmd = {"nimlsp",}; - filetypes = {'nim'}; + cmd = { "nimlsp" }, + filetypes = { "nim" }, root_dir = function(fname) - return util.root_pattern("*.nimble")(fname) or - util.find_git_ancestor(fname) or - util.path.dirname(fname) - end; - }; + return util.root_pattern "*.nimble"(fname) or util.find_git_ancestor(fname) or util.path.dirname(fname) + end, + }, docs = { - package_json = "https://raw.githubusercontent.com/pragmagic/vscode-nim/master/package.json"; + package_json = "https://raw.githubusercontent.com/pragmagic/vscode-nim/master/package.json", description = [[ https://github.com/PMunch/nimlsp `nimlsp` can be installed via the `nimble` package manager: ```sh nimble install nimlsp ``` - ]]; + ]], default_config = { - root_dir = [[root_pattern(".git") or os_homedir]]; - }; - }; + root_dir = [[root_pattern(".git") or os_homedir]], + }, + }, } diff --git a/lua/lspconfig/ocamlls.lua b/lua/lspconfig/ocamlls.lua index 053dfe3b..37a0d736 100644 --- a/lua/lspconfig/ocamlls.lua +++ b/lua/lspconfig/ocamlls.lua @@ -1,15 +1,15 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "ocamlls" local bin_name = "ocaml-language-server" configs[server_name] = { default_config = { - cmd = { bin_name, "--stdio" }; - filetypes = { "ocaml", "reason" }; - root_dir = util.root_pattern("*.opam", "esy.json", "package.json"); - }; + cmd = { bin_name, "--stdio" }, + filetypes = { "ocaml", "reason" }, + root_dir = util.root_pattern("*.opam", "esy.json", "package.json"), + }, docs = { description = [[ https://github.com/ocaml-lsp/ocaml-language-server @@ -18,10 +18,10 @@ https://github.com/ocaml-lsp/ocaml-language-server ```sh npm install -g ocaml-langauge-server ``` - ]]; + ]], default_config = { - root_dir = [[root_pattern("*.opam", "esy.json", "package.json")]]; - }; - }; -}; + root_dir = [[root_pattern("*.opam", "esy.json", "package.json")]], + }, + }, +} -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/ocamllsp.lua b/lua/lspconfig/ocamllsp.lua index 5ce8441d..f08fb3d4 100644 --- a/lua/lspconfig/ocamllsp.lua +++ b/lua/lspconfig/ocamllsp.lua @@ -1,12 +1,12 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local language_id_of = { - menhir = 'ocaml.menhir'; - ocaml = 'ocaml'; - ocamlinterface = 'ocaml.interface'; - ocamllex = 'ocaml.ocamllex'; - reason = 'reason'; + menhir = "ocaml.menhir", + ocaml = "ocaml", + ocamlinterface = "ocaml.interface", + ocamllex = "ocaml.ocamllex", + reason = "reason", } local filetypes = {} @@ -15,15 +15,17 @@ for ftype, _ in pairs(language_id_of) do table.insert(filetypes, ftype) end -local get_language_id = function (_, ftype) return language_id_of[ftype] end +local get_language_id = function(_, ftype) + return language_id_of[ftype] +end configs.ocamllsp = { default_config = { - cmd = {"ocamllsp",}; - filetypes = filetypes; - root_dir = util.root_pattern("*.opam", "esy.json", "package.json", ".git"); - get_language_id = get_language_id; - }; + cmd = { "ocamllsp" }, + filetypes = filetypes, + root_dir = util.root_pattern("*.opam", "esy.json", "package.json", ".git"), + get_language_id = get_language_id, + }, docs = { description = [[ https://github.com/ocaml/ocaml-lsp @@ -35,9 +37,9 @@ To install the lsp server in a particular opam switch: opam pin add ocaml-lsp-server https://github.com/ocaml/ocaml-lsp.git opam install ocaml-lsp-server ``` - ]]; + ]], default_config = { - root_dir = [[root_pattern("*.opam", "esy.json", "package.json", ".git")]]; - }; - }; + root_dir = [[root_pattern("*.opam", "esy.json", "package.json", ".git")]], + }, + }, } diff --git a/lua/lspconfig/omnisharp.lua b/lua/lspconfig/omnisharp.lua index e163770c..05cab4bc 100644 --- a/lua/lspconfig/omnisharp.lua +++ b/lua/lspconfig/omnisharp.lua @@ -1,14 +1,13 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' -local server_name = 'omnisharp' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" +local server_name = "omnisharp" configs[server_name] = { default_config = { - filetypes = {"cs", "vb"}; - root_dir = util.root_pattern("*.csproj", "*.sln"); - init_options = { - }; - }; + filetypes = { "cs", "vb" }, + root_dir = util.root_pattern("*.csproj", "*.sln"), + init_options = {}, + }, -- on_new_config = function(new_config) end; -- on_attach = function(client, bufnr) end; docs = { @@ -39,11 +38,11 @@ Note, if you download the executable for darwin you will need to strip the quara ```bash find /path/to/omnisharp-osx | xargs xattr -r -d com.apple.quarantine ``` -]]; +]], default_config = { - root_dir = [[root_pattern(".csproj", ".sln")]]; - }; - }; + root_dir = [[root_pattern(".csproj", ".sln")]], + }, + }, } -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/perlls.lua b/lua/lspconfig/perlls.lua index db50b240..4695d2f3 100644 --- a/lua/lspconfig/perlls.lua +++ b/lua/lspconfig/perlls.lua @@ -1,37 +1,43 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" configs.perlls = { default_config = { - cmd = {"perl", - "-MPerl::LanguageServer", - "-e", "Perl::LanguageServer::run","--", - "--port 13603", "--nostdio 0", "--version 2.1.0"}; + cmd = { + "perl", + "-MPerl::LanguageServer", + "-e", + "Perl::LanguageServer::run", + "--", + "--port 13603", + "--nostdio 0", + "--version 2.1.0", + }, settings = { perl = { - perlCmd = 'perl'; - perlInc = ' '; - fileFilter = {".pm",".pl"}; - ignoreDirs = '.git'; - }; - }; - filetypes = {"perl"}; + perlCmd = "perl", + perlInc = " ", + fileFilter = { ".pm", ".pl" }, + ignoreDirs = ".git", + }, + }, + filetypes = { "perl" }, root_dir = function(fname) - return util.root_pattern(".git")(fname) or vim.fn.getcwd() - end; - }; + return util.root_pattern ".git"(fname) or vim.fn.getcwd() + end, + }, docs = { - package_json = "https://raw.githubusercontent.com/richterger/Perl-LanguageServer/master/clients/vscode/perl/package.json"; + package_json = "https://raw.githubusercontent.com/richterger/Perl-LanguageServer/master/clients/vscode/perl/package.json", description = [[ https://github.com/richterger/Perl-LanguageServer/tree/master/clients/vscode/perl `Perl-LanguageServer`, a language server for Perl. To use the language server, ensure that you have Perl::LanguageServer installed and perl command is on your path. -]]; +]], default_config = { - root_dir = "vim's starting directory"; - }; - }; -}; + root_dir = "vim's starting directory", + }, + }, +} -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/phpactor.lua b/lua/lspconfig/phpactor.lua index b022cf1b..f358f092 100644 --- a/lua/lspconfig/phpactor.lua +++ b/lua/lspconfig/phpactor.lua @@ -1,32 +1,32 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "phpactor" local bin_name = "phpactor" configs[server_name] = { default_config = { - cmd = {bin_name, "language-server"}; - filetypes = {"php"}; - root_dir = function (pattern) - local cwd = vim.loop.cwd(); - local root = util.root_pattern("composer.json", ".git")(pattern); + cmd = { bin_name, "language-server" }, + filetypes = { "php" }, + root_dir = function(pattern) + local cwd = vim.loop.cwd() + local root = util.root_pattern("composer.json", ".git")(pattern) -- prefer cwd if root is a descendant - return util.path.is_descendant(cwd, root) and cwd or root; - end; - }; + return util.path.is_descendant(cwd, root) and cwd or root + end, + }, docs = { description = [[ https://github.com/phpactor/phpactor Installation: https://phpactor.readthedocs.io/en/master/usage/standalone.html#global-installation -]]; +]], default_config = { - cmd = {"phpactor", "language-server"}; - root_dir = [[root_pattern("composer.json", ".git")]]; - }; - }; + cmd = { "phpactor", "language-server" }, + root_dir = [[root_pattern("composer.json", ".git")]], + }, + }, } -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/powershell_es.lua b/lua/lspconfig/powershell_es.lua index 164875b2..c76d5b16 100644 --- a/lua/lspconfig/powershell_es.lua +++ b/lua/lspconfig/powershell_es.lua @@ -1,14 +1,15 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "powershell_es" -local temp_path = vim.fn.stdpath('cache') +local temp_path = vim.fn.stdpath "cache" local function make_cmd(bundle_path) if bundle_path ~= nil then - local command_fmt = [[%s/PowerShellEditorServices/Start-EditorServices.ps1 -BundledModulesPath %s -LogPath %s/powershell_es.log -SessionDetailsPath %s/powershell_es.session.json -FeatureFlags @() -AdditionalModules @() -HostName nvim -HostProfileId 0 -HostVersion 1.0.0 -Stdio -LogLevel Normal]] + local command_fmt = + [[%s/PowerShellEditorServices/Start-EditorServices.ps1 -BundledModulesPath %s -LogPath %s/powershell_es.log -SessionDetailsPath %s/powershell_es.session.json -FeatureFlags @() -AdditionalModules @() -HostName nvim -HostProfileId 0 -HostVersion 1.0.0 -Stdio -LogLevel Normal]] local command = command_fmt:format(bundle_path, bundle_path, temp_path, temp_path) - return {"pwsh", "-NoLogo", "-NoProfile", "-Command", command} + return { "pwsh", "-NoLogo", "-NoProfile", "-Command", command } end end @@ -18,11 +19,11 @@ configs[server_name] = { local bundle_path = new_config.bundle_path new_config.cmd = make_cmd(bundle_path) end, - filetypes = {"ps1"}, + filetypes = { "ps1" }, root_dir = function(fname) return util.find_git_ancestor(fname) or vim.fn.getcwd() - end; - }; + end, + }, docs = { description = [[ https://github.com/PowerShell/PowerShellEditorServices @@ -51,11 +52,11 @@ require'lspconfig'.powershell_es.setup{ cmd = {'pwsh', '-NoLogo', '-NoProfile', '-Command', "c:/PSES/Start-EditorServices.ps1 ..."} } ``` -]]; +]], default_config = { - root_dir = "git root or current directory"; - }; - }; -}; + root_dir = "git root or current directory", + }, + }, +} -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/prismals.lua b/lua/lspconfig/prismals.lua index 495b2b8a..93e3aed4 100644 --- a/lua/lspconfig/prismals.lua +++ b/lua/lspconfig/prismals.lua @@ -1,31 +1,31 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "prismals" local bin_name = "prisma-language-server" -if vim.fn.has('win32') == 1 then - bin_name = bin_name..".cmd" +if vim.fn.has "win32" == 1 then + bin_name = bin_name .. ".cmd" end configs[server_name] = { default_config = { - cmd = {bin_name, "--stdio"}; - filetypes = {"prisma"}; + cmd = { bin_name, "--stdio" }, + filetypes = { "prisma" }, settings = { prisma = { - prismaFmtBinPath = ""; - } - }; - root_dir =util.root_pattern(".git", "package.json"); - }; + prismaFmtBinPath = "", + }, + }, + root_dir = util.root_pattern(".git", "package.json"), + }, docs = { description = [[ npm install -g @prisma/language-server 'prismals, a language server for the prisma javascript and typescript orm' -]]; +]], default_config = { - root_dir = [[root_pattern(".git", "package.json")]]; - }; - }; + root_dir = [[root_pattern(".git", "package.json")]], + }, + }, } diff --git a/lua/lspconfig/purescriptls.lua b/lua/lspconfig/purescriptls.lua index b8a4745c..986d3e12 100644 --- a/lua/lspconfig/purescriptls.lua +++ b/lua/lspconfig/purescriptls.lua @@ -1,30 +1,30 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "purescriptls" local bin_name = "purescript-language-server" -if vim.fn.has('win32') == 1 then - bin_name = bin_name..'.cmd' +if vim.fn.has "win32" == 1 then + bin_name = bin_name .. ".cmd" end configs[server_name] = { default_config = { - cmd = {bin_name, "--stdio"}; - filetypes = {"purescript"}; - root_dir = util.root_pattern("spago.dhall", "bower.json"); - }; + cmd = { bin_name, "--stdio" }, + filetypes = { "purescript" }, + root_dir = util.root_pattern("spago.dhall", "bower.json"), + }, docs = { - package_json = "https://raw.githubusercontent.com/nwolverson/vscode-ide-purescript/master/package.json"; + package_json = "https://raw.githubusercontent.com/nwolverson/vscode-ide-purescript/master/package.json", description = [[ https://github.com/nwolverson/purescript-language-server `purescript-language-server` can be installed via `npm` ```sh npm install -g purescript-language-server ``` -]]; +]], default_config = { - root_dir = [[root_pattern("spago.dhall, bower.json")]]; - }; - }; -}; + root_dir = [[root_pattern("spago.dhall, bower.json")]], + }, + }, +} -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/pyls.lua b/lua/lspconfig/pyls.lua index 5e3dc5a9..72336455 100644 --- a/lua/lspconfig/pyls.lua +++ b/lua/lspconfig/pyls.lua @@ -1,15 +1,15 @@ -local configs = require 'lspconfig/configs' +local configs = require "lspconfig/configs" configs.pyls = { default_config = { - cmd = {"pyls"}; - filetypes = {"python"}; + cmd = { "pyls" }, + filetypes = { "python" }, root_dir = function(fname) return vim.fn.getcwd() - end; - }; + end, + }, docs = { - package_json = "https://raw.githubusercontent.com/palantir/python-language-server/develop/vscode-client/package.json"; + package_json = "https://raw.githubusercontent.com/palantir/python-language-server/develop/vscode-client/package.json", description = [[ https://github.com/palantir/python-language-server @@ -17,10 +17,10 @@ https://github.com/palantir/python-language-server The language server can be installed via `pipx install 'python-language-server[all]'`. - ]]; + ]], default_config = { - root_dir = "vim's starting directory"; - }; - }; -}; + root_dir = "vim's starting directory", + }, + }, +} -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/pyls_ms.lua b/lua/lspconfig/pyls_ms.lua index e30fc681..863ff8bf 100644 --- a/lua/lspconfig/pyls_ms.lua +++ b/lua/lspconfig/pyls_ms.lua @@ -1,37 +1,36 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local name = "pyls_ms" configs[name] = { default_config = { - filetypes = {"python"}; + filetypes = { "python" }, root_dir = function(fname) return util.find_git_ancestor(fname) or vim.loop.os_homedir() - end; + end, settings = { python = { analysis = { - errors = {}; - info = {}; - disabled = {}; - }; - }; - }; + errors = {}, + info = {}, + disabled = {}, + }, + }, + }, init_options = { interpreter = { - properties = - { - InterpreterPath = ""; - Version = ""; - }; - }; - displayOptions = {}; - analysisUpdates = true; - asyncStartup = true; - }; - }; + properties = { + InterpreterPath = "", + Version = "", + }, + }, + displayOptions = {}, + analysisUpdates = true, + asyncStartup = true, + }, + }, docs = { description = [[ https://github.com/Microsoft/python-language-server @@ -61,11 +60,11 @@ Version = "3.8" This server accepts configuration via the `settings` key. - ]]; + ]], default_config = { - root_dir = "vim's starting directory"; - }; - }; -}; + root_dir = "vim's starting directory", + }, + }, +} -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/pylsp.lua b/lua/lspconfig/pylsp.lua index f46c9052..a88413fa 100644 --- a/lua/lspconfig/pylsp.lua +++ b/lua/lspconfig/pylsp.lua @@ -1,23 +1,21 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" configs.pylsp = { default_config = { - cmd = {"pylsp"}; - filetypes = {"python"}; + cmd = { "pylsp" }, + filetypes = { "python" }, root_dir = function(fname) local root_files = { "pyproject.toml", "setup.py", "setup.cfg", "requirements.txt", - "Pipfile" + "Pipfile", } - return util.root_pattern(unpack(root_files))(fname) or - util.find_git_ancestor(fname) or - util.path.dirname(fname) - end; - }; + return util.root_pattern(unpack(root_files))(fname) or util.find_git_ancestor(fname) or util.path.dirname(fname) + end, + }, docs = { description = [[ https://github.com/python-lsp/python-lsp-server @@ -28,7 +26,7 @@ The language server can be installed via `pipx install 'python-lsp-server[all]'` Further instructions can be found in the [project's README](https://github.com/python-lsp/python-lsp-server). Note: This is a community fork of `pyls`. - ]]; - }; -}; + ]], + }, +} -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/pyright.lua b/lua/lspconfig/pyright.lua index bb22a27f..86bb4295 100644 --- a/lua/lspconfig/pyright.lua +++ b/lua/lspconfig/pyright.lua @@ -1,23 +1,23 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "pyright" local bin_name = "pyright-langserver" -if vim.fn.has('win32') == 1 then - bin_name = bin_name..".cmd" +if vim.fn.has "win32" == 1 then + bin_name = bin_name .. ".cmd" end local root_files = { - 'setup.py', - 'pyproject.toml', - 'setup.cfg', - 'requirements.txt', - '.git', + "setup.py", + "pyproject.toml", + "setup.cfg", + "requirements.txt", + ".git", } local function organize_imports() local params = { - command = 'pyright.organizeimports', + command = "pyright.organizeimports", arguments = { vim.uri_from_bufnr(0) }, } vim.lsp.buf.execute_command(params) @@ -25,36 +25,35 @@ end configs[server_name] = { default_config = { - cmd = {bin_name, "--stdio"}; - filetypes = {"python"}; + cmd = { bin_name, "--stdio" }, + filetypes = { "python" }, root_dir = function(filename) - return util.root_pattern(unpack(root_files))(filename) or - util.path.dirname(filename) - end; + return util.root_pattern(unpack(root_files))(filename) or util.path.dirname(filename) + end, settings = { python = { analysis = { - autoSearchPaths = true; - useLibraryCodeForTypes = true; - diagnosticMode = 'workspace'; - }; - }; - }; - }; + autoSearchPaths = true, + useLibraryCodeForTypes = true, + diagnosticMode = "workspace", + }, + }, + }, + }, commands = { PyrightOrganizeImports = { - organize_imports; - description = "Organize Imports"; - }; - }; + organize_imports, + description = "Organize Imports", + }, + }, docs = { - package_json = 'https://raw.githubusercontent.com/microsoft/pyright/master/packages/vscode-pyright/package.json', + package_json = "https://raw.githubusercontent.com/microsoft/pyright/master/packages/vscode-pyright/package.json", description = [[ https://github.com/microsoft/pyright `pyright`, a static type checker and language server for python -]]; - }; +]], + }, } -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/r_language_server.lua b/lua/lspconfig/r_language_server.lua index d75da11f..32be96b9 100644 --- a/lua/lspconfig/r_language_server.lua +++ b/lua/lspconfig/r_language_server.lua @@ -1,17 +1,17 @@ -local util = require 'lspconfig/util' -local configs = require 'lspconfig/configs' +local util = require "lspconfig/util" +local configs = require "lspconfig/configs" configs.r_language_server = { default_config = { - cmd = {"R", "--slave", "-e", "languageserver::run()"}; - filetypes = {"r", "rmd"}; + cmd = { "R", "--slave", "-e", "languageserver::run()" }, + filetypes = { "r", "rmd" }, root_dir = function(fname) return util.find_git_ancestor(fname) or vim.loop.os_homedir() - end; - log_level = vim.lsp.protocol.MessageType.Warning; - }; + end, + log_level = vim.lsp.protocol.MessageType.Warning, + }, docs = { - package_json = "https://raw.githubusercontent.com/REditorSupport/vscode-r-lsp/master/package.json"; + package_json = "https://raw.githubusercontent.com/REditorSupport/vscode-r-lsp/master/package.json", description = [[ [languageserver](https://github.com/REditorSupport/languageserver) is an implementation of the Microsoft's Language Server Protocol for the R @@ -22,9 +22,9 @@ configs.r_language_server = { ```R install.packages("languageserver") ``` - ]]; + ]], default_config = { - root_dir = [[root_pattern(".git") or os_homedir]] - }; - }; + root_dir = [[root_pattern(".git") or os_homedir]], + }, + }, } diff --git a/lua/lspconfig/racket_langserver.lua b/lua/lspconfig/racket_langserver.lua index 2fc1e21b..1e64b50d 100644 --- a/lua/lspconfig/racket_langserver.lua +++ b/lua/lspconfig/racket_langserver.lua @@ -1,21 +1,20 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local root_files = { - '.git', + ".git", } configs.racket_langserver = { default_config = { - cmd = {"racket", "--lib", "racket-langserver"}; - filetypes = {"racket", "scheme"}; + cmd = { "racket", "--lib", "racket-langserver" }, + filetypes = { "racket", "scheme" }, root_dir = function(filename) - return util.root_pattern(unpack(root_files))(filename) or - util.path.dirname(filename) - end - }; + return util.root_pattern(unpack(root_files))(filename) or util.path.dirname(filename) + end, + }, docs = { - description = [[ + description = [[ [https://github.com/jeapostrophe/racket-langserver](https://github.com/jeapostrophe/racket-langserver) The Racket language server. This project seeks to use @@ -23,6 +22,6 @@ The Racket language server. This project seeks to use functionality that mimics DrRacket's code tools as closely as possible. Install via `raco`: `raco pkg install racket-langserver` -]]; - }; -}; +]], + }, +} diff --git a/lua/lspconfig/rescriptls.lua b/lua/lspconfig/rescriptls.lua index afe2037c..e7db7dbb 100644 --- a/lua/lspconfig/rescriptls.lua +++ b/lua/lspconfig/rescriptls.lua @@ -1,14 +1,14 @@ -local lspconfig = require('lspconfig') -local configs = require('lspconfig/configs') +local lspconfig = require "lspconfig" +local configs = require "lspconfig/configs" -local name = 'rescriptls' +local name = "rescriptls" configs[name] = { default_config = { cmd = {}, - filetypes = {'rescript'}, - root_dir = lspconfig.util.root_pattern('bsconfig.json', '.git'), - settings = {} + filetypes = { "rescript" }, + root_dir = lspconfig.util.root_pattern("bsconfig.json", ".git"), + settings = {}, }, docs = { description = [[ @@ -40,6 +40,6 @@ cmd = { Another option is to use vscode extension [release](https://github.com/rescript-lang/rescript-vscode/releases). Take a look at [here](https://github.com/rescript-lang/rescript-vscode#use-with-other-editors) for instructions. -]] - } +]], + }, } diff --git a/lua/lspconfig/rls.lua b/lua/lspconfig/rls.lua index 6ee3f327..8b1bbb4b 100644 --- a/lua/lspconfig/rls.lua +++ b/lua/lspconfig/rls.lua @@ -1,12 +1,12 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" configs.rls = { default_config = { - cmd = {"rls"}; - filetypes = {"rust"}; - root_dir = util.root_pattern("Cargo.toml"); - }; + cmd = { "rls" }, + filetypes = { "rust" }, + root_dir = util.root_pattern "Cargo.toml", + }, docs = { description = [[ https://github.com/rust-lang/rls @@ -35,10 +35,10 @@ If you want to use rls for a particular build, eg nightly, set cmd as follows: ```lua cmd = {"rustup", "run", "nightly", "rls"} ``` - ]]; + ]], default_config = { - root_dir = [[root_pattern("Cargo.toml")]]; - }; - }; -}; + root_dir = [[root_pattern("Cargo.toml")]], + }, + }, +} -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/rnix.lua b/lua/lspconfig/rnix.lua index ab879a75..5fb8d997 100644 --- a/lua/lspconfig/rnix.lua +++ b/lua/lspconfig/rnix.lua @@ -1,21 +1,19 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local name = "rnix" configs[name] = { default_config = { - cmd = {"rnix-lsp"}; - filetypes = {"nix"}; + cmd = { "rnix-lsp" }, + filetypes = { "nix" }, root_dir = function(fname) return util.find_git_ancestor(fname) or vim.loop.os_homedir() - end; - settings = { - }; - init_options = { - }; - }; + end, + settings = {}, + init_options = {}, + }, docs = { description = [[ https://github.com/nix-community/rnix-lsp @@ -26,9 +24,9 @@ To install manually, run `cargo install rnix-lsp`. If you are using nix, rnix-ls This server accepts configuration via the `settings` key. - ]]; + ]], default_config = { - root_dir = "vim's starting directory"; - }; - }; -}; + root_dir = "vim's starting directory", + }, + }, +} diff --git a/lua/lspconfig/rome.lua b/lua/lspconfig/rome.lua index b4a319e0..b8174d6a 100644 --- a/lua/lspconfig/rome.lua +++ b/lua/lspconfig/rome.lua @@ -1,26 +1,25 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" configs.rome = { default_config = { - cmd = {'rome', 'lsp'}, + cmd = { "rome", "lsp" }, filetypes = { - 'javascript', - 'javascriptreact', - 'json', - 'typescript', - 'typescript.tsx', - 'typescriptreact' + "javascript", + "javascriptreact", + "json", + "typescript", + "typescript.tsx", + "typescriptreact", }, root_dir = function(fname) - return util.find_package_json_ancestor(fname) or - util.find_node_modules_ancestor(fname) or - util.find_git_ancestor(fname) or - util.path.dirname(fname) - end + return util.find_package_json_ancestor(fname) or util.find_node_modules_ancestor(fname) or util.find_git_ancestor( + fname + ) or util.path.dirname(fname) + end, }, docs = { - description = [[ + description = [[ https://rome.tools Language server for the Rome Frontend Toolchain. @@ -29,9 +28,8 @@ Language server for the Rome Frontend Toolchain. npm install [-g] rome ``` ]], - default_config = { - root_dir = [[root_pattern('package.json', 'node_modules', '.git') or dirname]] - } - } + default_config = { + root_dir = [[root_pattern('package.json', 'node_modules', '.git') or dirname]], + }, + }, } - diff --git a/lua/lspconfig/rust_analyzer.lua b/lua/lspconfig/rust_analyzer.lua index 20f35706..34c6420f 100644 --- a/lua/lspconfig/rust_analyzer.lua +++ b/lua/lspconfig/rust_analyzer.lua @@ -1,22 +1,23 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local lsp = vim.lsp local function reload_workspace(bufnr) bufnr = util.validate_bufnr(bufnr) - lsp.buf_request(bufnr, 'rust-analyzer/reloadWorkspace', nil, - function(err, _, result, _) - if err then error(tostring(err)) end - vim.notify("Cargo workspace reloaded") - end) + lsp.buf_request(bufnr, "rust-analyzer/reloadWorkspace", nil, function(err, _, result, _) + if err then + error(tostring(err)) + end + vim.notify "Cargo workspace reloaded" + end) end configs.rust_analyzer = { default_config = { - cmd = {"rust-analyzer"}; - filetypes = {"rust"}; + cmd = { "rust-analyzer" }, + filetypes = { "rust" }, root_dir = function(fname) - local cargo_crate_dir = util.root_pattern("Cargo.toml")(fname) + local cargo_crate_dir = util.root_pattern "Cargo.toml"(fname) local cmd = "cargo metadata --no-deps --format-version 1" if cargo_crate_dir ~= nil then cmd = cmd .. " --manifest-path " .. util.path.join(cargo_crate_dir, "Cargo.toml") @@ -26,37 +27,37 @@ configs.rust_analyzer = { if vim.v.shell_error == 0 then cargo_workspace_dir = vim.fn.json_decode(cargo_metadata)["workspace_root"] end - return cargo_workspace_dir or - cargo_crate_dir or - util.root_pattern("rust-project.json")(fname) or - util.find_git_ancestor(fname) - end; + return cargo_workspace_dir + or cargo_crate_dir + or util.root_pattern "rust-project.json"(fname) + or util.find_git_ancestor(fname) + end, settings = { - ["rust-analyzer"] = {} - }; - }; + ["rust-analyzer"] = {}, + }, + }, commands = { CargoReload = { function() reload_workspace(0) - end; - description = "Reload current cargo workspace" - } - }; + end, + description = "Reload current cargo workspace", + }, + }, docs = { - package_json = "https://raw.githubusercontent.com/rust-analyzer/rust-analyzer/master/editors/code/package.json"; + package_json = "https://raw.githubusercontent.com/rust-analyzer/rust-analyzer/master/editors/code/package.json", description = [[ https://github.com/rust-analyzer/rust-analyzer rust-analyzer (aka rls 2.0), a language server for Rust See [docs](https://github.com/rust-analyzer/rust-analyzer/tree/master/docs/user#settings) for extra settings. - ]]; + ]], default_config = { - root_dir = [[root_pattern("Cargo.toml", "rust-project.json")]]; - }; - }; -}; + root_dir = [[root_pattern("Cargo.toml", "rust-project.json")]], + }, + }, +} configs.rust_analyzer.reload_workspace = reload_workspace -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/scry.lua b/lua/lspconfig/scry.lua index f15074cb..afa6464a 100644 --- a/lua/lspconfig/scry.lua +++ b/lua/lspconfig/scry.lua @@ -1,24 +1,22 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" configs.scry = { default_config = { - cmd = {'scry'}, - filetypes = {'crystal'}, + cmd = { "scry" }, + filetypes = { "crystal" }, root_dir = function(fname) - return util.root_pattern('shard.yml')(fname) or - util.find_git_ancestor(fname) or - util.path.dirname(fname) - end + return util.root_pattern "shard.yml"(fname) or util.find_git_ancestor(fname) or util.path.dirname(fname) + end, }, docs = { - description = [[ + description = [[ https://github.com/crystal-lang-tools/scry Crystal language server. ]], - default_config = { - root_dir = [[root_pattern('shard.yml', '.git') or dirname]] - } - } + default_config = { + root_dir = [[root_pattern('shard.yml', '.git') or dirname]], + }, + }, } diff --git a/lua/lspconfig/solargraph.lua b/lua/lspconfig/solargraph.lua index fde1c359..353239ab 100644 --- a/lua/lspconfig/solargraph.lua +++ b/lua/lspconfig/solargraph.lua @@ -1,23 +1,23 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local bin_name = "solargraph" -if vim.fn.has('win32') == 1 then - bin_name = bin_name..'.bat' +if vim.fn.has "win32" == 1 then + bin_name = bin_name .. ".bat" end configs.solargraph = { default_config = { - cmd = {bin_name, "stdio"}; + cmd = { bin_name, "stdio" }, settings = { solargraph = { - diagnostics = true; - }; - }; - filetypes = {"ruby"}; - root_dir = util.root_pattern("Gemfile", ".git"); - }; + diagnostics = true, + }, + }, + filetypes = { "ruby" }, + root_dir = util.root_pattern("Gemfile", ".git"), + }, docs = { - package_json = "https://raw.githubusercontent.com/castwide/vscode-solargraph/master/package.json"; + package_json = "https://raw.githubusercontent.com/castwide/vscode-solargraph/master/package.json", description = [[ https://solargraph.org/ @@ -28,10 +28,10 @@ You can install solargraph via gem install. ```sh gem install --user-install solargraph ``` - ]]; + ]], default_config = { - root_dir = [[root_pattern("Gemfile", ".git")]]; - }; - }; -}; + root_dir = [[root_pattern("Gemfile", ".git")]], + }, + }, +} -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/sorbet.lua b/lua/lspconfig/sorbet.lua index 1f96288e..bdf0a024 100644 --- a/lua/lspconfig/sorbet.lua +++ b/lua/lspconfig/sorbet.lua @@ -1,15 +1,15 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "sorbet" local bin_name = "srb" configs[server_name] = { default_config = { - cmd = {bin_name, "tc", "--lsp"}; - filetypes = {"ruby"}; - root_dir = util.root_pattern("Gemfile", ".git"); - }; + cmd = { bin_name, "tc", "--lsp" }, + filetypes = { "ruby" }, + root_dir = util.root_pattern("Gemfile", ".git"), + }, docs = { description = [[ https://sorbet.org @@ -22,9 +22,9 @@ Sorbet up for new projects: https://sorbet.org/docs/adopting. ```sh gem install sorbet ``` - ]]; + ]], default_config = { - root_dir = [[root_pattern("Gemfile", ".git")]]; - }; - }; -}; + root_dir = [[root_pattern("Gemfile", ".git")]], + }, + }, +} diff --git a/lua/lspconfig/sourcekit.lua b/lua/lspconfig/sourcekit.lua index 85714311..7fb6e80a 100644 --- a/lua/lspconfig/sourcekit.lua +++ b/lua/lspconfig/sourcekit.lua @@ -1,22 +1,22 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" configs.sourcekit = { default_config = { - cmd = {"xcrun", "sourcekit-lsp"}; - filetypes = {"swift", "c", "cpp", "objective-c", "objective-cpp"}; - root_dir = util.root_pattern("Package.swift", ".git") - }; + cmd = { "xcrun", "sourcekit-lsp" }, + filetypes = { "swift", "c", "cpp", "objective-c", "objective-cpp" }, + root_dir = util.root_pattern("Package.swift", ".git"), + }, docs = { - package_json = "https://raw.githubusercontent.com/apple/sourcekit-lsp/main/Editors/vscode/package.json"; + package_json = "https://raw.githubusercontent.com/apple/sourcekit-lsp/main/Editors/vscode/package.json", description = [[ https://github.com/apple/sourcekit-lsp Language server for Swift and C/C++/Objective-C. - ]]; + ]], default_config = { - root_dir = [[root_pattern("Package.swift", ".git")]]; - }; - }; -}; + root_dir = [[root_pattern("Package.swift", ".git")]], + }, + }, +} -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/sqlls.lua b/lua/lspconfig/sqlls.lua index 6e0734d6..a4299b7d 100644 --- a/lua/lspconfig/sqlls.lua +++ b/lua/lspconfig/sqlls.lua @@ -1,18 +1,18 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "sqlls" -local root_pattern = util.root_pattern(".sqllsrc.json") +local root_pattern = util.root_pattern ".sqllsrc.json" configs[server_name] = { default_config = { - filetypes = {"sql", "mysql"}; + filetypes = { "sql", "mysql" }, root_dir = function(fname) return root_pattern(fname) or vim.loop.os_homedir() - end; - settings = {}; - }; + end, + settings = {}, + }, docs = { description = [[ https://github.com/joe-re/sql-language-server @@ -28,8 +28,8 @@ require'lspconfig'.sqlls.setup{ This LSP can be installed via `npm`. Find further instructions on manual installation of the sql-language-server at [joe-re/sql-language-server](https://github.com/joe-re/sql-language-server). <br> - ]]; - }; + ]], + }, } -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/sqls.lua b/lua/lspconfig/sqls.lua index f7d5d0f4..3561cffe 100644 --- a/lua/lspconfig/sqls.lua +++ b/lua/lspconfig/sqls.lua @@ -1,15 +1,15 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" configs.sqls = { default_config = { - cmd = {"sqls"}; - filetypes = {"sql", "mysql"}; + cmd = { "sqls" }, + filetypes = { "sql", "mysql" }, root_dir = function(fname) - return util.root_pattern("config.yml")(fname) or util.path.dirname(fname) - end; - settings = {}; - }; + return util.root_pattern "config.yml"(fname) or util.path.dirname(fname) + end, + settings = {}, + }, docs = { description = [[ https://github.com/lighttiger2505/sqls @@ -22,8 +22,8 @@ require'lspconfig'.sqls.setup{ ``` Sqls can be installed via `go get github.com/lighttiger2505/sqls`. Instructions for compiling Sqls from the source can be found at [lighttiger2505/sqls](https://github.com/lighttiger2505/sqls). - ]]; - }; + ]], + }, } -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/stylelint_lsp.lua b/lua/lspconfig/stylelint_lsp.lua index 9028864c..26bbacda 100644 --- a/lua/lspconfig/stylelint_lsp.lua +++ b/lua/lspconfig/stylelint_lsp.lua @@ -1,26 +1,26 @@ -local configs = require('lspconfig/configs') -local util = require('lspconfig/util') +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" configs.stylelint_lsp = { default_config = { - cmd = {'stylelint-lsp', '--stdio'}, + cmd = { "stylelint-lsp", "--stdio" }, filetypes = { - 'css', - 'less', - 'scss', - 'sugarss', - 'vue', - 'wxss', - 'javascript', - 'javascriptreact', - 'typescript', - 'typescriptreact' - }; - root_dir = util.root_pattern('.stylelintrc', 'package.json'); - settings = {}; + "css", + "less", + "scss", + "sugarss", + "vue", + "wxss", + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", + }, + root_dir = util.root_pattern(".stylelintrc", "package.json"), + settings = {}, }, docs = { - package_json = "https://raw.githubusercontent.com/bmatcuk/coc-stylelintplus/master/package.json"; + package_json = "https://raw.githubusercontent.com/bmatcuk/coc-stylelintplus/master/package.json", description = [[ https://github.com/bmatcuk/stylelint-lsp @@ -41,9 +41,9 @@ require'lspconfig'.stylelint_lsp.setup{ } } ``` -]]; +]], default_config = { - root_dir = [[ root_pattern('.stylelintrc', 'package.json') ]]; - }; - }; + root_dir = [[ root_pattern('.stylelintrc', 'package.json') ]], + }, + }, } diff --git a/lua/lspconfig/sumneko_lua.lua b/lua/lspconfig/sumneko_lua.lua index 919cc7b7..a02a492e 100644 --- a/lua/lspconfig/sumneko_lua.lua +++ b/lua/lspconfig/sumneko_lua.lua @@ -1,19 +1,19 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local name = "sumneko_lua" configs[name] = { default_config = { - filetypes = {'lua'}; + filetypes = { "lua" }, root_dir = function(fname) return util.find_git_ancestor(fname) or util.path.dirname(fname) - end; - log_level = vim.lsp.protocol.MessageType.Warning; - settings = { Lua = { telemetry = { enable = false }}}; - }; + end, + log_level = vim.lsp.protocol.MessageType.Warning, + settings = { Lua = { telemetry = { enable = false } } }, + }, docs = { - package_json = "https://raw.githubusercontent.com/sumneko/vscode-lua/master/package.json"; + package_json = "https://raw.githubusercontent.com/sumneko/vscode-lua/master/package.json", description = [[ https://github.com/sumneko/lua-language-server @@ -69,10 +69,10 @@ require'lspconfig'.sumneko_lua.setup { }, } ``` -]]; +]], default_config = { - root_dir = [[root_pattern(".git") or bufdir]]; - }; - }; + root_dir = [[root_pattern(".git") or bufdir]], + }, + }, } -- vim:et ts=2 diff --git a/lua/lspconfig/svelte.lua b/lua/lspconfig/svelte.lua index 07a9eded..014c249c 100644 --- a/lua/lspconfig/svelte.lua +++ b/lua/lspconfig/svelte.lua @@ -1,15 +1,15 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" -local server_name = 'svelte' -local bin_name = 'svelteserver' +local server_name = "svelte" +local bin_name = "svelteserver" configs[server_name] = { default_config = { - cmd = {bin_name, '--stdio'}; - filetypes = {'svelte'}; - root_dir = util.root_pattern("package.json", ".git"); - }; + cmd = { bin_name, "--stdio" }, + filetypes = { "svelte" }, + root_dir = util.root_pattern("package.json", ".git"), + }, docs = { description = [[ https://github.com/sveltejs/language-tools/tree/master/packages/language-server @@ -18,11 +18,11 @@ https://github.com/sveltejs/language-tools/tree/master/packages/language-server ```sh npm install -g svelte-language-server ``` -]]; +]], default_config = { - root_dir = [[root_pattern("package.json", ".git")]]; - }; - } + root_dir = [[root_pattern("package.json", ".git")]], + }, + }, } -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/svls.lua b/lua/lspconfig/svls.lua index 924b2158..9da85c68 100644 --- a/lua/lspconfig/svls.lua +++ b/lua/lspconfig/svls.lua @@ -1,5 +1,5 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "svls" @@ -7,13 +7,13 @@ configs[server_name] = { default_config = { cmd = { "svls" }, filetypes = { "verilog", "systemverilog" }, - root_dir = util.root_pattern(".git"); - }; + root_dir = util.root_pattern ".git", + }, docs = { description = [[ https://github.com/dalance/svls Language server for verilog and SystemVerilog - ]]; - } + ]], + }, } -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/tailwindcss.lua b/lua/lspconfig/tailwindcss.lua index e020894f..4a10d8fb 100644 --- a/lua/lspconfig/tailwindcss.lua +++ b/lua/lspconfig/tailwindcss.lua @@ -1,68 +1,68 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" -local server_name = 'tailwindcss' -local bin_name = 'tailwindcss-language-server' +local server_name = "tailwindcss" +local bin_name = "tailwindcss-language-server" configs[server_name] = { default_config = { - cmd = {bin_name, '--stdio'}, + cmd = { bin_name, "--stdio" }, -- filetypes copied and adjusted from tailwindcss-intellisense filetypes = { -- html - 'aspnetcorerazor', - 'astro', - 'astro-markdown', - 'blade', - 'django-html', - 'edge', - 'eelixir', -- vim ft - 'ejs', - 'erb', - 'eruby', -- vim ft - 'gohtml', - 'haml', - 'handlebars', - 'hbs', - 'html', + "aspnetcorerazor", + "astro", + "astro-markdown", + "blade", + "django-html", + "edge", + "eelixir", -- vim ft + "ejs", + "erb", + "eruby", -- vim ft + "gohtml", + "haml", + "handlebars", + "hbs", + "html", -- 'HTML (Eex)', -- 'HTML (EEx)', - 'html-eex', - 'jade', - 'leaf', - 'liquid', - 'markdown', - 'mdx', - 'mustache', - 'njk', - 'nunjucks', - 'php', - 'razor', - 'slim', - 'twig', + "html-eex", + "jade", + "leaf", + "liquid", + "markdown", + "mdx", + "mustache", + "njk", + "nunjucks", + "php", + "razor", + "slim", + "twig", -- css - 'css', - 'less', - 'postcss', - 'sass', - 'scss', - 'stylus', - 'sugarss', + "css", + "less", + "postcss", + "sass", + "scss", + "stylus", + "sugarss", -- js - 'javascript', - 'javascriptreact', - 'reason', - 'rescript', - 'typescript', - 'typescriptreact', + "javascript", + "javascriptreact", + "reason", + "rescript", + "typescript", + "typescriptreact", -- mixed - 'vue', - 'svelte', + "vue", + "svelte", }, init_options = { userLanguages = { - eelixir = 'html-eex', - eruby = 'erb', + eelixir = "html-eex", + eruby = "erb", }, }, settings = { @@ -80,19 +80,24 @@ configs[server_name] = { }, }, on_new_config = function(new_config) - if not new_config.settings then new_config.settings = {} end - if not new_config.settings.editor then new_config.settings.editor = {} end + if not new_config.settings then + new_config.settings = {} + end + if not new_config.settings.editor then + new_config.settings.editor = {} + end if not new_config.settings.editor.tabSize then -- set tab size for hover new_config.settings.editor.tabSize = vim.lsp.util.get_effective_tabstop() end end, root_dir = function(fname) - return util.root_pattern('tailwind.config.js', 'tailwind.config.ts')(fname) or - util.root_pattern('postcss.config.js', 'postcss.config.ts')(fname) or - util.find_package_json_ancestor(fname) or - util.find_node_modules_ancestor(fname) or - util.find_git_ancestor(fname) + return util.root_pattern("tailwind.config.js", "tailwind.config.ts")(fname) or util.root_pattern( + "postcss.config.js", + "postcss.config.ts" + )(fname) or util.find_package_json_ancestor(fname) or util.find_node_modules_ancestor(fname) or util.find_git_ancestor( + fname + ) end, }, docs = { diff --git a/lua/lspconfig/terraformls.lua b/lua/lspconfig/terraformls.lua index 90c973dd..ab487afa 100644 --- a/lua/lspconfig/terraformls.lua +++ b/lua/lspconfig/terraformls.lua @@ -1,23 +1,23 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" configs.terraformls = { default_config = { - cmd = {"terraform-ls", "serve"}; - filetypes = {"terraform"}; - root_dir = util.root_pattern(".terraform", ".git"); - }; + cmd = { "terraform-ls", "serve" }, + filetypes = { "terraform" }, + root_dir = util.root_pattern(".terraform", ".git"), + }, docs = { - package_json = "https://raw.githubusercontent.com/hashicorp/vscode-terraform/master/package.json"; + package_json = "https://raw.githubusercontent.com/hashicorp/vscode-terraform/master/package.json", description = [[ https://github.com/hashicorp/terraform-ls Terraform language server Download a released binary from https://github.com/hashicorp/terraform-ls/releases. -]]; +]], default_config = { - root_dir = [[root_pattern(".terraform", ".git")]]; - }; - }; + root_dir = [[root_pattern(".terraform", ".git")]], + }, + }, } -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/texlab.lua b/lua/lspconfig/texlab.lua index 6f47ca0a..02bd8419 100644 --- a/lua/lspconfig/texlab.lua +++ b/lua/lspconfig/texlab.lua @@ -1,39 +1,44 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local lsp = vim.lsp local texlab_build_status = vim.tbl_add_reverse_lookup { - Success = 0; - Error = 1; - Failure = 2; - Cancelled = 3; + Success = 0, + Error = 1, + Failure = 2, + Cancelled = 3, } local texlab_forward_status = vim.tbl_add_reverse_lookup { - Success = 0; - Error = 1; - Failure = 2; - Unconfigured = 3; + Success = 0, + Error = 1, + Failure = 2, + Unconfigured = 3, } local function buf_build(bufnr) bufnr = util.validate_bufnr(bufnr) - local params = { textDocument = { uri = vim.uri_from_bufnr(bufnr) } } - lsp.buf_request(bufnr, 'textDocument/build', params, - function(err, _, result, _) - if err then error(tostring(err)) end - print("Build "..texlab_build_status[result.status]) - end) + local params = { textDocument = { uri = vim.uri_from_bufnr(bufnr) } } + lsp.buf_request(bufnr, "textDocument/build", params, function(err, _, result, _) + if err then + error(tostring(err)) + end + print("Build " .. texlab_build_status[result.status]) + end) end local function buf_search(bufnr) bufnr = util.validate_bufnr(bufnr) - local params = { textDocument = { uri = vim.uri_from_bufnr(bufnr) }, position = { line = vim.fn.line('.')-1, character = vim.fn.col('.') }} - lsp.buf_request(bufnr, 'textDocument/forwardSearch', params, - function(err, _, result, _) - if err then error(tostring(err)) end - print("Search "..texlab_forward_status[result.status]) - end) + local params = { + textDocument = { uri = vim.uri_from_bufnr(bufnr) }, + position = { line = vim.fn.line "." - 1, character = vim.fn.col "." }, + } + lsp.buf_request(bufnr, "textDocument/forwardSearch", params, function(err, _, result, _) + if err then + error(tostring(err)) + end + print("Search " .. texlab_forward_status[result.status]) + end) end -- bufnr isn't actually required here, but we need a valid buffer in order to @@ -50,54 +55,54 @@ end configs.texlab = { default_config = { - cmd = {"texlab"}; - filetypes = {"tex", "bib"}; + cmd = { "texlab" }, + filetypes = { "tex", "bib" }, root_dir = function(filename) return util.path.dirname(filename) - end; + end, settings = { texlab = { - rootDirectory = nil; + rootDirectory = nil, build = { - executable = "latexmk"; - args = {"-pdf", "-interaction=nonstopmode", "-synctex=1", "%f"}; - onSave = false; - forwardSearchAfter = false; - }; - auxDirectory = '.'; + executable = "latexmk", + args = { "-pdf", "-interaction=nonstopmode", "-synctex=1", "%f" }, + onSave = false, + forwardSearchAfter = false, + }, + auxDirectory = ".", forwardSearch = { - executable = nil; - args = {}; - }; + executable = nil, + args = {}, + }, chktex = { - onOpenAndSave = false; - onEdit = false; - }; - diagnosticsDelay = 300; - latexFormatter = 'latexindent'; + onOpenAndSave = false, + onEdit = false, + }, + diagnosticsDelay = 300, + latexFormatter = "latexindent", latexindent = { - ["local"] = nil; -- local is a reserved keyword - modifyLineBreaks = false; - }; - bibtexFormatter = 'texlab'; - formatterLineLength = 80; - }; - }; - }; + ["local"] = nil, -- local is a reserved keyword + modifyLineBreaks = false, + }, + bibtexFormatter = "texlab", + formatterLineLength = 80, + }, + }, + }, commands = { TexlabBuild = { function() buf_build(0) - end; - description = "Build the current buffer"; - }; + end, + description = "Build the current buffer", + }, TexlabForward = { function() - buf_search(0) - end; - description = "Forward search from current position"; - } - }; + buf_search(0) + end, + description = "Forward search from current position", + }, + }, docs = { description = [[ https://github.com/latex-lsp/texlab @@ -105,11 +110,11 @@ https://github.com/latex-lsp/texlab A completion engine built from scratch for (La)TeX. See https://github.com/latex-lsp/texlab/blob/master/docs/options.md for configuration options. -]]; +]], default_config = { - root_dir = "vim's starting directory"; - }; - }; + root_dir = "vim's starting directory", + }, + }, } configs.texlab.buf_build = buf_build diff --git a/lua/lspconfig/tflint.lua b/lua/lspconfig/tflint.lua index ce4c3c65..a58416e0 100644 --- a/lua/lspconfig/tflint.lua +++ b/lua/lspconfig/tflint.lua @@ -3,9 +3,9 @@ local util = require "lspconfig/util" configs.tflint = { default_config = { - cmd = {"tflint", "--langserver"}, - filetypes = {"terraform"}, - root_dir = util.root_pattern(".terraform", ".git", ".tflint.hcl") + cmd = { "tflint", "--langserver" }, + filetypes = { "terraform" }, + root_dir = util.root_pattern(".terraform", ".git", ".tflint.hcl"), }, docs = { description = [[ @@ -15,8 +15,8 @@ A pluggable Terraform linter that can act as lsp server. Installation instructions can be found in https://github.com/terraform-linters/tflint#installation. ]], default_config = { - root_dir = [[root_pattern(".terraform", ".git", ".tflint.hcl")]] - } - } + root_dir = [[root_pattern(".terraform", ".git", ".tflint.hcl")]], + }, + }, } -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/tsserver.lua b/lua/lspconfig/tsserver.lua index 3a00374a..8bc11973 100644 --- a/lua/lspconfig/tsserver.lua +++ b/lua/lspconfig/tsserver.lua @@ -1,21 +1,22 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "tsserver" local bin_name = "typescript-language-server" -if vim.fn.has('win32') == 1 then - bin_name = bin_name..".cmd" +if vim.fn.has "win32" == 1 then + bin_name = bin_name .. ".cmd" end configs[server_name] = { default_config = { - cmd = {bin_name, "--stdio"}; - filetypes = {"javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx"}; + cmd = { bin_name, "--stdio" }, + filetypes = { "javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx" }, root_dir = function(fname) - return util.root_pattern("tsconfig.json")(fname) or - util.root_pattern("package.json", "jsconfig.json", ".git")(fname); - end - }; + return util.root_pattern "tsconfig.json"(fname) or util.root_pattern("package.json", "jsconfig.json", ".git")( + fname + ) + end, + }, docs = { description = [[ https://github.com/theia-ide/typescript-language-server @@ -24,11 +25,11 @@ https://github.com/theia-ide/typescript-language-server ```sh npm install -g typescript typescript-language-server ``` -]]; +]], default_config = { - root_dir = [[root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git")]]; - }; - }; + root_dir = [[root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git")]], + }, + }, } -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua index c4c21c22..625d3170 100644 --- a/lua/lspconfig/util.lua +++ b/lua/lspconfig/util.lua @@ -8,16 +8,16 @@ local fn = vim.fn local M = {} M.default_config = { - log_level = lsp.protocol.MessageType.Warning; - message_level = lsp.protocol.MessageType.Warning; - settings = vim.empty_dict(); - init_options = vim.empty_dict(); - handlers = {}; + log_level = lsp.protocol.MessageType.Warning, + message_level = lsp.protocol.MessageType.Warning, + settings = vim.empty_dict(), + init_options = vim.empty_dict(), + handlers = {}, } function M.validate_bufnr(bufnr) validate { - bufnr = { bufnr, 'n' } + bufnr = { bufnr, "n" }, } return bufnr == 0 and api.nvim_get_current_buf() or bufnr end @@ -48,19 +48,21 @@ end function M.create_module_commands(module_name, commands) for command_name, def in pairs(commands) do - local parts = {"command!"} + local parts = { "command!" } -- Insert attributes. for k, v in pairs(def) do - if type(k) == 'string' and type(v) == 'boolean' and v then - table.insert(parts, "-"..k) - elseif type(k) == 'number' and type(v) == 'string' and v:match("^%-") then + if type(k) == "string" and type(v) == "boolean" and v then + table.insert(parts, "-" .. k) + elseif type(k) == "number" and type(v) == "string" and v:match "^%-" then table.insert(parts, v) end end table.insert(parts, command_name) -- The command definition. - table.insert(parts, - string.format("lua require'lspconfig'[%q].commands[%q][1](<f-args>)", module_name, command_name)) + table.insert( + parts, + string.format("lua require'lspconfig'[%q].commands[%q][1](<f-args>)", module_name, command_name) + ) api.nvim_command(table.concat(parts, " ")) end end @@ -75,8 +77,8 @@ function M.has_bins(...) end M.script_path = function() - local str = debug.getinfo(2, "S").source:sub(2) - return str:match("(.*[/\\])") + local str = debug.getinfo(2, "S").source:sub(2) + return str:match "(.*[/\\])" end -- Some path utilities @@ -87,20 +89,20 @@ M.path = (function() end local function is_dir(filename) - return exists(filename) == 'directory' + return exists(filename) == "directory" end local function is_file(filename) - return exists(filename) == 'file' + return exists(filename) == "file" end - local is_windows = uv.os_uname().version:match("Windows") + local is_windows = uv.os_uname().version:match "Windows" local path_sep = is_windows and "\\" or "/" local is_fs_root if is_windows then is_fs_root = function(path) - return path:match("^%a:$") + return path:match "^%a:$" end else is_fs_root = function(path) @@ -110,16 +112,16 @@ M.path = (function() local function is_absolute(filename) if is_windows then - return filename:match("^%a:") or filename:match("^\\\\") + return filename:match "^%a:" or filename:match "^\\\\" else - return filename:match("^/") + return filename:match "^/" end end local dirname do - local strip_dir_pat = path_sep.."([^"..path_sep.."]+)$" - local strip_sep_pat = path_sep.."$" + local strip_dir_pat = path_sep .. "([^" .. path_sep .. "]+)$" + local strip_sep_pat = path_sep .. "$" dirname = function(path) if not path or #path == 0 then return @@ -133,9 +135,7 @@ M.path = (function() end local function path_join(...) - local result = - table.concat( - vim.tbl_flatten {...}, path_sep):gsub(path_sep.."+", path_sep) + local result = table.concat(vim.tbl_flatten { ... }, path_sep):gsub(path_sep .. "+", path_sep) return result end @@ -146,7 +146,9 @@ M.path = (function() -- Just in case our algo is buggy, don't infinite loop. for _ = 1, 100 do dir = dirname(dir) - if not dir then return end + if not dir then + return + end -- If we can't ascend further, then stop looking. if cb(dir, path) then return dir, path @@ -161,42 +163,45 @@ M.path = (function() local function iterate_parents(path) path = uv.fs_realpath(path) local function it(s, v) - if not v then return end - if is_fs_root(v) then return end + if not v then + return + end + if is_fs_root(v) then + return + end return dirname(v), path end return it, path, path end local function is_descendant(root, path) - if (not path) then - return false; + if not path then + return false end local function cb(dir, _) - return dir == root; + return dir == root end - local dir, _ = traverse_parents(path, cb); + local dir, _ = traverse_parents(path, cb) - return dir == root; + return dir == root end return { - is_dir = is_dir; - is_file = is_file; - is_absolute = is_absolute; - exists = exists; - sep = path_sep; - dirname = dirname; - join = path_join; - traverse_parents = traverse_parents; - iterate_parents = iterate_parents; - is_descendant = is_descendant; + is_dir = is_dir, + is_file = is_file, + is_absolute = is_absolute, + exists = exists, + sep = path_sep, + dirname = dirname, + join = path_join, + traverse_parents = traverse_parents, + iterate_parents = iterate_parents, + is_descendant = is_descendant, } end)() - -- Returns a function(root_dir), which, when called with a root_dir it hasn't -- seen before, will call make_config(root_dir) and start a new client. function M.server_per_root_dir_manager(_make_config) @@ -204,8 +209,12 @@ function M.server_per_root_dir_manager(_make_config) local manager = {} function manager.add(root_dir) - if not root_dir then return end - if not M.path.is_dir(root_dir) then return end + if not root_dir then + return + end + if not M.path.is_dir(root_dir) then + return + end -- Check if we have a client alredy or start and store it. local client_id = clients[root_dir] @@ -213,10 +222,15 @@ function M.server_per_root_dir_manager(_make_config) local new_config = _make_config(root_dir) --TODO:mjlbach -- these prints only show up with nvim_error_writeln() if not new_config.cmd then - print(string.format("Error, cmd not defined for [%q].".. - "You must manually define a cmd for the default config for this server." - .."See server documentation.", new_config.name)) - return + print( + string.format( + "Error, cmd not defined for [%q]." + .. "You must manually define a cmd for the default config for this server." + .. "See server documentation.", + new_config.name + ) + ) + return elseif vim.fn.executable(new_config.cmd[1]) == 0 then vim.notify(string.format("cmd [%q] is not executable.", new_config.cmd[1]), vim.log.levels.Error) return @@ -245,15 +259,19 @@ function M.server_per_root_dir_manager(_make_config) end function M.search_ancestors(startpath, func) - validate { func = {func, 'f'} } - if func(startpath) then return startpath end + validate { func = { func, "f" } } + if func(startpath) then + return startpath + end for path in M.path.iterate_parents(startpath) do - if func(path) then return path end + if func(path) then + return path + end end end function M.root_pattern(...) - local patterns = vim.tbl_flatten {...} + local patterns = vim.tbl_flatten { ... } local function matcher(path) for _, pattern in ipairs(patterns) do for _, p in ipairs(vim.fn.glob(M.path.join(path, pattern), true, true)) do @@ -289,6 +307,5 @@ function M.find_package_json_ancestor(startpath) end) end - return M -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/vala_ls.lua b/lua/lspconfig/vala_ls.lua index f2aba74b..684e54a0 100644 --- a/lua/lspconfig/vala_ls.lua +++ b/lua/lspconfig/vala_ls.lua @@ -1,18 +1,18 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" -local meson_matcher = function (path) +local meson_matcher = function(path) local pattern = "meson.build" local f = vim.fn.glob(util.path.join(path, pattern)) - if f == '' then + if f == "" then return nil end for line in io.lines(f) do -- skip meson comments - if not line:match('^%s*#.*') then - local str = line:gsub('%s+', '') - if str ~= '' then - if str:match('^project%(') then + if not line:match "^%s*#.*" then + local str = line:gsub("%s+", "") + if str ~= "" then + if str:match "^project%(" then return path else break @@ -24,17 +24,17 @@ end configs.vala_ls = { default_config = { - cmd = {'vala-language-server'}, - filetypes = {'vala', 'genie'}, - root_dir = function (fname) + cmd = { "vala-language-server" }, + filetypes = { "vala", "genie" }, + root_dir = function(fname) local root = util.search_ancestors(fname, meson_matcher) return root or util.find_git_ancestor(fname) end, }, docs = { - description = 'https://github.com/benwaffle/vala-language-server', + description = "https://github.com/benwaffle/vala-language-server", default_config = { - root_dir = [[root_pattern("meson.build", ".git")]] + root_dir = [[root_pattern("meson.build", ".git")]], }, }, } diff --git a/lua/lspconfig/vimls.lua b/lua/lspconfig/vimls.lua index 70bbc305..dcbb6a8e 100644 --- a/lua/lspconfig/vimls.lua +++ b/lua/lspconfig/vimls.lua @@ -1,16 +1,16 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "vimls" local bin_name = "vim-language-server" -if vim.fn.has('win32') == 1 then - bin_name = bin_name..".cmd" +if vim.fn.has "win32" == 1 then + bin_name = bin_name .. ".cmd" end configs[server_name] = { default_config = { - cmd = {bin_name, "--stdio"}, - filetypes = {"vim"}, + cmd = { bin_name, "--stdio" }, + filetypes = { "vim" }, root_dir = function(fname) return util.find_git_ancestor(fname) or vim.fn.getcwd() end, @@ -18,14 +18,14 @@ configs[server_name] = { iskeyword = "@,48-57,_,192-255,-#", vimruntime = "", runtimepath = "", - diagnostic = {enable = true}, + diagnostic = { enable = true }, indexes = { runtimepath = true, gap = 100, count = 3, - projectRootPatterns = {"runtime", "nvim", ".git", "autoload", "plugin"} + projectRootPatterns = { "runtime", "nvim", ".git", "autoload", "plugin" }, }, - suggest = {fromVimruntime = true, fromRuntimepath = true} + suggest = { fromVimruntime = true, fromRuntimepath = true }, }, }, docs = { @@ -36,8 +36,8 @@ You can install vim-language-server via npm: ```sh npm install -g vim-language-server ``` -]] - } +]], + }, } -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/vls.lua b/lua/lspconfig/vls.lua index fff37205..eb3c0add 100644 --- a/lua/lspconfig/vls.lua +++ b/lua/lspconfig/vls.lua @@ -1,13 +1,13 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local name = "vls" configs[name] = { default_config = { - filetypes = {"vlang"}; - root_dir = util.root_pattern("v.mod", ".git"); - }; + filetypes = { "vlang" }, + root_dir = util.root_pattern("v.mod", ".git"), + }, docs = { description = [[ https://github.com/vlang/vls @@ -27,10 +27,10 @@ require'lspconfig'.vls.setup { cmd = {vls_binary}, } ``` -]]; +]], default_config = { - root_dir = [[root_pattern("v.mod", ".git")]]; - }; - }; + root_dir = [[root_pattern("v.mod", ".git")]], + }, + }, } -- vim:et ts=2 diff --git a/lua/lspconfig/vuels.lua b/lua/lspconfig/vuels.lua index 146387e1..296f04ac 100644 --- a/lua/lspconfig/vuels.lua +++ b/lua/lspconfig/vuels.lua @@ -1,55 +1,55 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "vuels" local bin_name = "vls" configs[server_name] = { default_config = { - cmd = {bin_name}; - filetypes = {"vue"}; - root_dir = util.root_pattern("package.json", "vue.config.js"); + cmd = { bin_name }, + filetypes = { "vue" }, + root_dir = util.root_pattern("package.json", "vue.config.js"), init_options = { config = { vetur = { - useWorkspaceDependencies = false; + useWorkspaceDependencies = false, validation = { - template = true; - style = true; - script = true; - }; + template = true, + style = true, + script = true, + }, completion = { - autoImport = false; - useScaffoldSnippets = false; - tagCasing = "kebab"; - }; + autoImport = false, + useScaffoldSnippets = false, + tagCasing = "kebab", + }, format = { defaultFormatter = { - js = "none"; - ts = "none"; - }; - defaultFormatterOptions = {}; - scriptInitialIndent = false; - styleInitialIndent = false; - } - }; - css = {}; + js = "none", + ts = "none", + }, + defaultFormatterOptions = {}, + scriptInitialIndent = false, + styleInitialIndent = false, + }, + }, + css = {}, html = { - suggest = {}; - }; + suggest = {}, + }, javascript = { - format = {}; - }; + format = {}, + }, typescript = { - format = {}; - }; - emmet = {}; - stylusSupremacy = {}; - }; - }; - }; + format = {}, + }, + emmet = {}, + stylusSupremacy = {}, + }, + }, + }, docs = { - package_json = "https://raw.githubusercontent.com/vuejs/vetur/master/package.json"; + package_json = "https://raw.githubusercontent.com/vuejs/vetur/master/package.json", description = [[ https://github.com/vuejs/vetur/tree/master/server @@ -58,49 +58,49 @@ Vue language server(vls) ```sh npm install -g vls ``` -]]; +]], default_config = { - root_dir = [[root_pattern("package.json", "vue.config.js")]]; + root_dir = [[root_pattern("package.json", "vue.config.js")]], init_options = { config = { vetur = { - useWorkspaceDependencies = false; + useWorkspaceDependencies = false, validation = { - template = true; - style = true; - script = true; - }; + template = true, + style = true, + script = true, + }, completion = { - autoImport = false; - useScaffoldSnippets = false; - tagCasing = "kebab"; - }; + autoImport = false, + useScaffoldSnippets = false, + tagCasing = "kebab", + }, format = { defaultFormatter = { - js = "none"; - ts = "none"; - }; - defaultFormatterOptions = {}; - scriptInitialIndent = false; - styleInitialIndent = false; - } - }; - css = {}; + js = "none", + ts = "none", + }, + defaultFormatterOptions = {}, + scriptInitialIndent = false, + styleInitialIndent = false, + }, + }, + css = {}, html = { - suggest = {}; - }; + suggest = {}, + }, javascript = { - format = {}; - }; + format = {}, + }, typescript = { - format = {}; - }; - emmet = {}; - stylusSupremacy = {}; - }; - }; - }; - }; + format = {}, + }, + emmet = {}, + stylusSupremacy = {}, + }, + }, + }, + }, } -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/yamlls.lua b/lua/lspconfig/yamlls.lua index fcbd9b59..f20ced67 100644 --- a/lua/lspconfig/yamlls.lua +++ b/lua/lspconfig/yamlls.lua @@ -1,17 +1,17 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "yamlls" local bin_name = "yaml-language-server" configs[server_name] = { default_config = { - cmd = {bin_name, "--stdio"}; - filetypes = {"yaml"}; - root_dir = util.root_pattern(".git", vim.fn.getcwd()); - }; + cmd = { bin_name, "--stdio" }, + filetypes = { "yaml" }, + root_dir = util.root_pattern(".git", vim.fn.getcwd()), + }, docs = { - package_json = "https://raw.githubusercontent.com/redhat-developer/vscode-yaml/master/package.json"; + package_json = "https://raw.githubusercontent.com/redhat-developer/vscode-yaml/master/package.json", description = [[ https://github.com/redhat-developer/yaml-language-server @@ -19,11 +19,11 @@ https://github.com/redhat-developer/yaml-language-server ```sh npm install -g yaml-language-server ``` -]]; +]], default_config = { - root_dir = [[root_pattern(".git", vim.fn.getcwd())]]; - }; - }; + root_dir = [[root_pattern(".git", vim.fn.getcwd())]], + }, + }, } -- vim:et ts=2 sw=2 diff --git a/lua/lspconfig/zeta_note.lua b/lua/lspconfig/zeta_note.lua index 1057a927..0cafdbab 100644 --- a/lua/lspconfig/zeta_note.lua +++ b/lua/lspconfig/zeta_note.lua @@ -1,15 +1,15 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local server_name = "zeta_note" configs[server_name] = { default_config = { - filetypes = {"markdown"}; - root_dir = util.root_pattern(".zeta.toml"); - }; + filetypes = { "markdown" }, + root_dir = util.root_pattern ".zeta.toml", + }, docs = { - package_json = "https://raw.githubusercontent.com/artempyanykh/zeta-note-vscode/main/package.json"; + package_json = "https://raw.githubusercontent.com/artempyanykh/zeta-note-vscode/main/package.json", description = [[ https://github.com/artempyanykh/zeta-note @@ -24,9 +24,9 @@ require'lspconfig'.zeta_note.setup{ cmd = {'path/to/zeta-note'} } ``` -]]; +]], default_config = { - root_dir = [[root_pattern(".zeta.toml")]]; - }; - }; + root_dir = [[root_pattern(".zeta.toml")]], + }, + }, } diff --git a/lua/lspconfig/zls.lua b/lua/lspconfig/zls.lua index 66668050..659f36f2 100644 --- a/lua/lspconfig/zls.lua +++ b/lua/lspconfig/zls.lua @@ -1,22 +1,22 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" configs.zls = { - default_config = { - cmd = {"zls"}; - filetypes = {"zig", "zir"}; - root_dir = function(fname) - return util.root_pattern("zls.json", ".git")(fname) or util.path.dirname(fname) - end - }; - docs = { - description = [[ + default_config = { + cmd = { "zls" }, + filetypes = { "zig", "zir" }, + root_dir = function(fname) + return util.root_pattern("zls.json", ".git")(fname) or util.path.dirname(fname) + end, + }, + docs = { + description = [[ https://github.com/zigtools/zls `Zig LSP implementation + Zig Language Server`. - ]]; - default_config = { - root_dir = [[util.root_pattern("zls.json", ".git") or current_file_dirname]]; - }; - }; -}; + ]], + default_config = { + root_dir = [[util.root_pattern("zls.json", ".git") or current_file_dirname]], + }, + }, +} |
