feat(gen_lsp.lua): sort by name, handle failure #24504

This commit is contained in:
Justin M. Keyes
2023-08-01 15:52:53 +02:00
parent da09f9b551
commit f41496ce74
5 changed files with 255 additions and 286 deletions

View File

@@ -923,110 +923,62 @@ function protocol.resolve_capabilities(server_capabilities)
return server_capabilities
end
-- Generated by lsp_types.lua, keep at end of file.
-- Generated by gen_lsp.lua, keep at end of file.
--- LSP method names.
---
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#metaModel
protocol.Methods = {
--- The initialize request is sent from the client to the server.
--- It is sent once as the request after starting up the server.
--- The requests parameter is of type {@link InitializeParams}
--- the response if of type {@link InitializeResult} of a Thenable that
--- resolves to such.
initialize = 'initialize',
--- A shutdown request is sent from the client to the server.
--- It is sent once when the client decides to shutdown the
--- server. The only notification that is sent after a shutdown request
--- is the exit event.
shutdown = 'shutdown',
--- A request to resolve the incoming calls for a given `CallHierarchyItem`.
--- @since 3.16.0
callHierarchy_incomingCalls = 'callHierarchy/incomingCalls',
--- A request to resolve the outgoing calls for a given `CallHierarchyItem`.
--- @since 3.16.0
callHierarchy_outgoingCalls = 'callHierarchy/outgoingCalls',
--- The `client/registerCapability` request is sent from the server to the client to register a new capability
--- handler on the client side.
client_registerCapability = 'client/registerCapability',
--- The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability
--- handler on the client side.
client_unregisterCapability = 'client/unregisterCapability',
--- A request to resolve the implementation locations of a symbol at a given text
--- document position. The request's parameter is of type [TextDocumentPositionParams]
--- (#TextDocumentPositionParams) the response is of type {@link Definition} or a
--- Thenable that resolves to such.
textDocument_implementation = 'textDocument/implementation',
--- A request to resolve the type definition locations of a symbol at a given text
--- document position. The request's parameter is of type [TextDocumentPositionParams]
--- (#TextDocumentPositionParams) the response is of type {@link Definition} or a
--- Thenable that resolves to such.
textDocument_typeDefinition = 'textDocument/typeDefinition',
--- A request to list all color symbols found in a given text document. The request's
--- parameter is of type {@link DocumentColorParams} the
--- response is of type {@link ColorInformation ColorInformation[]} or a Thenable
--- that resolves to such.
textDocument_documentColor = 'textDocument/documentColor',
--- Request to resolve additional information for a given code action.The request's
--- parameter is of type {@link CodeAction} the response
--- is of type {@link CodeAction} or a Thenable that resolves to such.
codeAction_resolve = 'codeAction/resolve',
--- A request to resolve a command for a given code lens.
codeLens_resolve = 'codeLens/resolve',
--- Request to resolve additional information for a given completion item.The request's
--- parameter is of type {@link CompletionItem} the response
--- is of type {@link CompletionItem} or a Thenable that resolves to such.
completionItem_resolve = 'completionItem/resolve',
--- Request to resolve additional information for a given document link. The request's
--- parameter is of type {@link DocumentLink} the response
--- is of type {@link DocumentLink} or a Thenable that resolves to such.
documentLink_resolve = 'documentLink/resolve',
--- The initialize request is sent from the client to the server.
--- It is sent once as the request after starting up the server.
--- The requests parameter is of type {@link InitializeParams}
--- the response if of type {@link InitializeResult} of a Thenable that
--- resolves to such.
initialize = 'initialize',
--- A request to resolve additional properties for an inlay hint.
--- The request's parameter is of type {@link InlayHint}, the response is
--- of type {@link InlayHint} or a Thenable that resolves to such.
--- @since 3.17.0
inlayHint_resolve = 'inlayHint/resolve',
--- A shutdown request is sent from the client to the server.
--- It is sent once when the client decides to shutdown the
--- server. The only notification that is sent after a shutdown request
--- is the exit event.
shutdown = 'shutdown',
--- A request to provide commands for the given text document and range.
textDocument_codeAction = 'textDocument/codeAction',
--- A request to provide code lens for the given text document.
textDocument_codeLens = 'textDocument/codeLens',
--- A request to list all presentation for a color. The request's
--- parameter is of type {@link ColorPresentationParams} the
--- response is of type {@link ColorInformation ColorInformation[]} or a Thenable
--- that resolves to such.
textDocument_colorPresentation = 'textDocument/colorPresentation',
--- A request to provide folding ranges in a document. The request's
--- parameter is of type {@link FoldingRangeParams}, the
--- response is of type {@link FoldingRangeList} or a Thenable
--- that resolves to such.
textDocument_foldingRange = 'textDocument/foldingRange',
--- A request to resolve the type definition locations of a symbol at a given text
--- document position. The request's parameter is of type [TextDocumentPositionParams]
--- (#TextDocumentPositionParams) the response is of type {@link Declaration}
--- or a typed array of {@link DeclarationLink} or a Thenable that resolves
--- to such.
textDocument_declaration = 'textDocument/declaration',
--- A request to provide selection ranges in a document. The request's
--- parameter is of type {@link SelectionRangeParams}, the
--- response is of type {@link SelectionRange SelectionRange[]} or a Thenable
--- that resolves to such.
textDocument_selectionRange = 'textDocument/selectionRange',
--- A request to result a `CallHierarchyItem` in a document at a given position.
--- Can be used as an input to an incoming or outgoing call hierarchy.
--- @since 3.16.0
textDocument_prepareCallHierarchy = 'textDocument/prepareCallHierarchy',
--- @since 3.16.0
textDocument_semanticTokens_full = 'textDocument/semanticTokens/full',
--- @since 3.16.0
textDocument_semanticTokens_full_delta = 'textDocument/semanticTokens/full/delta',
--- @since 3.16.0
textDocument_semanticTokens_range = 'textDocument/semanticTokens/range',
--- A request to provide ranges that can be edited together.
--- @since 3.16.0
textDocument_linkedEditingRange = 'textDocument/linkedEditingRange',
--- A request to get the moniker of a symbol at a given text document position.
--- The request parameter is of type {@link TextDocumentPositionParams}.
--- The response is of type {@link Moniker Moniker[]} or `null`.
textDocument_moniker = 'textDocument/moniker',
--- A request to result a `TypeHierarchyItem` in a document at a given position.
--- Can be used as an input to a subtypes or supertypes type hierarchy.
--- @since 3.17.0
textDocument_prepareTypeHierarchy = 'textDocument/prepareTypeHierarchy',
--- A request to provide inline values in a document. The request's parameter is of
--- type {@link InlineValueParams}, the response is of type
--- {@link InlineValue InlineValue[]} or a Thenable that resolves to such.
--- @since 3.17.0
textDocument_inlineValue = 'textDocument/inlineValue',
--- A request to provide inlay hints in a document. The request's parameter is of
--- type {@link InlayHintsParams}, the response is of type
--- {@link InlayHint InlayHint[]} or a Thenable that resolves to such.
--- @since 3.17.0
textDocument_inlayHint = 'textDocument/inlayHint',
--- The document diagnostic request definition.
--- @since 3.17.0
textDocument_diagnostic = 'textDocument/diagnostic',
--- A request to provide inline completions in a document. The request's parameter is of
--- type {@link InlineCompletionParams}, the response is of type
--- {@link InlineCompletion InlineCompletion[]} or a Thenable that resolves to such.
--- @since 3.18.0
textDocument_inlineCompletion = 'textDocument/inlineCompletion',
--- A document will save request is sent from the client to the server before
--- the document is actually saved. The request can return an array of TextEdits
--- which will be applied to the text document before it is saved. Please note that
--- clients might drop results if computing the text edits took too long or if a
--- server constantly fails on this request. This is done to keep the save fast and
--- reliable.
textDocument_willSaveWaitUntil = 'textDocument/willSaveWaitUntil',
--- Request to request completion at a given text document position. The request's
--- parameter is of type {@link TextDocumentPosition} the response
--- is of type {@link CompletionItem CompletionItem[]} or {@link CompletionList}
@@ -1036,55 +988,153 @@ protocol.Methods = {
--- request. However, properties that are needed for the initial sorting and filtering, like `sortText`,
--- `filterText`, `insertText`, and `textEdit`, must not be changed during resolve.
textDocument_completion = 'textDocument/completion',
--- Request to request hover information at a given text document position. The request's
--- parameter is of type {@link TextDocumentPosition} the response is of
--- type {@link Hover} or a Thenable that resolves to such.
textDocument_hover = 'textDocument/hover',
textDocument_signatureHelp = 'textDocument/signatureHelp',
--- A request to resolve the type definition locations of a symbol at a given text
--- document position. The request's parameter is of type [TextDocumentPositionParams]
--- (#TextDocumentPositionParams) the response is of type {@link Declaration}
--- or a typed array of {@link DeclarationLink} or a Thenable that resolves
--- to such.
textDocument_declaration = 'textDocument/declaration',
--- A request to resolve the definition location of a symbol at a given text
--- document position. The request's parameter is of type [TextDocumentPosition]
--- (#TextDocumentPosition) the response is of either type {@link Definition}
--- or a typed array of {@link DefinitionLink} or a Thenable that resolves
--- to such.
textDocument_definition = 'textDocument/definition',
--- A request to resolve project-wide references for the symbol denoted
--- by the given text document position. The request's parameter is of
--- type {@link ReferenceParams} the response is of type
--- {@link Location Location[]} or a Thenable that resolves to such.
textDocument_references = 'textDocument/references',
--- The document diagnostic request definition.
--- @since 3.17.0
textDocument_diagnostic = 'textDocument/diagnostic',
--- A request to list all color symbols found in a given text document. The request's
--- parameter is of type {@link DocumentColorParams} the
--- response is of type {@link ColorInformation ColorInformation[]} or a Thenable
--- that resolves to such.
textDocument_documentColor = 'textDocument/documentColor',
--- Request to resolve a {@link DocumentHighlight} for a given
--- text document position. The request's parameter is of type [TextDocumentPosition]
--- (#TextDocumentPosition) the request response is of type [DocumentHighlight[]]
--- (#DocumentHighlight) or a Thenable that resolves to such.
textDocument_documentHighlight = 'textDocument/documentHighlight',
--- A request to provide document links
textDocument_documentLink = 'textDocument/documentLink',
--- A request to list all symbols found in a given text document. The request's
--- parameter is of type {@link TextDocumentIdentifier} the
--- response is of type {@link SymbolInformation SymbolInformation[]} or a Thenable
--- that resolves to such.
textDocument_documentSymbol = 'textDocument/documentSymbol',
--- A request to provide commands for the given text document and range.
textDocument_codeAction = 'textDocument/codeAction',
--- A request to provide code lens for the given text document.
textDocument_codeLens = 'textDocument/codeLens',
--- A request to provide document links
textDocument_documentLink = 'textDocument/documentLink',
--- A request to to format a whole document.
--- A request to provide folding ranges in a document. The request's
--- parameter is of type {@link FoldingRangeParams}, the
--- response is of type {@link FoldingRangeList} or a Thenable
--- that resolves to such.
textDocument_foldingRange = 'textDocument/foldingRange',
--- A request to format a whole document.
textDocument_formatting = 'textDocument/formatting',
--- Request to request hover information at a given text document position. The request's
--- parameter is of type {@link TextDocumentPosition} the response is of
--- type {@link Hover} or a Thenable that resolves to such.
textDocument_hover = 'textDocument/hover',
--- A request to resolve the implementation locations of a symbol at a given text
--- document position. The request's parameter is of type [TextDocumentPositionParams]
--- (#TextDocumentPositionParams) the response is of type {@link Definition} or a
--- Thenable that resolves to such.
textDocument_implementation = 'textDocument/implementation',
--- A request to provide inlay hints in a document. The request's parameter is of
--- type {@link InlayHintsParams}, the response is of type
--- {@link InlayHint InlayHint[]} or a Thenable that resolves to such.
--- @since 3.17.0
textDocument_inlayHint = 'textDocument/inlayHint',
--- A request to provide inline completions in a document. The request's parameter is of
--- type {@link InlineCompletionParams}, the response is of type
--- {@link InlineCompletion InlineCompletion[]} or a Thenable that resolves to such.
--- @since 3.18.0
textDocument_inlineCompletion = 'textDocument/inlineCompletion',
--- A request to provide inline values in a document. The request's parameter is of
--- type {@link InlineValueParams}, the response is of type
--- {@link InlineValue InlineValue[]} or a Thenable that resolves to such.
--- @since 3.17.0
textDocument_inlineValue = 'textDocument/inlineValue',
--- A request to provide ranges that can be edited together.
--- @since 3.16.0
textDocument_linkedEditingRange = 'textDocument/linkedEditingRange',
--- A request to get the moniker of a symbol at a given text document position.
--- The request parameter is of type {@link TextDocumentPositionParams}.
--- The response is of type {@link Moniker Moniker[]} or `null`.
textDocument_moniker = 'textDocument/moniker',
--- A request to format a document on type.
textDocument_onTypeFormatting = 'textDocument/onTypeFormatting',
--- A request to result a `CallHierarchyItem` in a document at a given position.
--- Can be used as an input to an incoming or outgoing call hierarchy.
--- @since 3.16.0
textDocument_prepareCallHierarchy = 'textDocument/prepareCallHierarchy',
--- A request to test and perform the setup necessary for a rename.
--- @since 3.16 - support for default behavior
textDocument_prepareRename = 'textDocument/prepareRename',
--- A request to result a `TypeHierarchyItem` in a document at a given position.
--- Can be used as an input to a subtypes or supertypes type hierarchy.
--- @since 3.17.0
textDocument_prepareTypeHierarchy = 'textDocument/prepareTypeHierarchy',
--- A request to format a range in a document.
textDocument_rangeFormatting = 'textDocument/rangeFormatting',
--- A request to format ranges in a document.
--- @since 3.18.0
--- @proposed
textDocument_rangesFormatting = 'textDocument/rangesFormatting',
--- A request to format a document on type.
textDocument_onTypeFormatting = 'textDocument/onTypeFormatting',
--- A request to resolve project-wide references for the symbol denoted
--- by the given text document position. The request's parameter is of
--- type {@link ReferenceParams} the response is of type
--- {@link Location Location[]} or a Thenable that resolves to such.
textDocument_references = 'textDocument/references',
--- A request to rename a symbol.
textDocument_rename = 'textDocument/rename',
--- A request to test and perform the setup necessary for a rename.
--- @since 3.16 - support for default behavior
textDocument_prepareRename = 'textDocument/prepareRename',
--- The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders.
workspace_workspaceFolders = 'workspace/workspaceFolders',
--- A request to provide selection ranges in a document. The request's
--- parameter is of type {@link SelectionRangeParams}, the
--- response is of type {@link SelectionRange SelectionRange[]} or a Thenable
--- that resolves to such.
textDocument_selectionRange = 'textDocument/selectionRange',
--- @since 3.16.0
textDocument_semanticTokens_full = 'textDocument/semanticTokens/full',
--- @since 3.16.0
textDocument_semanticTokens_full_delta = 'textDocument/semanticTokens/full/delta',
--- @since 3.16.0
textDocument_semanticTokens_range = 'textDocument/semanticTokens/range',
textDocument_signatureHelp = 'textDocument/signatureHelp',
--- A request to resolve the type definition locations of a symbol at a given text
--- document position. The request's parameter is of type [TextDocumentPositionParams]
--- (#TextDocumentPositionParams) the response is of type {@link Definition} or a
--- Thenable that resolves to such.
textDocument_typeDefinition = 'textDocument/typeDefinition',
--- A document will save request is sent from the client to the server before
--- the document is actually saved. The request can return an array of TextEdits
--- which will be applied to the text document before it is saved. Please note that
--- clients might drop results if computing the text edits took too long or if a
--- server constantly fails on this request. This is done to keep the save fast and
--- reliable.
textDocument_willSaveWaitUntil = 'textDocument/willSaveWaitUntil',
--- A request to resolve the subtypes for a given `TypeHierarchyItem`.
--- @since 3.17.0
typeHierarchy_subtypes = 'typeHierarchy/subtypes',
--- A request to resolve the supertypes for a given `TypeHierarchyItem`.
--- @since 3.17.0
typeHierarchy_supertypes = 'typeHierarchy/supertypes',
--- A request to show a document. This request might open an
--- external program depending on the value of the URI to open.
--- For example a request to open `https://code.visualstudio.com/`
--- will very likely open the URI in a WEB browser.
--- @since 3.16.0
window_showDocument = 'window/showDocument',
--- The show message request is sent from the server to the client to show a message
--- and a set of options actions to the user.
window_showMessageRequest = 'window/showMessageRequest',
--- The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress
--- reporting from the server.
window_workDoneProgress_create = 'window/workDoneProgress/create',
--- A request to resolve the range inside the workspace
--- symbol's location.
--- @since 3.17.0
workspaceSymbol_resolve = 'workspaceSymbol/resolve',
--- A request sent from the server to the client to modified certain resources.
workspace_applyEdit = 'workspace/applyEdit',
--- A request to refresh all code actions
--- @since 3.16.0
workspace_codeLens_refresh = 'workspace/codeLens/refresh',
--- The 'workspace/configuration' request is sent from the server to the client to fetch a certain
--- configuration setting.
--- This pull model replaces the old push model were the client signaled configuration change via an
@@ -1092,33 +1142,21 @@ protocol.Methods = {
--- result of `workspace/configuration` requests) the server should register for an empty configuration
--- change event and empty the cache if such an event is received.
workspace_configuration = 'workspace/configuration',
--- @since 3.16.0
workspace_semanticTokens_refresh = 'workspace/semanticTokens/refresh',
--- The will create files request is sent from the client to the server before files are actually
--- created as long as the creation is triggered from within the client.
--- The request can return a `WorkspaceEdit` which will be applied to workspace before the
--- files are created. Hence the `WorkspaceEdit` can not manipulate the content of the file
--- to be created.
--- @since 3.16.0
workspace_willCreateFiles = 'workspace/willCreateFiles',
--- The will rename files request is sent from the client to the server before files are actually
--- renamed as long as the rename is triggered from within the client.
--- @since 3.16.0
workspace_willRenameFiles = 'workspace/willRenameFiles',
--- The did delete files notification is sent from the client to the server when
--- files were deleted from within the client.
--- @since 3.16.0
workspace_willDeleteFiles = 'workspace/willDeleteFiles',
--- @since 3.17.0
workspace_inlineValue_refresh = 'workspace/inlineValue/refresh',
--- @since 3.17.0
workspace_inlayHint_refresh = 'workspace/inlayHint/refresh',
--- The workspace diagnostic request definition.
--- @since 3.17.0
workspace_diagnostic = 'workspace/diagnostic',
--- The diagnostic refresh request definition.
--- @since 3.17.0
workspace_diagnostic_refresh = 'workspace/diagnostic/refresh',
--- A request send from the client to the server to execute a command. The request might return
--- a workspace edit which the client will apply to the workspace.
workspace_executeCommand = 'workspace/executeCommand',
--- @since 3.17.0
workspace_inlayHint_refresh = 'workspace/inlayHint/refresh',
--- @since 3.17.0
workspace_inlineValue_refresh = 'workspace/inlineValue/refresh',
--- @since 3.16.0
workspace_semanticTokens_refresh = 'workspace/semanticTokens/refresh',
--- A request to list project-wide symbols matching the query string given
--- by the {@link WorkspaceSymbolParams}. The response is
--- of type {@link SymbolInformation SymbolInformation[]} or a Thenable that
@@ -1127,61 +1165,23 @@ protocol.Methods = {
--- need to advertise support for WorkspaceSymbols via the client capability
--- `workspace.symbol.resolveSupport`.
workspace_symbol = 'workspace/symbol',
--- A request to refresh all code actions
--- The will create files request is sent from the client to the server before files are actually
--- created as long as the creation is triggered from within the client.
--- The request can return a `WorkspaceEdit` which will be applied to workspace before the
--- files are created. Hence the `WorkspaceEdit` can not manipulate the content of the file
--- to be created.
--- @since 3.16.0
workspace_codeLens_refresh = 'workspace/codeLens/refresh',
--- A request send from the client to the server to execute a command. The request might return
--- a workspace edit which the client will apply to the workspace.
workspace_executeCommand = 'workspace/executeCommand',
--- A request sent from the server to the client to modified certain resources.
workspace_applyEdit = 'workspace/applyEdit',
--- The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress
--- reporting from the server.
window_workDoneProgress_create = 'window/workDoneProgress/create',
--- A request to resolve the incoming calls for a given `CallHierarchyItem`.
workspace_willCreateFiles = 'workspace/willCreateFiles',
--- The did delete files notification is sent from the client to the server when
--- files were deleted from within the client.
--- @since 3.16.0
callHierarchy_incomingCalls = 'callHierarchy/incomingCalls',
--- A request to resolve the outgoing calls for a given `CallHierarchyItem`.
workspace_willDeleteFiles = 'workspace/willDeleteFiles',
--- The will rename files request is sent from the client to the server before files are actually
--- renamed as long as the rename is triggered from within the client.
--- @since 3.16.0
callHierarchy_outgoingCalls = 'callHierarchy/outgoingCalls',
--- A request to show a document. This request might open an
--- external program depending on the value of the URI to open.
--- For example a request to open `https://code.visualstudio.com/`
--- will very likely open the URI in a WEB browser.
--- @since 3.16.0
window_showDocument = 'window/showDocument',
--- A request to resolve the supertypes for a given `TypeHierarchyItem`.
--- @since 3.17.0
typeHierarchy_supertypes = 'typeHierarchy/supertypes',
--- A request to resolve the subtypes for a given `TypeHierarchyItem`.
--- @since 3.17.0
typeHierarchy_subtypes = 'typeHierarchy/subtypes',
--- A request to resolve additional properties for an inlay hint.
--- The request's parameter is of type {@link InlayHint}, the response is
--- of type {@link InlayHint} or a Thenable that resolves to such.
--- @since 3.17.0
inlayHint_resolve = 'inlayHint/resolve',
--- The show message request is sent from the server to the client to show a message
--- and a set of options actions to the user.
window_showMessageRequest = 'window/showMessageRequest',
--- Request to resolve additional information for a given completion item.The request's
--- parameter is of type {@link CompletionItem} the response
--- is of type {@link CompletionItem} or a Thenable that resolves to such.
completionItem_resolve = 'completionItem/resolve',
--- Request to resolve additional information for a given code action.The request's
--- parameter is of type {@link CodeAction} the response
--- is of type {@link CodeAction} or a Thenable that resolves to such.
codeAction_resolve = 'codeAction/resolve',
--- A request to resolve the range inside the workspace
--- symbol's location.
--- @since 3.17.0
workspaceSymbol_resolve = 'workspaceSymbol/resolve',
--- A request to resolve a command for a given code lens.
codeLens_resolve = 'codeLens/resolve',
--- Request to resolve additional information for a given document link. The request's
--- parameter is of type {@link DocumentLink} the response
--- is of type {@link DocumentLink} or a Thenable that resolves to such.
documentLink_resolve = 'documentLink/resolve',
workspace_willRenameFiles = 'workspace/willRenameFiles',
--- The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders.
workspace_workspaceFolders = 'workspace/workspaceFolders',
}
local function freeze(t)
return setmetatable({}, {