Regenerate nvim config
This commit is contained in:
@ -0,0 +1,70 @@
|
||||
local M = {}
|
||||
|
||||
function M.run(func)
|
||||
coroutine.resume(coroutine.create(function()
|
||||
local status, err = pcall(func)
|
||||
if not status then
|
||||
vim.notify(('[lspconfig] unhandled error: %s'):format(tostring(err)), vim.log.levels.WARN)
|
||||
end
|
||||
end))
|
||||
end
|
||||
|
||||
--- @param cmd string|string[]
|
||||
--- @return string[]?
|
||||
function M.run_command(cmd)
|
||||
local co = assert(coroutine.running())
|
||||
|
||||
local stdout = {}
|
||||
local stderr = {}
|
||||
local exit_code = nil
|
||||
|
||||
local jobid = vim.fn.jobstart(cmd, {
|
||||
on_stdout = function(_, data, _)
|
||||
data = table.concat(data, '\n')
|
||||
if #data > 0 then
|
||||
stdout[#stdout + 1] = data
|
||||
end
|
||||
end,
|
||||
on_stderr = function(_, data, _)
|
||||
stderr[#stderr + 1] = table.concat(data, '\n')
|
||||
end,
|
||||
on_exit = function(_, code, _)
|
||||
exit_code = code
|
||||
coroutine.resume(co)
|
||||
end,
|
||||
stdout_buffered = true,
|
||||
stderr_buffered = true,
|
||||
})
|
||||
|
||||
if jobid <= 0 then
|
||||
vim.notify(('[lspconfig] unable to run cmd: %s'):format(cmd), vim.log.levels.WARN)
|
||||
return nil
|
||||
end
|
||||
|
||||
coroutine.yield()
|
||||
|
||||
if exit_code ~= 0 then
|
||||
vim.notify(
|
||||
('[lspconfig] cmd failed with code %d: %s\n%s'):format(exit_code, cmd, table.concat(stderr, '')),
|
||||
vim.log.levels.WARN
|
||||
)
|
||||
return nil
|
||||
end
|
||||
|
||||
if next(stdout) == nil then
|
||||
return nil
|
||||
end
|
||||
return stdout and stdout or nil
|
||||
end
|
||||
|
||||
function M.reenter()
|
||||
if vim.in_fast_event() then
|
||||
local co = assert(coroutine.running())
|
||||
vim.schedule(function()
|
||||
coroutine.resume(co)
|
||||
end)
|
||||
coroutine.yield()
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
@ -0,0 +1,295 @@
|
||||
local util = require 'lspconfig.util'
|
||||
local async = require 'lspconfig.async'
|
||||
local api, validate, lsp, uv, fn = vim.api, vim.validate, vim.lsp, vim.loop, vim.fn
|
||||
local tbl_deep_extend = vim.tbl_deep_extend
|
||||
|
||||
local configs = {}
|
||||
|
||||
--- @class lspconfig.Config : vim.lsp.ClientConfig
|
||||
--- @field enabled? boolean
|
||||
--- @field single_file_support? boolean
|
||||
--- @field filetypes? string[]
|
||||
--- @field filetype? string
|
||||
--- @field on_new_config? function
|
||||
--- @field autostart? boolean
|
||||
--- @field package _on_attach? fun(client: vim.lsp.Client, bufnr: integer)
|
||||
|
||||
--- @param cmd any
|
||||
local function sanitize_cmd(cmd)
|
||||
if cmd and type(cmd) == 'table' and not vim.tbl_isempty(cmd) then
|
||||
local original = cmd[1]
|
||||
cmd[1] = vim.fn.exepath(cmd[1])
|
||||
if #cmd[1] == 0 then
|
||||
cmd[1] = original
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
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 },
|
||||
}
|
||||
|
||||
if config_def.default_config.deprecate then
|
||||
vim.deprecate(
|
||||
config_name,
|
||||
config_def.default_config.deprecate.to,
|
||||
config_def.default_config.deprecate.version,
|
||||
'lspconfig',
|
||||
false
|
||||
)
|
||||
end
|
||||
|
||||
if config_def.commands then
|
||||
for k, v in pairs(config_def.commands) do
|
||||
validate {
|
||||
['command.name'] = { k, 's' },
|
||||
['command.fn'] = { v[1], 'f' },
|
||||
}
|
||||
end
|
||||
else
|
||||
config_def.commands = {}
|
||||
end
|
||||
|
||||
local M = {}
|
||||
|
||||
local default_config = tbl_deep_extend('keep', config_def.default_config, util.default_config)
|
||||
|
||||
-- Force this part.
|
||||
default_config.name = config_name
|
||||
|
||||
--- @param user_config lspconfig.Config
|
||||
function M.setup(user_config)
|
||||
local lsp_group = api.nvim_create_augroup('lspconfig', { clear = false })
|
||||
|
||||
validate {
|
||||
cmd = {
|
||||
user_config.cmd,
|
||||
{ 'f', 't' },
|
||||
true,
|
||||
},
|
||||
root_dir = { user_config.root_dir, 'f', true },
|
||||
filetypes = { user_config.filetype, 't', true },
|
||||
on_new_config = { user_config.on_new_config, 'f', true },
|
||||
on_attach = { user_config.on_attach, 'f', true },
|
||||
commands = { user_config.commands, 't', true },
|
||||
}
|
||||
if user_config.commands then
|
||||
for k, v in pairs(user_config.commands) do
|
||||
validate {
|
||||
['command.name'] = { k, 's' },
|
||||
['command.fn'] = { v[1], 'f' },
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
local config = tbl_deep_extend('keep', user_config, default_config)
|
||||
|
||||
sanitize_cmd(config.cmd)
|
||||
|
||||
if util.on_setup then
|
||||
pcall(util.on_setup, config, user_config)
|
||||
end
|
||||
|
||||
if config.autostart == true then
|
||||
local event_conf = config.filetypes and { event = 'FileType', pattern = config.filetypes }
|
||||
or { event = 'BufReadPost' }
|
||||
api.nvim_create_autocmd(event_conf.event, {
|
||||
pattern = event_conf.pattern or '*',
|
||||
callback = function(opt)
|
||||
M.manager:try_add(opt.buf)
|
||||
end,
|
||||
group = lsp_group,
|
||||
desc = string.format(
|
||||
'Checks whether server %s should start a new instance or attach to an existing one.',
|
||||
config.name
|
||||
),
|
||||
})
|
||||
end
|
||||
|
||||
local get_root_dir = config.root_dir
|
||||
|
||||
function M.launch(bufnr)
|
||||
bufnr = bufnr or api.nvim_get_current_buf()
|
||||
if not api.nvim_buf_is_valid(bufnr) then
|
||||
return
|
||||
end
|
||||
local bufname = api.nvim_buf_get_name(bufnr)
|
||||
if (#bufname == 0 and not config.single_file_support) or (#bufname ~= 0 and not util.bufname_valid(bufname)) then
|
||||
return
|
||||
end
|
||||
|
||||
local pwd = uv.cwd()
|
||||
|
||||
async.run(function()
|
||||
local root_dir
|
||||
if get_root_dir then
|
||||
root_dir = get_root_dir(util.path.sanitize(bufname), bufnr)
|
||||
async.reenter()
|
||||
if not api.nvim_buf_is_valid(bufnr) then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if root_dir then
|
||||
api.nvim_create_autocmd('BufReadPost', {
|
||||
pattern = fn.fnameescape(root_dir) .. '/*',
|
||||
callback = function(arg)
|
||||
if #M.manager:clients() == 0 then
|
||||
return true
|
||||
end
|
||||
M.manager:try_add_wrapper(arg.buf, root_dir)
|
||||
end,
|
||||
group = lsp_group,
|
||||
desc = string.format(
|
||||
'Checks whether server %s should attach to a newly opened buffer inside workspace %q.',
|
||||
config.name,
|
||||
root_dir
|
||||
),
|
||||
})
|
||||
|
||||
for _, buf in ipairs(api.nvim_list_bufs()) do
|
||||
local buf_name = api.nvim_buf_get_name(buf)
|
||||
if util.bufname_valid(buf_name) then
|
||||
local buf_dir = util.path.sanitize(buf_name)
|
||||
if buf_dir:sub(1, root_dir:len()) == root_dir then
|
||||
M.manager:try_add_wrapper(buf, root_dir)
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif config.single_file_support then
|
||||
-- This allows on_new_config to use the parent directory of the file
|
||||
-- Effectively this is the root from lspconfig's perspective, as we use
|
||||
-- this to attach additional files in the same parent folder to the same server.
|
||||
-- We just no longer send rootDirectory or workspaceFolders during initialization.
|
||||
if not api.nvim_buf_is_valid(bufnr) or (#bufname ~= 0 and not util.bufname_valid(bufname)) then
|
||||
return
|
||||
end
|
||||
local pseudo_root = #bufname == 0 and pwd or util.path.dirname(util.path.sanitize(bufname))
|
||||
M.manager:add(pseudo_root, true, bufnr)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- Used by :LspInfo
|
||||
M.get_root_dir = get_root_dir
|
||||
M.filetypes = config.filetypes
|
||||
M.handlers = config.handlers
|
||||
M.cmd = config.cmd
|
||||
M.autostart = config.autostart
|
||||
|
||||
-- In the case of a reload, close existing things.
|
||||
local reload = false
|
||||
if M.manager then
|
||||
for _, client in ipairs(M.manager:clients()) do
|
||||
client.stop(true)
|
||||
end
|
||||
reload = true
|
||||
M.manager = nil
|
||||
end
|
||||
|
||||
local make_config = function(root_dir)
|
||||
local new_config = tbl_deep_extend('keep', vim.empty_dict(), config) --[[@as lspconfig.Config]]
|
||||
new_config.capabilities = tbl_deep_extend('keep', new_config.capabilities, {
|
||||
workspace = {
|
||||
configuration = true,
|
||||
},
|
||||
})
|
||||
|
||||
if config_def.on_new_config then
|
||||
pcall(config_def.on_new_config, new_config, root_dir)
|
||||
end
|
||||
if config.on_new_config then
|
||||
pcall(config.on_new_config, new_config, root_dir)
|
||||
end
|
||||
|
||||
new_config.on_init = util.add_hook_after(new_config.on_init, function(client, result)
|
||||
-- Handle offset encoding by default
|
||||
if result.offsetEncoding then
|
||||
client.offset_encoding = result.offsetEncoding
|
||||
end
|
||||
|
||||
-- Send `settings` to server via workspace/didChangeConfiguration
|
||||
function client.workspace_did_change_configuration(settings)
|
||||
if not settings then
|
||||
return
|
||||
end
|
||||
if vim.tbl_isempty(settings) then
|
||||
settings = { [vim.type_idx] = vim.types.dictionary }
|
||||
end
|
||||
return client.notify('workspace/didChangeConfiguration', {
|
||||
settings = settings,
|
||||
})
|
||||
end
|
||||
end)
|
||||
|
||||
-- Save the old _on_attach so that we can reference it via the BufEnter.
|
||||
new_config._on_attach = new_config.on_attach
|
||||
new_config.on_attach = function(client, bufnr)
|
||||
if bufnr == api.nvim_get_current_buf() then
|
||||
M._setup_buffer(client.id, bufnr)
|
||||
else
|
||||
if api.nvim_buf_is_valid(bufnr) then
|
||||
api.nvim_create_autocmd('BufEnter', {
|
||||
callback = function()
|
||||
M._setup_buffer(client.id, bufnr)
|
||||
end,
|
||||
group = lsp_group,
|
||||
buffer = bufnr,
|
||||
once = true,
|
||||
desc = 'Reattaches the server with the updated configurations if changed.',
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
new_config.root_dir = root_dir
|
||||
new_config.workspace_folders = {
|
||||
{
|
||||
uri = vim.uri_from_fname(root_dir),
|
||||
name = string.format('%s', root_dir),
|
||||
},
|
||||
}
|
||||
return new_config
|
||||
end
|
||||
|
||||
local manager = require('lspconfig.manager').new(config, make_config)
|
||||
|
||||
M.manager = manager
|
||||
M.make_config = make_config
|
||||
if reload and config.autostart ~= false then
|
||||
for _, bufnr in ipairs(api.nvim_list_bufs()) do
|
||||
manager:try_add_wrapper(bufnr)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M._setup_buffer(client_id, bufnr)
|
||||
local client = lsp.get_client_by_id(client_id)
|
||||
if not client then
|
||||
return
|
||||
end
|
||||
local config = client.config --[[@as lspconfig.Config]]
|
||||
if config._on_attach then
|
||||
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)
|
||||
end
|
||||
if not M.commands_created and not vim.tbl_isempty(M.commands) then
|
||||
util.create_module_commands(config_name, M.commands)
|
||||
end
|
||||
end
|
||||
|
||||
M.commands = config_def.commands
|
||||
M.name = config_name
|
||||
M.document_config = config_def
|
||||
|
||||
rawset(t, config_name, M)
|
||||
end
|
||||
|
||||
return setmetatable({}, configs)
|
||||
@ -0,0 +1,302 @@
|
||||
local api = vim.api
|
||||
local lsp = vim.lsp
|
||||
local uv = vim.loop
|
||||
|
||||
local async = require 'lspconfig.async'
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
---@param client vim.lsp.Client
|
||||
---@param root_dir string
|
||||
---@return boolean
|
||||
local function check_in_workspace(client, root_dir)
|
||||
if not client.workspace_folders then
|
||||
return false
|
||||
end
|
||||
|
||||
for _, dir in ipairs(client.workspace_folders) do
|
||||
if (root_dir .. '/'):sub(1, #dir.name + 1) == dir.name .. '/' then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
--- @class lspconfig.Manager
|
||||
--- @field _clients table<string,integer[]>
|
||||
--- @field config lspconfig.Config
|
||||
--- @field make_config fun(root_dir: string): lspconfig.Config
|
||||
local M = {}
|
||||
|
||||
--- @param config lspconfig.Config
|
||||
--- @param make_config fun(root_dir: string): lspconfig.Config
|
||||
--- @return lspconfig.Manager
|
||||
function M.new(config, make_config)
|
||||
return setmetatable({
|
||||
_clients = {},
|
||||
config = config,
|
||||
make_config = make_config,
|
||||
}, {
|
||||
__index = M,
|
||||
})
|
||||
end
|
||||
|
||||
--- @private
|
||||
--- @param clients table<string,integer[]>
|
||||
--- @param root_dir string
|
||||
--- @param client_name string
|
||||
--- @return vim.lsp.Client?
|
||||
local function get_client(clients, root_dir, client_name)
|
||||
if vim.tbl_isempty(clients) then
|
||||
return
|
||||
end
|
||||
|
||||
if clients[root_dir] then
|
||||
for _, id in pairs(clients[root_dir]) do
|
||||
local client = lsp.get_client_by_id(id)
|
||||
if client and client.name == client_name then
|
||||
return client
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for _, ids in pairs(clients) do
|
||||
for _, id in ipairs(ids) do
|
||||
local client = lsp.get_client_by_id(id)
|
||||
if client and client.name == client_name then
|
||||
return client
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- @private
|
||||
--- @param bufnr integer
|
||||
--- @param root string
|
||||
--- @param client_id integer
|
||||
function M:_attach_and_cache(bufnr, root, client_id)
|
||||
local clients = self._clients
|
||||
lsp.buf_attach_client(bufnr, client_id)
|
||||
if not clients[root] then
|
||||
clients[root] = {}
|
||||
end
|
||||
if not vim.tbl_contains(clients[root], client_id) then
|
||||
clients[root][#clients[root] + 1] = client_id
|
||||
end
|
||||
end
|
||||
|
||||
--- @private
|
||||
--- @param bufnr integer
|
||||
--- @param root_dir string
|
||||
--- @param client vim.lsp.Client
|
||||
function M:_register_workspace_folders(bufnr, root_dir, client)
|
||||
local params = {
|
||||
event = {
|
||||
added = { { uri = vim.uri_from_fname(root_dir), name = root_dir } },
|
||||
removed = {},
|
||||
},
|
||||
}
|
||||
client.rpc.notify('workspace/didChangeWorkspaceFolders', params)
|
||||
if not client.workspace_folders then
|
||||
client.workspace_folders = {}
|
||||
end
|
||||
client.workspace_folders[#client.workspace_folders + 1] = params.event.added[1]
|
||||
self:_attach_and_cache(bufnr, root_dir, client.id)
|
||||
end
|
||||
|
||||
--- @private
|
||||
--- @param bufnr integer
|
||||
--- @param new_config lspconfig.Config
|
||||
--- @param root_dir string
|
||||
--- @param single_file boolean
|
||||
function M:_start_new_client(bufnr, new_config, root_dir, single_file)
|
||||
-- do nothing if the client is not enabled
|
||||
if new_config.enabled == false then
|
||||
return
|
||||
end
|
||||
if not new_config.cmd then
|
||||
vim.notify(
|
||||
string.format(
|
||||
'[lspconfig] cmd not defined for %q. Manually set cmd in the setup {} call according to server_configurations.md, see :help lspconfig-index.',
|
||||
new_config.name
|
||||
),
|
||||
vim.log.levels.ERROR
|
||||
)
|
||||
return
|
||||
end
|
||||
|
||||
local clients = self._clients
|
||||
|
||||
new_config.on_exit = util.add_hook_before(new_config.on_exit, function()
|
||||
for index, id in pairs(clients[root_dir]) do
|
||||
local exist = assert(lsp.get_client_by_id(id))
|
||||
if exist.name == new_config.name then
|
||||
table.remove(clients[root_dir], index)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Launch the server in the root directory used internally by lspconfig, if otherwise unset
|
||||
-- also check that the path exist
|
||||
if not new_config.cmd_cwd and uv.fs_realpath(root_dir) then
|
||||
new_config.cmd_cwd = root_dir
|
||||
end
|
||||
|
||||
-- Sending rootDirectory and workspaceFolders as null is not explicitly
|
||||
-- codified in the spec. Certain servers crash if initialized with a NULL
|
||||
-- root directory.
|
||||
if single_file then
|
||||
new_config.root_dir = nil
|
||||
new_config.workspace_folders = nil
|
||||
end
|
||||
|
||||
-- TODO: Replace lsp.start_client with lsp.start
|
||||
local client_id, err = lsp.start_client(new_config)
|
||||
if not client_id then
|
||||
if err then
|
||||
vim.notify(err, vim.log.levels.WARN)
|
||||
end
|
||||
return
|
||||
end
|
||||
self:_attach_and_cache(bufnr, root_dir, client_id)
|
||||
end
|
||||
|
||||
--- @private
|
||||
--- @param bufnr integer
|
||||
--- @param new_config lspconfig.Config
|
||||
--- @param root_dir string
|
||||
--- @param client vim.lsp.Client
|
||||
--- @param single_file boolean
|
||||
function M:_attach_or_spawn(bufnr, new_config, root_dir, client, single_file)
|
||||
if check_in_workspace(client, root_dir) then
|
||||
return self:_attach_and_cache(bufnr, root_dir, client.id)
|
||||
end
|
||||
|
||||
local supported = vim.tbl_get(client, 'server_capabilities', 'workspace', 'workspaceFolders', 'supported')
|
||||
if supported then
|
||||
return self:_register_workspace_folders(bufnr, root_dir, client)
|
||||
end
|
||||
self:_start_new_client(bufnr, new_config, root_dir, single_file)
|
||||
end
|
||||
|
||||
--- @private
|
||||
--- @param bufnr integer
|
||||
--- @param new_config lspconfig.Config
|
||||
--- @param root_dir string
|
||||
--- @param client vim.lsp.Client
|
||||
--- @param single_file boolean
|
||||
function M:_attach_after_client_initialized(bufnr, new_config, root_dir, client, single_file)
|
||||
local timer = assert(uv.new_timer())
|
||||
timer:start(
|
||||
0,
|
||||
10,
|
||||
vim.schedule_wrap(function()
|
||||
if client.initialized and client.server_capabilities and not timer:is_closing() then
|
||||
self:_attach_or_spawn(bufnr, new_config, root_dir, client, single_file)
|
||||
timer:stop()
|
||||
timer:close()
|
||||
end
|
||||
end)
|
||||
)
|
||||
end
|
||||
|
||||
---@param root_dir string
|
||||
---@param single_file boolean
|
||||
---@param bufnr integer
|
||||
function M:add(root_dir, single_file, bufnr)
|
||||
root_dir = util.path.sanitize(root_dir)
|
||||
local new_config = self.make_config(root_dir)
|
||||
local client = get_client(self._clients, root_dir, new_config.name)
|
||||
|
||||
if not client then
|
||||
return self:_start_new_client(bufnr, new_config, root_dir, single_file)
|
||||
end
|
||||
|
||||
if self._clients[root_dir] or single_file then
|
||||
lsp.buf_attach_client(bufnr, client.id)
|
||||
return
|
||||
end
|
||||
|
||||
-- make sure neovim had exchanged capabilities from language server
|
||||
-- it's useful to check server support workspaceFolders or not
|
||||
if client.initialized and client.server_capabilities then
|
||||
self:_attach_or_spawn(bufnr, new_config, root_dir, client, single_file)
|
||||
else
|
||||
self:_attach_after_client_initialized(bufnr, new_config, root_dir, client, single_file)
|
||||
end
|
||||
end
|
||||
|
||||
--- @return vim.lsp.Client[]
|
||||
function M:clients()
|
||||
local res = {}
|
||||
for _, client_ids in pairs(self._clients) do
|
||||
for _, id in ipairs(client_ids) do
|
||||
res[#res + 1] = lsp.get_client_by_id(id)
|
||||
end
|
||||
end
|
||||
return res
|
||||
end
|
||||
|
||||
--- Try to attach the buffer `bufnr` to a client using this config, creating
|
||||
--- a new client if one doesn't already exist for `bufnr`.
|
||||
--- @param bufnr integer
|
||||
--- @param project_root? string
|
||||
function M:try_add(bufnr, project_root)
|
||||
bufnr = bufnr or api.nvim_get_current_buf()
|
||||
|
||||
if vim.bo[bufnr].buftype == 'nofile' then
|
||||
return
|
||||
end
|
||||
|
||||
local bufname = api.nvim_buf_get_name(bufnr)
|
||||
if #bufname == 0 and not self.config.single_file_support then
|
||||
return
|
||||
end
|
||||
|
||||
if #bufname ~= 0 and not util.bufname_valid(bufname) then
|
||||
return
|
||||
end
|
||||
|
||||
if project_root then
|
||||
self:add(project_root, false, bufnr)
|
||||
return
|
||||
end
|
||||
|
||||
local buf_path = util.path.sanitize(bufname)
|
||||
|
||||
local get_root_dir = self.config.root_dir
|
||||
|
||||
local pwd = assert(uv.cwd())
|
||||
|
||||
async.run(function()
|
||||
local root_dir
|
||||
if get_root_dir then
|
||||
root_dir = get_root_dir(buf_path, bufnr)
|
||||
async.reenter()
|
||||
if not api.nvim_buf_is_valid(bufnr) then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if root_dir then
|
||||
self:add(root_dir, false, bufnr)
|
||||
elseif self.config.single_file_support then
|
||||
local pseudo_root = #bufname == 0 and pwd or util.path.dirname(buf_path)
|
||||
self:add(pseudo_root, true, bufnr)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
--- Check that the buffer `bufnr` has a valid filetype according to
|
||||
--- `config.filetypes`, then do `manager.try_add(bufnr)`.
|
||||
--- @param bufnr integer
|
||||
--- @param project_root? string
|
||||
function M:try_add_wrapper(bufnr, project_root)
|
||||
local config = self.config
|
||||
-- `config.filetypes = nil` means all filetypes are valid.
|
||||
if not config.filetypes or vim.tbl_contains(config.filetypes, vim.bo[bufnr].filetype) then
|
||||
self:try_add(bufnr, project_root)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
@ -0,0 +1,17 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'als' },
|
||||
filetypes = { 'agda' },
|
||||
root_dir = util.root_pattern('.git', '*.agda-lib'),
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/agda/agda-language-server
|
||||
|
||||
Language Server for Agda.
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'aiken', 'lsp' },
|
||||
filetypes = { 'aiken' },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern('aiken.toml', '.git')(fname)
|
||||
end,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/aiken-lang/aiken
|
||||
|
||||
A language server for Aiken Programming Language.
|
||||
[Installation](https://aiken-lang.org/installation-instructions)
|
||||
|
||||
It can be i
|
||||
]],
|
||||
default_config = {
|
||||
cmd = { 'aiken', 'lsp' },
|
||||
root_dir = [[root_pattern("aiken.toml", ".git")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
local util = require 'lspconfig.util'
|
||||
local bin_name = 'ada_language_server'
|
||||
|
||||
if vim.fn.has 'win32' == 1 then
|
||||
bin_name = 'ada_language_server.exe'
|
||||
end
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { bin_name },
|
||||
filetypes = { 'ada' },
|
||||
root_dir = util.root_pattern('Makefile', '.git', '*.gpr', '*.adc'),
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/AdaCore/ada_language_server
|
||||
|
||||
Installation instructions can be found [here](https://github.com/AdaCore/ada_language_server#Install).
|
||||
|
||||
Can be configured by passing a "settings" object to `als.setup{}`:
|
||||
|
||||
```lua
|
||||
require('lspconfig').als.setup{
|
||||
settings = {
|
||||
ada = {
|
||||
projectFile = "project.gpr";
|
||||
scenarioVariables = { ... };
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[util.root_pattern("Makefile", ".git", "*.gpr", "*.adc")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'anakinls' },
|
||||
filetypes = { 'python' },
|
||||
root_dir = function(fname)
|
||||
local root_files = {
|
||||
'pyproject.toml',
|
||||
'setup.py',
|
||||
'setup.cfg',
|
||||
'requirements.txt',
|
||||
'Pipfile',
|
||||
}
|
||||
return util.root_pattern(unpack(root_files))(fname) or util.find_git_ancestor(fname)
|
||||
end,
|
||||
single_file_support = true,
|
||||
settings = {
|
||||
anakinls = {
|
||||
pyflakes_errors = {
|
||||
-- Full list: https://github.com/PyCQA/pyflakes/blob/master/pyflakes/messages.py
|
||||
|
||||
'ImportStarNotPermitted',
|
||||
|
||||
'UndefinedExport',
|
||||
'UndefinedLocal',
|
||||
'UndefinedName',
|
||||
|
||||
'DuplicateArgument',
|
||||
'MultiValueRepeatedKeyLiteral',
|
||||
'MultiValueRepeatedKeyVariable',
|
||||
|
||||
'FutureFeatureNotDefined',
|
||||
'LateFutureImport',
|
||||
|
||||
'ReturnOutsideFunction',
|
||||
'YieldOutsideFunction',
|
||||
'ContinueOutsideLoop',
|
||||
'BreakOutsideLoop',
|
||||
|
||||
'TwoStarredExpressions',
|
||||
'TooManyExpressionsInStarredAssignment',
|
||||
|
||||
'ForwardAnnotationSyntaxError',
|
||||
'RaiseNotImplemented',
|
||||
|
||||
'StringDotFormatExtraPositionalArguments',
|
||||
'StringDotFormatExtraNamedArguments',
|
||||
'StringDotFormatMissingArgument',
|
||||
'StringDotFormatMixingAutomatic',
|
||||
'StringDotFormatInvalidFormat',
|
||||
|
||||
'PercentFormatInvalidFormat',
|
||||
'PercentFormatMixedPositionalAndNamed',
|
||||
'PercentFormatUnsupportedFormat',
|
||||
'PercentFormatPositionalCountMismatch',
|
||||
'PercentFormatExtraNamedArguments',
|
||||
'PercentFormatMissingArgument',
|
||||
'PercentFormatExpectedMapping',
|
||||
'PercentFormatExpectedSequence',
|
||||
'PercentFormatStarRequiresSequence',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://pypi.org/project/anakin-language-server/
|
||||
|
||||
`anakin-language-server` is yet another Jedi Python language server.
|
||||
|
||||
Available options:
|
||||
|
||||
* Initialization: https://github.com/muffinmad/anakin-language-server#initialization-option
|
||||
* Configuration: https://github.com/muffinmad/anakin-language-server#configuration-options
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
-- Angular requires a node_modules directory to probe for @angular/language-service and typescript
|
||||
-- in order to use your projects configured versions.
|
||||
-- This defaults to the vim cwd, but will get overwritten by the resolved root of the file.
|
||||
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 ''
|
||||
end
|
||||
|
||||
local default_probe_dir = get_probe_dir(vim.fn.getcwd())
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = {
|
||||
'ngserver',
|
||||
'--stdio',
|
||||
'--tsProbeLocations',
|
||||
default_probe_dir,
|
||||
'--ngProbeLocations',
|
||||
default_probe_dir,
|
||||
},
|
||||
filetypes = { 'typescript', 'html', 'typescriptreact', 'typescript.tsx' },
|
||||
-- Check for angular.json 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',
|
||||
},
|
||||
on_new_config = function(new_config, new_root_dir)
|
||||
local new_probe_dir = get_probe_dir(new_root_dir)
|
||||
|
||||
-- We need to check our probe directories because they may have changed.
|
||||
new_config.cmd = {
|
||||
'ngserver',
|
||||
'--stdio',
|
||||
'--tsProbeLocations',
|
||||
new_probe_dir,
|
||||
'--ngProbeLocations',
|
||||
new_probe_dir,
|
||||
}
|
||||
end,
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/angular/vscode-ng-language-service
|
||||
|
||||
`angular-language-server` can be installed via npm `npm install -g @angular/language-server`.
|
||||
|
||||
Note, that if you override the default `cmd`, you must also update `on_new_config` to set `new_config.cmd` during startup.
|
||||
|
||||
```lua
|
||||
local project_library_path = "/path/to/project/lib"
|
||||
local cmd = {"ngserver", "--stdio", "--tsProbeLocations", project_library_path , "--ngProbeLocations", project_library_path}
|
||||
|
||||
require'lspconfig'.angularls.setup{
|
||||
cmd = cmd,
|
||||
on_new_config = function(new_config,new_root_dir)
|
||||
new_config.cmd = cmd
|
||||
end,
|
||||
}
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("angular.json")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'ansible-language-server', '--stdio' },
|
||||
settings = {
|
||||
ansible = {
|
||||
python = {
|
||||
interpreterPath = 'python',
|
||||
},
|
||||
ansible = {
|
||||
path = 'ansible',
|
||||
},
|
||||
executionEnvironment = {
|
||||
enabled = false,
|
||||
},
|
||||
validation = {
|
||||
enabled = true,
|
||||
lint = {
|
||||
enabled = true,
|
||||
path = 'ansible-lint',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
filetypes = { 'yaml.ansible' },
|
||||
root_dir = util.root_pattern('ansible.cfg', '.ansible-lint'),
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/ansible/vscode-ansible
|
||||
|
||||
Language server for the ansible configuration management tool.
|
||||
|
||||
`ansible-language-server` can be installed via `npm`:
|
||||
|
||||
```sh
|
||||
npm install -g @ansible/ansible-language-server
|
||||
```
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'antlersls', '--stdio' },
|
||||
filetypes = { 'html', 'antlers' },
|
||||
root_dir = util.root_pattern 'composer.json',
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://www.npmjs.com/package/antlers-language-server
|
||||
|
||||
`antlersls` can be installed via `npm`:
|
||||
```sh
|
||||
npm install -g antlers-language-server
|
||||
```
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
filetypes = { 'apexcode' },
|
||||
root_dir = util.root_pattern 'sfdx-project.json',
|
||||
on_new_config = function(config)
|
||||
if not config.cmd and config.apex_jar_path then
|
||||
config.cmd = {
|
||||
vim.env.JAVA_HOME and util.path.join(vim.env.JAVA_HOME, 'bin', 'java') or 'java',
|
||||
'-cp',
|
||||
config.apex_jar_path,
|
||||
'-Ddebug.internal.errors=true',
|
||||
'-Ddebug.semantic.errors=' .. tostring(config.apex_enable_semantic_errors or false),
|
||||
'-Ddebug.completion.statistics=' .. tostring(config.apex_enable_completion_statistics or false),
|
||||
'-Dlwc.typegeneration.disabled=true',
|
||||
}
|
||||
if config.apex_jvm_max_heap then
|
||||
table.insert(config.cmd, '-Xmx' .. config.apex_jvm_max_heap)
|
||||
end
|
||||
table.insert(config.cmd, 'apex.jorje.lsp.ApexLanguageServerLauncher')
|
||||
end
|
||||
end,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/forcedotcom/salesforcedx-vscode
|
||||
|
||||
Language server for Apex.
|
||||
|
||||
For manual installation, download the JAR file from the [VSCode
|
||||
extension](https://github.com/forcedotcom/salesforcedx-vscode/tree/develop/packages/salesforcedx-vscode-apex).
|
||||
|
||||
```lua
|
||||
require'lspconfig'.apex_ls.setup {
|
||||
apex_jar_path = '/path/to/apex-jorje-lsp.jar',
|
||||
apex_enable_semantic_errors = false, -- Whether to allow Apex Language Server to surface semantic errors
|
||||
apex_enable_completion_statistics = false, -- Whether to allow Apex Language Server to collect telemetry on code completion usage
|
||||
}
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern('sfdx-project.json')]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,87 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
local default_capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
default_capabilities.textDocument.semanticTokens = vim.NIL
|
||||
default_capabilities.workspace.semanticTokens = vim.NIL
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
filetypes = { 'arduino' },
|
||||
root_dir = util.root_pattern '*.ino',
|
||||
cmd = {
|
||||
'arduino-language-server',
|
||||
},
|
||||
capabilities = default_capabilities,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/arduino/arduino-language-server
|
||||
|
||||
Language server for Arduino
|
||||
|
||||
The `arduino-language-server` can be installed by running:
|
||||
|
||||
```
|
||||
go install github.com/arduino/arduino-language-server@latest
|
||||
```
|
||||
|
||||
The `arduino-cli` tool must also be installed. Follow [these
|
||||
installation instructions](https://arduino.github.io/arduino-cli/latest/installation/) for
|
||||
your platform.
|
||||
|
||||
After installing `arduino-cli`, follow [these
|
||||
instructions](https://arduino.github.io/arduino-cli/latest/getting-started/#create-a-configuration-file)
|
||||
for generating a configuration file if you haven't done so already, and make
|
||||
sure you [install any relevant platforms
|
||||
libraries](https://arduino.github.io/arduino-cli/latest/getting-started/#install-the-core-for-your-board).
|
||||
|
||||
The language server also requires `clangd` to be installed. Follow [these
|
||||
installation instructions](https://clangd.llvm.org/installation) for your
|
||||
platform.
|
||||
|
||||
If you don't have a sketch yet create one.
|
||||
|
||||
```sh
|
||||
$ arduino-cli sketch new test
|
||||
$ cd test
|
||||
```
|
||||
|
||||
You will need a `sketch.yaml` file in order for the language server to understand your project. It will also save you passing options to `arduino-cli` each time you compile or upload a file. You can generate the file like using the following commands.
|
||||
|
||||
|
||||
First gather some information about your board. Make sure your board is connected and run the following:
|
||||
|
||||
```sh
|
||||
$ arduino-cli board list
|
||||
Port Protocol Type Board Name FQBN Core
|
||||
/dev/ttyACM0 serial Serial Port (USB) Arduino Uno arduino:avr:uno arduino:avr
|
||||
```
|
||||
|
||||
Then generate the file:
|
||||
|
||||
```sh
|
||||
arduino-cli board attach -p /dev/ttyACM0 -b arduino:avr:uno test.ino
|
||||
```
|
||||
|
||||
The resulting file should like like this:
|
||||
|
||||
```yaml
|
||||
default_fqbn: arduino:avr:uno
|
||||
default_port: /dev/ttyACM0
|
||||
```
|
||||
|
||||
Your folder structure should look like this:
|
||||
|
||||
```
|
||||
.
|
||||
├── test.ino
|
||||
└── sketch.yaml
|
||||
```
|
||||
|
||||
For further instruction about configuration options, run `arduino-language-server --help`.
|
||||
|
||||
Note that an upstream bug makes keywords in some cases become undefined by the language server.
|
||||
Ref: https://github.com/arduino/arduino-ide/issues/159
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'asm-lsp' },
|
||||
filetypes = { 'asm', 'vmasm' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/bergercookie/asm-lsp
|
||||
|
||||
Language Server for GAS/GO Assembly
|
||||
|
||||
`asm-lsp` can be installed via cargo:
|
||||
cargo install asm-lsp
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'ast-grep', 'lsp' },
|
||||
filetypes = { -- https://ast-grep.github.io/reference/languages.html
|
||||
'c',
|
||||
'cpp',
|
||||
'rust',
|
||||
'go',
|
||||
'java',
|
||||
'python',
|
||||
'javascript',
|
||||
'typescript',
|
||||
'html',
|
||||
'css',
|
||||
'kotlin',
|
||||
'dart',
|
||||
'lua',
|
||||
},
|
||||
root_dir = util.root_pattern('sgconfig.yaml', 'sgconfig.yml'),
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://ast-grep.github.io/
|
||||
|
||||
ast-grep(sg) is a fast and polyglot tool for code structural search, lint, rewriting at large scale.
|
||||
ast-grep LSP only works in projects that have `sgconfig.y[a]ml` in their root directories.
|
||||
```sh
|
||||
npm install [-g] @ast-grep/cli
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern('sgconfig.yaml', 'sgconfig.yml')]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
local function get_typescript_server_path(root_dir)
|
||||
local project_root = util.find_node_modules_ancestor(root_dir)
|
||||
return project_root and (util.path.join(project_root, 'node_modules', 'typescript', 'lib')) or ''
|
||||
end
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'astro-ls', '--stdio' },
|
||||
filetypes = { 'astro' },
|
||||
root_dir = util.root_pattern('package.json', 'tsconfig.json', 'jsconfig.json', '.git'),
|
||||
init_options = {
|
||||
typescript = {},
|
||||
},
|
||||
on_new_config = function(new_config, new_root_dir)
|
||||
if vim.tbl_get(new_config.init_options, 'typescript') and not new_config.init_options.typescript.tsdk then
|
||||
new_config.init_options.typescript.tsdk = get_typescript_server_path(new_root_dir)
|
||||
end
|
||||
end,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/withastro/language-tools/tree/main/packages/language-server
|
||||
|
||||
`astro-ls` can be installed via `npm`:
|
||||
```sh
|
||||
npm install -g @astrojs/language-server
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
local root_files = { 'configure.ac', 'Makefile', 'Makefile.am', '*.mk' }
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'autotools-language-server' },
|
||||
filetypes = { 'config', 'automake', 'make' },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern(unpack(root_files))(fname)
|
||||
end,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/Freed-Wu/autotools-language-server
|
||||
|
||||
`autotools-language-server` can be installed via `pip`:
|
||||
```sh
|
||||
pip install autotools-language-server
|
||||
```
|
||||
|
||||
Language server for autoconf, automake and make using tree sitter in python.
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = { 'configure.ac', 'Makefile', 'Makefile.am', '*.mk' },
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
if vim.version().major == 0 and vim.version().minor < 7 then
|
||||
vim.notify('The AWK language server requires nvim >= 0.7', vim.log.levels.ERROR)
|
||||
return
|
||||
end
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'awk-language-server' },
|
||||
filetypes = { 'awk' },
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/Beaglefoot/awk-language-server/
|
||||
|
||||
`awk-language-server` can be installed via `npm`:
|
||||
```sh
|
||||
npm install -g awk-language-server
|
||||
```
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'azure-pipelines-language-server', '--stdio' },
|
||||
filetypes = { 'yaml' },
|
||||
root_dir = util.root_pattern 'azure-pipelines.yml',
|
||||
single_file_support = true,
|
||||
settings = {},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/microsoft/azure-pipelines-language-server
|
||||
|
||||
An Azure Pipelines language server
|
||||
|
||||
`azure-pipelines-ls` can be installed via `npm`:
|
||||
|
||||
```sh
|
||||
npm install -g azure-pipelines-language-server
|
||||
```
|
||||
|
||||
By default `azure-pipelines-ls` will only work in files named `azure-pipelines.yml`, this can be changed by providing additional settings like so:
|
||||
```lua
|
||||
require("lspconfig").azure_pipelines_ls.setup {
|
||||
... -- other configuration for setup {}
|
||||
settings = {
|
||||
yaml = {
|
||||
schemas = {
|
||||
["https://raw.githubusercontent.com/microsoft/azure-pipelines-vscode/master/service-schema.json"] = {
|
||||
"/azure-pipeline*.y*l",
|
||||
"/*.azure*",
|
||||
"Azure-Pipelines/**/*.y*l",
|
||||
"Pipelines/*.y*l",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
The Azure Pipelines LSP is a fork of `yaml-language-server` and as such the same settings can be passed to it as `yaml-language-server`.
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'bacon-ls' },
|
||||
filetypes = { 'rust' },
|
||||
root_dir = util.root_pattern('.bacon-locations', 'Cargo.toml'),
|
||||
single_file_support = true,
|
||||
settings = {},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/crisidev/bacon-ls
|
||||
|
||||
A Language Server Protocol wrapper for [bacon](https://dystroy.org/bacon/).
|
||||
It offers textDocument/diagnostic and workspace/diagnostic capabilities for Rust
|
||||
workspaces using the Bacon export locations file.
|
||||
|
||||
It requires `bacon` and `bacon-ls` to be installed on the system using
|
||||
[mason.nvim](https://github.com/williamboman/mason.nvim) or manually:util
|
||||
|
||||
```sh
|
||||
$ cargo install --locked bacon bacon-ls
|
||||
```
|
||||
|
||||
Settings can be changed using the `settings` dictionary:util
|
||||
|
||||
```lua
|
||||
settings = {
|
||||
-- Bacon export filename, default .bacon-locations
|
||||
locationsFile = ".bacon-locations",
|
||||
-- Maximum time in seconds the LSP server waits for Bacon to update the
|
||||
-- export file before loading the new diagnostics
|
||||
waitTimeSeconds = 10
|
||||
}
|
||||
```
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,80 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
local root_files = {
|
||||
'pyproject.toml',
|
||||
'setup.py',
|
||||
'setup.cfg',
|
||||
'requirements.txt',
|
||||
'Pipfile',
|
||||
'pyrightconfig.json',
|
||||
'.git',
|
||||
}
|
||||
|
||||
local function organize_imports()
|
||||
local params = {
|
||||
command = 'basedpyright.organizeimports',
|
||||
arguments = { vim.uri_from_bufnr(0) },
|
||||
}
|
||||
|
||||
local clients = util.get_lsp_clients {
|
||||
bufnr = vim.api.nvim_get_current_buf(),
|
||||
name = 'basedpyright',
|
||||
}
|
||||
for _, client in ipairs(clients) do
|
||||
client.request('workspace/executeCommand', params, nil, 0)
|
||||
end
|
||||
end
|
||||
|
||||
local function set_python_path(path)
|
||||
local clients = util.get_lsp_clients {
|
||||
bufnr = vim.api.nvim_get_current_buf(),
|
||||
name = 'basedpyright',
|
||||
}
|
||||
for _, client in ipairs(clients) do
|
||||
if client.settings then
|
||||
client.settings.python = vim.tbl_deep_extend('force', client.settings.python or {}, { pythonPath = path })
|
||||
else
|
||||
client.config.settings = vim.tbl_deep_extend('force', client.config.settings, { python = { pythonPath = path } })
|
||||
end
|
||||
client.notify('workspace/didChangeConfiguration', { settings = nil })
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'basedpyright-langserver', '--stdio' },
|
||||
filetypes = { 'python' },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern(unpack(root_files))(fname)
|
||||
end,
|
||||
single_file_support = true,
|
||||
settings = {
|
||||
basedpyright = {
|
||||
analysis = {
|
||||
autoSearchPaths = true,
|
||||
useLibraryCodeForTypes = true,
|
||||
diagnosticMode = 'openFilesOnly',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
commands = {
|
||||
PyrightOrganizeImports = {
|
||||
organize_imports,
|
||||
description = 'Organize Imports',
|
||||
},
|
||||
PyrightSetPythonPath = {
|
||||
set_python_path,
|
||||
description = 'Reconfigure basedpyright with the provided python path',
|
||||
nargs = 1,
|
||||
complete = 'file',
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://detachhead.github.io/basedpyright
|
||||
|
||||
`basedpyright`, a static type checker and language server for python
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'bash-language-server', 'start' },
|
||||
settings = {
|
||||
bashIde = {
|
||||
-- Glob pattern for finding and parsing shell script files in the workspace.
|
||||
-- Used by the background analysis features across files.
|
||||
|
||||
-- Prevent recursive scanning which will cause issues when opening a file
|
||||
-- directly in the home directory (e.g. ~/foo.sh).
|
||||
--
|
||||
-- Default upstream pattern is "**/*@(.sh|.inc|.bash|.command)".
|
||||
globPattern = vim.env.GLOB_PATTERN or '*@(.sh|.inc|.bash|.command)',
|
||||
},
|
||||
},
|
||||
filetypes = { 'sh' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/bash-lsp/bash-language-server
|
||||
|
||||
`bash-language-server` can be installed via `npm`:
|
||||
```sh
|
||||
npm i -g bash-language-server
|
||||
```
|
||||
|
||||
Language server for bash, written using tree sitter in typescript.
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[util.find_git_ancestor]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'beancount-language-server', '--stdio' },
|
||||
filetypes = { 'beancount', 'bean' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
init_options = {},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/polarmutex/beancount-language-server#installation
|
||||
|
||||
See https://github.com/polarmutex/beancount-language-server#configuration for configuration options
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern(".git")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
filetypes = { 'bicep' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
init_options = {},
|
||||
},
|
||||
docs = {
|
||||
description = [=[
|
||||
https://github.com/azure/bicep
|
||||
Bicep language server
|
||||
|
||||
Bicep language server can be installed by downloading and extracting a release of bicep-langserver.zip from [Bicep GitHub releases](https://github.com/Azure/bicep/releases).
|
||||
|
||||
Bicep language server requires the [dotnet-sdk](https://dotnet.microsoft.com/download) to be installed.
|
||||
|
||||
Neovim does not have built-in support for the bicep filetype which is required for lspconfig to automatically launch the language server.
|
||||
|
||||
Filetype detection can be added via an autocmd:
|
||||
```lua
|
||||
vim.cmd [[ autocmd BufNewFile,BufRead *.bicep set filetype=bicep ]]
|
||||
```
|
||||
|
||||
**By default, bicep language server does not have a `cmd` set.** This is because nvim-lspconfig does not make assumptions about your path. You must add the following to your init.vim or init.lua to set `cmd` to the absolute path ($HOME and ~ are not expanded) of the unzipped run script or binary.
|
||||
|
||||
```lua
|
||||
local bicep_lsp_bin = "/path/to/bicep-langserver/Bicep.LangServer.dll"
|
||||
require'lspconfig'.bicep.setup{
|
||||
cmd = { "dotnet", bicep_lsp_bin };
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
To download the latest release and place in /usr/local/bin/bicep-langserver:
|
||||
```bash
|
||||
(cd $(mktemp -d) \
|
||||
&& curl -fLO https://github.com/Azure/bicep/releases/latest/download/bicep-langserver.zip \
|
||||
&& rm -rf /usr/local/bin/bicep-langserver \
|
||||
&& unzip -d /usr/local/bin/bicep-langserver bicep-langserver.zip)
|
||||
```
|
||||
]=],
|
||||
default_config = {
|
||||
root_dir = [[util.find_git_ancestor]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'biome', 'lsp-proxy' },
|
||||
filetypes = {
|
||||
'javascript',
|
||||
'javascriptreact',
|
||||
'json',
|
||||
'jsonc',
|
||||
'typescript',
|
||||
'typescript.tsx',
|
||||
'typescriptreact',
|
||||
'astro',
|
||||
'svelte',
|
||||
'vue',
|
||||
},
|
||||
root_dir = util.root_pattern('biome.json', 'biome.jsonc'),
|
||||
single_file_support = false,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://biomejs.dev
|
||||
|
||||
Toolchain of the web. [Successor of Rome](https://biomejs.dev/blog/annoucing-biome).
|
||||
|
||||
```sh
|
||||
npm install [-g] @biomejs/biome
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern('biome.json', 'biome.jsonc')]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'bitbake-language-server' },
|
||||
filetypes = { 'bitbake' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
🛠️ bitbake language server
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'blueprint-compiler', 'lsp' },
|
||||
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 '*@(.blp)',
|
||||
},
|
||||
filetypes = { 'blueprint' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://gitlab.gnome.org/jwestman/blueprint-compiler
|
||||
|
||||
`blueprint-compiler` can be installed via your system package manager.
|
||||
|
||||
Language server for the blueprint markup language, written in python and part
|
||||
of the blueprint-compiler.
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[util.find_git_ancestor]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
-- set os dependent library path
|
||||
local function library_path(path, cmd_env)
|
||||
path = path or '/usr/local/lib'
|
||||
cmd_env = cmd_env or {}
|
||||
if vim.fn.has 'macunix' and not cmd_env.DYLD_LIBRARY_PATH then
|
||||
cmd_env.DYLD_LIBRARY_PATH = path
|
||||
elseif vim.fn.has 'linux' and not cmd_env.LD_LIBRARY_PATH then
|
||||
cmd_env.LD_LIBRARY_PATH = path
|
||||
end
|
||||
return cmd_env
|
||||
end
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'bqnlsp' },
|
||||
filetypes = { 'bqn' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
libcbqnPath = nil,
|
||||
on_new_config = function(new_config, _)
|
||||
if new_config.libcbqnPath then
|
||||
new_config.cmd_env = library_path(new_config.libcbqnPath, new_config.cmd_env)
|
||||
end
|
||||
end,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://git.sr.ht/~detegr/bqnlsp
|
||||
|
||||
|
||||
`bqnlsp`, a language server for BQN.
|
||||
|
||||
The binary depends on the shared library of [CBQN](https://github.com/dzaima/CBQN) `libcbqn.so`.
|
||||
If CBQN is installed system-wide (using `sudo make install` in its source directory) and `bqnlsp` errors that it can't find the shared library, update the linker cache by executing `sudo ldconfig`.
|
||||
If CBQN has been installed in a non-standard directory or can't be installed globally pass `libcbqnPath = '/path/to/CBQN'` to the setup function.
|
||||
This will set the environment variables `LD_LIBRARY_PATH` (Linux) or `DYLD_LIBRARY_PATH` (macOS) to the provided path.
|
||||
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[util.find_git_ancestor]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
local util = require 'lspconfig/util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'bsc', '--lsp', '--stdio' },
|
||||
filetypes = { 'brs' },
|
||||
single_file_support = true,
|
||||
root_dir = util.root_pattern('makefile', 'Makefile', '.git'),
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/RokuCommunity/brighterscript
|
||||
|
||||
`brightscript` can be installed via `npm`:
|
||||
```sh
|
||||
npm install -g brighterscript
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern(".git")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
filetypes = { 'bsl', 'os' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/1c-syntax/bsl-language-server
|
||||
|
||||
Language Server Protocol implementation for 1C (BSL) - 1C:Enterprise 8 and OneScript languages.
|
||||
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern(".git")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'buck2', 'lsp' },
|
||||
filetypes = { 'bzl' },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern '.buckconfig'(fname)
|
||||
end,
|
||||
},
|
||||
docs = {
|
||||
description = [=[
|
||||
https://github.com/facebook/buck2
|
||||
|
||||
Build system, successor to Buck
|
||||
|
||||
To better detect Buck2 project files, the following can be added:
|
||||
|
||||
```
|
||||
vim.cmd [[ autocmd BufRead,BufNewFile *.bxl,BUCK,TARGETS set filetype=bzl ]]
|
||||
```
|
||||
]=],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern(".buckconfig")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'buddy-lsp-server' },
|
||||
filetypes = { 'mlir' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/buddy-compiler/buddy-mlir#buddy-lsp-server
|
||||
The Language Server for the buddy-mlir, a drop-in replacement for mlir-lsp-server,
|
||||
supporting new dialects defined in buddy-mlir.
|
||||
`buddy-lsp-server` can be installed at the buddy-mlir repository (buddy-compiler/buddy-mlir)
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'bufls', 'serve' },
|
||||
filetypes = { 'proto' },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern('buf.work.yaml', '.git')(fname)
|
||||
end,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/bufbuild/buf-language-server
|
||||
|
||||
`buf-language-server` can be installed via `go install`:
|
||||
```sh
|
||||
go install github.com/bufbuild/buf-language-server/cmd/bufls@latest
|
||||
```
|
||||
|
||||
bufls is a Protobuf language server compatible with Buf modules and workspaces
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("buf.work.yaml", ".git")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'bzl', 'lsp', 'serve' },
|
||||
filetypes = { 'bzl' },
|
||||
-- https://docs.bazel.build/versions/5.4.1/build-ref.html#workspace
|
||||
root_dir = util.root_pattern('WORKSPACE', 'WORKSPACE.bazel'),
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://bzl.io/
|
||||
|
||||
https://docs.stack.build/docs/cli/installation
|
||||
|
||||
https://docs.stack.build/docs/vscode/starlark-language-server
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern(".git")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'flow', 'cadence', 'language-server' },
|
||||
filetypes = { 'cdc' },
|
||||
init_options = {
|
||||
numberOfAccounts = '1',
|
||||
},
|
||||
root_dir = function(fname, _)
|
||||
return util.root_pattern 'flow.json'(fname) or vim.env.HOME
|
||||
end,
|
||||
on_new_config = function(new_config, new_root_dir)
|
||||
new_config.init_options.configPath = util.path.join(new_root_dir, 'flow.json')
|
||||
end,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
[Cadence Language Server](https://github.com/onflow/cadence-tools/tree/master/languageserver)
|
||||
using the [flow-cli](https://developers.flow.com/tools/flow-cli).
|
||||
|
||||
The `flow` command from flow-cli must be available. For install instructions see
|
||||
[the docs](https://developers.flow.com/tools/flow-cli/install#install-the-flow-cli) or the
|
||||
[Github page](https://github.com/onflow/flow-cli).
|
||||
|
||||
By default the configuration is taken from the closest `flow.json` or the `flow.json` in the users home directory.
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[util.root_pattern('flow.json') or vim.env.HOME]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
local bin_name = 'cairo-language-server'
|
||||
local cmd = { bin_name, '/C', '--node-ipc' }
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
init_options = { hostInfo = 'neovim' },
|
||||
cmd = cmd,
|
||||
filetypes = { 'cairo' },
|
||||
root_dir = util.root_pattern('Scarb.toml', 'cairo_project.toml', '.git'),
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
[Cairo Language Server](https://github.com/starkware-libs/cairo/tree/main/crates/cairo-lang-language-server)
|
||||
|
||||
First, install cairo following [this tutorial](https://medium.com/@elias.tazartes/ahead-of-the-curve-install-cairo-1-0-alpha-and-prepare-for-regenesis-85f4e3940e20)
|
||||
|
||||
Then enable cairo language server in your lua configuration.
|
||||
```lua
|
||||
require'lspconfig'.cairo_ls.setup{}
|
||||
```
|
||||
|
||||
*cairo-language-server is still under active development, some features might not work yet !*
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("Scarb.toml", "cairo_project.toml", ".git")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
local root_files = {
|
||||
'compile_commands.json',
|
||||
'.ccls',
|
||||
}
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'ccls' },
|
||||
filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern(unpack(root_files))(fname) or util.find_git_ancestor(fname)
|
||||
end,
|
||||
offset_encoding = 'utf-32',
|
||||
-- ccls does not support sending a null root directory
|
||||
single_file_support = false,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/MaskRay/ccls/wiki
|
||||
|
||||
ccls relies on a [JSON compilation database](https://clang.llvm.org/docs/JSONCompilationDatabase.html) specified
|
||||
as compile_commands.json or, for simpler projects, a .ccls.
|
||||
For details on how to automatically generate one using CMake look [here](https://cmake.org/cmake/help/latest/variable/CMAKE_EXPORT_COMPILE_COMMANDS.html). Alternatively, you can use [Bear](https://github.com/rizsotto/Bear).
|
||||
|
||||
Customization options are passed to ccls at initialization time via init_options, a list of available options can be found [here](https://github.com/MaskRay/ccls/wiki/Customization#initialization-options). For example:
|
||||
|
||||
```lua
|
||||
local lspconfig = require'lspconfig'
|
||||
lspconfig.ccls.setup {
|
||||
init_options = {
|
||||
compilationDatabaseDirectory = "build";
|
||||
index = {
|
||||
threads = 0;
|
||||
};
|
||||
clang = {
|
||||
excludeArgs = { "-frounding-math"} ;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern('compile_commands.json', '.ccls', '.git')]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
local root_files = {
|
||||
'package.json',
|
||||
'db',
|
||||
'srv',
|
||||
}
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'cds-lsp', '--stdio' },
|
||||
filetypes = { 'cds' },
|
||||
-- init_options = { provideFormatter = true }, -- needed to enable formatting capabilities
|
||||
root_dir = util.root_pattern(unpack(root_files)),
|
||||
single_file_support = true,
|
||||
settings = {
|
||||
cds = { validate = true },
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
|
||||
https://cap.cloud.sap/docs/
|
||||
|
||||
`cds-lsp` can be installed via `npm`:
|
||||
|
||||
```sh
|
||||
npm i -g @sap/cds-lsp
|
||||
```
|
||||
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
local util = require 'lspconfig/util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'circom-lsp' },
|
||||
filetypes = { 'circom' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
[Circom Language Server](https://github.com/rubydusa/circom-lsp)
|
||||
|
||||
`circom-lsp`, the language server for the Circom language.
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,88 @@
|
||||
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 clangd_client = util.get_active_client_by_name(bufnr, 'clangd')
|
||||
local params = { uri = vim.uri_from_bufnr(bufnr) }
|
||||
if clangd_client then
|
||||
clangd_client.request('textDocument/switchSourceHeader', params, function(err, result)
|
||||
if err then
|
||||
error(tostring(err))
|
||||
end
|
||||
if not result then
|
||||
print 'Corresponding file cannot be determined'
|
||||
return
|
||||
end
|
||||
vim.api.nvim_command('edit ' .. vim.uri_to_fname(result))
|
||||
end, bufnr)
|
||||
else
|
||||
print 'method textDocument/switchSourceHeader is not supported by any servers active on the current buffer'
|
||||
end
|
||||
end
|
||||
|
||||
local root_files = {
|
||||
'.clangd',
|
||||
'.clang-tidy',
|
||||
'.clang-format',
|
||||
'compile_commands.json',
|
||||
'compile_flags.txt',
|
||||
'configure.ac', -- AutoTools
|
||||
}
|
||||
|
||||
local default_capabilities = {
|
||||
textDocument = {
|
||||
completion = {
|
||||
editsNearCursor = true,
|
||||
},
|
||||
},
|
||||
offsetEncoding = { 'utf-8', 'utf-16' },
|
||||
}
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'clangd' },
|
||||
filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda', 'proto' },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern(unpack(root_files))(fname) or util.find_git_ancestor(fname)
|
||||
end,
|
||||
single_file_support = true,
|
||||
capabilities = default_capabilities,
|
||||
},
|
||||
commands = {
|
||||
ClangdSwitchSourceHeader = {
|
||||
function()
|
||||
switch_source_header(0)
|
||||
end,
|
||||
description = 'Switch between source/header',
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://clangd.llvm.org/installation.html
|
||||
|
||||
- **NOTE:** Clang >= 11 is recommended! See [#23](https://github.com/neovim/nvim-lsp/issues/23).
|
||||
- If `compile_commands.json` lives in a build directory, you should
|
||||
symlink it to the root of your source tree.
|
||||
```
|
||||
ln -s /path/to/myproject/build/compile_commands.json /path/to/myproject/
|
||||
```
|
||||
- clangd relies on a [JSON compilation database](https://clang.llvm.org/docs/JSONCompilationDatabase.html)
|
||||
specified as compile_commands.json, see https://clangd.llvm.org/installation#compile_commandsjson
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[
|
||||
root_pattern(
|
||||
'.clangd',
|
||||
'.clang-tidy',
|
||||
'.clang-format',
|
||||
'compile_commands.json',
|
||||
'compile_flags.txt',
|
||||
'configure.ac',
|
||||
'.git'
|
||||
)
|
||||
]],
|
||||
capabilities = [[default capabilities, with offsetEncoding utf-8]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'clarity-lsp' },
|
||||
filetypes = { 'clar', 'clarity' },
|
||||
root_dir = util.root_pattern '.git',
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
`clarity-lsp` is a language server for the Clarity language. Clarity is a decidable smart contract language that optimizes for predictability and security. Smart contracts allow developers to encode essential business logic on a blockchain.
|
||||
|
||||
To learn how to configure the clarity language server, see the [clarity-lsp documentation](https://github.com/hirosystems/clarity-lsp).
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern(".git")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'clojure-lsp' },
|
||||
filetypes = { 'clojure', 'edn' },
|
||||
root_dir = util.root_pattern('project.clj', 'deps.edn', 'build.boot', 'shadow-cljs.edn', '.git', 'bb.edn'),
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/clojure-lsp/clojure-lsp
|
||||
|
||||
Clojure Language Server
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("project.clj", "deps.edn", "build.boot", "shadow-cljs.edn", ".git", "bb.edn")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
local root_files = { 'CMakePresets.json', 'CTestConfig.cmake', '.git', 'build', 'cmake' }
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'cmake-language-server' },
|
||||
filetypes = { 'cmake' },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern(unpack(root_files))(fname)
|
||||
end,
|
||||
single_file_support = true,
|
||||
init_options = {
|
||||
buildDirectory = 'build',
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/regen100/cmake-language-server
|
||||
|
||||
CMake LSP Implementation
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern('CMakePresets.json', 'CTestConfig.cmake', '.git', 'build', 'cmake')]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'cobol-language-support' },
|
||||
filetypes = { 'cobol' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
Cobol language support
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[util.find_git_ancestor]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
local workspace_folders = {}
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'codeql', 'execute', 'language-server', '--check-errors', 'ON_CHANGE', '-q' },
|
||||
filetypes = { 'ql' },
|
||||
root_dir = util.root_pattern 'qlpack.yml',
|
||||
log_level = vim.lsp.protocol.MessageType.Warning,
|
||||
before_init = function(initialize_params)
|
||||
table.insert(workspace_folders, { name = 'workspace', uri = initialize_params['rootUri'] })
|
||||
initialize_params['workspaceFolders'] = workspace_folders
|
||||
end,
|
||||
settings = {
|
||||
search_path = vim.empty_dict(),
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
Reference:
|
||||
https://codeql.github.com/docs/codeql-cli/
|
||||
|
||||
Binaries:
|
||||
https://github.com/github/codeql-cli-binaries
|
||||
]],
|
||||
default_config = {
|
||||
settings = {
|
||||
search_path = [[list containing all search paths, eg: '~/codeql-home/codeql-repo']],
|
||||
},
|
||||
},
|
||||
},
|
||||
on_new_config = function(config)
|
||||
if type(config.settings.search_path) == 'table' and not vim.tbl_isempty(config.settings.search_path) then
|
||||
local search_path = '--search-path='
|
||||
for _, path in ipairs(config.settings.search_path) do
|
||||
search_path = search_path .. vim.fn.expand(path) .. ':'
|
||||
table.insert(workspace_folders, {
|
||||
name = 'workspace',
|
||||
uri = string.format('file://%s', path),
|
||||
})
|
||||
end
|
||||
config.cmd = { 'codeql', 'execute', 'language-server', '--check-errors', 'ON_CHANGE', '-q', search_path }
|
||||
else
|
||||
config.cmd = { 'codeql', 'execute', 'language-server', '--check-errors', 'ON_CHANGE', '-q' }
|
||||
end
|
||||
end,
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'coffeesense-language-server', '--stdio' },
|
||||
filetypes = { 'coffee' },
|
||||
root_dir = util.root_pattern 'package.json',
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/phil294/coffeesense
|
||||
|
||||
CoffeeSense Language Server
|
||||
`coffeesense-language-server` can be installed via `npm`:
|
||||
```sh
|
||||
npm install -g coffeesense-language-server
|
||||
```
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'Contextive.LanguageServer' },
|
||||
root_dir = util.root_pattern('.contextive', '.git'),
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/dev-cycles/contextive
|
||||
|
||||
Language Server for Contextive.
|
||||
|
||||
Contextive allows you to define terms in a central file and provides auto-completion suggestions and hover panels for these terms wherever they're used.
|
||||
|
||||
To install the language server, you need to download the appropriate [GitHub release asset](https://github.com/dev-cycles/contextive/releases/) for your operating system and architecture.
|
||||
|
||||
After the download unzip the Contextive.LanguageServer binary and copy the file into a folder that is included in your system's PATH.
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'coq-lsp' },
|
||||
filetypes = { 'coq' },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern '_CoqProject'(fname) or util.find_git_ancestor(fname)
|
||||
end,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/ejgallego/coq-lsp/
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'crystalline' },
|
||||
filetypes = { 'crystal' },
|
||||
root_dir = util.root_pattern 'shard.yml' or util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/elbywan/crystalline
|
||||
|
||||
Crystal language server.
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern('shard.yml', '.git')]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'csharp-ls' },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern '*.sln'(fname) or util.root_pattern '*.csproj'(fname)
|
||||
end,
|
||||
filetypes = { 'cs' },
|
||||
init_options = {
|
||||
AutomaticWorkspaceInit = true,
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/razzmatazz/csharp-language-server
|
||||
|
||||
Language Server for C#.
|
||||
|
||||
csharp-ls requires the [dotnet-sdk](https://dotnet.microsoft.com/download) to be installed.
|
||||
|
||||
The preferred way to install csharp-ls is with `dotnet tool install --global csharp-ls`.
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'css-variables-language-server', '--stdio' },
|
||||
filetypes = { 'css', 'scss', 'less' },
|
||||
root_dir = util.root_pattern('package.json', '.git'),
|
||||
-- Same as inlined defaults that don't seem to work without hardcoding them in the lua config
|
||||
-- https://github.com/vunguyentuan/vscode-css-variables/blob/763a564df763f17aceb5f3d6070e0b444a2f47ff/packages/css-variables-language-server/src/CSSVariableManager.ts#L31-L50
|
||||
settings = {
|
||||
cssVariables = {
|
||||
lookupFiles = { '**/*.less', '**/*.scss', '**/*.sass', '**/*.css' },
|
||||
blacklistFolders = {
|
||||
'**/.cache',
|
||||
'**/.DS_Store',
|
||||
'**/.git',
|
||||
'**/.hg',
|
||||
'**/.next',
|
||||
'**/.svn',
|
||||
'**/bower_components',
|
||||
'**/CVS',
|
||||
'**/dist',
|
||||
'**/node_modules',
|
||||
'**/tests',
|
||||
'**/tmp',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/vunguyentuan/vscode-css-variables/tree/master/packages/css-variables-language-server
|
||||
|
||||
CSS variables autocompletion and go-to-definition
|
||||
|
||||
`css-variables-language-server` can be installed via `npm`:
|
||||
|
||||
```sh
|
||||
npm i -g css-variables-language-server
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("package.json", ".git") or bufdir]],
|
||||
settings = [[
|
||||
cssVariables = {
|
||||
lookupFiles = { '**/*.less', '**/*.scss', '**/*.sass', '**/*.css' },
|
||||
blacklistFolders = {
|
||||
'**/.cache',
|
||||
'**/.DS_Store',
|
||||
'**/.git',
|
||||
'**/.hg',
|
||||
'**/.next',
|
||||
'**/.svn',
|
||||
'**/bower_components',
|
||||
'**/CVS',
|
||||
'**/dist',
|
||||
'**/node_modules',
|
||||
'**/tests',
|
||||
'**/tmp',
|
||||
},
|
||||
},
|
||||
]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'vscode-css-language-server', '--stdio' },
|
||||
filetypes = { 'css', 'scss', 'less' },
|
||||
init_options = { provideFormatter = true }, -- needed to enable formatting capabilities
|
||||
root_dir = util.root_pattern('package.json', '.git'),
|
||||
single_file_support = true,
|
||||
settings = {
|
||||
css = { validate = true },
|
||||
scss = { validate = true },
|
||||
less = { validate = true },
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
|
||||
https://github.com/hrsh7th/vscode-langservers-extracted
|
||||
|
||||
`css-languageserver` can be installed via `npm`:
|
||||
|
||||
```sh
|
||||
npm i -g vscode-langservers-extracted
|
||||
```
|
||||
|
||||
Neovim does not currently include built-in snippets. `vscode-css-language-server` only provides completions when snippet support is enabled. To enable completion, install a snippet plugin and add the following override to your language client capabilities during setup.
|
||||
|
||||
```lua
|
||||
--Enable (broadcasting) snippet capability for completion
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
require'lspconfig'.cssls.setup {
|
||||
capabilities = capabilities,
|
||||
}
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("package.json", ".git") or bufdir]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'cssmodules-language-server' },
|
||||
filetypes = { 'javascript', 'javascriptreact', 'typescript', 'typescriptreact' },
|
||||
root_dir = util.find_package_json_ancestor,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/antonk52/cssmodules-language-server
|
||||
|
||||
Language server for autocompletion and go-to-definition functionality for CSS modules.
|
||||
|
||||
You can install cssmodules-language-server via npm:
|
||||
```sh
|
||||
npm install -g cssmodules-language-server
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("package.json")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'cucumber-language-server', '--stdio' },
|
||||
filetypes = { 'cucumber' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://cucumber.io
|
||||
https://github.com/cucumber/common
|
||||
https://www.npmjs.com/package/@cucumber/language-server
|
||||
|
||||
Language server for Cucumber.
|
||||
|
||||
`cucumber-language-server` can be installed via `npm`:
|
||||
```sh
|
||||
npm install -g @cucumber/language-server
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[util.find_git_ancestor]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
init_options = { hostInfo = 'neovim' },
|
||||
cmd = { 'custom-elements-languageserver', '--stdio' },
|
||||
root_dir = util.root_pattern('tsconfig.json', 'package.json', 'jsconfig.json', '.git'),
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/Matsuuu/custom-elements-language-server
|
||||
|
||||
`custom-elements-languageserver` depends on `typescript`. Both packages can be installed via `npm`:
|
||||
```sh
|
||||
npm install -g typescript custom-elements-languageserver
|
||||
```
|
||||
To configure typescript language server, add a
|
||||
[`tsconfig.json`](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) or
|
||||
[`jsconfig.json`](https://code.visualstudio.com/docs/languages/jsconfig) to the root of your
|
||||
project.
|
||||
Here's an example that disables type checking in JavaScript files.
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"checkJs": false
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("tsconfig.json", "package.json", "jsconfig.json", ".git")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'cypher-language-server', '--stdio' },
|
||||
filetypes = { 'cypher' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/neo4j/cypher-language-support/tree/main/packages/language-server
|
||||
|
||||
`cypher-language-server`, language server for Cypher query language.
|
||||
Part of the umbrella project cypher-language-support: https://github.com/neo4j/cypher-language-support
|
||||
|
||||
`cypher-language-server` can be installed via `npm`:
|
||||
```sh
|
||||
npm i -g @neo4j-cypher/language-server
|
||||
```
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'dafny', 'server' },
|
||||
filetypes = { 'dfy', 'dafny' },
|
||||
root_dir = function(fname)
|
||||
util.find_git_ancestor(fname)
|
||||
end,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
Support for the Dafny language server.
|
||||
|
||||
The default `cmd` uses "dafny server", which works on Dafny 4.0.0+. For
|
||||
older versions of Dafny, you can compile the language server from source at
|
||||
[dafny-lang/language-server-csharp](https://github.com/dafny-lang/language-server-csharp)
|
||||
and set `cmd = {"dotnet", "<Path to your language server>"}`.
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'cuelsp' },
|
||||
filetypes = { 'cue' },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern('cue.mod', '.git')(fname)
|
||||
end,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/dagger/cuelsp
|
||||
|
||||
Dagger's lsp server for cuelang.
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("cue.mod", ".git")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'dart', 'language-server', '--protocol=lsp' },
|
||||
filetypes = { 'dart' },
|
||||
root_dir = util.root_pattern 'pubspec.yaml',
|
||||
init_options = {
|
||||
onlyAnalyzeProjectsWithOpenFiles = true,
|
||||
suggestFromUnimportedLibraries = true,
|
||||
closingLabels = true,
|
||||
outline = true,
|
||||
flutterOutline = true,
|
||||
},
|
||||
settings = {
|
||||
dart = {
|
||||
completeFunctionCalls = true,
|
||||
showTodos = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/dart-lang/sdk/tree/master/pkg/analysis_server/tool/lsp_spec
|
||||
|
||||
Language server for dart.
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("pubspec.yaml")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'dcm', 'start-server', '--client=neovim' },
|
||||
filetypes = { 'dart' },
|
||||
root_dir = util.root_pattern 'pubspec.yaml',
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://dcm.dev/
|
||||
|
||||
Language server for DCM analyzer.
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("pubspec.yaml")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'debputy', 'lsp', 'server' },
|
||||
filetypes = { 'debcontrol', 'debcopyright', 'debchangelog', 'make', 'yaml' },
|
||||
root_dir = util.root_pattern 'debian',
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://salsa.debian.org/debian/debputy
|
||||
|
||||
Language Server for Debian packages.
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'DelphiLSP.exe' },
|
||||
filetypes = { 'pascal' },
|
||||
root_dir = util.root_pattern '*.dpr',
|
||||
single_file_support = false,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
Language server for Delphi from Embarcadero.
|
||||
https://marketplace.visualstudio.com/items?itemName=EmbarcaderoTechnologies.delphilsp
|
||||
|
||||
Note, the '*.delphilsp.json' file is required, more details at:
|
||||
https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Using_DelphiLSP_Code_Insight_with_Other_Editors
|
||||
|
||||
Below, you'll find a sample configuration for the lazy manager.
|
||||
When on_attach is triggered, it signals DelphiLSP to load settings from a configuration file.
|
||||
Without this step, DelphiLSP initializes but remains non-functional:
|
||||
|
||||
```lua
|
||||
"neovim/nvim-lspconfig",
|
||||
lazy = false,
|
||||
config = function()
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
lspconfig.delphi_ls.setup({
|
||||
capabilities = capabilities,
|
||||
|
||||
on_attach = function(client)
|
||||
local lsp_config = vim.fs.find(function(name)
|
||||
return name:match(".*%.delphilsp.json$")
|
||||
end, { type = "file", path = client.config.root_dir, upward = false })[1]
|
||||
|
||||
if lsp_config then
|
||||
client.config.settings = { settingsFile = lsp_config }
|
||||
client.notify("workspace/didChangeConfiguration", { settings = client.config.settings })
|
||||
else
|
||||
vim.notify_once("delphi_ls: '*.delphilsp.json' config file not found")
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
```
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,127 @@
|
||||
local util = require 'lspconfig.util'
|
||||
local lsp = vim.lsp
|
||||
|
||||
local function buf_cache(bufnr, client)
|
||||
local params = {
|
||||
command = 'deno.cache',
|
||||
arguments = { {}, vim.uri_from_bufnr(bufnr) },
|
||||
}
|
||||
client.request('workspace/executeCommand', params, function(err, _result, ctx)
|
||||
if err then
|
||||
local uri = ctx.params.arguments[2]
|
||||
vim.api.nvim_err_writeln('cache command failed for ' .. vim.uri_to_fname(uri))
|
||||
end
|
||||
end, bufnr)
|
||||
end
|
||||
|
||||
local function virtual_text_document_handler(uri, res, client)
|
||||
if not res then
|
||||
return nil
|
||||
end
|
||||
|
||||
local lines = vim.split(res.result, '\n')
|
||||
local bufnr = vim.uri_to_bufnr(uri)
|
||||
|
||||
local current_buf = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
|
||||
if #current_buf ~= 0 then
|
||||
return nil
|
||||
end
|
||||
|
||||
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines)
|
||||
vim.api.nvim_set_option_value('readonly', true, { buf = bufnr })
|
||||
vim.api.nvim_set_option_value('modified', false, { buf = bufnr })
|
||||
vim.api.nvim_set_option_value('modifiable', false, { buf = bufnr })
|
||||
lsp.buf_attach_client(bufnr, client.id)
|
||||
end
|
||||
|
||||
local function virtual_text_document(uri, client)
|
||||
local params = {
|
||||
textDocument = {
|
||||
uri = uri,
|
||||
},
|
||||
}
|
||||
local result = client.request_sync('deno/virtualTextDocument', params)
|
||||
virtual_text_document_handler(uri, result, client)
|
||||
end
|
||||
|
||||
local function denols_handler(err, result, ctx, config)
|
||||
if not result or vim.tbl_isempty(result) then
|
||||
return nil
|
||||
end
|
||||
|
||||
local client = vim.lsp.get_client_by_id(ctx.client_id)
|
||||
for _, res in pairs(result) do
|
||||
local uri = res.uri or res.targetUri
|
||||
if uri:match '^deno:' then
|
||||
virtual_text_document(uri, client)
|
||||
res['uri'] = uri
|
||||
res['targetUri'] = uri
|
||||
end
|
||||
end
|
||||
|
||||
lsp.handlers[ctx.method](err, result, ctx, config)
|
||||
end
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'deno', 'lsp' },
|
||||
cmd_env = { NO_COLOR = true },
|
||||
filetypes = {
|
||||
'javascript',
|
||||
'javascriptreact',
|
||||
'javascript.jsx',
|
||||
'typescript',
|
||||
'typescriptreact',
|
||||
'typescript.tsx',
|
||||
},
|
||||
root_dir = util.root_pattern('deno.json', 'deno.jsonc', '.git'),
|
||||
settings = {
|
||||
deno = {
|
||||
enable = true,
|
||||
suggest = {
|
||||
imports = {
|
||||
hosts = {
|
||||
['https://deno.land'] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
handlers = {
|
||||
['textDocument/definition'] = denols_handler,
|
||||
['textDocument/typeDefinition'] = denols_handler,
|
||||
['textDocument/references'] = denols_handler,
|
||||
},
|
||||
},
|
||||
commands = {
|
||||
DenolsCache = {
|
||||
function()
|
||||
local clients = util.get_lsp_clients { bufnr = 0, name = 'denols' }
|
||||
if #clients > 0 then
|
||||
buf_cache(0, clients[#clients])
|
||||
end
|
||||
end,
|
||||
description = 'Cache a module and all of its dependencies.',
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/denoland/deno
|
||||
|
||||
Deno's built-in language server
|
||||
|
||||
To appropriately highlight codefences returned from denols, you will need to augment vim.g.markdown_fenced languages
|
||||
in your init.lua. Example:
|
||||
|
||||
```lua
|
||||
vim.g.markdown_fenced_languages = {
|
||||
"ts=typescript"
|
||||
}
|
||||
```
|
||||
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("deno.json", "deno.jsonc", ".git")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'dhall-lsp-server' },
|
||||
filetypes = { 'dhall' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-lsp-server
|
||||
|
||||
language server for dhall
|
||||
|
||||
`dhall-lsp-server` can be installed via cabal:
|
||||
```sh
|
||||
cabal install dhall-lsp-server
|
||||
```
|
||||
prebuilt binaries can be found [here](https://github.com/dhall-lang/dhall-haskell/releases).
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern(".git")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'diagnostic-languageserver', '--stdio' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
filetypes = {},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/iamcco/diagnostic-languageserver
|
||||
|
||||
Diagnostic language server integrate with linters.
|
||||
]],
|
||||
default_config = {
|
||||
filetypes = 'Empty by default, override to add filetypes',
|
||||
root_dir = "Vim's starting directory",
|
||||
init_options = 'Configuration from https://github.com/iamcco/diagnostic-languageserver#config--document',
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'digestif' },
|
||||
filetypes = { 'tex', 'plaintex', 'context' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/astoff/digestif
|
||||
|
||||
Digestif is a code analyzer, and a language server, for LaTeX, ConTeXt et caterva. It provides
|
||||
|
||||
context-sensitive completion, documentation, code navigation, and related functionality to any
|
||||
|
||||
text editor that speaks the LSP protocol.
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'docker-compose-langserver', '--stdio' },
|
||||
filetypes = { 'yaml.docker-compose' },
|
||||
root_dir = util.root_pattern('docker-compose.yaml', 'docker-compose.yml', 'compose.yaml', 'compose.yml'),
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/microsoft/compose-language-service
|
||||
This project contains a language service for Docker Compose.
|
||||
|
||||
`compose-language-service` can be installed via `npm`:
|
||||
|
||||
```sh
|
||||
npm install @microsoft/compose-language-service
|
||||
```
|
||||
|
||||
Note: If the docker-compose-langserver doesn't startup when entering a `docker-compose.yaml` file, make sure that the filetype is `yaml.docker-compose`. You can set with: `:set filetype=yaml.docker-compose`.
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("docker-compose.yaml", "docker-compose.yml", "compose.yaml", "compose.yml")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'docker-langserver', '--stdio' },
|
||||
filetypes = { 'dockerfile' },
|
||||
root_dir = util.root_pattern 'Dockerfile',
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/rcjsuen/dockerfile-language-server-nodejs
|
||||
|
||||
`docker-langserver` can be installed via `npm`:
|
||||
```sh
|
||||
npm install -g dockerfile-language-server-nodejs
|
||||
```
|
||||
|
||||
Additional configuration can be applied in the following way:
|
||||
```lua
|
||||
require("lspconfig").dockerls.setup {
|
||||
settings = {
|
||||
docker = {
|
||||
languageserver = {
|
||||
formatter = {
|
||||
ignoreMultilineInstructions = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("Dockerfile")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'dolmenls' },
|
||||
filetypes = { 'smt2', 'tptp', 'p', 'cnf', 'icnf', 'zf' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/Gbury/dolmen/blob/master/doc/lsp.md
|
||||
|
||||
`dolmenls` can be installed via `opam`
|
||||
```sh
|
||||
opam install dolmen_lsp
|
||||
```
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'dot-language-server', '--stdio' },
|
||||
filetypes = { 'dot' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/nikeee/dot-language-server
|
||||
|
||||
`dot-language-server` can be installed via `npm`:
|
||||
```sh
|
||||
npm install -g dot-language-server
|
||||
```
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'dprint', 'lsp' },
|
||||
filetypes = {
|
||||
'javascript',
|
||||
'javascriptreact',
|
||||
'typescript',
|
||||
'typescriptreact',
|
||||
'json',
|
||||
'jsonc',
|
||||
'markdown',
|
||||
'python',
|
||||
'toml',
|
||||
'rust',
|
||||
'roslyn',
|
||||
},
|
||||
root_dir = util.root_pattern('dprint.json', '.dprint.json', 'dprint.jsonc', '.dprint.jsonc'),
|
||||
single_file_support = true,
|
||||
settings = {},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/dprint/dprint
|
||||
|
||||
Pluggable and configurable code formatting platform written in Rust.
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = util.root_pattern('dprint.json', '.dprint.json', 'dprint.jsonc', '.dprint.jsonc'),
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
local function get_java_bin(config)
|
||||
local java_bin = vim.tbl_get(config, 'drools', 'java', 'bin')
|
||||
if not java_bin then
|
||||
java_bin = vim.env.JAVA_HOME and util.path.join(vim.env.JAVA_HOME, 'bin', 'java') or 'java'
|
||||
if vim.fn.has 'win32' == 1 then
|
||||
java_bin = java_bin .. '.exe'
|
||||
end
|
||||
end
|
||||
return java_bin
|
||||
end
|
||||
|
||||
local function get_java_opts(config)
|
||||
local java_opts = vim.tbl_get(config, 'drools', 'java', 'opts')
|
||||
return java_opts and java_opts or {}
|
||||
end
|
||||
|
||||
local function get_jar(config)
|
||||
local jar = vim.tbl_get(config, 'drools', 'jar')
|
||||
return jar and jar or 'drools-lsp-server-jar-with-dependencies.jar'
|
||||
end
|
||||
|
||||
local function get_cmd(config)
|
||||
local cmd = vim.tbl_get(config, 'cmd')
|
||||
if not cmd then
|
||||
cmd = { get_java_bin(config) }
|
||||
for _, o in ipairs(get_java_opts(config)) do
|
||||
table.insert(cmd, o)
|
||||
end
|
||||
---@diagnostic disable-next-line:missing-parameter
|
||||
vim.list_extend(cmd, { '-jar', get_jar(config) })
|
||||
end
|
||||
return cmd
|
||||
end
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
filetypes = { 'drools' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
on_new_config = function(new_config)
|
||||
new_config.cmd = get_cmd(new_config)
|
||||
end,
|
||||
},
|
||||
docs = {
|
||||
description = [=[
|
||||
https://github.com/kiegroup/drools-lsp
|
||||
|
||||
Language server for the [Drools Rule Language (DRL)](https://docs.drools.org/latest/drools-docs/docs-website/drools/language-reference/#con-drl_drl-rules).
|
||||
|
||||
The `drools-lsp` server is a self-contained java jar file (`drools-lsp-server-jar-with-dependencies.jar`), and can be downloaded from [https://github.com/kiegroup/drools-lsp/releases/](https://github.com/kiegroup/drools-lsp/releases/).
|
||||
|
||||
Configuration information:
|
||||
```lua
|
||||
-- Option 1) Specify the entire command:
|
||||
require('lspconfig').drools_lsp.setup {
|
||||
cmd = { '/path/to/java', '-jar', '/path/to/drools-lsp-server-jar-with-dependencies.jar' },
|
||||
}
|
||||
|
||||
-- Option 2) Specify just the jar path (the JAVA_HOME environment variable will be respected if present):
|
||||
require('lspconfig').drools_lsp.setup {
|
||||
drools = { jar = '/path/to/drools-lsp-server-jar-with-dependencies.jar' },
|
||||
}
|
||||
|
||||
-- Option 3) Specify the java bin and/or java opts in addition to the jar path:
|
||||
require('lspconfig').drools_lsp.setup {
|
||||
drools = {
|
||||
java = { bin = '/path/to/java', opts = { '-Xmx100m' } },
|
||||
jar = '/path/to/drools-lsp-server-jar-with-dependencies.jar',
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
Neovim does not yet have automatic detection for the `drools` filetype, but it can be added with:
|
||||
```lua
|
||||
vim.cmd [[ autocmd BufNewFile,BufRead *.drl set filetype=drools ]]
|
||||
```
|
||||
]=],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,80 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
local bin_name = 'ds-pinyin-lsp'
|
||||
if vim.fn.has 'win32' == 1 then
|
||||
bin_name = bin_name .. '.exe'
|
||||
end
|
||||
|
||||
local function ds_pinyin_lsp_off(bufnr)
|
||||
bufnr = util.validate_bufnr(bufnr)
|
||||
local ds_pinyin_lsp_client = util.get_active_client_by_name(bufnr, 'ds_pinyin_lsp')
|
||||
if ds_pinyin_lsp_client then
|
||||
ds_pinyin_lsp_client.notify('$/turn/completion', {
|
||||
['completion_on'] = false,
|
||||
})
|
||||
else
|
||||
vim.notify 'notification $/turn/completion is not supported by any servers active on the current buffer'
|
||||
end
|
||||
end
|
||||
|
||||
local function ds_pinyin_lsp_on(bufnr)
|
||||
bufnr = util.validate_bufnr(bufnr)
|
||||
local ds_pinyin_lsp_client = util.get_active_client_by_name(bufnr, 'ds_pinyin_lsp')
|
||||
if ds_pinyin_lsp_client then
|
||||
ds_pinyin_lsp_client.notify('$/turn/completion', {
|
||||
['completion_on'] = true,
|
||||
})
|
||||
else
|
||||
vim.notify 'notification $/turn/completion is not supported by any servers active on the current buffer'
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { bin_name },
|
||||
filetypes = { 'markdown', 'org' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
init_options = {
|
||||
completion_on = true,
|
||||
show_symbols = true,
|
||||
show_symbols_only_follow_by_hanzi = false,
|
||||
show_symbols_by_n_times = 0,
|
||||
match_as_same_as_input = true,
|
||||
match_long_input = true,
|
||||
max_suggest = 15,
|
||||
},
|
||||
},
|
||||
commands = {
|
||||
DsPinyinCompletionOff = {
|
||||
function()
|
||||
ds_pinyin_lsp_off(0)
|
||||
end,
|
||||
description = 'Turn off the ds-pinyin-lsp completion',
|
||||
},
|
||||
DsPinyinCompletionOn = {
|
||||
function()
|
||||
ds_pinyin_lsp_on(0)
|
||||
end,
|
||||
description = 'Turn on the ds-pinyin-lsp completion',
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
description = [=[
|
||||
https://github.com/iamcco/ds-pinyin-lsp
|
||||
Dead simple Pinyin language server for input Chinese without IME(input method).
|
||||
To install, download the latest [release](https://github.com/iamcco/ds-pinyin-lsp/releases) and ensure `ds-pinyin-lsp` is on your path.
|
||||
And make ensure the database file `dict.db3` is also downloaded. And put the path to `dict.dbs` in the following code.
|
||||
|
||||
```lua
|
||||
|
||||
require('lspconfig').ds_pinyin_lsp.setup {
|
||||
init_options = {
|
||||
db_path = "your_path_to_database"
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
]=],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
local util = require 'lspconfig/util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'earthlyls' },
|
||||
filetypes = { 'earthfile' },
|
||||
root_dir = util.root_pattern 'Earthfile',
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/glehmann/earthlyls
|
||||
|
||||
A fast language server for earthly.
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'ecsact_lsp_server', '--stdio' },
|
||||
filetypes = { 'ecsact' },
|
||||
root_dir = util.root_pattern '.git',
|
||||
single_file_support = true,
|
||||
},
|
||||
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/ecsact-dev/ecsact_lsp_server
|
||||
|
||||
Language server for Ecsact.
|
||||
|
||||
The default cmd assumes `ecsact_lsp_server` is in your PATH. Typically from the
|
||||
Ecsact SDK: https://ecsact.dev/start
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'efm-langserver' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
},
|
||||
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/mattn/efm-langserver
|
||||
|
||||
General purpose Language Server that can use specified error message format generated from specified command.
|
||||
|
||||
Requires at minimum EFM version [v0.0.38](https://github.com/mattn/efm-langserver/releases/tag/v0.0.38) to support
|
||||
launching the language server on single files. If on an older version of EFM, disable single file support:
|
||||
|
||||
```lua
|
||||
require('lspconfig')['efm'].setup{
|
||||
settings = ..., -- You must populate this according to the EFM readme
|
||||
filetypes = ..., -- Populate this according to the note below
|
||||
single_file_support = false, -- This is the important line for supporting older version of EFM
|
||||
}
|
||||
```
|
||||
|
||||
Note: In order for neovim's built-in language server client to send the appropriate `languageId` to EFM, **you must
|
||||
specify `filetypes` in your call to `setup{}`**. Otherwise `lspconfig` will launch EFM on the `BufEnter` instead
|
||||
of the `FileType` autocommand, and the `filetype` variable used to populate the `languageId` will not yet be set.
|
||||
|
||||
```lua
|
||||
require('lspconfig')['efm'].setup{
|
||||
settings = ..., -- You must populate this according to the EFM readme
|
||||
filetypes = { 'python','cpp','lua' }
|
||||
}
|
||||
```
|
||||
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[util.root_pattern(".git")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
return {
|
||||
default_config = {
|
||||
filetypes = { 'elixir', 'eelixir', 'heex', 'surface' },
|
||||
root_dir = function(fname)
|
||||
local matches = vim.fs.find({ 'mix.exs' }, { upward = true, limit = 2, path = fname })
|
||||
local child_or_root_path, maybe_umbrella_path = unpack(matches)
|
||||
local root_dir = vim.fs.dirname(maybe_umbrella_path or child_or_root_path)
|
||||
|
||||
return root_dir
|
||||
end,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/elixir-lsp/elixir-ls
|
||||
|
||||
`elixir-ls` can be installed by following the instructions [here](https://github.com/elixir-lsp/elixir-ls#building-and-running).
|
||||
|
||||
```bash
|
||||
curl -fLO https://github.com/elixir-lsp/elixir-ls/releases/latest/download/elixir-ls.zip
|
||||
unzip elixir-ls.zip -d /path/to/elixir-ls
|
||||
# Unix
|
||||
chmod +x /path/to/elixir-ls/language_server.sh
|
||||
```
|
||||
|
||||
**By default, elixir-ls doesn't have a `cmd` set.** This is because nvim-lspconfig does not make assumptions about your path. You must add the following to your init.vim or init.lua to set `cmd` to the absolute path ($HOME and ~ are not expanded) of your unzipped elixir-ls.
|
||||
|
||||
```lua
|
||||
require'lspconfig'.elixirls.setup{
|
||||
-- Unix
|
||||
cmd = { "/path/to/elixir-ls/language_server.sh" };
|
||||
-- Windows
|
||||
cmd = { "/path/to/elixir-ls/language_server.bat" };
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
'root_dir' is chosen like this: if two or more directories containing `mix.exs` were found when searching directories upward, the second one (higher up) is chosen, with the assumption that it is the root of an umbrella app. Otherwise the directory containing the single mix.exs that was found is chosen.
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = '{{see description above}}',
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
local util = require 'lspconfig.util'
|
||||
local lsp = vim.lsp
|
||||
local api = vim.api
|
||||
|
||||
local default_capabilities = lsp.protocol.make_client_capabilities()
|
||||
default_capabilities.offsetEncoding = { 'utf-8', 'utf-16' }
|
||||
local elm_root_pattern = util.root_pattern 'elm.json'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'elm-language-server' },
|
||||
-- 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' },
|
||||
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
|
||||
return elm_root_pattern(fname)
|
||||
end
|
||||
end,
|
||||
init_options = {
|
||||
elmReviewDiagnostics = 'off', -- 'off' | 'warning' | 'error'
|
||||
skipInstallPackageConfirmation = false,
|
||||
disableElmLSDiagnostics = false,
|
||||
onlyUpdateDiagnosticsOnSave = false,
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/elm-tooling/elm-language-server#installation
|
||||
|
||||
If you don't want to use Nvim to install it, then you can use:
|
||||
```sh
|
||||
npm install -g elm elm-test elm-format @elm-tooling/elm-language-server
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("elm.json")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'elp', 'server' },
|
||||
filetypes = { 'erlang' },
|
||||
root_dir = util.root_pattern('rebar.config', 'erlang.mk', '.git'),
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://whatsapp.github.io/erlang-language-platform
|
||||
|
||||
ELP integrates Erlang into modern IDEs via the language server protocol and was
|
||||
inspired by rust-analyzer.
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern('rebar.config', 'erlang.mk', '.git')]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'ember-language-server', '--stdio' },
|
||||
filetypes = { 'handlebars', 'typescript', 'javascript', 'typescript.glimmer', 'javascript.glimmer' },
|
||||
root_dir = util.root_pattern('ember-cli-build.js', '.git'),
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/ember-tooling/ember-language-server
|
||||
|
||||
`ember-language-server` can be installed via `npm`:
|
||||
|
||||
```sh
|
||||
npm install -g @ember-tooling/ember-language-server
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("ember-cli-build.js", ".git")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'emmet-language-server', '--stdio' },
|
||||
filetypes = {
|
||||
'css',
|
||||
'eruby',
|
||||
'html',
|
||||
'htmldjango',
|
||||
'javascriptreact',
|
||||
'less',
|
||||
'pug',
|
||||
'sass',
|
||||
'scss',
|
||||
'typescriptreact',
|
||||
},
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/olrtg/emmet-language-server
|
||||
|
||||
Package can be installed via `npm`:
|
||||
```sh
|
||||
npm install -g @olrtg/emmet-language-server
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = 'git root',
|
||||
single_file_support = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'emmet-ls', '--stdio' },
|
||||
filetypes = {
|
||||
'astro',
|
||||
'css',
|
||||
'eruby',
|
||||
'html',
|
||||
'htmldjango',
|
||||
'javascriptreact',
|
||||
'less',
|
||||
'pug',
|
||||
'sass',
|
||||
'scss',
|
||||
'svelte',
|
||||
'typescriptreact',
|
||||
'vue',
|
||||
},
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/aca/emmet-ls
|
||||
|
||||
Package can be installed via `npm`:
|
||||
```sh
|
||||
npm install -g emmet-ls
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = 'git root',
|
||||
single_file_support = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'erg', '--language-server' },
|
||||
filetypes = { 'erg' },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern 'package.er'(fname) or util.find_git_ancestor(fname)
|
||||
end,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/erg-lang/erg#flags ELS
|
||||
|
||||
ELS (erg-language-server) is a language server for the Erg programming language.
|
||||
|
||||
erg-language-server can be installed via `cargo` and used as follows:
|
||||
```sh
|
||||
cargo install erg --features els
|
||||
erg --language-server
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("package.er") or find_git_ancestor]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'erlang_ls' },
|
||||
filetypes = { 'erlang' },
|
||||
root_dir = util.root_pattern('rebar.config', 'erlang.mk', '.git'),
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://erlang-ls.github.io
|
||||
|
||||
Language Server for Erlang.
|
||||
|
||||
Clone [erlang_ls](https://github.com/erlang-ls/erlang_ls)
|
||||
Compile the project with `make` and copy resulting binaries somewhere in your $PATH eg. `cp _build/*/bin/* ~/local/bin`
|
||||
|
||||
Installation instruction can be found [here](https://github.com/erlang-ls/erlang_ls).
|
||||
|
||||
Installation requirements:
|
||||
- [Erlang OTP 21+](https://github.com/erlang/otp)
|
||||
- [rebar3 3.9.1+](https://github.com/erlang/rebar3)
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern('rebar.config', 'erlang.mk', '.git')]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'python3', '-m', 'esbonio' },
|
||||
filetypes = { 'rst' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/swyddfa/esbonio
|
||||
|
||||
Esbonio is a language server for [Sphinx](https://www.sphinx-doc.org/en/master/) documentation projects.
|
||||
The language server can be installed via pip
|
||||
|
||||
```
|
||||
pip install esbonio
|
||||
```
|
||||
|
||||
Since Sphinx is highly extensible you will get best results if you install the language server in the same
|
||||
Python environment as the one used to build your documentation. To ensure that the correct Python environment
|
||||
is picked up, you can either launch `nvim` with the correct environment activated.
|
||||
|
||||
```
|
||||
source env/bin/activate
|
||||
nvim
|
||||
```
|
||||
|
||||
Or you can modify the default `cmd` to include the full path to the Python interpreter.
|
||||
|
||||
```lua
|
||||
require'lspconfig'.esbonio.setup {
|
||||
cmd = { '/path/to/virtualenv/bin/python', '-m', 'esbonio' }
|
||||
}
|
||||
```
|
||||
|
||||
Esbonio supports a number of config values passed as `init_options` on startup, for example.
|
||||
|
||||
```lua
|
||||
require'lspconfig'.esbonio.setup {
|
||||
init_options = {
|
||||
server = {
|
||||
logLevel = "debug"
|
||||
},
|
||||
sphinx = {
|
||||
confDir = "/path/to/docs",
|
||||
srcDir = "${confDir}/../docs-src"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
A full list and explanation of the available options can be found [here](https://docs.esbon.io/en/esbonio-language-server-v0.16.4/lsp/getting-started.html?editor=neovim-lspconfig#configuration)
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,202 @@
|
||||
local util = require 'lspconfig.util'
|
||||
local lsp = vim.lsp
|
||||
|
||||
local function fix_all(opts)
|
||||
opts = opts or {}
|
||||
|
||||
local eslint_lsp_client = util.get_active_client_by_name(opts.bufnr, 'eslint')
|
||||
if eslint_lsp_client == nil then
|
||||
return
|
||||
end
|
||||
|
||||
local request
|
||||
if opts.sync then
|
||||
request = function(bufnr, method, params)
|
||||
eslint_lsp_client.request_sync(method, params, nil, bufnr)
|
||||
end
|
||||
else
|
||||
request = function(bufnr, method, params)
|
||||
eslint_lsp_client.request(method, params, nil, bufnr)
|
||||
end
|
||||
end
|
||||
|
||||
local bufnr = util.validate_bufnr(opts.bufnr or 0)
|
||||
request(0, 'workspace/executeCommand', {
|
||||
command = 'eslint.applyAllFixes',
|
||||
arguments = {
|
||||
{
|
||||
uri = vim.uri_from_bufnr(bufnr),
|
||||
version = lsp.util.buf_versions[bufnr],
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
local root_file = {
|
||||
'.eslintrc',
|
||||
'.eslintrc.js',
|
||||
'.eslintrc.cjs',
|
||||
'.eslintrc.yaml',
|
||||
'.eslintrc.yml',
|
||||
'.eslintrc.json',
|
||||
'eslint.config.js',
|
||||
'eslint.config.mjs',
|
||||
'eslint.config.cjs',
|
||||
'eslint.config.ts',
|
||||
'eslint.config.mts',
|
||||
'eslint.config.cts',
|
||||
}
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'vscode-eslint-language-server', '--stdio' },
|
||||
filetypes = {
|
||||
'javascript',
|
||||
'javascriptreact',
|
||||
'javascript.jsx',
|
||||
'typescript',
|
||||
'typescriptreact',
|
||||
'typescript.tsx',
|
||||
'vue',
|
||||
'svelte',
|
||||
'astro',
|
||||
},
|
||||
-- https://eslint.org/docs/user-guide/configuring/configuration-files#configuration-file-formats
|
||||
root_dir = function(fname)
|
||||
root_file = util.insert_package_json(root_file, 'eslintConfig', fname)
|
||||
return util.root_pattern(unpack(root_file))(fname)
|
||||
end,
|
||||
-- Refer to https://github.com/Microsoft/vscode-eslint#settings-options for documentation.
|
||||
settings = {
|
||||
validate = 'on',
|
||||
packageManager = nil,
|
||||
useESLintClass = false,
|
||||
experimental = {
|
||||
useFlatConfig = false,
|
||||
},
|
||||
codeActionOnSave = {
|
||||
enable = false,
|
||||
mode = 'all',
|
||||
},
|
||||
format = true,
|
||||
quiet = false,
|
||||
onIgnoredFiles = 'off',
|
||||
rulesCustomizations = {},
|
||||
run = 'onType',
|
||||
problems = {
|
||||
shortenToSingleLine = false,
|
||||
},
|
||||
-- nodePath configures the directory in which the eslint server should start its node_modules resolution.
|
||||
-- This path is relative to the workspace folder (root dir) of the server instance.
|
||||
nodePath = '',
|
||||
-- use the workspace folder location or the file location (if no workspace folder is open) as the working directory
|
||||
workingDirectory = { mode = 'location' },
|
||||
codeAction = {
|
||||
disableRuleComment = {
|
||||
enable = true,
|
||||
location = 'separateLine',
|
||||
},
|
||||
showDocumentation = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
on_new_config = function(config, new_root_dir)
|
||||
-- The "workspaceFolder" is a VSCode concept. It limits how far the
|
||||
-- server will traverse the file system when locating the ESLint config
|
||||
-- file (e.g., .eslintrc).
|
||||
config.settings.workspaceFolder = {
|
||||
uri = new_root_dir,
|
||||
name = vim.fn.fnamemodify(new_root_dir, ':t'),
|
||||
}
|
||||
|
||||
-- Support flat config
|
||||
if
|
||||
vim.fn.filereadable(new_root_dir .. '/eslint.config.js') == 1
|
||||
or vim.fn.filereadable(new_root_dir .. '/eslint.config.mjs') == 1
|
||||
or vim.fn.filereadable(new_root_dir .. '/eslint.config.cjs') == 1
|
||||
or vim.fn.filereadable(new_root_dir .. '/eslint.config.ts') == 1
|
||||
or vim.fn.filereadable(new_root_dir .. '/eslint.config.mts') == 1
|
||||
or vim.fn.filereadable(new_root_dir .. '/eslint.config.cts') == 1
|
||||
then
|
||||
config.settings.experimental.useFlatConfig = true
|
||||
end
|
||||
|
||||
-- Support Yarn2 (PnP) projects
|
||||
local pnp_cjs = util.path.join(new_root_dir, '.pnp.cjs')
|
||||
local pnp_js = util.path.join(new_root_dir, '.pnp.js')
|
||||
if util.path.exists(pnp_cjs) or util.path.exists(pnp_js) then
|
||||
config.cmd = vim.list_extend({ 'yarn', 'exec' }, config.cmd)
|
||||
end
|
||||
end,
|
||||
handlers = {
|
||||
['eslint/openDoc'] = function(_, result)
|
||||
if not result then
|
||||
return
|
||||
end
|
||||
local sysname = vim.loop.os_uname().sysname
|
||||
if sysname:match 'Windows' then
|
||||
os.execute(string.format('start %q', result.url))
|
||||
elseif sysname:match 'Linux' then
|
||||
os.execute(string.format('xdg-open %q', result.url))
|
||||
else
|
||||
os.execute(string.format('open %q', result.url))
|
||||
end
|
||||
return {}
|
||||
end,
|
||||
['eslint/confirmESLintExecution'] = function(_, result)
|
||||
if not result then
|
||||
return
|
||||
end
|
||||
return 4 -- approved
|
||||
end,
|
||||
['eslint/probeFailed'] = function()
|
||||
vim.notify('[lspconfig] ESLint probe failed.', vim.log.levels.WARN)
|
||||
return {}
|
||||
end,
|
||||
['eslint/noLibrary'] = function()
|
||||
vim.notify('[lspconfig] Unable to find ESLint library.', vim.log.levels.WARN)
|
||||
return {}
|
||||
end,
|
||||
},
|
||||
},
|
||||
commands = {
|
||||
EslintFixAll = {
|
||||
function()
|
||||
fix_all { sync = true, bufnr = 0 }
|
||||
end,
|
||||
description = 'Fix all eslint problems for this buffer',
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/hrsh7th/vscode-langservers-extracted
|
||||
|
||||
`vscode-eslint-language-server` is a linting engine for JavaScript / Typescript.
|
||||
It can be installed via `npm`:
|
||||
|
||||
```sh
|
||||
npm i -g vscode-langservers-extracted
|
||||
```
|
||||
|
||||
`vscode-eslint-language-server` provides an `EslintFixAll` command that can be used to format a document on save:
|
||||
```lua
|
||||
lspconfig.eslint.setup({
|
||||
--- ...
|
||||
on_attach = function(client, bufnr)
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
buffer = bufnr,
|
||||
command = "EslintFixAll",
|
||||
})
|
||||
end,
|
||||
})
|
||||
```
|
||||
|
||||
See [vscode-eslint](https://github.com/microsoft/vscode-eslint/blob/55871979d7af184bf09af491b6ea35ebd56822cf/server/src/eslintServer.ts#L216-L229) for configuration options.
|
||||
|
||||
Messages handled in lspconfig: `eslint/openDoc`, `eslint/confirmESLintExecution`, `eslint/probeFailed`, `eslint/noLibrary`
|
||||
|
||||
Additional messages you can handle: `eslint/noConfig`
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'facility-language-server' },
|
||||
filetypes = { 'fsd' },
|
||||
single_file_support = true,
|
||||
root_dir = util.find_git_ancestor,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/FacilityApi/FacilityLanguageServer
|
||||
|
||||
Facility language server protocol (LSP) support.
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'fennel-language-server' },
|
||||
filetypes = { 'fennel' },
|
||||
single_file_support = true,
|
||||
root_dir = util.find_git_ancestor,
|
||||
settings = {},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/rydesun/fennel-language-server
|
||||
|
||||
Fennel language server protocol (LSP) support.
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
local default_capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
default_capabilities.offsetEncoding = { 'utf-8', 'utf-16' }
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'fennel-ls' },
|
||||
filetypes = { 'fennel' },
|
||||
root_dir = function(dir)
|
||||
return util.find_git_ancestor(dir)
|
||||
end,
|
||||
settings = {},
|
||||
capabilities = default_capabilities,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://sr.ht/~xerool/fennel-ls/
|
||||
|
||||
A language server for fennel.
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'npx', '--no-install', 'flow', 'lsp' },
|
||||
filetypes = { 'javascript', 'javascriptreact', 'javascript.jsx' },
|
||||
root_dir = util.root_pattern '.flowconfig',
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://flow.org/
|
||||
https://github.com/facebook/flow
|
||||
|
||||
See below for how to setup Flow itself.
|
||||
https://flow.org/en/docs/install/
|
||||
|
||||
See below for lsp command options.
|
||||
|
||||
```sh
|
||||
npx flow lsp --help
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern(".flowconfig")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'flux-lsp' },
|
||||
filetypes = { 'flux' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/influxdata/flux-lsp
|
||||
`flux-lsp` can be installed via `cargo`:
|
||||
```sh
|
||||
cargo install --git https://github.com/influxdata/flux-lsp
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[util.find_git_ancestor]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'foam-ls', '--stdio' },
|
||||
filetypes = { 'foam', 'OpenFOAM' },
|
||||
root_dir = function(fname)
|
||||
return util.search_ancestors(fname, function(path)
|
||||
if util.path.exists(util.path.join(path, 'system', 'controlDict')) then
|
||||
return path
|
||||
end
|
||||
end)
|
||||
end,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/FoamScience/foam-language-server
|
||||
|
||||
`foam-language-server` can be installed via `npm`
|
||||
```sh
|
||||
npm install -g foam-language-server
|
||||
```
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = {
|
||||
'fortls',
|
||||
'--notify_init',
|
||||
'--hover_signature',
|
||||
'--hover_language=fortran',
|
||||
'--use_signature_help',
|
||||
},
|
||||
filetypes = { 'fortran' },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern '.fortls'(fname) or util.find_git_ancestor(fname)
|
||||
end,
|
||||
settings = {},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/gnikit/fortls
|
||||
|
||||
fortls is a Fortran Language Server, the server can be installed via pip
|
||||
|
||||
```sh
|
||||
pip install fortls
|
||||
```
|
||||
|
||||
Settings to the server can be passed either through the `cmd` option or through
|
||||
a local configuration file e.g. `.fortls`. For more information
|
||||
see the `fortls` [documentation](https://gnikit.github.io/fortls/options.html).
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern(".fortls")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'fsautocomplete', '--adaptive-lsp-server-enabled' },
|
||||
root_dir = util.root_pattern('*.sln', '*.fsproj', '.git'),
|
||||
filetypes = { 'fsharp' },
|
||||
init_options = {
|
||||
AutomaticWorkspaceInit = true,
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/fsharp/FsAutoComplete
|
||||
|
||||
Language Server for F# provided by FsAutoComplete (FSAC).
|
||||
|
||||
FsAutoComplete requires the [dotnet-sdk](https://dotnet.microsoft.com/download) to be installed.
|
||||
|
||||
The preferred way to install FsAutoComplete is with `dotnet tool install --global fsautocomplete`.
|
||||
|
||||
Instructions to compile from source are found on the main [repository](https://github.com/fsharp/FsAutoComplete).
|
||||
|
||||
You may also need to configure the filetype as Vim defaults to Forth for `*.fs` files:
|
||||
|
||||
`autocmd BufNewFile,BufRead *.fs,*.fsx,*.fsi set filetype=fsharp`
|
||||
|
||||
This is automatically done by plugins such as [PhilT/vim-fsharp](https://github.com/PhilT/vim-fsharp), [fsharp/vim-fsharp](https://github.com/fsharp/vim-fsharp), and [adelarsq/neofsharp.vim](https://github.com/adelarsq/neofsharp.vim).
|
||||
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'dotnet', 'FSharpLanguageServer.dll' },
|
||||
root_dir = util.root_pattern('*.sln', '*.fsproj', '.git'),
|
||||
filetypes = { 'fsharp' },
|
||||
init_options = {
|
||||
AutomaticWorkspaceInit = true,
|
||||
},
|
||||
settings = {},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
F# Language Server
|
||||
https://github.com/faldor20/fsharp-language-server
|
||||
|
||||
An implementation of the language server protocol using the F# Compiler Service.
|
||||
|
||||
Build the project from source and override the command path to location of DLL.
|
||||
|
||||
If filetype determination is not already performed by an available plugin ([PhilT/vim-fsharp](https://github.com/PhilT/vim-fsharp), [fsharp/vim-fsharp](https://github.com/fsharp/vim-fsharp), and [adelarsq/neofsharp.vim](https://github.com/adelarsq/neofsharp.vim).
|
||||
), then the following must be added to initialization configuration:
|
||||
|
||||
|
||||
`autocmd BufNewFile,BufRead *.fs,*.fsx,*.fsi set filetype=fsharp`
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'fstar.exe', '--lsp' },
|
||||
filetypes = { 'fstar' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/FStarLang/FStar
|
||||
|
||||
LSP support is included in FStar. Make sure `fstar.exe` is in your PATH.
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[util.find_git_ancestor]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'futhark', 'lsp' },
|
||||
filetypes = { 'futhark', 'fut' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/diku-dk/futhark
|
||||
|
||||
Futhark Language Server
|
||||
|
||||
This language server comes with the futhark compiler and is run with the command
|
||||
```
|
||||
futhark lsp
|
||||
```
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
local port = os.getenv 'GDScript_Port' or '6005'
|
||||
local cmd = { 'nc', 'localhost', port }
|
||||
|
||||
if vim.fn.has 'nvim-0.8' == 1 then
|
||||
cmd = vim.lsp.rpc.connect('127.0.0.1', port)
|
||||
end
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = cmd,
|
||||
filetypes = { 'gd', 'gdscript', 'gdscript3' },
|
||||
root_dir = util.root_pattern('project.godot', '.git'),
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/godotengine/godot
|
||||
|
||||
Language server for GDScript, used by Godot Engine.
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[util.root_pattern("project.godot", ".git")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'gdshader-lsp', '--stdio' },
|
||||
filetypes = { 'gdshader', 'gdshaderinc' },
|
||||
root_dir = util.root_pattern 'project.godot',
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/godofavacyn/gdshader-lsp
|
||||
|
||||
A language server for the Godot Shading language.
|
||||
]],
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'ghcide', '--lsp' },
|
||||
filetypes = { 'haskell', 'lhaskell' },
|
||||
root_dir = util.root_pattern('stack.yaml', 'hie-bios', 'BUILD.bazel', 'cabal.config', 'package.yaml'),
|
||||
},
|
||||
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/digital-asset/ghcide
|
||||
|
||||
A library for building Haskell IDE tooling.
|
||||
"ghcide" isn't for end users now. Use "haskell-language-server" instead of "ghcide".
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("stack.yaml", "hie-bios", "BUILD.bazel", "cabal.config", "package.yaml")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'ghdl-ls' },
|
||||
filetypes = { 'vhdl' },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern 'hdl-prj.json'(fname) or util.find_git_ancestor(fname)
|
||||
end,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/ghdl/ghdl-language-server
|
||||
|
||||
A language server for VHDL, using ghdl as its backend.
|
||||
|
||||
`ghdl-ls` is part of pyghdl, for installation instructions see
|
||||
[the upstream README](https://github.com/ghdl/ghdl/tree/master/pyGHDL/lsp).
|
||||
]],
|
||||
},
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user