aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.stylua.toml2
-rw-r--r--lua/lspconfig.lua32
-rw-r--r--lua/lspconfig/_lspui.lua32
-rw-r--r--lua/lspconfig/als.lua18
-rw-r--r--lua/lspconfig/angularls.lua28
-rw-r--r--lua/lspconfig/bashls.lua12
-rw-r--r--lua/lspconfig/beancount.lua14
-rw-r--r--lua/lspconfig/ccls.lua10
-rw-r--r--lua/lspconfig/clangd.lua22
-rw-r--r--lua/lspconfig/clojure_lsp.lua10
-rw-r--r--lua/lspconfig/cmake.lua12
-rw-r--r--lua/lspconfig/codeqlls.lua28
-rw-r--r--lua/lspconfig/configs.lua58
-rw-r--r--lua/lspconfig/crystalline.lua10
-rw-r--r--lua/lspconfig/cssls.lua14
-rw-r--r--lua/lspconfig/dartls.lua38
-rw-r--r--lua/lspconfig/denols.lua58
-rw-r--r--lua/lspconfig/dhall_lsp_server.lua10
-rw-r--r--lua/lspconfig/diagnosticls.lua14
-rw-r--r--lua/lspconfig/dockerls.lua14
-rw-r--r--lua/lspconfig/dotls.lua14
-rw-r--r--lua/lspconfig/efm.lua10
-rw-r--r--lua/lspconfig/elixirls.lua12
-rw-r--r--lua/lspconfig/elmls.lua28
-rw-r--r--lua/lspconfig/ember.lua14
-rw-r--r--lua/lspconfig/erlangls.lua10
-rw-r--r--lua/lspconfig/flow.lua12
-rw-r--r--lua/lspconfig/fortls.lua12
-rw-r--r--lua/lspconfig/fsautocomplete.lua12
-rw-r--r--lua/lspconfig/gdscript.lua10
-rw-r--r--lua/lspconfig/ghcide.lua10
-rw-r--r--lua/lspconfig/gopls.lua10
-rw-r--r--lua/lspconfig/graphql.lua14
-rw-r--r--lua/lspconfig/groovyls.lua22
-rw-r--r--lua/lspconfig/haxe_language_server.lua14
-rw-r--r--lua/lspconfig/health.lua10
-rw-r--r--lua/lspconfig/hie.lua12
-rw-r--r--lua/lspconfig/hls.lua16
-rw-r--r--lua/lspconfig/html.lua16
-rw-r--r--lua/lspconfig/intelephense.lua14
-rw-r--r--lua/lspconfig/java_language_server.lua10
-rw-r--r--lua/lspconfig/jdtls.lua84
-rw-r--r--lua/lspconfig/jedi_language_server.lua6
-rw-r--r--lua/lspconfig/jsonls.lua16
-rw-r--r--lua/lspconfig/julials.lua20
-rw-r--r--lua/lspconfig/kotlin_language_server.lua28
-rw-r--r--lua/lspconfig/lean3ls.lua12
-rw-r--r--lua/lspconfig/leanls.lua12
-rw-r--r--lua/lspconfig/lspinfo.lua92
-rw-r--r--lua/lspconfig/metals.lua14
-rw-r--r--lua/lspconfig/nimls.lua12
-rw-r--r--lua/lspconfig/ocamlls.lua14
-rw-r--r--lua/lspconfig/ocamllsp.lua18
-rw-r--r--lua/lspconfig/omnisharp.lua10
-rw-r--r--lua/lspconfig/perlls.lua34
-rw-r--r--lua/lspconfig/perlpls.lua12
-rw-r--r--lua/lspconfig/phpactor.lua16
-rw-r--r--lua/lspconfig/powershell_es.lua14
-rw-r--r--lua/lspconfig/prismals.lua20
-rw-r--r--lua/lspconfig/puppet.lua20
-rw-r--r--lua/lspconfig/purescriptls.lua20
-rw-r--r--lua/lspconfig/pyls.lua8
-rw-r--r--lua/lspconfig/pyls_ms.lua12
-rw-r--r--lua/lspconfig/pylsp.lua18
-rw-r--r--lua/lspconfig/pyright.lua34
-rw-r--r--lua/lspconfig/r_language_server.lua10
-rw-r--r--lua/lspconfig/racket_langserver.lua10
-rw-r--r--lua/lspconfig/rescriptls.lua10
-rw-r--r--lua/lspconfig/rls.lua10
-rw-r--r--lua/lspconfig/rnix.lua10
-rw-r--r--lua/lspconfig/rome.lua18
-rw-r--r--lua/lspconfig/rust_analyzer.lua28
-rw-r--r--lua/lspconfig/scry.lua10
-rw-r--r--lua/lspconfig/solargraph.lua18
-rw-r--r--lua/lspconfig/sorbet.lua14
-rw-r--r--lua/lspconfig/sourcekit.lua12
-rw-r--r--lua/lspconfig/sqlls.lua10
-rw-r--r--lua/lspconfig/sqls.lua10
-rw-r--r--lua/lspconfig/stylelint_lsp.lua30
-rw-r--r--lua/lspconfig/sumneko_lua.lua10
-rw-r--r--lua/lspconfig/svelte.lua14
-rw-r--r--lua/lspconfig/svls.lua12
-rw-r--r--lua/lspconfig/tailwindcss.lua118
-rw-r--r--lua/lspconfig/terraformls.lua12
-rw-r--r--lua/lspconfig/texlab.lua34
-rw-r--r--lua/lspconfig/tflint.lua10
-rw-r--r--lua/lspconfig/tsserver.lua20
-rw-r--r--lua/lspconfig/util.lua60
-rw-r--r--lua/lspconfig/vala_ls.lua22
-rw-r--r--lua/lspconfig/vimls.lua24
-rw-r--r--lua/lspconfig/vls.lua10
-rw-r--r--lua/lspconfig/vuels.lua26
-rw-r--r--lua/lspconfig/yamlls.lua16
-rw-r--r--lua/lspconfig/zeta_note.lua12
-rw-r--r--lua/lspconfig/zls.lua10
-rw-r--r--scripts/docgen.lua130
-rw-r--r--scripts/vimdocgen.lua22
-rw-r--r--test/lspconfig_spec.lua52
-rw-r--r--test/minimal_init.lua60
99 files changed, 1069 insertions, 1069 deletions
diff --git a/.stylua.toml b/.stylua.toml
index df96b7b0..e548311d 100644
--- a/.stylua.toml
+++ b/.stylua.toml
@@ -2,5 +2,5 @@ column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
-quote_style = "AutoPreferDouble"
+quote_style = "AutoPreferSingle"
no_call_parentheses = true
diff --git a/lua/lspconfig.lua b/lua/lspconfig.lua
index 7d6ae4cf..75bf26bd 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,30 +18,30 @@ function M._root._setup()
M._root.commands = {
LspInfo = {
function()
- require "lspconfig/lspinfo"()
+ require 'lspconfig/lspinfo'()
end,
- "-nargs=0",
- description = "`:LspInfo` Displays attached, active, and configured language servers",
+ '-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.",
+ '-nargs=? -complete=custom,v:lua.lsp_complete_configured_servers',
+ description = '`:LspStart` Manually launches a language server.',
},
LspStop = {
function(client_id)
@@ -54,8 +54,8 @@ function M._root._setup()
end
end
end,
- "-nargs=? -complete=customlist,v:lua.lsp_get_active_client_ids",
- description = "`:LspStop` Manually stops the given language client.",
+ '-nargs=? -complete=customlist,v:lua.lsp_get_active_client_ids',
+ description = '`:LspStop` Manually stops the given language client.',
},
LspRestart = {
function(client_id)
@@ -71,16 +71,16 @@ function M._root._setup()
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.",
+ '-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)
+ M.util.create_module_commands('_root', M._root.commands)
end
local mt = {}
@@ -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 a79b9293..51c8fae9 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",
+ relative = 'editor',
row = top,
col = left,
width = width,
height = height,
- style = "minimal",
+ style = 'minimal',
}
return opts
@@ -57,15 +57,15 @@ function win_float.percentage_range_window(col_range, row_range, options)
options = apply_defaults(options, win_float.default_options)
local win_opts = win_float.default_opts(options)
- win_opts.relative = "editor"
+ 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
@@ -76,12 +76,12 @@ function win_float.percentage_range_window(col_range, row_range, options)
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 8940dd12..e4eaf1c7 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" },
+ 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
diff --git a/lua/lspconfig/angularls.lua b/lua/lspconfig/angularls.lua
index 4acec89c..5c7120d8 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,29 +17,29 @@ local default_probe_dir = get_probe_dir(vim.fn.getcwd())
configs[server_name] = {
default_config = {
cmd = {
- "ngserver",
- "--stdio",
- "--tsProbeLocations",
+ 'ngserver',
+ '--stdio',
+ '--tsProbeLocations',
default_probe_dir,
- "--ngProbeLocations",
+ '--ngProbeLocations',
default_probe_dir,
},
- filetypes = { "typescript", "html", "typescriptreact", "typescript.tsx" },
+ 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",
+ 'ngserver',
+ '--stdio',
+ '--tsProbeLocations',
new_probe_dir,
- "--ngProbeLocations",
+ '--ngProbeLocations',
new_probe_dir,
}
end,
diff --git a/lua/lspconfig/bashls.lua b/lua/lspconfig/bashls.lua
index 5990f104..22452d31 100644
--- a/lua/lspconfig/bashls.lua
+++ b/lua/lspconfig/bashls.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 server_name = "bashls"
+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" },
+ filetypes = { 'sh' },
root_dir = util.path.dirname,
},
docs = {
diff --git a/lua/lspconfig/beancount.lua b/lua/lspconfig/beancount.lua
index fdbdd3f1..1436b7c8 100644
--- a/lua/lspconfig/beancount.lua
+++ b/lua/lspconfig/beancount.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 = "beancount"
-local bin_name = "beancount-langserver"
+local server_name = 'beancount'
+local bin_name = 'beancount-langserver'
configs[server_name] = {
default_config = {
cmd = { bin_name },
- filetypes = { "beancount" },
+ filetypes = { 'beancount' },
root_dir = function(fname)
return util.find_git_ancestor(fname) or util.path.dirname(fname)
end,
init_options = {
-- this is the path to the beancout journal file
- journalFile = "",
+ journalFile = '',
-- this is the path to the pyton binary with beancount installed
- pythonPath = "python3",
+ pythonPath = 'python3',
},
},
docs = {
diff --git a/lua/lspconfig/ccls.lua b/lua/lspconfig/ccls.lua
index 120253c3..bb9a02d1 100644
--- a/lua/lspconfig/ccls.lua
+++ b/lua/lspconfig/ccls.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.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)
+ return util.root_pattern('compile_commands.json', 'compile_flags.txt', '.git')(fname) or util.path.dirname(fname)
end,
},
docs = {
diff --git a/lua/lspconfig/clangd.lua b/lua/lspconfig/clangd.lua
index c5f756bc..b2fcae81 100644
--- a/lua/lspconfig/clangd.lua
+++ b/lua/lspconfig/clangd.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'
-- 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)
+ 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"
+ print 'Corresponding file cannot be determined'
return
end
- vim.api.nvim_command("edit " .. vim.uri_to_fname(result))
+ 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 root_pattern = util.root_pattern('compile_commands.json', 'compile_flags.txt', '.git')
local default_capabilities = vim.tbl_deep_extend(
- "force",
+ 'force',
util.default_config.capabilities or vim.lsp.protocol.make_client_capabilities(),
{
textDocument = {
@@ -28,14 +28,14 @@ local default_capabilities = vim.tbl_deep_extend(
editsNearCursor = true,
},
},
- offsetEncoding = { "utf-8", "utf-16" },
+ 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)
return root_pattern(filename) or util.path.dirname(filename)
@@ -52,7 +52,7 @@ configs.clangd = {
function()
switch_source_header(0)
end,
- description = "Switch between source/header",
+ description = 'Switch between source/header',
},
},
docs = {
diff --git a/lua/lspconfig/clojure_lsp.lua b/lua/lspconfig/clojure_lsp.lua
index df7f7419..891ffb37 100644
--- a/lua/lspconfig/clojure_lsp.lua
+++ b/lua/lspconfig/clojure_lsp.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.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 = [[
diff --git a/lua/lspconfig/cmake.lua b/lua/lspconfig/cmake.lua
index 17039563..032aab87 100644
--- a/lua/lspconfig/cmake.lua
+++ b/lua/lspconfig/cmake.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.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)
+ return util.root_pattern('.git', 'compile_commands.json', 'build')(fname) or util.path.dirname(fname)
end,
init_options = {
- buildDirectory = "build",
+ buildDirectory = 'build',
},
},
docs = {
diff --git a/lua/lspconfig/codeqlls.lua b/lua/lspconfig/codeqlls.lua
index 5a3f6e83..5bb13a48 100644
--- a/lua/lspconfig/codeqlls.lua
+++ b/lua/lspconfig/codeqlls.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 = "codeqlls"
+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" },
+ 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"] = {
+ initialize_params['workspaceFolders'] = {
{
- name = "workspace",
- uri = initialize_params["rootUri"],
+ name = 'workspace',
+ uri = initialize_params['rootUri'],
},
}
end,
@@ -40,14 +40,14 @@ https://github.com/github/codeql-cli-binaries
},
},
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="
+ 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) .. ":"
+ search_path = search_path .. vim.fn.expand(path) .. ':'
end
- config.cmd = { "codeql", "execute", "language-server", "--check-errors", "ON_CHANGE", "-q", search_path }
+ 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" }
+ 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 28202df6..ee434028 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
@@ -25,36 +25,36 @@ function configs.__newindex(t, config_name, config_def)
local M = {}
- local default_config = tbl_extend("keep", config_def.default_config, util.default_config)
+ local default_config = tbl_extend('keep', config_def.default_config, util.default_config)
-- Force this part.
default_config.name = config_name
function M.setup(config)
validate {
- cmd = { config.cmd, "t", true },
- 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', true },
+ 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
- config = tbl_extend("keep", config, default_config)
+ config = tbl_extend('keep', config, default_config)
local trigger
if config.filetypes then
- trigger = "FileType " .. table.concat(config.filetypes, ",")
+ trigger = 'FileType ' .. table.concat(config.filetypes, ',')
else
- trigger = "BufReadPost *"
+ 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))
@@ -65,13 +65,13 @@ function configs.__newindex(t, config_name, config_def)
function M.autostart()
local root_dir = get_root_dir(api.nvim_buf_get_name(0), api.nvim_get_current_buf())
if not root_dir then
- vim.notify(string.format("Autostart for %s failed: matching root directory not detected.", config_name))
+ 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 .. "/*",
+ 'BufReadPost ' .. root_dir .. '/*',
config.name
)
)
@@ -100,10 +100,10 @@ function configs.__newindex(t, config_name, config_def)
end
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)
+ 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.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,
},
@@ -124,7 +124,7 @@ function configs.__newindex(t, config_name, config_def)
if vim.tbl_isempty(settings) then
settings = { [vim.type_idx] = vim.types.dictionary }
end
- return client.notify("workspace/didChangeConfiguration", {
+ return client.notify('workspace/didChangeConfiguration', {
settings = settings,
})
end
@@ -161,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, "buftype") == "nofile" then
+ if vim.api.nvim_buf_get_option(bufnr, 'buftype') == 'nofile' then
return
end
local root_dir = get_root_dir(api.nvim_buf_get_name(bufnr), bufnr)
@@ -172,7 +172,7 @@ function configs.__newindex(t, config_name, config_def)
end
function manager.try_add_wrapper(bufnr)
- local buf_filetype = vim.api.nvim_buf_get_option(bufnr, "filetype")
+ local buf_filetype = vim.api.nvim_buf_get_option(bufnr, 'filetype')
for _, filetype in ipairs(config.filetypes) do
if buf_filetype == filetype then
manager.try_add(bufnr)
@@ -199,7 +199,7 @@ function configs.__newindex(t, config_name, config_def)
client.config._on_attach(client, bufnr)
end
if client.config.commands and not vim.tbl_isempty(client.config.commands) then
- M.commands = vim.tbl_deep_extend("force", M.commands, client.config.commands)
+ M.commands = vim.tbl_deep_extend('force', M.commands, client.config.commands)
end
if not M.commands_created and not vim.tbl_isempty(M.commands) then
-- Create the module commands
diff --git a/lua/lspconfig/crystalline.lua b/lua/lspconfig/crystalline.lua
index 15bb17a7..8943937d 100644
--- a/lua/lspconfig/crystalline.lua
+++ b/lua/lspconfig/crystalline.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.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)
+ return util.root_pattern 'shard.yml'(fname) or util.find_git_ancestor(fname) or util.path.dirname(fname)
end,
},
docs = {
diff --git a/lua/lspconfig/cssls.lua b/lua/lspconfig/cssls.lua
index bb189111..098727a0 100644
--- a/lua/lspconfig/cssls.lua
+++ b/lua/lspconfig/cssls.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 = "cssls"
-local bin_name = "vscode-css-language-server"
+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,
diff --git a/lua/lspconfig/dartls.lua b/lua/lspconfig/dartls.lua
index e7da8665..aaf9dcc3 100644
--- a/lua/lspconfig/dartls.lua
+++ b/lua/lspconfig/dartls.lua
@@ -1,27 +1,27 @@
-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 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")
- 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")
+ 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')
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 dart_sdk_root_path = vim.fn['fnamemodify'](find_dart_sdk_root_path(), ':h')
+ local snapshot = dart_sdk_root_path .. '/snapshots/analysis_server.dart.snapshot'
- if vim.fn["has"] "win32" == 1 or vim.fn["has"] "win64" == 1 then
- snapshot = snapshot:gsub("/", "\\")
+ if vim.fn['has'] 'win32' == 1 or vim.fn['has'] 'win64' == 1 then
+ snapshot = snapshot:gsub('/', '\\')
end
return snapshot
@@ -29,9 +29,9 @@ 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,
@@ -41,7 +41,7 @@ configs[server_name] = {
},
},
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
diff --git a/lua/lspconfig/denols.lua b/lua/lspconfig/denols.lua
index 2f74f38c..62e26ac1 100644
--- a/lua/lspconfig/denols.lua
+++ b/lua/lspconfig/denols.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 lsp = vim.lsp
-local server_name = "denols"
+local server_name = 'denols'
local function deno_uri_to_uri(uri)
-- denols returns deno:/https/deno.land/std%400.85.0/http/server.ts
-- nvim-lsp only handles deno://
- if string.sub(uri, 1, 6) == "deno:/" and string.sub(uri, 7, 7) ~= "/" then
- return string.gsub(uri, "^deno:/", "deno://", 1)
+ if string.sub(uri, 1, 6) == 'deno:/' and string.sub(uri, 7, 7) ~= '/' then
+ return string.gsub(uri, '^deno:/', 'deno://', 1)
end
return uri
end
@@ -16,17 +16,17 @@ end
local function uri_to_deno_uri(uri)
-- denols use deno:/ and nvim-lsp use deno:// as buffer_uri.
-- When buffer_uri is deno://, change uri to deno:/.
- if string.sub(uri, 1, 7) == "deno://" and string.sub(uri, 8, 8) ~= "/" then
- return string.gsub(uri, "^deno://", "deno:/", 1)
+ if string.sub(uri, 1, 7) == 'deno://' and string.sub(uri, 8, 8) ~= '/' then
+ return string.gsub(uri, '^deno://', 'deno:/', 1)
end
return uri
end
local function buf_cache(bufnr)
local params = {}
- params["referrer"] = { uri = vim.uri_from_bufnr(bufnr) }
- params["uris"] = {}
- lsp.buf_request(bufnr, "deno/cache", params, function(err)
+ 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
@@ -39,7 +39,7 @@ local function virtual_text_document_handler(uri, result)
end
for client_id, res in pairs(result) do
- local lines = vim.split(res.result, "\n")
+ 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)
@@ -48,9 +48,9 @@ local function virtual_text_document_handler(uri, result)
end
vim.api.nvim_buf_set_lines(bufnr, 0, -1, nil, lines)
- vim.api.nvim_buf_set_option(bufnr, "readonly", true)
- vim.api.nvim_buf_set_option(bufnr, "modified", false)
- vim.api.nvim_buf_set_option(bufnr, "modifiable", false)
+ vim.api.nvim_buf_set_option(bufnr, 'readonly', true)
+ vim.api.nvim_buf_set_option(bufnr, 'modified', false)
+ vim.api.nvim_buf_set_option(bufnr, 'modifiable', false)
lsp.buf_attach_client(bufnr, client_id)
end
end
@@ -61,7 +61,7 @@ local function virtual_text_document(uri)
uri = uri,
},
}
- local result = lsp.buf_request_sync(0, "deno/virtualTextDocument", params)
+ local result = lsp.buf_request_sync(0, 'deno/virtualTextDocument', params)
virtual_text_document_handler(uri, result)
end
@@ -72,10 +72,10 @@ local function denols_handler(err, method, result)
for _, res in pairs(result) do
local uri = res.uri or res.targetUri
- if string.sub(uri, 1, 6) == "deno:/" then
+ 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
@@ -85,51 +85,51 @@ end
local function denols_definition()
local params = lsp.util.make_position_params()
params.textDocument.uri = uri_to_deno_uri(params.textDocument.uri)
- lsp.buf_request(0, "textDocument/definition", params)
+ lsp.buf_request(0, 'textDocument/definition', params)
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,
}
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,
},
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.",
+ 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.",
+ 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.",
+ description = 'Cache a module and all of its dependencies.',
},
},
docs = {
diff --git a/lua/lspconfig/dhall_lsp_server.lua b/lua/lspconfig/dhall_lsp_server.lua
index a2c5b1b2..761d2b46 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 = {
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
diff --git a/lua/lspconfig/diagnosticls.lua b/lua/lspconfig/diagnosticls.lua
index 6b865ba0..ae5fa884 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"
+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,
},
@@ -17,9 +17,9 @@ https://github.com/iamcco/diagnostic-languageserver
Diagnostic language server integrate with linters.
]],
default_config = {
- filetypes = "Empty by default, override to add filetypes",
+ 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",
+ 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 dcf80b90..927424e8 100644
--- a/lua/lspconfig/dockerls.lua
+++ b/lua/lspconfig/dockerls.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 = "dockerls"
-local bin_name = "docker-langserver"
+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 = [[
diff --git a/lua/lspconfig/dotls.lua b/lua/lspconfig/dotls.lua
index 90ddde7e..6bd47f0c 100644
--- a/lua/lspconfig/dotls.lua
+++ b/lua/lspconfig/dotls.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 = "dotls"
-local bin_name = "dot-language-server"
+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,
diff --git a/lua/lspconfig/efm.lua b/lua/lspconfig/efm.lua
index cde64424..6a48690e 100644
--- a/lua/lspconfig/efm.lua
+++ b/lua/lspconfig/efm.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 = "efm"
-local bin_name = "efm-langserver"
+local server_name = 'efm'
+local bin_name = 'efm-langserver'
configs[server_name] = {
default_config = {
cmd = { bin_name },
root_dir = function(fname)
- return util.root_pattern ".git"(fname) or util.path.dirname(fname)
+ return util.root_pattern '.git'(fname) or util.path.dirname(fname)
end,
},
diff --git a/lua/lspconfig/elixirls.lua b/lua/lspconfig/elixirls.lua
index 6aab6ab4..26f90a10 100644
--- a/lua/lspconfig/elixirls.lua
+++ b/lua/lspconfig/elixirls.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 = "elixirls"
+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()
+ 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",
+ package_json = 'https://raw.githubusercontent.com/JakeBecker/vscode-elixir-ls/master/package.json',
description = [[
https://github.com/elixir-lsp/elixir-ls
diff --git a/lua/lspconfig/elmls.lua b/lua/lspconfig/elmls.lua
index 415d5eb3..7bc62290 100644
--- a/lua/lspconfig/elmls.lua
+++ b/lua/lspconfig/elmls.lua
@@ -1,35 +1,35 @@
-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
-local server_name = "elmls"
-local bin_name = "elm-language-server"
+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 },
-- 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,
init_options = {
- elmPath = "elm",
- elmFormatPath = "elm-format",
- elmTestPath = "elm-test",
- elmAnalyseTrigger = "change",
+ 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
diff --git a/lua/lspconfig/ember.lua b/lua/lspconfig/ember.lua
index 3536d97e..d042eca6 100644
--- a/lua/lspconfig/ember.lua
+++ b/lua/lspconfig/ember.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 = "ember"
-local bin_name = "ember-language-server"
+local server_name = 'ember'
+local bin_name = 'ember-language-server'
configs[server_name] = {
default_config = {
- cmd = { bin_name, "--stdio" },
- filetypes = { "handlebars", "typescript", "javascript" },
- root_dir = util.root_pattern("ember-cli-build.js", ".git"),
+ cmd = { bin_name, '--stdio' },
+ filetypes = { 'handlebars', 'typescript', 'javascript' },
+ root_dir = util.root_pattern('ember-cli-build.js', '.git'),
},
docs = {
description = [[
diff --git a/lua/lspconfig/erlangls.lua b/lua/lspconfig/erlangls.lua
index d8e3703e..a161a194 100644
--- a/lua/lspconfig/erlangls.lua
+++ b/lua/lspconfig/erlangls.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.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)
+ return util.root_pattern('rebar.config', 'erlang.mk', '.git')(fname) or util.path.dirname(fname)
end,
},
docs = {
diff --git a/lua/lspconfig/flow.lua b/lua/lspconfig/flow.lua
index de2b7984..2a4bd880 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
diff --git a/lua/lspconfig/fortls.lua b/lua/lspconfig/fortls.lua
index ad9725c4..404a0f5c 100644
--- a/lua/lspconfig/fortls.lua
+++ b/lua/lspconfig/fortls.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'
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
diff --git a/lua/lspconfig/fsautocomplete.lua b/lua/lspconfig/fsautocomplete.lua
index 57dcfdcb..0c3fe851 100644
--- a/lua/lspconfig/fsautocomplete.lua
+++ b/lua/lspconfig/fsautocomplete.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 server_name = "fsautocomplete"
+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,
},
diff --git a/lua/lspconfig/gdscript.lua b/lua/lspconfig/gdscript.lua
index 3e0ea264..b39de1a2 100644
--- a/lua/lspconfig/gdscript.lua
+++ b/lua/lspconfig/gdscript.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.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 = [[
diff --git a/lua/lspconfig/ghcide.lua b/lua/lspconfig/ghcide.lua
index 376543f2..04d782c7 100644
--- a/lua/lspconfig/ghcide.lua
+++ b/lua/lspconfig/ghcide.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.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 = {
diff --git a/lua/lspconfig/gopls.lua b/lua/lspconfig/gopls.lua
index 9c9c2bbb..abbf21e3 100644
--- a/lua/lspconfig/gopls.lua
+++ b/lua/lspconfig/gopls.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.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;
diff --git a/lua/lspconfig/graphql.lua b/lua/lspconfig/graphql.lua
index aa84413d..6a93c6f8 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 329fb36a..13004bda 100644
--- a/lua/lspconfig/groovyls.lua
+++ b/lua/lspconfig/groovyls.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 name = "groovyls"
-local bin_name = "groovy-language-server-all.jar"
+local name = 'groovyls'
+local bin_name = 'groovy-language-server-all.jar'
configs[name] = {
default_config = {
cmd = {
- "java",
- "-jar",
+ '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 = [[
@@ -36,11 +36,11 @@ require'lspconfig'.groovyls.setup{
]],
default_config = {
cmd = {
- "java",
- "-jar",
+ 'java',
+ '-jar',
bin_name,
},
- filetypes = { "groovy" },
+ filetypes = { 'groovy' },
root_dir = [[root_pattern(".git") or vim.loop.os_homedir()]],
},
},
diff --git a/lua/lspconfig/haxe_language_server.lua b/lua/lspconfig/haxe_language_server.lua
index 24d1cd73..fd3bdc21 100644
--- a/lua/lspconfig/haxe_language_server.lua
+++ b/lua/lspconfig/haxe_language_server.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'
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 = {
diff --git a/lua/lspconfig/health.lua b/lua/lspconfig/health.lua
index a9666b6e..8c83d562 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 4efff0f1..8ef47c56 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
diff --git a/lua/lspconfig/hls.lua b/lua/lspconfig/hls.lua
index 2a6ce5ee..b0df2fa0 100644
--- a/lua/lspconfig/hls.lua
+++ b/lua/lspconfig/hls.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.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",
+ 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 ""
+ return ''
end,
},
diff --git a/lua/lspconfig/html.lua b/lua/lspconfig/html.lua
index 095d70bf..120139da 100644
--- a/lua/lspconfig/html.lua
+++ b/lua/lspconfig/html.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'
-local server_name = "html"
-local bin_name = "vscode-html-language-server"
+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 = {},
init_options = {
embeddedLanguages = { css = true, javascript = true },
- configurationSection = { "html", "css", "javascript" },
+ configurationSection = { 'html', 'css', 'javascript' },
},
},
docs = {
diff --git a/lua/lspconfig/intelephense.lua b/lua/lspconfig/intelephense.lua
index 2b358c78..479cfe40 100644
--- a/lua/lspconfig/intelephense.lua
+++ b/lua/lspconfig/intelephense.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 = "intelephense"
-local bin_name = "intelephense"
+local server_name = 'intelephense'
+local bin_name = 'intelephense'
configs[server_name] = {
default_config = {
- cmd = { bin_name, "--stdio" },
- filetypes = { "php" },
+ cmd = { bin_name, '--stdio' },
+ filetypes = { 'php' },
root_dir = function(pattern)
local cwd = vim.loop.cwd()
- local root = util.root_pattern("composer.json", ".git")(pattern)
+ 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
diff --git a/lua/lspconfig/java_language_server.lua b/lua/lspconfig/java_language_server.lua
index b52b43df..c2aec95f 100644
--- a/lua/lspconfig/java_language_server.lua
+++ b/lua/lspconfig/java_language_server.lua
@@ -1,13 +1,13 @@
-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"),
+ filetypes = { 'java' },
+ root_dir = lspconfig.util.root_pattern('build.gradle', 'pom.xml', '.git'),
settings = {},
},
docs = {
diff --git a/lua/lspconfig/jdtls.lua b/lua/lspconfig/jdtls.lua
index 5ebf2ee8..f77daf1c 100644
--- a/lua/lspconfig/jdtls.lua
+++ b/lua/lspconfig/jdtls.lua
@@ -1,28 +1,28 @@
-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 server_name = 'jdtls'
local cmd = {
- 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",
- "-Dlog.protocol=true",
- "-Dlog.level=ALL",
- "-Xms1g",
- "-Xmx2G",
- "-jar",
- tostring(vim.fn.getenv "JAR"),
- "-configuration",
- tostring(vim.fn.getenv "JDTLS_CONFIG"),
- "-data",
- 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",
+ 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',
+ '-Dlog.protocol=true',
+ '-Dlog.level=ALL',
+ '-Xms1g',
+ '-Xmx2G',
+ '-jar',
+ tostring(vim.fn.getenv 'JAR'),
+ '-configuration',
+ tostring(vim.fn.getenv 'JDTLS_CONFIG'),
+ '-data',
+ 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.
@@ -33,13 +33,13 @@ 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.
@@ -49,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
@@ -73,10 +73,10 @@ 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)
@@ -87,7 +87,7 @@ configs[server_name] = {
return vim.fn.getcwd()
end,
init_options = {
- workspace = path.join { vim.loop.os_homedir(), "workspace" },
+ workspace = path.join { vim.loop.os_homedir(), 'workspace' },
jvm_args = {},
os_config = nil,
},
@@ -99,35 +99,35 @@ 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)
+ ['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
+ 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)
+ handlers['textDocument/codeAction'](a, b, actions)
end,
- ["textDocument/rename"] = function(a, b, workspace_edit)
- handlers["textDocument/rename"](a, b, fix_zero_version(workspace_edit))
+ ['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))
+ ['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",
+ package_json = 'https://raw.githubusercontent.com/redhat-developer/vscode-java/master/package.json',
description = [[
https://projects.eclipse.org/projects/eclipse.jdt.ls
diff --git a/lua/lspconfig/jedi_language_server.lua b/lua/lspconfig/jedi_language_server.lua
index 57ba99c5..50b94429 100644
--- a/lua/lspconfig/jedi_language_server.lua
+++ b/lua/lspconfig/jedi_language_server.lua
@@ -1,9 +1,9 @@
-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,
diff --git a/lua/lspconfig/jsonls.lua b/lua/lspconfig/jsonls.lua
index 20c2753b..eccfc22f 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"
+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()),
+ 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
diff --git a/lua/lspconfig/julials.lua b/lua/lspconfig/julials.lua
index d6cc351c..bdf92b3a 100644
--- a/lua/lspconfig/julials.lua
+++ b/lua/lspconfig/julials.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'
local cmd = {
- "julia",
- "--startup-file=no",
- "--history-file=no",
- "-e",
+ 'julia',
+ '--startup-file=no',
+ '--history-file=no',
+ '-e',
[[
using Pkg;
Pkg.instantiate()
@@ -24,18 +24,18 @@ configs.julials = {
default_config = {
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,
},
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
diff --git a/lua/lspconfig/kotlin_language_server.lua b/lua/lspconfig/kotlin_language_server.lua
index baa96e22..2c394bc1 100644
--- a/lua/lspconfig/kotlin_language_server.lua
+++ b/lua/lspconfig/kotlin_language_server.lua
@@ -6,12 +6,12 @@
--- 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"
+local bin_name = 'kotlin-language-server'
+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
@@ -20,27 +20,27 @@ end
-- 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 },
},
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,
@@ -52,7 +52,7 @@ configs.kotlin_language_server = {
]],
default_config = {
root_dir = [[root_pattern("settings.gradle")]],
- cmd = { "kotlin-language-server" },
+ cmd = { 'kotlin-language-server' },
capabilities = [[
smart code completion,
diagnostics,
diff --git a/lua/lspconfig/lean3ls.lua b/lua/lspconfig/lean3ls.lua
index 083f4f0c..412f0ec7 100644
--- a/lua/lspconfig/lean3ls.lua
+++ b/lua/lspconfig/lean3ls.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.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)
+ 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
+ if not util.path.is_file(root .. '/leanpkg.toml') then
return
end
if not config.cmd_cwd then
diff --git a/lua/lspconfig/leanls.lua b/lua/lspconfig/leanls.lua
index 946275dd..625e07ae 100644
--- a/lua/lspconfig/leanls.lua
+++ b/lua/lspconfig/leanls.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.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)
+ 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
+ if not util.path.is_file(root .. '/leanpkg.toml') then
return
end
if not config.cmd_cwd then
diff --git a/lua/lspconfig/lspinfo.lua b/lua/lspconfig/lspinfo.lua
index 02b5fff0..2e96b440 100644
--- a/lua/lspconfig/lspinfo.lua
+++ b/lua/lspconfig/lspinfo.lua
@@ -1,5 +1,5 @@
-local configs = require "lspconfig/configs"
-local lspui = require "lspconfig/_lspui"
+local configs = require 'lspconfig/configs'
+local lspui = require 'lspconfig/_lspui'
return function()
-- These options need to be cached before switching to the floating
@@ -7,7 +7,7 @@ return function()
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,12 +20,12 @@ return function()
end
local header = {
- "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(
+ '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,
- ", "
+ ', '
),
}
vim.list_extend(buf_lines, header)
@@ -33,34 +33,34 @@ return function()
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
- local indent = " "
+ local indent = ' '
local function make_client_info(client)
- local server_specific_info = ""
+ local server_specific_info = ''
if client.config.lspinfo then
server_specific_info = client.config.lspinfo(client.config)
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
@@ -70,8 +70,8 @@ return function()
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
@@ -79,58 +79,58 @@ return function()
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"
+ local cmd_not_found_msg = 'False. Please check your path and ensure the server is installed'
vim.list_extend(buf_lines, matching_config_header)
for _, config in pairs(configs) do
local cmd_is_executable, cmd
if config.cmd then
cmd = remove_newlines(config.cmd)
if vim.fn.executable(config.cmd[1]) == 1 then
- cmd_is_executable = "True"
+ cmd_is_executable = 'True'
else
cmd_is_executable = cmd_not_found_msg
end
else
- cmd = "cmd not defined"
+ cmd = 'cmd not defined'
cmd_is_executable = cmd
end
if config.filetypes then
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)
end
end
else
local matching_config_info = {
- "",
- "Config: " .. config.name,
- "\tfiletype: " .. "No filetypes defined, please define filetypes in setup().",
+ '',
+ '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.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
+ '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)
+ 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 7fcb187a..620b7323 100644
--- a/lua/lspconfig/metals.lua
+++ b/lua/lspconfig/metals.lua
@@ -1,16 +1,16 @@
-local configs = require "lspconfig/configs"
-local util = require "lspconfig/util"
-local server_name = "metals"
-local bin_name = "metals"
+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"),
+ 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",
+ statusBarProvider = 'show-message',
isHttpEnabled = true,
compilerOptions = {
snippetAutoIndent = false,
diff --git a/lua/lspconfig/nimls.lua b/lua/lspconfig/nimls.lua
index 63267d14..06f0af87 100644
--- a/lua/lspconfig/nimls.lua
+++ b/lua/lspconfig/nimls.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'
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)
+ 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:
diff --git a/lua/lspconfig/ocamlls.lua b/lua/lspconfig/ocamlls.lua
index 37a0d736..028a96e3 100644
--- a/lua/lspconfig/ocamlls.lua
+++ b/lua/lspconfig/ocamlls.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 = "ocamlls"
-local bin_name = "ocaml-language-server"
+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 = [[
diff --git a/lua/lspconfig/ocamllsp.lua b/lua/lspconfig/ocamllsp.lua
index f08fb3d4..1b103702 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 = {}
@@ -21,9 +21,9 @@ end
configs.ocamllsp = {
default_config = {
- cmd = { "ocamllsp" },
+ cmd = { 'ocamllsp' },
filetypes = filetypes,
- root_dir = util.root_pattern("*.opam", "esy.json", "package.json", ".git"),
+ root_dir = util.root_pattern('*.opam', 'esy.json', 'package.json', '.git'),
get_language_id = get_language_id,
},
docs = {
diff --git a/lua/lspconfig/omnisharp.lua b/lua/lspconfig/omnisharp.lua
index 05cab4bc..fcba1be5 100644
--- a/lua/lspconfig/omnisharp.lua
+++ b/lua/lspconfig/omnisharp.lua
@@ -1,11 +1,11 @@
-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"),
+ filetypes = { 'cs', 'vb' },
+ root_dir = util.root_pattern('*.csproj', '*.sln'),
init_options = {},
},
-- on_new_config = function(new_config) end;
diff --git a/lua/lspconfig/perlls.lua b/lua/lspconfig/perlls.lua
index 4695d2f3..b063779f 100644
--- a/lua/lspconfig/perlls.lua
+++ b/lua/lspconfig/perlls.lua
@@ -1,33 +1,33 @@
-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",
+ '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",
+ perlCmd = 'perl',
+ perlInc = ' ',
+ fileFilter = { '.pm', '.pl' },
+ ignoreDirs = '.git',
},
},
- filetypes = { "perl" },
+ filetypes = { 'perl' },
root_dir = function(fname)
- return util.root_pattern ".git"(fname) or vim.fn.getcwd()
+ 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
diff --git a/lua/lspconfig/perlpls.lua b/lua/lspconfig/perlpls.lua
index 6f8c0a7d..00c0d0c1 100644
--- a/lua/lspconfig/perlpls.lua
+++ b/lua/lspconfig/perlpls.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'
configs.perlpls = {
default_config = {
- cmd = { "pls" },
+ cmd = { 'pls' },
settings = {
perl = {
perlcritic = { enabled = false },
},
},
- filetypes = { "perl" },
+ filetypes = { 'perl' },
root_dir = function(filename)
- return util.root_pattern ".git"(filename) or util.path.dirname(filename)
+ return util.root_pattern '.git'(filename) or util.path.dirname(filename)
end,
},
docs = {
- package_json = "https://raw.githubusercontent.com/FractalBoy/perl-language-server/master/client/package.json",
+ package_json = 'https://raw.githubusercontent.com/FractalBoy/perl-language-server/master/client/package.json',
description = [[
https://github.com/FractalBoy/perl-language-server
https://metacpan.org/pod/PLS
diff --git a/lua/lspconfig/phpactor.lua b/lua/lspconfig/phpactor.lua
index f358f092..658704e8 100644
--- a/lua/lspconfig/phpactor.lua
+++ b/lua/lspconfig/phpactor.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 = "phpactor"
-local bin_name = "phpactor"
+local server_name = 'phpactor'
+local bin_name = 'phpactor'
configs[server_name] = {
default_config = {
- cmd = { bin_name, "language-server" },
- filetypes = { "php" },
+ 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)
+ 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
@@ -23,7 +23,7 @@ https://github.com/phpactor/phpactor
Installation: https://phpactor.readthedocs.io/en/master/usage/standalone.html#global-installation
]],
default_config = {
- cmd = { "phpactor", "language-server" },
+ cmd = { 'phpactor', 'language-server' },
root_dir = [[root_pattern("composer.json", ".git")]],
},
},
diff --git a/lua/lspconfig/powershell_es.lua b/lua/lspconfig/powershell_es.lua
index c76d5b16..0f621a1d 100644
--- a/lua/lspconfig/powershell_es.lua
+++ b/lua/lspconfig/powershell_es.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 = "powershell_es"
-local temp_path = vim.fn.stdpath "cache"
+local server_name = 'powershell_es'
+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 = 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
@@ -19,7 +19,7 @@ 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,
@@ -54,7 +54,7 @@ require'lspconfig'.powershell_es.setup{
```
]],
default_config = {
- root_dir = "git root or current directory",
+ root_dir = 'git root or current directory',
},
},
}
diff --git a/lua/lspconfig/prismals.lua b/lua/lspconfig/prismals.lua
index 93e3aed4..ea53d205 100644
--- a/lua/lspconfig/prismals.lua
+++ b/lua/lspconfig/prismals.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'
-local server_name = "prismals"
-local bin_name = "prisma-language-server"
-if vim.fn.has "win32" == 1 then
- bin_name = bin_name .. ".cmd"
+local server_name = 'prismals'
+local bin_name = 'prisma-language-server'
+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 = "",
+ prismaFmtBinPath = '',
},
},
- root_dir = util.root_pattern(".git", "package.json"),
+ root_dir = util.root_pattern('.git', 'package.json'),
},
docs = {
description = [[
diff --git a/lua/lspconfig/puppet.lua b/lua/lspconfig/puppet.lua
index dc17fcfa..c666ec6a 100644
--- a/lua/lspconfig/puppet.lua
+++ b/lua/lspconfig/puppet.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'
-local server_name = "puppet"
-local bin_name = "puppet-languageserver"
+local server_name = 'puppet'
+local bin_name = 'puppet-languageserver'
local root_files = {
- "manifests",
- ".puppet-lint.rc",
- "hiera.yaml",
- ".git",
+ 'manifests',
+ '.puppet-lint.rc',
+ 'hiera.yaml',
+ '.git',
}
configs[server_name] = {
default_config = {
- cmd = { bin_name, "--stdio" },
- filetypes = { "puppet" },
+ cmd = { bin_name, '--stdio' },
+ filetypes = { 'puppet' },
root_dir = function(filename)
return util.root_pattern(unpack(root_files))(filename) or util.path.dirname(filename)
end,
diff --git a/lua/lspconfig/purescriptls.lua b/lua/lspconfig/purescriptls.lua
index 986d3e12..e38a3c29 100644
--- a/lua/lspconfig/purescriptls.lua
+++ b/lua/lspconfig/purescriptls.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'
-local server_name = "purescriptls"
-local bin_name = "purescript-language-server"
-if vim.fn.has "win32" == 1 then
- bin_name = bin_name .. ".cmd"
+local server_name = 'purescriptls'
+local bin_name = 'purescript-language-server'
+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`
diff --git a/lua/lspconfig/pyls.lua b/lua/lspconfig/pyls.lua
index 72336455..3523b4e7 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,
},
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
diff --git a/lua/lspconfig/pyls_ms.lua b/lua/lspconfig/pyls_ms.lua
index 863ff8bf..88e48666 100644
--- a/lua/lspconfig/pyls_ms.lua
+++ b/lua/lspconfig/pyls_ms.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 name = "pyls_ms"
+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,
@@ -22,8 +22,8 @@ configs[name] = {
init_options = {
interpreter = {
properties = {
- InterpreterPath = "",
- Version = "",
+ InterpreterPath = '',
+ Version = '',
},
},
displayOptions = {},
diff --git a/lua/lspconfig/pylsp.lua b/lua/lspconfig/pylsp.lua
index a88413fa..c0a46409 100644
--- a/lua/lspconfig/pylsp.lua
+++ b/lua/lspconfig/pylsp.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'
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",
+ 'pyproject.toml',
+ 'setup.py',
+ 'setup.cfg',
+ 'requirements.txt',
+ 'Pipfile',
}
return util.root_pattern(unpack(root_files))(fname) or util.find_git_ancestor(fname) or util.path.dirname(fname)
end,
diff --git a/lua/lspconfig/pyright.lua b/lua/lspconfig/pyright.lua
index 86bb4295..165d99bc 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"
+local server_name = 'pyright'
+local bin_name = 'pyright-langserver'
+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,8 +25,8 @@ 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,
@@ -35,7 +35,7 @@ configs[server_name] = {
analysis = {
autoSearchPaths = true,
useLibraryCodeForTypes = true,
- diagnosticMode = "workspace",
+ diagnosticMode = 'workspace',
},
},
},
@@ -43,11 +43,11 @@ configs[server_name] = {
commands = {
PyrightOrganizeImports = {
organize_imports,
- description = "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
diff --git a/lua/lspconfig/r_language_server.lua b/lua/lspconfig/r_language_server.lua
index 32be96b9..7bf8e526 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,
},
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
diff --git a/lua/lspconfig/racket_langserver.lua b/lua/lspconfig/racket_langserver.lua
index 1e64b50d..abbc45be 100644
--- a/lua/lspconfig/racket_langserver.lua
+++ b/lua/lspconfig/racket_langserver.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 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,
diff --git a/lua/lspconfig/rescriptls.lua b/lua/lspconfig/rescriptls.lua
index e7db7dbb..13ea1b73 100644
--- a/lua/lspconfig/rescriptls.lua
+++ b/lua/lspconfig/rescriptls.lua
@@ -1,13 +1,13 @@
-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"),
+ filetypes = { 'rescript' },
+ root_dir = lspconfig.util.root_pattern('bsconfig.json', '.git'),
settings = {},
},
docs = {
diff --git a/lua/lspconfig/rls.lua b/lua/lspconfig/rls.lua
index 8b1bbb4b..1f865473 100644
--- a/lua/lspconfig/rls.lua
+++ b/lua/lspconfig/rls.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.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 = [[
diff --git a/lua/lspconfig/rnix.lua b/lua/lspconfig/rnix.lua
index 5fb8d997..66a205de 100644
--- a/lua/lspconfig/rnix.lua
+++ b/lua/lspconfig/rnix.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 = "rnix"
+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,
diff --git a/lua/lspconfig/rome.lua b/lua/lspconfig/rome.lua
index aed635bf..a54b0168 100644
--- a/lua/lspconfig/rome.lua
+++ b/lua/lspconfig/rome.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'
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)
diff --git a/lua/lspconfig/rust_analyzer.lua b/lua/lspconfig/rust_analyzer.lua
index 34c6420f..b5f151c8 100644
--- a/lua/lspconfig/rust_analyzer.lua
+++ b/lua/lspconfig/rust_analyzer.lua
@@ -1,39 +1,39 @@
-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, _)
+ lsp.buf_request(bufnr, 'rust-analyzer/reloadWorkspace', nil, function(err, _, result, _)
if err then
error(tostring(err))
end
- vim.notify "Cargo workspace reloaded"
+ 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 cmd = "cargo metadata --no-deps --format-version 1"
+ 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")
+ cmd = cmd .. ' --manifest-path ' .. util.path.join(cargo_crate_dir, 'Cargo.toml')
end
local cargo_metadata = vim.fn.system(cmd)
local cargo_workspace_dir = nil
if vim.v.shell_error == 0 then
- cargo_workspace_dir = vim.fn.json_decode(cargo_metadata)["workspace_root"]
+ 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.root_pattern 'rust-project.json'(fname)
or util.find_git_ancestor(fname)
end,
settings = {
- ["rust-analyzer"] = {},
+ ['rust-analyzer'] = {},
},
},
commands = {
@@ -41,11 +41,11 @@ configs.rust_analyzer = {
function()
reload_workspace(0)
end,
- description = "Reload current cargo workspace",
+ 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
diff --git a/lua/lspconfig/scry.lua b/lua/lspconfig/scry.lua
index afa6464a..0d8c5b25 100644
--- a/lua/lspconfig/scry.lua
+++ b/lua/lspconfig/scry.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.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)
+ return util.root_pattern 'shard.yml'(fname) or util.find_git_ancestor(fname) or util.path.dirname(fname)
end,
},
docs = {
diff --git a/lua/lspconfig/solargraph.lua b/lua/lspconfig/solargraph.lua
index 82b04065..399c87e8 100644
--- a/lua/lspconfig/solargraph.lua
+++ b/lua/lspconfig/solargraph.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 bin_name = "solargraph"
-if vim.fn.has "win32" == 1 then
- bin_name = bin_name .. ".bat"
+local bin_name = 'solargraph'
+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,
},
},
init_options = { formatting = true },
- filetypes = { "ruby" },
- root_dir = util.root_pattern("Gemfile", ".git"),
+ 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/
diff --git a/lua/lspconfig/sorbet.lua b/lua/lspconfig/sorbet.lua
index bdf0a024..5d275d70 100644
--- a/lua/lspconfig/sorbet.lua
+++ b/lua/lspconfig/sorbet.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 = "sorbet"
-local bin_name = "srb"
+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 = [[
diff --git a/lua/lspconfig/sourcekit.lua b/lua/lspconfig/sourcekit.lua
index 7fb6e80a..6b01361e 100644
--- a/lua/lspconfig/sourcekit.lua
+++ b/lua/lspconfig/sourcekit.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.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
diff --git a/lua/lspconfig/sqlls.lua b/lua/lspconfig/sqlls.lua
index a4299b7d..37bc6fd2 100644
--- a/lua/lspconfig/sqlls.lua
+++ b/lua/lspconfig/sqlls.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 server_name = "sqlls"
+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,
diff --git a/lua/lspconfig/sqls.lua b/lua/lspconfig/sqls.lua
index 3561cffe..86342677 100644
--- a/lua/lspconfig/sqls.lua
+++ b/lua/lspconfig/sqls.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.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)
+ return util.root_pattern 'config.yml'(fname) or util.path.dirname(fname)
end,
settings = {},
},
diff --git a/lua/lspconfig/stylelint_lsp.lua b/lua/lspconfig/stylelint_lsp.lua
index 26bbacda..cd435de8 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",
+ 'css',
+ 'less',
+ 'scss',
+ 'sugarss',
+ 'vue',
+ 'wxss',
+ 'javascript',
+ 'javascriptreact',
+ 'typescript',
+ 'typescriptreact',
},
- root_dir = util.root_pattern(".stylelintrc", "package.json"),
+ 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
diff --git a/lua/lspconfig/sumneko_lua.lua b/lua/lspconfig/sumneko_lua.lua
index a02a492e..c66f53c1 100644
--- a/lua/lspconfig/sumneko_lua.lua
+++ b/lua/lspconfig/sumneko_lua.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'
-local name = "sumneko_lua"
+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,
@@ -13,7 +13,7 @@ configs[name] = {
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
diff --git a/lua/lspconfig/svelte.lua b/lua/lspconfig/svelte.lua
index 014c249c..e38103cf 100644
--- a/lua/lspconfig/svelte.lua
+++ b/lua/lspconfig/svelte.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 = "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 = [[
diff --git a/lua/lspconfig/svls.lua b/lua/lspconfig/svls.lua
index 9da85c68..da7e00c9 100644
--- a/lua/lspconfig/svls.lua
+++ b/lua/lspconfig/svls.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 server_name = "svls"
+local server_name = 'svls'
configs[server_name] = {
default_config = {
- cmd = { "svls" },
- filetypes = { "verilog", "systemverilog" },
- root_dir = util.root_pattern ".git",
+ cmd = { 'svls' },
+ filetypes = { 'verilog', 'systemverilog' },
+ root_dir = util.root_pattern '.git',
},
docs = {
description = [[
diff --git a/lua/lspconfig/tailwindcss.lua b/lua/lspconfig/tailwindcss.lua
index 1a07d3a9..4ffe8f1c 100644
--- a/lua/lspconfig/tailwindcss.lua
+++ b/lua/lspconfig/tailwindcss.lua
@@ -1,81 +1,81 @@
-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 = {
tailwindCSS = {
validate = true,
lint = {
- cssConflict = "warning",
- invalidApply = "error",
- invalidScreen = "error",
- invalidVariant = "error",
- invalidConfigPath = "error",
- invalidTailwindDirective = "error",
- recommendedVariantOrder = "warning",
+ cssConflict = 'warning',
+ invalidApply = 'error',
+ invalidScreen = 'error',
+ invalidVariant = 'error',
+ invalidConfigPath = 'error',
+ invalidTailwindDirective = 'error',
+ recommendedVariantOrder = 'warning',
},
},
},
@@ -92,8 +92,8 @@ configs[server_name] = {
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)
+ 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)
diff --git a/lua/lspconfig/terraformls.lua b/lua/lspconfig/terraformls.lua
index ab487afa..ffe01b46 100644
--- a/lua/lspconfig/terraformls.lua
+++ b/lua/lspconfig/terraformls.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.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
diff --git a/lua/lspconfig/texlab.lua b/lua/lspconfig/texlab.lua
index 02bd8419..0a2c9a10 100644
--- a/lua/lspconfig/texlab.lua
+++ b/lua/lspconfig/texlab.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 texlab_build_status = vim.tbl_add_reverse_lookup {
@@ -19,11 +19,11 @@ local texlab_forward_status = vim.tbl_add_reverse_lookup {
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, _)
+ lsp.buf_request(bufnr, 'textDocument/build', params, function(err, _, result, _)
if err then
error(tostring(err))
end
- print("Build " .. texlab_build_status[result.status])
+ print('Build ' .. texlab_build_status[result.status])
end)
end
@@ -31,13 +31,13 @@ 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 "." },
+ position = { line = vim.fn.line '.' - 1, character = vim.fn.col '.' },
}
- lsp.buf_request(bufnr, "textDocument/forwardSearch", params, function(err, _, result, _)
+ lsp.buf_request(bufnr, 'textDocument/forwardSearch', params, function(err, _, result, _)
if err then
error(tostring(err))
end
- print("Search " .. texlab_forward_status[result.status])
+ print('Search ' .. texlab_forward_status[result.status])
end)
end
@@ -55,8 +55,8 @@ 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,
@@ -64,12 +64,12 @@ configs.texlab = {
texlab = {
rootDirectory = nil,
build = {
- executable = "latexmk",
- args = { "-pdf", "-interaction=nonstopmode", "-synctex=1", "%f" },
+ executable = 'latexmk',
+ args = { '-pdf', '-interaction=nonstopmode', '-synctex=1', '%f' },
onSave = false,
forwardSearchAfter = false,
},
- auxDirectory = ".",
+ auxDirectory = '.',
forwardSearch = {
executable = nil,
args = {},
@@ -79,12 +79,12 @@ configs.texlab = {
onEdit = false,
},
diagnosticsDelay = 300,
- latexFormatter = "latexindent",
+ latexFormatter = 'latexindent',
latexindent = {
- ["local"] = nil, -- local is a reserved keyword
+ ['local'] = nil, -- local is a reserved keyword
modifyLineBreaks = false,
},
- bibtexFormatter = "texlab",
+ bibtexFormatter = 'texlab',
formatterLineLength = 80,
},
},
@@ -94,13 +94,13 @@ configs.texlab = {
function()
buf_build(0)
end,
- description = "Build the current buffer",
+ description = 'Build the current buffer',
},
TexlabForward = {
function()
buf_search(0)
end,
- description = "Forward search from current position",
+ description = 'Forward search from current position',
},
},
docs = {
diff --git a/lua/lspconfig/tflint.lua b/lua/lspconfig/tflint.lua
index a58416e0..7aa7d314 100644
--- a/lua/lspconfig/tflint.lua
+++ b/lua/lspconfig/tflint.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.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 = [[
diff --git a/lua/lspconfig/tsserver.lua b/lua/lspconfig/tsserver.lua
index 8de49d08..76c21359 100644
--- a/lua/lspconfig/tsserver.lua
+++ b/lua/lspconfig/tsserver.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 server_name = "tsserver"
-local bin_name = "typescript-language-server"
-if vim.fn.has "win32" == 1 then
- bin_name = bin_name .. ".cmd"
+local server_name = 'tsserver'
+local bin_name = 'typescript-language-server'
+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)
+ return util.root_pattern 'tsconfig.json'(fname)
+ or util.root_pattern('package.json', 'jsconfig.json', '.git')(fname)
end,
},
docs = {
diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua
index 3e10db1e..c18f3072 100644
--- a/lua/lspconfig/util.lua
+++ b/lua/lspconfig/util.lua
@@ -17,7 +17,7 @@ M.default_config = {
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,12 +48,12 @@ 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
@@ -63,12 +63,12 @@ function M.create_module_commands(module_name, commands)
parts,
string.format("lua require'lspconfig'[%q].commands[%q][1](<f-args>)", module_name, command_name)
)
- api.nvim_command(table.concat(parts, " "))
+ api.nvim_command(table.concat(parts, ' '))
end
end
function M.has_bins(...)
- for i = 1, select("#", ...) do
+ for i = 1, select('#', ...) do
if 0 == fn.executable((select(i, ...))) then
return false
end
@@ -77,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
@@ -89,53 +89,53 @@ 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 path_sep = is_windows and "\\" or "/"
+ 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)
- return path == "/"
+ return path == '/'
end
end
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
end
- local result = path:gsub(strip_sep_pat, ""):gsub(strip_dir_pat, "")
+ local result = path:gsub(strip_sep_pat, ''):gsub(strip_dir_pat, '')
if #result == 0 then
- return "/"
+ return '/'
end
return result
end
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
@@ -226,15 +226,15 @@ function M.server_per_root_dir_manager(_make_config)
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.",
+ '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)
+ vim.notify(string.format('cmd [%q] is not executable.', new_config.cmd[1]), vim.log.levels.Error)
return
end
new_config.on_exit = M.add_hook_before(new_config.on_exit, function()
@@ -261,7 +261,7 @@ function M.server_per_root_dir_manager(_make_config)
end
function M.search_ancestors(startpath, func)
- validate { func = { func, "f" } }
+ validate { func = { func, 'f' } }
if func(startpath) then
return startpath
end
@@ -296,21 +296,21 @@ function M.root_pattern(...)
end
function M.find_git_ancestor(startpath)
return M.search_ancestors(startpath, function(path)
- if M.path.is_dir(M.path.join(path, ".git")) then
+ if M.path.is_dir(M.path.join(path, '.git')) then
return path
end
end)
end
function M.find_node_modules_ancestor(startpath)
return M.search_ancestors(startpath, function(path)
- if M.path.is_dir(M.path.join(path, "node_modules")) then
+ if M.path.is_dir(M.path.join(path, 'node_modules')) then
return path
end
end)
end
function M.find_package_json_ancestor(startpath)
return M.search_ancestors(startpath, function(path)
- if M.path.is_file(M.path.join(path, "package.json")) then
+ if M.path.is_file(M.path.join(path, 'package.json')) then
return path
end
end)
diff --git a/lua/lspconfig/vala_ls.lua b/lua/lspconfig/vala_ls.lua
index 684e54a0..652f7ea3 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 pattern = "meson.build"
+ 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,15 +24,15 @@ end
configs.vala_ls = {
default_config = {
- cmd = { "vala-language-server" },
- filetypes = { "vala", "genie" },
+ 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")]],
},
diff --git a/lua/lspconfig/vimls.lua b/lua/lspconfig/vimls.lua
index dcbb6a8e..0c0b714c 100644
--- a/lua/lspconfig/vimls.lua
+++ b/lua/lspconfig/vimls.lua
@@ -1,29 +1,29 @@
-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"
+local server_name = 'vimls'
+local bin_name = 'vim-language-server'
+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,
init_options = {
- iskeyword = "@,48-57,_,192-255,-#",
- vimruntime = "",
- runtimepath = "",
+ iskeyword = '@,48-57,_,192-255,-#',
+ vimruntime = '',
+ runtimepath = '',
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 },
},
diff --git a/lua/lspconfig/vls.lua b/lua/lspconfig/vls.lua
index eb3c0add..9afa5a22 100644
--- a/lua/lspconfig/vls.lua
+++ b/lua/lspconfig/vls.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 name = "vls"
+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 = [[
diff --git a/lua/lspconfig/vuels.lua b/lua/lspconfig/vuels.lua
index 296f04ac..2f69f2fe 100644
--- a/lua/lspconfig/vuels.lua
+++ b/lua/lspconfig/vuels.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 = "vuels"
-local bin_name = "vls"
+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"),
+ filetypes = { 'vue' },
+ root_dir = util.root_pattern('package.json', 'vue.config.js'),
init_options = {
config = {
vetur = {
@@ -21,12 +21,12 @@ configs[server_name] = {
completion = {
autoImport = false,
useScaffoldSnippets = false,
- tagCasing = "kebab",
+ tagCasing = 'kebab',
},
format = {
defaultFormatter = {
- js = "none",
- ts = "none",
+ js = 'none',
+ ts = 'none',
},
defaultFormatterOptions = {},
scriptInitialIndent = false,
@@ -49,7 +49,7 @@ configs[server_name] = {
},
},
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
@@ -73,12 +73,12 @@ npm install -g vls
completion = {
autoImport = false,
useScaffoldSnippets = false,
- tagCasing = "kebab",
+ tagCasing = 'kebab',
},
format = {
defaultFormatter = {
- js = "none",
- ts = "none",
+ js = 'none',
+ ts = 'none',
},
defaultFormatterOptions = {},
scriptInitialIndent = false,
diff --git a/lua/lspconfig/yamlls.lua b/lua/lspconfig/yamlls.lua
index f20ced67..81624a77 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"
+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
diff --git a/lua/lspconfig/zeta_note.lua b/lua/lspconfig/zeta_note.lua
index 0cafdbab..d7c51549 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"
+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
diff --git a/lua/lspconfig/zls.lua b/lua/lspconfig/zls.lua
index 659f36f2..311be3f5 100644
--- a/lua/lspconfig/zls.lua
+++ b/lua/lspconfig/zls.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.zls = {
default_config = {
- cmd = { "zls" },
- filetypes = { "zig", "zir" },
+ cmd = { 'zls' },
+ filetypes = { 'zig', 'zir' },
root_dir = function(fname)
- return util.root_pattern("zls.json", ".git")(fname) or util.path.dirname(fname)
+ return util.root_pattern('zls.json', '.git')(fname) or util.path.dirname(fname)
end,
},
docs = {
diff --git a/scripts/docgen.lua b/scripts/docgen.lua
index 64644795..4809d3df 100644
--- a/scripts/docgen.lua
+++ b/scripts/docgen.lua
@@ -1,13 +1,13 @@
-require "lspconfig"
-local configs = require "lspconfig/configs"
-local util = require "lspconfig/util"
+require 'lspconfig'
+local configs = require 'lspconfig/configs'
+local util = require 'lspconfig/util'
local inspect = vim.inspect
local uv = vim.loop
local fn = vim.fn
local tbl_flatten = vim.tbl_flatten
local function template(s, params)
- return (s:gsub("{{([^{}]+)}}", params))
+ return (s:gsub('{{([^{}]+)}}', params))
end
local function map_list(t, func)
@@ -23,25 +23,25 @@ end
local function indent(n, s)
local prefix
- if type(n) == "number" then
+ if type(n) == 'number' then
if n <= 0 then
return s
end
- prefix = string.rep(" ", n)
+ prefix = string.rep(' ', n)
else
- assert(type(n) == "string", "n must be number or string")
+ assert(type(n) == 'string', 'n must be number or string')
prefix = n
end
- local lines = vim.split(s, "\n", true)
+ local lines = vim.split(s, '\n', true)
for i, line in ipairs(lines) do
lines[i] = prefix .. line
end
- return table.concat(lines, "\n")
+ return table.concat(lines, '\n')
end
local function make_parts(fns)
return tbl_flatten(map_list(fns, function(v)
- if type(v) == "function" then
+ if type(v) == 'function' then
v = v()
end
return { v }
@@ -54,7 +54,7 @@ end
local function readfile(path)
assert(util.path.is_file(path))
- return io.open(path):read "*a"
+ return io.open(path):read '*a'
end
local function sorted_map_table(t, func)
@@ -84,38 +84,38 @@ require'lspconfig'.{{template_name}}.setup{}
local function require_all_configs()
-- Configs are lazy-loaded, tickle them to populate the `configs` singleton.
- for _, v in ipairs(vim.fn.glob("lua/lspconfig/*.lua", 1, 1)) do
- local module_name = v:gsub(".*/", ""):gsub("%.lua$", "")
- require("lspconfig/" .. module_name)
+ for _, v in ipairs(vim.fn.glob('lua/lspconfig/*.lua', 1, 1)) do
+ local module_name = v:gsub('.*/', ''):gsub('%.lua$', '')
+ require('lspconfig/' .. module_name)
end
end
local function make_lsp_sections()
return make_section(
0,
- "\n",
+ '\n',
sorted_map_table(configs, function(template_name, template_object)
local template_def = template_object.document_config
local docs = template_def.docs
local params = {
template_name = template_name,
- preamble = "",
- body = "",
+ preamble = '',
+ body = '',
}
- params.body = make_section(2, "\n\n", {
+ params.body = make_section(2, '\n\n', {
function()
if not template_def.commands then
return
end
- return make_section(0, "\n", {
- "Commands:",
+ return make_section(0, '\n', {
+ 'Commands:',
sorted_map_table(template_def.commands, function(name, def)
if def.description then
- return string.format("- %s: %s", name, def.description)
+ return string.format('- %s: %s', name, def.description)
end
- return string.format("- %s", name)
+ return string.format('- %s', name)
end),
})
end,
@@ -123,15 +123,15 @@ local function make_lsp_sections()
if not template_def.default_config then
return
end
- return make_section(0, "\n", {
- "Default Values:",
+ return make_section(0, '\n', {
+ 'Default Values:',
sorted_map_table(template_def.default_config, function(k, v)
local description = ((docs or {}).default_config or {})[k]
- if description and type(description) ~= "string" then
+ if description and type(description) ~= 'string' then
description = inspect(description)
- elseif not description and type(v) == "function" then
+ elseif not description and type(v) == 'function' then
local info = debug.getinfo(v)
- local file = io.open(string.sub(info.source, 2), "r")
+ local file = io.open(string.sub(info.source, 2), 'r')
local fileContent = {}
for line in file:lines() do
@@ -144,17 +144,17 @@ local function make_lsp_sections()
table.insert(root_dir, fileContent[i])
end
- description = table.concat(root_dir, "\n")
- description = string.gsub(description, ".*function", "function")
+ description = table.concat(root_dir, '\n')
+ description = string.gsub(description, '.*function', 'function')
end
- return indent(2, string.format("%s = %s", k, description or inspect(v)))
+ return indent(2, string.format('%s = %s', k, description or inspect(v)))
end),
})
end,
})
if docs then
- local tempdir = os.getenv "DOCGEN_TEMPDIR" or uv.fs_mkdtemp "/tmp/nvim-lsp.XXXXXX"
+ local tempdir = os.getenv 'DOCGEN_TEMPDIR' or uv.fs_mkdtemp '/tmp/nvim-lsp.XXXXXX'
local preamble_parts = make_parts {
function()
if docs.description and #docs.description > 0 then
@@ -162,19 +162,19 @@ local function make_lsp_sections()
end
end,
function()
- local package_json_name = util.path.join(tempdir, template_name .. ".package.json")
+ local package_json_name = util.path.join(tempdir, template_name .. '.package.json')
if docs.package_json then
if not util.path.is_file(package_json_name) then
- os.execute(string.format("curl -v -L -o %q %q", package_json_name, docs.package_json))
+ os.execute(string.format('curl -v -L -o %q %q', package_json_name, docs.package_json))
end
if not util.path.is_file(package_json_name) then
- print(string.format("Failed to download package.json for %q at %q", template_name, docs.package_json))
+ print(string.format('Failed to download package.json for %q at %q', template_name, docs.package_json))
os.exit(1)
return
end
local data = fn.json_decode(readfile(package_json_name))
-- The entire autogenerated section.
- return make_section(0, "\n", {
+ return make_section(0, '\n', {
-- The default settings section
function()
local default_settings = (data.contributes or {}).configuration
@@ -182,71 +182,71 @@ local function make_lsp_sections()
return
end
-- The outer section.
- return make_section(0, "\n", {
- "This server accepts configuration via the `settings` key.",
- "<details><summary>Available settings:</summary>",
- "",
+ return make_section(0, '\n', {
+ 'This server accepts configuration via the `settings` key.',
+ '<details><summary>Available settings:</summary>',
+ '',
-- The list of properties.
make_section(
0,
- "\n\n",
+ '\n\n',
sorted_map_table(default_settings.properties, function(k, v)
local function tick(s)
- return string.format("`%s`", s)
+ return string.format('`%s`', s)
end
local function bold(s)
- return string.format("**%s**", s)
+ return string.format('**%s**', s)
end
-- https://github.github.com/gfm/#backslash-escapes
local function excape_markdown_punctuations(str)
local pattern =
- "\\(\\*\\|\\.\\|?\\|!\\|\"\\|#\\|\\$\\|%\\|'\\|(\\|)\\|,\\|-\\|\\/\\|:\\|;\\|<\\|=\\|>\\|@\\|\\[\\|\\\\\\|\\]\\|\\^\\|_\\|`\\|{\\|\\\\|\\|}\\)"
- return fn.substitute(str, pattern, "\\\\\\0", "g")
+ '\\(\\*\\|\\.\\|?\\|!\\|"\\|#\\|\\$\\|%\\|\'\\|(\\|)\\|,\\|-\\|\\/\\|:\\|;\\|<\\|=\\|>\\|@\\|\\[\\|\\\\\\|\\]\\|\\^\\|_\\|`\\|{\\|\\\\|\\|}\\)'
+ return fn.substitute(str, pattern, '\\\\\\0', 'g')
end
-- local function pre(s) return string.format("<pre>%s</pre>", s) end
-- local function code(s) return string.format("<code>%s</code>", s) end
- if not (type(v) == "table") then
+ if not (type(v) == 'table') then
return
end
- return make_section(0, "\n", {
- "- " .. make_section(0, ": ", {
+ return make_section(0, '\n', {
+ '- ' .. make_section(0, ': ', {
bold(tick(k)),
function()
if v.enum then
- return tick("enum " .. inspect(v.enum))
+ return tick('enum ' .. inspect(v.enum))
end
if v.type then
- return tick(table.concat(tbl_flatten { v.type }, "|"))
+ return tick(table.concat(tbl_flatten { v.type }, '|'))
end
end,
}),
- "",
- make_section(2, "\n\n", {
- { v.default and "Default: " .. tick(inspect(v.default, { newline = "", indent = "" })) },
- { v.items and "Array items: " .. tick(inspect(v.items, { newline = "", indent = "" })) },
+ '',
+ make_section(2, '\n\n', {
+ { v.default and 'Default: ' .. tick(inspect(v.default, { newline = '', indent = '' })) },
+ { v.items and 'Array items: ' .. tick(inspect(v.items, { newline = '', indent = '' })) },
{ excape_markdown_punctuations(v.description) },
}),
})
end)
),
- "",
- "</details>",
+ '',
+ '</details>',
})
end,
})
end
end,
}
- if not os.getenv "DOCGEN_TEMPDIR" then
- os.execute("rm -rf " .. tempdir)
+ if not os.getenv 'DOCGEN_TEMPDIR' then
+ os.execute('rm -rf ' .. tempdir)
end
-- Insert a newline after the preamble if it exists.
if #preamble_parts > 0 then
- table.insert(preamble_parts, "")
+ table.insert(preamble_parts, '')
end
- params.preamble = table.concat(preamble_parts, "\n")
+ params.preamble = table.concat(preamble_parts, '\n')
end
return template(lsp_section_template, params)
@@ -257,28 +257,28 @@ end
local function make_implemented_servers_list()
return make_section(
0,
- "\n",
+ '\n',
sorted_map_table(configs, function(k)
- return template("- [{{server}}](#{{server}})", { server = k })
+ return template('- [{{server}}](#{{server}})', { server = k })
end)
)
end
local function generate_readme(template_file, params)
vim.validate {
- lsp_server_details = { params.lsp_server_details, "s" },
- implemented_servers_list = { params.implemented_servers_list, "s" },
+ lsp_server_details = { params.lsp_server_details, 's' },
+ implemented_servers_list = { params.implemented_servers_list, 's' },
}
local input_template = readfile(template_file)
local readme_data = template(input_template, params)
- local writer = io.open("CONFIG.md", "w")
+ local writer = io.open('CONFIG.md', 'w')
writer:write(readme_data)
writer:close()
end
require_all_configs()
-generate_readme("scripts/README_template.md", {
+generate_readme('scripts/README_template.md', {
implemented_servers_list = make_implemented_servers_list(),
lsp_server_details = make_lsp_sections(),
})
diff --git a/scripts/vimdocgen.lua b/scripts/vimdocgen.lua
index fe9d21e1..17a8de94 100644
--- a/scripts/vimdocgen.lua
+++ b/scripts/vimdocgen.lua
@@ -1,20 +1,20 @@
-local docgen = require "babelfish"
+local docgen = require 'babelfish'
local docs = {}
docs.generate = function()
local metadata = {
- input_file = "./README.md",
- output_file = "./doc/lspconfig.txt",
- project_name = "lspconfig",
+ input_file = './README.md',
+ output_file = './doc/lspconfig.txt',
+ project_name = 'lspconfig',
header_aliases = {
- ["Example: using the defaults"] = { "Defaults", "defaults" },
- ["Example: override some defaults"] = { "Overriding server defaults", "override-server-defaults" },
- ["Example: custom config"] = { "Custom config", "custom-config" },
- ["Example: override default config for all servers"] = { "Overriding all defaults", "override-all-defaults" },
- ["Individual server settings and initialization options"] = { "Per-server documentation", "server-documentation" },
- ["Keybindings and completion"] = { "Keybindings", "keybindings" },
- ["Manually starting (or restarting) language servers"] = { "Manual control", "manual-control" },
+ ['Example: using the defaults'] = { 'Defaults', 'defaults' },
+ ['Example: override some defaults'] = { 'Overriding server defaults', 'override-server-defaults' },
+ ['Example: custom config'] = { 'Custom config', 'custom-config' },
+ ['Example: override default config for all servers'] = { 'Overriding all defaults', 'override-all-defaults' },
+ ['Individual server settings and initialization options'] = { 'Per-server documentation', 'server-documentation' },
+ ['Keybindings and completion'] = { 'Keybindings', 'keybindings' },
+ ['Manually starting (or restarting) language servers'] = { 'Manual control', 'manual-control' },
},
}
docgen.generate_readme(metadata)
diff --git a/test/lspconfig_spec.lua b/test/lspconfig_spec.lua
index e6a80d1d..cef8aa46 100644
--- a/test/lspconfig_spec.lua
+++ b/test/lspconfig_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require "test.functional.helpers"(after_each)
+local helpers = require 'test.functional.helpers'(after_each)
local clear = helpers.clear
local exec_lua = helpers.exec_lua
local eq = helpers.eq
@@ -15,11 +15,11 @@ before_each(function()
)
end)
-describe("lspconfig", function()
- describe("util", function()
- describe("path", function()
- describe("exists", function()
- it("is present directory", function()
+describe('lspconfig', function()
+ describe('util', function()
+ describe('path', function()
+ describe('exists', function()
+ it('is present directory', function()
ok(exec_lua [[
local lspconfig = require("lspconfig")
@@ -28,7 +28,7 @@ describe("lspconfig", function()
]])
end)
- it("is not present directory", function()
+ it('is not present directory', function()
ok(exec_lua [[
local lspconfig = require("lspconfig")
@@ -37,7 +37,7 @@ describe("lspconfig", function()
]])
end)
- it("is present file", function()
+ it('is present file', function()
ok(exec_lua [[
local lspconfig = require("lspconfig")
@@ -49,7 +49,7 @@ describe("lspconfig", function()
]])
end)
- it("is not present file", function()
+ it('is not present file', function()
ok(exec_lua [[
local lspconfig = require("lspconfig")
@@ -62,8 +62,8 @@ describe("lspconfig", function()
end)
end)
- describe("is_dir", function()
- it("is directory", function()
+ describe('is_dir', function()
+ it('is directory', function()
ok(exec_lua [[
local lspconfig = require("lspconfig")
@@ -72,7 +72,7 @@ describe("lspconfig", function()
]])
end)
- it("is not present directory", function()
+ it('is not present directory', function()
ok(exec_lua [[
local lspconfig = require("lspconfig")
@@ -81,7 +81,7 @@ describe("lspconfig", function()
]])
end)
- it("is file", function()
+ it('is file', function()
ok(exec_lua [[
local lspconfig = require("lspconfig")
@@ -94,8 +94,8 @@ describe("lspconfig", function()
end)
end)
- describe("is_file", function()
- it("is file", function()
+ describe('is_file', function()
+ it('is file', function()
ok(exec_lua [[
local lspconfig = require("lspconfig")
@@ -107,7 +107,7 @@ describe("lspconfig", function()
]])
end)
- it("is not present file", function()
+ it('is not present file', function()
ok(exec_lua [[
local lspconfig = require("lspconfig")
@@ -119,7 +119,7 @@ describe("lspconfig", function()
]])
end)
- it("is directory", function()
+ it('is directory', function()
ok(exec_lua [[
local lspconfig = require("lspconfig")
@@ -129,15 +129,15 @@ describe("lspconfig", function()
end)
end)
- describe("is_absolute", function()
- it("is absolute", function()
+ describe('is_absolute', function()
+ it('is absolute', function()
ok(exec_lua [[
local lspconfig = require("lspconfig")
return not (lspconfig.util.path.is_absolute("/foo/bar") == nil)
]])
end)
- it("is not absolute", function()
+ it('is not absolute', function()
ok(exec_lua [[
local lspconfig = require("lspconfig")
return lspconfig.util.path.is_absolute("foo/bar") == nil
@@ -150,21 +150,21 @@ describe("lspconfig", function()
end)
end)
- describe("join", function()
- it("", function()
+ describe('join', function()
+ it('', function()
eq(
exec_lua [[
local lspconfig = require("lspconfig")
return lspconfig.util.path.join("foo", "bar", "baz")
]],
- "foo/bar/baz"
+ 'foo/bar/baz'
)
end)
end)
end)
- describe("root_pattern", function()
- it("resolves to a_marker.txt", function()
+ describe('root_pattern', function()
+ it('resolves to a_marker.txt', function()
ok(exec_lua [[
local lspconfig = require("lspconfig")
@@ -175,7 +175,7 @@ describe("lspconfig", function()
]])
end)
- it("resolves to root_marker.txt", function()
+ it('resolves to root_marker.txt', function()
ok(exec_lua [[
local lspconfig = require("lspconfig")
diff --git a/test/minimal_init.lua b/test/minimal_init.lua
index b7f749ba..83023dec 100644
--- a/test/minimal_init.lua
+++ b/test/minimal_init.lua
@@ -1,24 +1,24 @@
-- install packer
local fn = vim.fn
-local install_path = "/tmp/nvim/site/pack/packer/start/packer.nvim"
+local install_path = '/tmp/nvim/site/pack/packer/start/packer.nvim'
vim.cmd [[set packpath=/tmp/nvim/site]]
local function load_plugins()
- local use = require("packer").use
- require("packer").startup {
+ local use = require('packer').use
+ require('packer').startup {
function()
- use "wbthomason/packer.nvim"
- use "neovim/nvim-lspconfig"
+ use 'wbthomason/packer.nvim'
+ use 'neovim/nvim-lspconfig'
end,
- config = { package_root = "/tmp/nvim/site/pack" },
+ config = { package_root = '/tmp/nvim/site/pack' },
}
end
_G.load_config = function()
- vim.lsp.set_log_level "trace"
- local nvim_lsp = require "lspconfig"
+ vim.lsp.set_log_level 'trace'
+ local nvim_lsp = require 'lspconfig'
local on_attach = function(_, bufnr)
local function buf_set_keymap(...)
vim.api.nvim_buf_set_keymap(bufnr, ...)
@@ -27,32 +27,32 @@ _G.load_config = function()
vim.api.nvim_buf_set_option(bufnr, ...)
end
- buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
+ buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings.
local opts = { noremap = true, silent = true }
- buf_set_keymap("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts)
- buf_set_keymap("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
- buf_set_keymap("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
- buf_set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
- buf_set_keymap("n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
- buf_set_keymap("n", "<space>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
- buf_set_keymap("n", "<space>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
- buf_set_keymap("n", "<space>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>", opts)
- buf_set_keymap("n", "<space>D", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
- buf_set_keymap("n", "<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
- buf_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
- buf_set_keymap("n", "<space>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
- buf_set_keymap("n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts)
- buf_set_keymap("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts)
- buf_set_keymap("n", "<space>q", "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", opts)
+ buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
+ buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
+ buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
+ buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
+ buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
+ buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
+ buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
+ buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
+ buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
+ buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
+ buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
+ buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
+ buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
+ buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
+ buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
end
-- Add the server that troubles you here
- local name = "pyright"
- local cmd = { "pyright-langserver", "--stdio" } -- needed for elixirls, omnisharp, sumneko_lua
+ local name = 'pyright'
+ local cmd = { 'pyright-langserver', '--stdio' } -- needed for elixirls, omnisharp, sumneko_lua
if not name then
- print "You have not defined a server name, please edit minimal_init.lua"
+ print 'You have not defined a server name, please edit minimal_init.lua'
end
if not nvim_lsp[name].document_config.default_config.cmd and not cmd then
print [[You have not defined a server default cmd for a server
@@ -68,10 +68,10 @@ _G.load_config = function()
end
if fn.isdirectory(install_path) == 0 then
- fn.system { "git", "clone", "https://github.com/wbthomason/packer.nvim", install_path }
+ fn.system { 'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path }
load_plugins()
- require("packer").sync()
- vim.cmd "autocmd User PackerComplete ++once lua load_config()"
+ require('packer').sync()
+ vim.cmd 'autocmd User PackerComplete ++once lua load_config()'
else
load_plugins()
_G.load_config()