docs(lsp): document rpc Client request/notify as fields #40573

Problem:
`request()` and `notify()` are methods of the object returned by
`vim.lsp.rpc.start()`/`connect()`, but were rendered with module-level
helptags (`vim.lsp.rpc.request()`, `vim.lsp.rpc.notify()`) (erroneously
implying module functions that do not exist).

Solution:
Mark the wrappers `@private` and describe them on `vim.lsp.rpc.Client` instead.
This commit is contained in:
Barrett Ruth
2026-07-04 08:24:25 -05:00
committed by GitHub
parent 00917aa6f6
commit 6cbc5ea13d
3 changed files with 10 additions and 40 deletions

View File

@@ -72,7 +72,7 @@ end
--- end
--- ```
---
--- - See |vim.lsp.rpc.request()| |vim.lsp.rpc.notify()|
--- - See |vim.lsp.rpc.Client|.
--- - For TCP there is a builtin RPC client factory: |vim.lsp.rpc.connect()|
--- @field cmd string[]|fun(dispatchers: vim.lsp.rpc.Dispatchers, config: vim.lsp.ClientConfig): vim.lsp.rpc.Client
---

View File

@@ -266,10 +266,10 @@ end
--- @field private message_stream vim.net.MessageStream
--- @field private dispatchers vim.lsp.rpc.Dispatchers
---
--- See [vim.lsp.rpc.request()]
--- Sends a request to the LSP server.
--- @field request fun(method: vim.lsp.protocol.Method.ClientToServer.Request, params: table?, callback: fun(err?: lsp.ResponseError, result: any, request_id: integer), notify_reply_callback?: fun(message_id: integer)):boolean,integer?
---
--- See [vim.lsp.rpc.notify()]
--- Sends a notification to the LSP server.
--- @field notify fun(method: vim.lsp.protocol.Method.ClientToServer.Notification, params: any): boolean
---
--- Indicates if the RPC is closing.
@@ -304,8 +304,7 @@ function Client.new(dispatchers, transport, decode, format)
result.transport:terminate()
end
--- Sends a request to the LSP server and runs {callback} upon response.
---
---@private
---@param method (vim.lsp.protocol.Method.ClientToServer.Request) The invoked LSP method
---@param params (table?) Parameters for the invoked LSP method
---@param callback fun(err: lsp.ResponseError?, result: any) Callback to invoke
@@ -316,7 +315,7 @@ function Client.new(dispatchers, transport, decode, format)
return result:_request(method, params, callback, notify_reply_callback)
end
--- Sends a notification to the LSP server.
---@private
---@param method (vim.lsp.protocol.Method.ClientToServer.Notification) The invoked LSP method
---@param params (table?) Parameters for the invoked LSP method
---@return boolean `true` if notification could be sent, `false` if not
@@ -386,7 +385,7 @@ function Client:send_response(request_id, err, result)
end
---@package
--- Sends a request to the LSP server and runs {callback} upon response. |vim.lsp.rpc.request()|
--- Sends a request to the LSP server and runs {callback} upon response.
---
---@param method vim.lsp.protocol.Method.ClientToServer.Request The invoked LSP method
---@param params table? Parameters for the invoked LSP method