mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 17:21:49 +00:00
feat(lsp): use stricter types for methods
This change modifies gen_lsp.lua so alias types are generated for various types of lsp methods to distinguish between notifications and requests: - vim.lsp.protocol.Method.ServerToClient.Request - vim.lsp.protocol.Method.ServerToClient.Notification - vim.lsp.protocol.Method.ClientToServer.Request - vim.lsp.protocol.Method.ClientToServer.Notification These types are then used instead of `string` where appropriate.
This commit is contained in:

committed by
Lewis Russell

parent
34b4df774d
commit
d7e0d46ffa
@@ -621,22 +621,15 @@ function protocol.resolve_capabilities(server_capabilities)
|
||||
end
|
||||
|
||||
-- Generated by gen_lsp.lua, keep at end of file.
|
||||
--- @alias vim.lsp.protocol.Method.ClientToServer
|
||||
--- @alias vim.lsp.protocol.Method.ClientToServer.Request
|
||||
--- | 'callHierarchy/incomingCalls',
|
||||
--- | 'callHierarchy/outgoingCalls',
|
||||
--- | 'codeAction/resolve',
|
||||
--- | 'codeLens/resolve',
|
||||
--- | 'completionItem/resolve',
|
||||
--- | 'documentLink/resolve',
|
||||
--- | '$/setTrace',
|
||||
--- | 'exit',
|
||||
--- | 'initialize',
|
||||
--- | 'initialized',
|
||||
--- | 'inlayHint/resolve',
|
||||
--- | 'notebookDocument/didChange',
|
||||
--- | 'notebookDocument/didClose',
|
||||
--- | 'notebookDocument/didOpen',
|
||||
--- | 'notebookDocument/didSave',
|
||||
--- | 'shutdown',
|
||||
--- | 'textDocument/codeAction',
|
||||
--- | 'textDocument/codeLens',
|
||||
@@ -645,10 +638,6 @@ end
|
||||
--- | 'textDocument/declaration',
|
||||
--- | 'textDocument/definition',
|
||||
--- | 'textDocument/diagnostic',
|
||||
--- | 'textDocument/didChange',
|
||||
--- | 'textDocument/didClose',
|
||||
--- | 'textDocument/didOpen',
|
||||
--- | 'textDocument/didSave',
|
||||
--- | 'textDocument/documentColor',
|
||||
--- | 'textDocument/documentHighlight',
|
||||
--- | 'textDocument/documentLink',
|
||||
@@ -676,19 +665,11 @@ end
|
||||
--- | 'textDocument/semanticTokens/range',
|
||||
--- | 'textDocument/signatureHelp',
|
||||
--- | 'textDocument/typeDefinition',
|
||||
--- | 'textDocument/willSave',
|
||||
--- | 'textDocument/willSaveWaitUntil',
|
||||
--- | 'typeHierarchy/subtypes',
|
||||
--- | 'typeHierarchy/supertypes',
|
||||
--- | 'window/workDoneProgress/cancel',
|
||||
--- | 'workspaceSymbol/resolve',
|
||||
--- | 'workspace/diagnostic',
|
||||
--- | 'workspace/didChangeConfiguration',
|
||||
--- | 'workspace/didChangeWatchedFiles',
|
||||
--- | 'workspace/didChangeWorkspaceFolders',
|
||||
--- | 'workspace/didCreateFiles',
|
||||
--- | 'workspace/didDeleteFiles',
|
||||
--- | 'workspace/didRenameFiles',
|
||||
--- | 'workspace/executeCommand',
|
||||
--- | 'workspace/symbol',
|
||||
--- | 'workspace/textDocumentContent',
|
||||
@@ -696,15 +677,35 @@ end
|
||||
--- | 'workspace/willDeleteFiles',
|
||||
--- | 'workspace/willRenameFiles',
|
||||
|
||||
--- @alias vim.lsp.protocol.Method.ServerToClient
|
||||
--- @alias vim.lsp.protocol.Method.ClientToServer.Notification
|
||||
--- | '$/setTrace',
|
||||
--- | 'exit',
|
||||
--- | 'initialized',
|
||||
--- | 'notebookDocument/didChange',
|
||||
--- | 'notebookDocument/didClose',
|
||||
--- | 'notebookDocument/didOpen',
|
||||
--- | 'notebookDocument/didSave',
|
||||
--- | 'textDocument/didChange',
|
||||
--- | 'textDocument/didClose',
|
||||
--- | 'textDocument/didOpen',
|
||||
--- | 'textDocument/didSave',
|
||||
--- | 'textDocument/willSave',
|
||||
--- | 'window/workDoneProgress/cancel',
|
||||
--- | 'workspace/didChangeConfiguration',
|
||||
--- | 'workspace/didChangeWatchedFiles',
|
||||
--- | 'workspace/didChangeWorkspaceFolders',
|
||||
--- | 'workspace/didCreateFiles',
|
||||
--- | 'workspace/didDeleteFiles',
|
||||
--- | 'workspace/didRenameFiles',
|
||||
|
||||
--- @alias vim.lsp.protocol.Method.ClientToServer
|
||||
--- | vim.lsp.protocol.Method.ClientToServer.Request
|
||||
--- | vim.lsp.protocol.Method.ClientToServer.Notification
|
||||
|
||||
--- @alias vim.lsp.protocol.Method.ServerToClient.Request
|
||||
--- | 'client/registerCapability',
|
||||
--- | 'client/unregisterCapability',
|
||||
--- | '$/logTrace',
|
||||
--- | 'telemetry/event',
|
||||
--- | 'textDocument/publishDiagnostics',
|
||||
--- | 'window/logMessage',
|
||||
--- | 'window/showDocument',
|
||||
--- | 'window/showMessage',
|
||||
--- | 'window/showMessageRequest',
|
||||
--- | 'window/workDoneProgress/create',
|
||||
--- | 'workspace/applyEdit',
|
||||
@@ -718,6 +719,17 @@ end
|
||||
--- | 'workspace/textDocumentContent/refresh',
|
||||
--- | 'workspace/workspaceFolders',
|
||||
|
||||
--- @alias vim.lsp.protocol.Method.ServerToClient.Notification
|
||||
--- | '$/logTrace',
|
||||
--- | 'telemetry/event',
|
||||
--- | 'textDocument/publishDiagnostics',
|
||||
--- | 'window/logMessage',
|
||||
--- | 'window/showMessage',
|
||||
|
||||
--- @alias vim.lsp.protocol.Method.ServerToClient
|
||||
--- | vim.lsp.protocol.Method.ServerToClient.Request
|
||||
--- | vim.lsp.protocol.Method.ServerToClient.Notification
|
||||
|
||||
--- @alias vim.lsp.protocol.Method
|
||||
--- | vim.lsp.protocol.Method.ClientToServer
|
||||
--- | vim.lsp.protocol.Method.ServerToClient
|
||||
|
Reference in New Issue
Block a user