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/protocol.lua9
-rw-r--r--runtime/lua/vim/lsp/rpc.lua8
-rw-r--r--runtime/lua/vim/lsp/types.lua20
3 files changed, 25 insertions, 12 deletions
diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua
index 12345b6c8c..41dfc9e00e 100644
--- a/runtime/lua/vim/lsp/protocol.lua
+++ b/runtime/lua/vim/lsp/protocol.lua
@@ -20,14 +20,6 @@ function transform_schema_to_table()
end
--]=]
----@class lsp.ShowMessageRequestParams
----@field type lsp.MessageType
----@field message string
----@field actions nil|lsp.MessageActionItem[]
-
----@class lsp.MessageActionItem
----@field title string
-
local constants = {
DiagnosticSeverity = {
-- Reports an error.
@@ -60,6 +52,7 @@ local constants = {
},
-- The file event type.
+ ---@enum lsp.FileChangeType
FileChangeType = {
-- The file got created.
Created = 1,
diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua
index f1492601ff..aa833deb99 100644
--- a/runtime/lua/vim/lsp/rpc.lua
+++ b/runtime/lua/vim/lsp/rpc.lua
@@ -319,9 +319,9 @@ end
---
---@param method (string) The invoked LSP method
---@param params (table|nil) Parameters for the invoked LSP method
----@param callback (function) Callback to invoke
+---@param callback fun(err: lsp.ResponseError|nil, result: any) Callback to invoke
---@param notify_reply_callback (function|nil) Callback to invoke as soon as a request is no longer pending
----@returns (bool, number) `(true, message_id)` if request could be sent, `false` if not
+---@return boolean success, integer|nil request_id true, request_id if request could be sent, `false` if not
function Client:request(method, params, callback, notify_reply_callback)
validate({
callback = { callback, 'f' },
@@ -538,9 +538,9 @@ local function public_client(client)
---
---@param method (string) The invoked LSP method
---@param params (table|nil) Parameters for the invoked LSP method
- ---@param callback (function) Callback to invoke
+ ---@param callback fun(err: lsp.ResponseError | nil, result: any) Callback to invoke
---@param notify_reply_callback (function|nil) Callback to invoke as soon as a request is no longer pending
- ---@returns (bool, number) `(true, message_id)` if request could be sent, `false` if not
+ ---@return boolean success, integer|nil request_id true, message_id if request could be sent, `false` if not
function result.request(method, params, callback, notify_reply_callback)
return client:request(method, params, callback, notify_reply_callback)
end
diff --git a/runtime/lua/vim/lsp/types.lua b/runtime/lua/vim/lsp/types.lua
new file mode 100644
index 0000000000..1aea6841ee
--- /dev/null
+++ b/runtime/lua/vim/lsp/types.lua
@@ -0,0 +1,20 @@
+---@meta
+
+---@alias lsp-handler fun(err: lsp.ResponseError|nil, result: any, context: table, config: table|nil)
+
+---@class lsp.ResponseError
+---@field code integer
+---@field message string
+---@field data string|number|boolean|table[]|table|nil
+
+---@class lsp.ShowMessageRequestParams
+---@field type lsp.MessageType
+---@field message string
+---@field actions nil|lsp.MessageActionItem[]
+
+---@class lsp.MessageActionItem
+---@field title string
+
+---@class lsp.FileEvent
+---@field uri string
+---@field type lsp.FileChangeType