aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/lua/vim/lsp')
-rw-r--r--runtime/lua/vim/lsp/_completion.lua4
-rw-r--r--runtime/lua/vim/lsp/_dynamic.lua2
-rw-r--r--runtime/lua/vim/lsp/_watchfiles.lua4
-rw-r--r--runtime/lua/vim/lsp/diagnostic.lua6
-rw-r--r--runtime/lua/vim/lsp/handlers.lua14
-rw-r--r--runtime/lua/vim/lsp/health.lua2
-rw-r--r--runtime/lua/vim/lsp/util.lua4
7 files changed, 17 insertions, 19 deletions
diff --git a/runtime/lua/vim/lsp/_completion.lua b/runtime/lua/vim/lsp/_completion.lua
index 7a607d6c13..84dbf9083e 100644
--- a/runtime/lua/vim/lsp/_completion.lua
+++ b/runtime/lua/vim/lsp/_completion.lua
@@ -8,7 +8,7 @@ local ms = protocol.Methods
---@return string parsed snippet
local function parse_snippet(input)
local ok, parsed = pcall(function()
- return require('vim.lsp._snippet_grammar').parse(input)
+ return vim.lsp._snippet_grammar.parse(input)
end)
return ok and tostring(parsed) or input
end
@@ -206,7 +206,7 @@ function M.omnifunc(findstart, base)
local params = util.make_position_params(win, client.offset_encoding)
client.request(ms.textDocument_completion, params, function(err, result)
if err then
- require('vim.lsp.log').warn(err.message)
+ vim.lsp.log.warn(err.message)
end
if result and vim.fn.mode() == 'i' then
local matches
diff --git a/runtime/lua/vim/lsp/_dynamic.lua b/runtime/lua/vim/lsp/_dynamic.lua
index 5edb27b498..3c9dee2c69 100644
--- a/runtime/lua/vim/lsp/_dynamic.lua
+++ b/runtime/lua/vim/lsp/_dynamic.lua
@@ -1,4 +1,4 @@
-local glob = require('vim.glob')
+local glob = vim.glob
--- @class lsp.DynamicCapabilities
--- @field capabilities table<string, lsp.Registration[]>
diff --git a/runtime/lua/vim/lsp/_watchfiles.lua b/runtime/lua/vim/lsp/_watchfiles.lua
index af4cc65f71..59b8c38166 100644
--- a/runtime/lua/vim/lsp/_watchfiles.lua
+++ b/runtime/lua/vim/lsp/_watchfiles.lua
@@ -1,6 +1,6 @@
local bit = require('bit')
-local glob = require('vim.glob')
-local watch = require('vim._watch')
+local glob = vim.glob
+local watch = vim._watch
local protocol = require('vim.lsp.protocol')
local ms = protocol.Methods
local lpeg = vim.lpeg
diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua
index cba5b66672..46dda01e3f 100644
--- a/runtime/lua/vim/lsp/diagnostic.lua
+++ b/runtime/lua/vim/lsp/diagnostic.lua
@@ -1,8 +1,6 @@
---@brief lsp-diagnostic
-local util = require('vim.lsp.util')
local protocol = require('vim.lsp.protocol')
-local log = require('vim.lsp.log')
local ms = protocol.Methods
local api = vim.api
@@ -95,7 +93,7 @@ local function tags_lsp_to_vim(diagnostic, client_id)
tags = tags or {}
tags.deprecated = true
else
- log.info(string.format('Unknown DiagnosticTag %d from LSP client %d', tag, client_id))
+ vim.lsp.log.info(string.format('Unknown DiagnosticTag %d from LSP client %d', tag, client_id))
end
end
return tags
@@ -425,7 +423,7 @@ end
local function _refresh(bufnr, opts)
opts = opts or {}
opts['bufnr'] = bufnr
- util._refresh(ms.textDocument_diagnostic, opts)
+ vim.lsp.util._refresh(ms.textDocument_diagnostic, opts)
end
--- Enable pull diagnostics for a buffer
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua
index 6ed8e1d40f..26a71487e2 100644
--- a/runtime/lua/vim/lsp/handlers.lua
+++ b/runtime/lua/vim/lsp/handlers.lua
@@ -120,7 +120,7 @@ M[ms.client_registerCapability] = function(_, result, ctx)
local unsupported = {}
for _, reg in ipairs(result.registrations) do
if reg.method == ms.workspace_didChangeWatchedFiles then
- require('vim.lsp._watchfiles').register(reg, ctx)
+ vim.lsp._watchfiles.register(reg, ctx)
elseif not client.dynamic_capabilities:supports_registration(reg.method) then
unsupported[#unsupported + 1] = reg.method
end
@@ -144,7 +144,7 @@ M[ms.client_unregisterCapability] = function(_, result, ctx)
for _, unreg in ipairs(result.unregisterations) do
if unreg.method == ms.workspace_didChangeWatchedFiles then
- require('vim.lsp._watchfiles').unregister(unreg, ctx)
+ vim.lsp._watchfiles.unregister(unreg, ctx)
end
end
return vim.NIL
@@ -223,19 +223,19 @@ M[ms.workspace_workspaceFolders] = function(_, _, ctx)
end
M[ms.textDocument_publishDiagnostics] = function(...)
- return require('vim.lsp.diagnostic').on_publish_diagnostics(...)
+ return vim.lsp.diagnostic.on_publish_diagnostics(...)
end
M[ms.textDocument_diagnostic] = function(...)
- return require('vim.lsp.diagnostic').on_diagnostic(...)
+ return vim.lsp.diagnostic.on_diagnostic(...)
end
M[ms.textDocument_codeLens] = function(...)
- return require('vim.lsp.codelens').on_codelens(...)
+ return vim.lsp.codelens.on_codelens(...)
end
M[ms.textDocument_inlayHint] = function(...)
- return require('vim.lsp.inlay_hint').on_inlayhint(...)
+ return vim.lsp.inlay_hint.on_inlayhint(...)
end
--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_references
@@ -643,7 +643,7 @@ end
---@see https://microsoft.github.io/language-server-protocol/specification/#workspace_inlayHint_refresh
M[ms.workspace_inlayHint_refresh] = function(err, result, ctx, config)
- return require('vim.lsp.inlay_hint').on_refresh(err, result, ctx, config)
+ return vim.lsp.inlay_hint.on_refresh(err, result, ctx, config)
end
-- Add boilerplate error validation and logging for all of these.
diff --git a/runtime/lua/vim/lsp/health.lua b/runtime/lua/vim/lsp/health.lua
index fe06006108..9c989e5246 100644
--- a/runtime/lua/vim/lsp/health.lua
+++ b/runtime/lua/vim/lsp/health.lua
@@ -5,7 +5,7 @@ function M.check()
local report_info = vim.health.info
local report_warn = vim.health.warn
- local log = require('vim.lsp.log')
+ local log = vim.lsp.log
local current_log_level = log.get_level()
local log_level_string = log.levels[current_log_level]
report_info(string.format('LSP log level : %s', log_level_string))
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index cee09d85e0..b5e15e135c 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -3,7 +3,7 @@ local snippet = require('vim.lsp._snippet_grammar')
local validate = vim.validate
local api = vim.api
local list_extend = vim.list_extend
-local highlight = require('vim.highlight')
+local highlight = vim.highlight
local uv = vim.uv
local npcall = vim.F.npcall
@@ -636,7 +636,7 @@ end
---@see complete-items
function M.text_document_completion_list_to_complete_items(result, prefix)
vim.deprecate('vim.lsp.util.text_document_completion_list_to_complete_items()', nil, '0.11')
- return require('vim.lsp._completion')._lsp_to_complete_items(result, prefix)
+ return vim.lsp._completion._lsp_to_complete_items(result, prefix)
end
--- Like vim.fn.bufwinid except it works across tabpages.