local if_nil = vim.F.if_nil
local default_handlers = require 'vim.lsp.handlers'
local log = require 'vim.lsp.log'
local lsp_rpc = require 'vim.lsp.rpc'
local protocol = require 'vim.lsp.protocol'
local util = require 'vim.lsp.util'
local vim = vim
local nvim_err_writeln, nvim_buf_get_lines, nvim_command, nvim_buf_get_option
= vim.api.nvim_err_writeln, vim.api.nvim_buf_get_lines, vim.api.nvim_command, vim.api.nvim_buf_get_option
local uv = vim.loop
local tbl_isempty, tbl_extend = vim.tbl_isempty, vim.tbl_extend
local validate = vim.validate
local lsp = {
protocol = protocol;
handlers = default_handlers;
buf = require'vim.lsp.buf';
diagnostic = require'vim.lsp.diagnostic';
codelens = require'vim.lsp.codelens';
util = util;
-- Allow raw RPC access.
rpc = lsp_rpc;
-- Export these directly from rpc.
rpc_response_error = lsp_rpc.rpc_response_error;
}
-- maps request name to the required resolved_capability in the client.
lsp._request_name_to_capability = {
['textDocument/hover'] = 'hover';
['textDocument/signatureHelp'] = 'signature_help';
['textDocument/definition'] = 'goto_definition';
['textDocument/implementation'] = 'implementation';
['textDocument/declaration'] = 'declaration';
['textDocument/typeDefinition'] = 'type_definition';
['textDocument/documentSymbol'] = 'document_symbol';
['textDocument/prepareCallHierarchy'] = 'call_hierarchy';
['textDocument/rename'] = 'rename';
['textDocument/codeAction'] = 'code_action';
['textDocument/codeLens'] = 'code_lens';
['codeLens/resolve'] = 'code_lens_resolve';
['workspace/executeCommand'] = 'execute_command';
['workspace/symbol'] = 'workspace_symbol';
['textDocument/references'] = 'find_references';
['textDocument/rangeFormatting'] = 'document_range_formatting';
['textDocument/formatting'] = 'document_formatting';
['textDocument/completion'] = 'completion';
['textDocument/documentHighlight'] = 'document_highlight';
}
-- TODO improve handling of scratch buffers with LSP attached.
--@private
--- Concate
|