diff --git a/src/Client.fs b/src/Client.fs index c828e5c..3c60e89 100644 --- a/src/Client.fs +++ b/src/Client.fs @@ -42,7 +42,7 @@ type LspClient() = /// The telemetry notification is sent from the server to the client to ask the client to log /// a telemetry event. - abstract member TelemetryEvent: Newtonsoft.Json.Linq.JToken -> Async + abstract member TelemetryEvent: LSPAny -> Async default __.TelemetryEvent(_) = ignoreNotification @@ -81,7 +81,7 @@ type LspClient() = /// The request can fetch n configuration settings in one roundtrip. The order of the returned configuration /// settings correspond to the order of the passed ConfigurationItems (e.g. the first item in the response /// is the result for the first configuration item in the params). - abstract member WorkspaceConfiguration: ConfigurationParams -> AsyncLspResult + abstract member WorkspaceConfiguration: ConfigurationParams -> AsyncLspResult default __.WorkspaceConfiguration(_) = notImplemented @@ -172,7 +172,7 @@ type LspClient() = member this.WindowShowMessageRequest(p: ShowMessageRequestParams) = this.WindowShowMessageRequest(p) member this.WindowLogMessage(p: LogMessageParams) = this.WindowLogMessage(p) member this.WindowShowDocument(p: ShowDocumentParams) = this.WindowShowDocument(p) - member this.TelemetryEvent(p: Newtonsoft.Json.Linq.JToken) = this.TelemetryEvent(p) + member this.TelemetryEvent(p: LSPAny) = this.TelemetryEvent(p) member this.ClientRegisterCapability(p: RegistrationParams) = this.ClientRegisterCapability(p) member this.ClientUnregisterCapability(p: UnregistrationParams) = this.ClientUnregisterCapability(p) member this.WorkspaceWorkspaceFolders() = this.WorkspaceWorkspaceFolders() diff --git a/src/ClientServer.cg.fs b/src/ClientServer.cg.fs index e7e0f61..abb989b 100644 --- a/src/ClientServer.cg.fs +++ b/src/ClientServer.cg.fs @@ -4,586 +4,607 @@ open Ionide.LanguageServerProtocol.Types open Ionide.LanguageServerProtocol.JsonRpc type ILspServer = - inherit System.IDisposable - // Notifications - /// The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace - /// folder configuration changes. - abstract WorkspaceDidChangeWorkspaceFolders: DidChangeWorkspaceFoldersParams -> Async - /// The `window/workDoneProgress/cancel` notification is sent from the client to the server to cancel a progress - /// initiated on the server side. - abstract WindowWorkDoneProgressCancel: WorkDoneProgressCancelParams -> Async - /// The did create files notification is sent from the client to the server when - /// files were created from within the client. - /// - /// @since 3.16.0 - abstract WorkspaceDidCreateFiles: CreateFilesParams -> Async - /// The did rename files notification is sent from the client to the server when - /// files were renamed from within the client. - /// - /// @since 3.16.0 - abstract WorkspaceDidRenameFiles: RenameFilesParams -> Async - /// The will delete files request is sent from the client to the server before files are actually - /// deleted as long as the deletion is triggered from within the client. - /// - /// @since 3.16.0 - abstract WorkspaceDidDeleteFiles: DeleteFilesParams -> Async - /// A notification sent when a notebook opens. - /// - /// @since 3.17.0 - abstract NotebookDocumentDidOpen: DidOpenNotebookDocumentParams -> Async - abstract NotebookDocumentDidChange: DidChangeNotebookDocumentParams -> Async - /// A notification sent when a notebook document is saved. - /// - /// @since 3.17.0 - abstract NotebookDocumentDidSave: DidSaveNotebookDocumentParams -> Async - /// A notification sent when a notebook closes. - /// - /// @since 3.17.0 - abstract NotebookDocumentDidClose: DidCloseNotebookDocumentParams -> Async - /// The initialized notification is sent from the client to the - /// server after the client is fully initialized and the server - /// is allowed to send requests from the server to the client. - abstract Initialized: InitializedParams -> Async - /// The exit event is sent from the client to the server to - /// ask the server to exit its process. - abstract Exit: unit -> Async - /// The configuration change notification is sent from the client to the server - /// when the client's configuration has changed. The notification contains - /// the changed configuration as defined by the language client. - abstract WorkspaceDidChangeConfiguration: DidChangeConfigurationParams -> Async - /// The document open notification is sent from the client to the server to signal - /// newly opened text documents. The document's truth is now managed by the client - /// and the server must not try to read the document's truth using the document's - /// uri. Open in this sense means it is managed by the client. It doesn't necessarily - /// mean that its content is presented in an editor. An open notification must not - /// be sent more than once without a corresponding close notification send before. - /// This means open and close notification must be balanced and the max open count - /// is one. - abstract TextDocumentDidOpen: DidOpenTextDocumentParams -> Async - /// The document change notification is sent from the client to the server to signal - /// changes to a text document. - abstract TextDocumentDidChange: DidChangeTextDocumentParams -> Async - /// The document close notification is sent from the client to the server when - /// the document got closed in the client. The document's truth now exists where - /// the document's uri points to (e.g. if the document's uri is a file uri the - /// truth now exists on disk). As with the open notification the close notification - /// is about managing the document's content. Receiving a close notification - /// doesn't mean that the document was open in an editor before. A close - /// notification requires a previous open notification to be sent. - abstract TextDocumentDidClose: DidCloseTextDocumentParams -> Async - /// The document save notification is sent from the client to the server when - /// the document got saved in the client. - abstract TextDocumentDidSave: DidSaveTextDocumentParams -> Async - /// A document will save notification is sent from the client to the server before - /// the document is actually saved. - abstract TextDocumentWillSave: WillSaveTextDocumentParams -> Async - /// The watched files notification is sent from the client to the server when - /// the client detects changes to file watched by the language client. - abstract WorkspaceDidChangeWatchedFiles: DidChangeWatchedFilesParams -> Async - abstract SetTrace: SetTraceParams -> Async - abstract CancelRequest: CancelParams -> Async - abstract Progress: ProgressParams -> Async - // Requests - /// A request to resolve the implementation locations of a symbol at a given text - /// document position. The request's parameter is of type {@link TextDocumentPositionParams} - /// the response is of type {@link Definition} or a Thenable that resolves to such. - abstract TextDocumentImplementation: - ImplementationParams -> AsyncLspResult>>> + inherit System.IDisposable + // Notifications + /// The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace + /// folder configuration changes. + abstract WorkspaceDidChangeWorkspaceFolders: DidChangeWorkspaceFoldersParams -> Async + /// The `window/workDoneProgress/cancel` notification is sent from the client to the server to cancel a progress + /// initiated on the server side. + abstract WindowWorkDoneProgressCancel: WorkDoneProgressCancelParams -> Async + /// The did create files notification is sent from the client to the server when + /// files were created from within the client. + /// + /// @since 3.16.0 + abstract WorkspaceDidCreateFiles: CreateFilesParams -> Async + /// The did rename files notification is sent from the client to the server when + /// files were renamed from within the client. + /// + /// @since 3.16.0 + abstract WorkspaceDidRenameFiles: RenameFilesParams -> Async + /// The will delete files request is sent from the client to the server before files are actually + /// deleted as long as the deletion is triggered from within the client. + /// + /// @since 3.16.0 + abstract WorkspaceDidDeleteFiles: DeleteFilesParams -> Async + /// A notification sent when a notebook opens. + /// + /// @since 3.17.0 + abstract NotebookDocumentDidOpen: DidOpenNotebookDocumentParams -> Async + abstract NotebookDocumentDidChange: DidChangeNotebookDocumentParams -> Async + /// A notification sent when a notebook document is saved. + /// + /// @since 3.17.0 + abstract NotebookDocumentDidSave: DidSaveNotebookDocumentParams -> Async + /// A notification sent when a notebook closes. + /// + /// @since 3.17.0 + abstract NotebookDocumentDidClose: DidCloseNotebookDocumentParams -> Async + /// The initialized notification is sent from the client to the + /// server after the client is fully initialized and the server + /// is allowed to send requests from the server to the client. + abstract Initialized: InitializedParams -> Async + /// The exit event is sent from the client to the server to + /// ask the server to exit its process. + abstract Exit: unit -> Async + /// The configuration change notification is sent from the client to the server + /// when the client's configuration has changed. The notification contains + /// the changed configuration as defined by the language client. + abstract WorkspaceDidChangeConfiguration: DidChangeConfigurationParams -> Async + /// The document open notification is sent from the client to the server to signal + /// newly opened text documents. The document's truth is now managed by the client + /// and the server must not try to read the document's truth using the document's + /// uri. Open in this sense means it is managed by the client. It doesn't necessarily + /// mean that its content is presented in an editor. An open notification must not + /// be sent more than once without a corresponding close notification send before. + /// This means open and close notification must be balanced and the max open count + /// is one. + abstract TextDocumentDidOpen: DidOpenTextDocumentParams -> Async + /// The document change notification is sent from the client to the server to signal + /// changes to a text document. + abstract TextDocumentDidChange: DidChangeTextDocumentParams -> Async + /// The document close notification is sent from the client to the server when + /// the document got closed in the client. The document's truth now exists where + /// the document's uri points to (e.g. if the document's uri is a file uri the + /// truth now exists on disk). As with the open notification the close notification + /// is about managing the document's content. Receiving a close notification + /// doesn't mean that the document was open in an editor before. A close + /// notification requires a previous open notification to be sent. + abstract TextDocumentDidClose: DidCloseTextDocumentParams -> Async + /// The document save notification is sent from the client to the server when + /// the document got saved in the client. + abstract TextDocumentDidSave: DidSaveTextDocumentParams -> Async + /// A document will save notification is sent from the client to the server before + /// the document is actually saved. + abstract TextDocumentWillSave: WillSaveTextDocumentParams -> Async + /// The watched files notification is sent from the client to the server when + /// the client detects changes to file watched by the language client. + abstract WorkspaceDidChangeWatchedFiles: DidChangeWatchedFilesParams -> Async + abstract SetTrace: SetTraceParams -> Async + abstract CancelRequest: CancelParams -> Async + abstract Progress: ProgressParams -> Async + // Requests + /// A request to resolve the implementation locations of a symbol at a given text + /// document position. The request's parameter is of type {@link TextDocumentPositionParams} + /// the response is of type {@link Definition} or a Thenable that resolves to such. + abstract TextDocumentImplementation: + ImplementationParams -> AsyncLspResult>>> - /// A request to resolve the type definition locations of a symbol at a given text - /// document position. The request's parameter is of type {@link TextDocumentPositionParams} - /// the response is of type {@link Definition} or a Thenable that resolves to such. - abstract TextDocumentTypeDefinition: - TypeDefinitionParams -> AsyncLspResult>>> + /// A request to resolve the type definition locations of a symbol at a given text + /// document position. The request's parameter is of type {@link TextDocumentPositionParams} + /// the response is of type {@link Definition} or a Thenable that resolves to such. + abstract TextDocumentTypeDefinition: + TypeDefinitionParams -> AsyncLspResult>>> - /// 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. - abstract TextDocumentDocumentColor: DocumentColorParams -> AsyncLspResult> - /// 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. - abstract TextDocumentColorPresentation: ColorPresentationParams -> AsyncLspResult> - /// 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. - abstract TextDocumentFoldingRange: FoldingRangeParams -> AsyncLspResult>> - /// A request to resolve the type definition locations of a symbol at a given text - /// document position. The request's parameter is of type {@link TextDocumentPositionParams} - /// the response is of type {@link Declaration} or a typed array of {@link DeclarationLink} - /// or a Thenable that resolves to such. - abstract TextDocumentDeclaration: DeclarationParams -> AsyncLspResult>>> - /// 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. - abstract TextDocumentSelectionRange: SelectionRangeParams -> AsyncLspResult>> + /// 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. + abstract TextDocumentDocumentColor: DocumentColorParams -> AsyncLspResult> + /// 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. + abstract TextDocumentColorPresentation: ColorPresentationParams -> AsyncLspResult> + /// 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. + abstract TextDocumentFoldingRange: FoldingRangeParams -> AsyncLspResult>> - /// 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 - abstract TextDocumentPrepareCallHierarchy: - CallHierarchyPrepareParams -> AsyncLspResult>> + /// A request to resolve the type definition locations of a symbol at a given text + /// document position. The request's parameter is of type {@link TextDocumentPositionParams} + /// the response is of type {@link Declaration} or a typed array of {@link DeclarationLink} + /// or a Thenable that resolves to such. + abstract TextDocumentDeclaration: + DeclarationParams -> AsyncLspResult>>> - /// A request to resolve the incoming calls for a given `CallHierarchyItem`. - /// - /// @since 3.16.0 - abstract CallHierarchyIncomingCalls: - CallHierarchyIncomingCallsParams -> AsyncLspResult>> + /// 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. + abstract TextDocumentSelectionRange: SelectionRangeParams -> AsyncLspResult>> - /// A request to resolve the outgoing calls for a given `CallHierarchyItem`. - /// - /// @since 3.16.0 - abstract CallHierarchyOutgoingCalls: - CallHierarchyOutgoingCallsParams -> AsyncLspResult>> + /// 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 + abstract TextDocumentPrepareCallHierarchy: + CallHierarchyPrepareParams -> AsyncLspResult>> - /// @since 3.16.0 - abstract TextDocumentSemanticTokensFull: SemanticTokensParams -> AsyncLspResult> + /// A request to resolve the incoming calls for a given `CallHierarchyItem`. + /// + /// @since 3.16.0 + abstract CallHierarchyIncomingCalls: + CallHierarchyIncomingCallsParams -> AsyncLspResult>> - /// @since 3.16.0 - abstract TextDocumentSemanticTokensFullDelta: - SemanticTokensDeltaParams -> AsyncLspResult>> + /// A request to resolve the outgoing calls for a given `CallHierarchyItem`. + /// + /// @since 3.16.0 + abstract CallHierarchyOutgoingCalls: + CallHierarchyOutgoingCallsParams -> AsyncLspResult>> - /// @since 3.16.0 - abstract TextDocumentSemanticTokensRange: SemanticTokensRangeParams -> AsyncLspResult> - /// A request to provide ranges that can be edited together. - /// - /// @since 3.16.0 - abstract TextDocumentLinkedEditingRange: LinkedEditingRangeParams -> AsyncLspResult> - /// 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 - abstract WorkspaceWillCreateFiles: CreateFilesParams -> AsyncLspResult> - /// 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 - abstract WorkspaceWillRenameFiles: RenameFilesParams -> AsyncLspResult> - /// 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 - abstract WorkspaceWillDeleteFiles: DeleteFilesParams -> AsyncLspResult> - /// 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`. - abstract TextDocumentMoniker: MonikerParams -> AsyncLspResult>> + /// @since 3.16.0 + abstract TextDocumentSemanticTokensFull: SemanticTokensParams -> AsyncLspResult> - /// 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 - abstract TextDocumentPrepareTypeHierarchy: - TypeHierarchyPrepareParams -> AsyncLspResult>> + /// @since 3.16.0 + abstract TextDocumentSemanticTokensFullDelta: + SemanticTokensDeltaParams -> AsyncLspResult>> - /// A request to resolve the supertypes for a given `TypeHierarchyItem`. - /// - /// @since 3.17.0 - abstract TypeHierarchySupertypes: TypeHierarchySupertypesParams -> AsyncLspResult>> - /// A request to resolve the subtypes for a given `TypeHierarchyItem`. - /// - /// @since 3.17.0 - abstract TypeHierarchySubtypes: TypeHierarchySubtypesParams -> AsyncLspResult>> - /// 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 - abstract TextDocumentInlineValue: InlineValueParams -> AsyncLspResult>> - /// 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 - abstract TextDocumentInlayHint: InlayHintParams -> AsyncLspResult>> - /// 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 - abstract InlayHintResolve: InlayHint -> AsyncLspResult - /// The document diagnostic request definition. - /// - /// @since 3.17.0 - abstract TextDocumentDiagnostic: DocumentDiagnosticParams -> AsyncLspResult - /// The workspace diagnostic request definition. - /// - /// @since 3.17.0 - abstract WorkspaceDiagnostic: WorkspaceDiagnosticParams -> AsyncLspResult - /// 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. - abstract Initialize: InitializeParams -> AsyncLspResult - /// 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. - abstract Shutdown: unit -> AsyncLspResult - /// 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. - abstract TextDocumentWillSaveWaitUntil: WillSaveTextDocumentParams -> AsyncLspResult>> - /// 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} - /// or a Thenable that resolves to such. - /// - /// The request can delay the computation of the {@link CompletionItem.detail `detail`} - /// and {@link CompletionItem.documentation `documentation`} properties to the `completionItem/resolve` - /// request. However, properties that are needed for the initial sorting and filtering, like `sortText`, - /// `filterText`, `insertText`, and `textEdit`, must not be changed during resolve. - abstract TextDocumentCompletion: CompletionParams -> AsyncLspResult, CompletionList>>> - /// 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. - abstract CompletionItemResolve: CompletionItem -> AsyncLspResult - /// 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. - abstract TextDocumentHover: HoverParams -> AsyncLspResult> - abstract TextDocumentSignatureHelp: SignatureHelpParams -> AsyncLspResult> - /// A request to resolve the definition location of a symbol at a given text - /// document position. The request's parameter is of type {@link TextDocumentPosition} - /// the response is of either type {@link Definition} or a typed array of - /// {@link DefinitionLink} or a Thenable that resolves to such. - abstract TextDocumentDefinition: DefinitionParams -> AsyncLspResult>>> - /// 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. - abstract TextDocumentReferences: ReferenceParams -> AsyncLspResult>> - /// Request to resolve a {@link DocumentHighlight} for a given - /// text document position. The request's parameter is of type {@link TextDocumentPosition} - /// the request response is an array of type {@link DocumentHighlight} - /// or a Thenable that resolves to such. - abstract TextDocumentDocumentHighlight: DocumentHighlightParams -> AsyncLspResult>> + /// @since 3.16.0 + abstract TextDocumentSemanticTokensRange: SemanticTokensRangeParams -> AsyncLspResult> + /// A request to provide ranges that can be edited together. + /// + /// @since 3.16.0 + abstract TextDocumentLinkedEditingRange: LinkedEditingRangeParams -> AsyncLspResult> + /// 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 + abstract WorkspaceWillCreateFiles: CreateFilesParams -> AsyncLspResult> + /// 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 + abstract WorkspaceWillRenameFiles: RenameFilesParams -> AsyncLspResult> + /// 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 + abstract WorkspaceWillDeleteFiles: DeleteFilesParams -> AsyncLspResult> + /// 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`. + abstract TextDocumentMoniker: MonikerParams -> AsyncLspResult>> - /// 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. - abstract TextDocumentDocumentSymbol: - DocumentSymbolParams -> AsyncLspResult, array>>> + /// 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 + abstract TextDocumentPrepareTypeHierarchy: + TypeHierarchyPrepareParams -> AsyncLspResult>> - /// A request to provide commands for the given text document and range. - abstract TextDocumentCodeAction: CodeActionParams -> AsyncLspResult>>> - /// 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. - abstract CodeActionResolve: CodeAction -> AsyncLspResult + /// A request to resolve the supertypes for a given `TypeHierarchyItem`. + /// + /// @since 3.17.0 + abstract TypeHierarchySupertypes: TypeHierarchySupertypesParams -> AsyncLspResult>> + /// A request to resolve the subtypes for a given `TypeHierarchyItem`. + /// + /// @since 3.17.0 + abstract TypeHierarchySubtypes: TypeHierarchySubtypesParams -> AsyncLspResult>> + /// 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 + abstract TextDocumentInlineValue: InlineValueParams -> AsyncLspResult>> + /// 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 + abstract TextDocumentInlayHint: InlayHintParams -> AsyncLspResult>> + /// 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 + abstract InlayHintResolve: InlayHint -> AsyncLspResult + /// The document diagnostic request definition. + /// + /// @since 3.17.0 + abstract TextDocumentDiagnostic: DocumentDiagnosticParams -> AsyncLspResult + /// The workspace diagnostic request definition. + /// + /// @since 3.17.0 + abstract WorkspaceDiagnostic: WorkspaceDiagnosticParams -> AsyncLspResult + /// 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. + abstract Initialize: InitializeParams -> AsyncLspResult + /// 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. + abstract Shutdown: unit -> AsyncLspResult + /// 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. + abstract TextDocumentWillSaveWaitUntil: WillSaveTextDocumentParams -> AsyncLspResult>> - /// 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 - /// resolves to such. - /// - /// @since 3.17.0 - support for WorkspaceSymbol in the returned data. Clients - /// need to advertise support for WorkspaceSymbols via the client capability - /// `workspace.symbol.resolveSupport`. - abstract WorkspaceSymbol: - WorkspaceSymbolParams -> AsyncLspResult, array>>> + /// 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} + /// or a Thenable that resolves to such. + /// + /// The request can delay the computation of the {@link CompletionItem.detail `detail`} + /// and {@link CompletionItem.documentation `documentation`} properties to the `completionItem/resolve` + /// request. However, properties that are needed for the initial sorting and filtering, like `sortText`, + /// `filterText`, `insertText`, and `textEdit`, must not be changed during resolve. + abstract TextDocumentCompletion: + CompletionParams -> AsyncLspResult, CompletionList>>> - /// A request to resolve the range inside the workspace - /// symbol's location. - /// - /// @since 3.17.0 - abstract WorkspaceSymbolResolve: WorkspaceSymbol -> AsyncLspResult - /// A request to provide code lens for the given text document. - abstract TextDocumentCodeLens: CodeLensParams -> AsyncLspResult>> - /// A request to resolve a command for a given code lens. - abstract CodeLensResolve: CodeLens -> AsyncLspResult - /// A request to provide document links - abstract TextDocumentDocumentLink: DocumentLinkParams -> AsyncLspResult>> - /// 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. - abstract DocumentLinkResolve: DocumentLink -> AsyncLspResult - /// A request to format a whole document. - abstract TextDocumentFormatting: DocumentFormattingParams -> AsyncLspResult>> - /// A request to format a range in a document. - abstract TextDocumentRangeFormatting: DocumentRangeFormattingParams -> AsyncLspResult>> - /// A request to format a document on type. - abstract TextDocumentOnTypeFormatting: DocumentOnTypeFormattingParams -> AsyncLspResult>> - /// A request to rename a symbol. - abstract TextDocumentRename: RenameParams -> AsyncLspResult> - /// A request to test and perform the setup necessary for a rename. - /// - /// @since 3.16 - support for default behavior - abstract TextDocumentPrepareRename: PrepareRenameParams -> AsyncLspResult> - /// 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. - abstract WorkspaceExecuteCommand: ExecuteCommandParams -> AsyncLspResult> + /// 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. + abstract CompletionItemResolve: CompletionItem -> AsyncLspResult + /// 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. + abstract TextDocumentHover: HoverParams -> AsyncLspResult> + abstract TextDocumentSignatureHelp: SignatureHelpParams -> AsyncLspResult> + /// A request to resolve the definition location of a symbol at a given text + /// document position. The request's parameter is of type {@link TextDocumentPosition} + /// the response is of either type {@link Definition} or a typed array of + /// {@link DefinitionLink} or a Thenable that resolves to such. + abstract TextDocumentDefinition: DefinitionParams -> AsyncLspResult>>> + /// 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. + abstract TextDocumentReferences: ReferenceParams -> AsyncLspResult>> + /// Request to resolve a {@link DocumentHighlight} for a given + /// text document position. The request's parameter is of type {@link TextDocumentPosition} + /// the request response is an array of type {@link DocumentHighlight} + /// or a Thenable that resolves to such. + abstract TextDocumentDocumentHighlight: DocumentHighlightParams -> AsyncLspResult>> + + /// 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. + abstract TextDocumentDocumentSymbol: + DocumentSymbolParams -> AsyncLspResult, array>>> + + /// A request to provide commands for the given text document and range. + abstract TextDocumentCodeAction: CodeActionParams -> AsyncLspResult>>> + /// 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. + abstract CodeActionResolve: CodeAction -> AsyncLspResult + + /// 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 + /// resolves to such. + /// + /// @since 3.17.0 - support for WorkspaceSymbol in the returned data. Clients + /// need to advertise support for WorkspaceSymbols via the client capability + /// `workspace.symbol.resolveSupport`. + abstract WorkspaceSymbol: + WorkspaceSymbolParams -> AsyncLspResult, array>>> + + /// A request to resolve the range inside the workspace + /// symbol's location. + /// + /// @since 3.17.0 + abstract WorkspaceSymbolResolve: WorkspaceSymbol -> AsyncLspResult + /// A request to provide code lens for the given text document. + abstract TextDocumentCodeLens: CodeLensParams -> AsyncLspResult>> + /// A request to resolve a command for a given code lens. + abstract CodeLensResolve: CodeLens -> AsyncLspResult + /// A request to provide document links + abstract TextDocumentDocumentLink: DocumentLinkParams -> AsyncLspResult>> + /// 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. + abstract DocumentLinkResolve: DocumentLink -> AsyncLspResult + /// A request to format a whole document. + abstract TextDocumentFormatting: DocumentFormattingParams -> AsyncLspResult>> + /// A request to format a range in a document. + abstract TextDocumentRangeFormatting: DocumentRangeFormattingParams -> AsyncLspResult>> + /// A request to format a document on type. + abstract TextDocumentOnTypeFormatting: DocumentOnTypeFormattingParams -> AsyncLspResult>> + /// A request to rename a symbol. + abstract TextDocumentRename: RenameParams -> AsyncLspResult> + /// A request to test and perform the setup necessary for a rename. + /// + /// @since 3.16 - support for default behavior + abstract TextDocumentPrepareRename: PrepareRenameParams -> AsyncLspResult> + /// 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. + abstract WorkspaceExecuteCommand: ExecuteCommandParams -> AsyncLspResult> type ILspClient = - inherit System.IDisposable - // Notifications - /// The show message notification is sent from a server to a client to ask - /// the client to display a particular message in the user interface. - abstract WindowShowMessage: ShowMessageParams -> Async - /// The log message notification is sent from the server to the client to ask - /// the client to log a particular message. - abstract WindowLogMessage: LogMessageParams -> Async - /// The telemetry event notification is sent from the server to the client to ask - /// the client to log telemetry data. - abstract TelemetryEvent: LSPAny -> Async - /// Diagnostics notification are sent from the server to the client to signal - /// results of validation runs. - abstract TextDocumentPublishDiagnostics: PublishDiagnosticsParams -> Async - abstract LogTrace: LogTraceParams -> Async - abstract CancelRequest: CancelParams -> Async - abstract Progress: ProgressParams -> Async - // Requests - /// The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders. - abstract WorkspaceWorkspaceFolders: unit -> AsyncLspResult>> - /// 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 where the client signaled configuration change via an - /// event. If the server still needs to react to configuration changes (since the server caches the - /// 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. - abstract WorkspaceConfiguration: ConfigurationParams -> AsyncLspResult> - /// The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress - /// reporting from the server. - abstract WindowWorkDoneProgressCreate: WorkDoneProgressCreateParams -> AsyncLspResult - /// @since 3.16.0 - abstract WorkspaceSemanticTokensRefresh: unit -> AsyncLspResult - /// 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 - abstract WindowShowDocument: ShowDocumentParams -> AsyncLspResult - /// @since 3.17.0 - abstract WorkspaceInlineValueRefresh: unit -> AsyncLspResult - /// @since 3.17.0 - abstract WorkspaceInlayHintRefresh: unit -> AsyncLspResult - /// The diagnostic refresh request definition. - /// - /// @since 3.17.0 - abstract WorkspaceDiagnosticRefresh: unit -> AsyncLspResult - /// The `client/registerCapability` request is sent from the server to the client to register a new capability - /// handler on the client side. - abstract ClientRegisterCapability: RegistrationParams -> AsyncLspResult - /// The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability - /// handler on the client side. - abstract ClientUnregisterCapability: UnregistrationParams -> AsyncLspResult - /// 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. - abstract WindowShowMessageRequest: ShowMessageRequestParams -> AsyncLspResult> - /// A request to refresh all code actions - /// - /// @since 3.16.0 - abstract WorkspaceCodeLensRefresh: unit -> AsyncLspResult - /// A request sent from the server to the client to modified certain resources. - abstract WorkspaceApplyEdit: ApplyWorkspaceEditParams -> AsyncLspResult + inherit System.IDisposable + // Notifications + /// The show message notification is sent from a server to a client to ask + /// the client to display a particular message in the user interface. + abstract WindowShowMessage: ShowMessageParams -> Async + /// The log message notification is sent from the server to the client to ask + /// the client to log a particular message. + abstract WindowLogMessage: LogMessageParams -> Async + /// The telemetry event notification is sent from the server to the client to ask + /// the client to log telemetry data. + abstract TelemetryEvent: LSPAny -> Async + /// Diagnostics notification are sent from the server to the client to signal + /// results of validation runs. + abstract TextDocumentPublishDiagnostics: PublishDiagnosticsParams -> Async + abstract LogTrace: LogTraceParams -> Async + abstract CancelRequest: CancelParams -> Async + abstract Progress: ProgressParams -> Async + // Requests + /// The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders. + abstract WorkspaceWorkspaceFolders: unit -> AsyncLspResult>> + /// 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 where the client signaled configuration change via an + /// event. If the server still needs to react to configuration changes (since the server caches the + /// 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. + abstract WorkspaceConfiguration: ConfigurationParams -> AsyncLspResult> + /// The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress + /// reporting from the server. + abstract WindowWorkDoneProgressCreate: WorkDoneProgressCreateParams -> AsyncLspResult + /// @since 3.16.0 + abstract WorkspaceSemanticTokensRefresh: unit -> AsyncLspResult + /// 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 + abstract WindowShowDocument: ShowDocumentParams -> AsyncLspResult + /// @since 3.17.0 + abstract WorkspaceInlineValueRefresh: unit -> AsyncLspResult + /// @since 3.17.0 + abstract WorkspaceInlayHintRefresh: unit -> AsyncLspResult + /// The diagnostic refresh request definition. + /// + /// @since 3.17.0 + abstract WorkspaceDiagnosticRefresh: unit -> AsyncLspResult + /// The `client/registerCapability` request is sent from the server to the client to register a new capability + /// handler on the client side. + abstract ClientRegisterCapability: RegistrationParams -> AsyncLspResult + /// The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability + /// handler on the client side. + abstract ClientUnregisterCapability: UnregistrationParams -> AsyncLspResult + /// 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. + abstract WindowShowMessageRequest: ShowMessageRequestParams -> AsyncLspResult> + /// A request to refresh all code actions + /// + /// @since 3.16.0 + abstract WorkspaceCodeLensRefresh: unit -> AsyncLspResult + /// A request sent from the server to the client to modified certain resources. + abstract WorkspaceApplyEdit: ApplyWorkspaceEditParams -> AsyncLspResult module Mappings = - type ServerRequestHandling<'server when 'server :> ILspServer> = { Run: 'server -> System.Delegate } + type ServerRequestHandling<'server when 'server :> ILspServer> = { Run: 'server -> System.Delegate } - let routeMappings () = - let serverRequestHandling run = { - Run = - fun server -> - run server - |> JsonRpc.Requests.requestHandling - } + let routeMappings () = + let serverRequestHandling run = + { + Run = + fun server -> + run server + |> JsonRpc.Requests.requestHandling + } - [ - "textDocument/implementation", - serverRequestHandling (fun server request -> server.TextDocumentImplementation(request)) - "textDocument/typeDefinition", - serverRequestHandling (fun server request -> server.TextDocumentTypeDefinition(request)) - "textDocument/documentColor", - serverRequestHandling (fun server request -> server.TextDocumentDocumentColor(request)) - "textDocument/colorPresentation", - serverRequestHandling (fun server request -> server.TextDocumentColorPresentation(request)) - "textDocument/foldingRange", - serverRequestHandling (fun server request -> server.TextDocumentFoldingRange(request)) - "textDocument/declaration", serverRequestHandling (fun server request -> server.TextDocumentDeclaration(request)) - "textDocument/selectionRange", - serverRequestHandling (fun server request -> server.TextDocumentSelectionRange(request)) - "textDocument/prepareCallHierarchy", - serverRequestHandling (fun server request -> server.TextDocumentPrepareCallHierarchy(request)) - "callHierarchy/incomingCalls", - serverRequestHandling (fun server request -> server.CallHierarchyIncomingCalls(request)) - "callHierarchy/outgoingCalls", - serverRequestHandling (fun server request -> server.CallHierarchyOutgoingCalls(request)) - "textDocument/semanticTokens/full", - serverRequestHandling (fun server request -> server.TextDocumentSemanticTokensFull(request)) - "textDocument/semanticTokens/full/delta", - serverRequestHandling (fun server request -> server.TextDocumentSemanticTokensFullDelta(request)) - "textDocument/semanticTokens/range", - serverRequestHandling (fun server request -> server.TextDocumentSemanticTokensRange(request)) - "textDocument/linkedEditingRange", - serverRequestHandling (fun server request -> server.TextDocumentLinkedEditingRange(request)) - "workspace/willCreateFiles", - serverRequestHandling (fun server request -> server.WorkspaceWillCreateFiles(request)) - "workspace/willRenameFiles", - serverRequestHandling (fun server request -> server.WorkspaceWillRenameFiles(request)) - "workspace/willDeleteFiles", - serverRequestHandling (fun server request -> server.WorkspaceWillDeleteFiles(request)) - "textDocument/moniker", serverRequestHandling (fun server request -> server.TextDocumentMoniker(request)) - "textDocument/prepareTypeHierarchy", - serverRequestHandling (fun server request -> server.TextDocumentPrepareTypeHierarchy(request)) - "typeHierarchy/supertypes", serverRequestHandling (fun server request -> server.TypeHierarchySupertypes(request)) - "typeHierarchy/subtypes", serverRequestHandling (fun server request -> server.TypeHierarchySubtypes(request)) - "textDocument/inlineValue", serverRequestHandling (fun server request -> server.TextDocumentInlineValue(request)) - "textDocument/inlayHint", serverRequestHandling (fun server request -> server.TextDocumentInlayHint(request)) - "inlayHint/resolve", serverRequestHandling (fun server request -> server.InlayHintResolve(request)) - "textDocument/diagnostic", serverRequestHandling (fun server request -> server.TextDocumentDiagnostic(request)) - "workspace/diagnostic", serverRequestHandling (fun server request -> server.WorkspaceDiagnostic(request)) - "initialize", serverRequestHandling (fun server request -> server.Initialize(request)) - "shutdown", serverRequestHandling (fun server request -> server.Shutdown()) - "textDocument/willSaveWaitUntil", - serverRequestHandling (fun server request -> server.TextDocumentWillSaveWaitUntil(request)) - "textDocument/completion", serverRequestHandling (fun server request -> server.TextDocumentCompletion(request)) - "completionItem/resolve", serverRequestHandling (fun server request -> server.CompletionItemResolve(request)) - "textDocument/hover", serverRequestHandling (fun server request -> server.TextDocumentHover(request)) - "textDocument/signatureHelp", - serverRequestHandling (fun server request -> server.TextDocumentSignatureHelp(request)) - "textDocument/definition", serverRequestHandling (fun server request -> server.TextDocumentDefinition(request)) - "textDocument/references", serverRequestHandling (fun server request -> server.TextDocumentReferences(request)) - "textDocument/documentHighlight", - serverRequestHandling (fun server request -> server.TextDocumentDocumentHighlight(request)) - "textDocument/documentSymbol", - serverRequestHandling (fun server request -> server.TextDocumentDocumentSymbol(request)) - "textDocument/codeAction", serverRequestHandling (fun server request -> server.TextDocumentCodeAction(request)) - "codeAction/resolve", serverRequestHandling (fun server request -> server.CodeActionResolve(request)) - "workspace/symbol", serverRequestHandling (fun server request -> server.WorkspaceSymbol(request)) - "workspaceSymbol/resolve", serverRequestHandling (fun server request -> server.WorkspaceSymbolResolve(request)) - "textDocument/codeLens", serverRequestHandling (fun server request -> server.TextDocumentCodeLens(request)) - "codeLens/resolve", serverRequestHandling (fun server request -> server.CodeLensResolve(request)) - "textDocument/documentLink", - serverRequestHandling (fun server request -> server.TextDocumentDocumentLink(request)) - "documentLink/resolve", serverRequestHandling (fun server request -> server.DocumentLinkResolve(request)) - "textDocument/formatting", serverRequestHandling (fun server request -> server.TextDocumentFormatting(request)) - "textDocument/rangeFormatting", - serverRequestHandling (fun server request -> server.TextDocumentRangeFormatting(request)) - "textDocument/onTypeFormatting", - serverRequestHandling (fun server request -> server.TextDocumentOnTypeFormatting(request)) - "textDocument/rename", serverRequestHandling (fun server request -> server.TextDocumentRename(request)) - "textDocument/prepareRename", - serverRequestHandling (fun server request -> server.TextDocumentPrepareRename(request)) - "workspace/executeCommand", serverRequestHandling (fun server request -> server.WorkspaceExecuteCommand(request)) - "workspace/didChangeWorkspaceFolders", - serverRequestHandling (fun server request -> - server.WorkspaceDidChangeWorkspaceFolders(request) - |> Requests.notificationSuccess - ) - "window/workDoneProgress/cancel", - serverRequestHandling (fun server request -> - server.WindowWorkDoneProgressCancel(request) - |> Requests.notificationSuccess - ) - "workspace/didCreateFiles", - serverRequestHandling (fun server request -> - server.WorkspaceDidCreateFiles(request) - |> Requests.notificationSuccess - ) - "workspace/didRenameFiles", - serverRequestHandling (fun server request -> - server.WorkspaceDidRenameFiles(request) - |> Requests.notificationSuccess - ) - "workspace/didDeleteFiles", - serverRequestHandling (fun server request -> - server.WorkspaceDidDeleteFiles(request) - |> Requests.notificationSuccess - ) - "notebookDocument/didOpen", - serverRequestHandling (fun server request -> - server.NotebookDocumentDidOpen(request) - |> Requests.notificationSuccess - ) - "notebookDocument/didChange", - serverRequestHandling (fun server request -> - server.NotebookDocumentDidChange(request) - |> Requests.notificationSuccess - ) - "notebookDocument/didSave", - serverRequestHandling (fun server request -> - server.NotebookDocumentDidSave(request) - |> Requests.notificationSuccess - ) - "notebookDocument/didClose", - serverRequestHandling (fun server request -> - server.NotebookDocumentDidClose(request) - |> Requests.notificationSuccess - ) - "initialized", - serverRequestHandling (fun server request -> - server.Initialized(request) - |> Requests.notificationSuccess - ) - "exit", - serverRequestHandling (fun server request -> - server.Exit() - |> Requests.notificationSuccess - ) - "workspace/didChangeConfiguration", - serverRequestHandling (fun server request -> - server.WorkspaceDidChangeConfiguration(request) - |> Requests.notificationSuccess - ) - "textDocument/didOpen", - serverRequestHandling (fun server request -> - server.TextDocumentDidOpen(request) - |> Requests.notificationSuccess - ) - "textDocument/didChange", - serverRequestHandling (fun server request -> - server.TextDocumentDidChange(request) - |> Requests.notificationSuccess - ) - "textDocument/didClose", - serverRequestHandling (fun server request -> - server.TextDocumentDidClose(request) - |> Requests.notificationSuccess - ) - "textDocument/didSave", - serverRequestHandling (fun server request -> - server.TextDocumentDidSave(request) - |> Requests.notificationSuccess - ) - "textDocument/willSave", - serverRequestHandling (fun server request -> - server.TextDocumentWillSave(request) - |> Requests.notificationSuccess - ) - "workspace/didChangeWatchedFiles", - serverRequestHandling (fun server request -> - server.WorkspaceDidChangeWatchedFiles(request) - |> Requests.notificationSuccess - ) - "$/setTrace", - serverRequestHandling (fun server request -> - server.SetTrace(request) - |> Requests.notificationSuccess - ) - "$/cancelRequest", - serverRequestHandling (fun server request -> - server.CancelRequest(request) - |> Requests.notificationSuccess - ) - "$/progress", - serverRequestHandling (fun server request -> - server.Progress(request) - |> Requests.notificationSuccess - ) - ] \ No newline at end of file + [ + "textDocument/implementation", + serverRequestHandling (fun server request -> server.TextDocumentImplementation(request)) + "textDocument/typeDefinition", + serverRequestHandling (fun server request -> server.TextDocumentTypeDefinition(request)) + "textDocument/documentColor", + serverRequestHandling (fun server request -> server.TextDocumentDocumentColor(request)) + "textDocument/colorPresentation", + serverRequestHandling (fun server request -> server.TextDocumentColorPresentation(request)) + "textDocument/foldingRange", + serverRequestHandling (fun server request -> server.TextDocumentFoldingRange(request)) + "textDocument/declaration", + serverRequestHandling (fun server request -> server.TextDocumentDeclaration(request)) + "textDocument/selectionRange", + serverRequestHandling (fun server request -> server.TextDocumentSelectionRange(request)) + "textDocument/prepareCallHierarchy", + serverRequestHandling (fun server request -> server.TextDocumentPrepareCallHierarchy(request)) + "callHierarchy/incomingCalls", + serverRequestHandling (fun server request -> server.CallHierarchyIncomingCalls(request)) + "callHierarchy/outgoingCalls", + serverRequestHandling (fun server request -> server.CallHierarchyOutgoingCalls(request)) + "textDocument/semanticTokens/full", + serverRequestHandling (fun server request -> server.TextDocumentSemanticTokensFull(request)) + "textDocument/semanticTokens/full/delta", + serverRequestHandling (fun server request -> server.TextDocumentSemanticTokensFullDelta(request)) + "textDocument/semanticTokens/range", + serverRequestHandling (fun server request -> server.TextDocumentSemanticTokensRange(request)) + "textDocument/linkedEditingRange", + serverRequestHandling (fun server request -> server.TextDocumentLinkedEditingRange(request)) + "workspace/willCreateFiles", + serverRequestHandling (fun server request -> server.WorkspaceWillCreateFiles(request)) + "workspace/willRenameFiles", + serverRequestHandling (fun server request -> server.WorkspaceWillRenameFiles(request)) + "workspace/willDeleteFiles", + serverRequestHandling (fun server request -> server.WorkspaceWillDeleteFiles(request)) + "textDocument/moniker", serverRequestHandling (fun server request -> server.TextDocumentMoniker(request)) + "textDocument/prepareTypeHierarchy", + serverRequestHandling (fun server request -> server.TextDocumentPrepareTypeHierarchy(request)) + "typeHierarchy/supertypes", + serverRequestHandling (fun server request -> server.TypeHierarchySupertypes(request)) + "typeHierarchy/subtypes", + serverRequestHandling (fun server request -> server.TypeHierarchySubtypes(request)) + "textDocument/inlineValue", + serverRequestHandling (fun server request -> server.TextDocumentInlineValue(request)) + "textDocument/inlayHint", + serverRequestHandling (fun server request -> server.TextDocumentInlayHint(request)) + "inlayHint/resolve", serverRequestHandling (fun server request -> server.InlayHintResolve(request)) + "textDocument/diagnostic", + serverRequestHandling (fun server request -> server.TextDocumentDiagnostic(request)) + "workspace/diagnostic", serverRequestHandling (fun server request -> server.WorkspaceDiagnostic(request)) + "initialize", serverRequestHandling (fun server request -> server.Initialize(request)) + "shutdown", serverRequestHandling (fun server request -> server.Shutdown()) + "textDocument/willSaveWaitUntil", + serverRequestHandling (fun server request -> server.TextDocumentWillSaveWaitUntil(request)) + "textDocument/completion", + serverRequestHandling (fun server request -> server.TextDocumentCompletion(request)) + "completionItem/resolve", + serverRequestHandling (fun server request -> server.CompletionItemResolve(request)) + "textDocument/hover", serverRequestHandling (fun server request -> server.TextDocumentHover(request)) + "textDocument/signatureHelp", + serverRequestHandling (fun server request -> server.TextDocumentSignatureHelp(request)) + "textDocument/definition", + serverRequestHandling (fun server request -> server.TextDocumentDefinition(request)) + "textDocument/references", + serverRequestHandling (fun server request -> server.TextDocumentReferences(request)) + "textDocument/documentHighlight", + serverRequestHandling (fun server request -> server.TextDocumentDocumentHighlight(request)) + "textDocument/documentSymbol", + serverRequestHandling (fun server request -> server.TextDocumentDocumentSymbol(request)) + "textDocument/codeAction", + serverRequestHandling (fun server request -> server.TextDocumentCodeAction(request)) + "codeAction/resolve", serverRequestHandling (fun server request -> server.CodeActionResolve(request)) + "workspace/symbol", serverRequestHandling (fun server request -> server.WorkspaceSymbol(request)) + "workspaceSymbol/resolve", + serverRequestHandling (fun server request -> server.WorkspaceSymbolResolve(request)) + "textDocument/codeLens", serverRequestHandling (fun server request -> server.TextDocumentCodeLens(request)) + "codeLens/resolve", serverRequestHandling (fun server request -> server.CodeLensResolve(request)) + "textDocument/documentLink", + serverRequestHandling (fun server request -> server.TextDocumentDocumentLink(request)) + "documentLink/resolve", serverRequestHandling (fun server request -> server.DocumentLinkResolve(request)) + "textDocument/formatting", + serverRequestHandling (fun server request -> server.TextDocumentFormatting(request)) + "textDocument/rangeFormatting", + serverRequestHandling (fun server request -> server.TextDocumentRangeFormatting(request)) + "textDocument/onTypeFormatting", + serverRequestHandling (fun server request -> server.TextDocumentOnTypeFormatting(request)) + "textDocument/rename", serverRequestHandling (fun server request -> server.TextDocumentRename(request)) + "textDocument/prepareRename", + serverRequestHandling (fun server request -> server.TextDocumentPrepareRename(request)) + "workspace/executeCommand", + serverRequestHandling (fun server request -> server.WorkspaceExecuteCommand(request)) + "workspace/didChangeWorkspaceFolders", + serverRequestHandling (fun server request -> + server.WorkspaceDidChangeWorkspaceFolders(request) + |> Requests.notificationSuccess + ) + "window/workDoneProgress/cancel", + serverRequestHandling (fun server request -> + server.WindowWorkDoneProgressCancel(request) + |> Requests.notificationSuccess + ) + "workspace/didCreateFiles", + serverRequestHandling (fun server request -> + server.WorkspaceDidCreateFiles(request) + |> Requests.notificationSuccess + ) + "workspace/didRenameFiles", + serverRequestHandling (fun server request -> + server.WorkspaceDidRenameFiles(request) + |> Requests.notificationSuccess + ) + "workspace/didDeleteFiles", + serverRequestHandling (fun server request -> + server.WorkspaceDidDeleteFiles(request) + |> Requests.notificationSuccess + ) + "notebookDocument/didOpen", + serverRequestHandling (fun server request -> + server.NotebookDocumentDidOpen(request) + |> Requests.notificationSuccess + ) + "notebookDocument/didChange", + serverRequestHandling (fun server request -> + server.NotebookDocumentDidChange(request) + |> Requests.notificationSuccess + ) + "notebookDocument/didSave", + serverRequestHandling (fun server request -> + server.NotebookDocumentDidSave(request) + |> Requests.notificationSuccess + ) + "notebookDocument/didClose", + serverRequestHandling (fun server request -> + server.NotebookDocumentDidClose(request) + |> Requests.notificationSuccess + ) + "initialized", + serverRequestHandling (fun server request -> + server.Initialized(request) + |> Requests.notificationSuccess + ) + "exit", + serverRequestHandling (fun server request -> + server.Exit() + |> Requests.notificationSuccess + ) + "workspace/didChangeConfiguration", + serverRequestHandling (fun server request -> + server.WorkspaceDidChangeConfiguration(request) + |> Requests.notificationSuccess + ) + "textDocument/didOpen", + serverRequestHandling (fun server request -> + server.TextDocumentDidOpen(request) + |> Requests.notificationSuccess + ) + "textDocument/didChange", + serverRequestHandling (fun server request -> + server.TextDocumentDidChange(request) + |> Requests.notificationSuccess + ) + "textDocument/didClose", + serverRequestHandling (fun server request -> + server.TextDocumentDidClose(request) + |> Requests.notificationSuccess + ) + "textDocument/didSave", + serverRequestHandling (fun server request -> + server.TextDocumentDidSave(request) + |> Requests.notificationSuccess + ) + "textDocument/willSave", + serverRequestHandling (fun server request -> + server.TextDocumentWillSave(request) + |> Requests.notificationSuccess + ) + "workspace/didChangeWatchedFiles", + serverRequestHandling (fun server request -> + server.WorkspaceDidChangeWatchedFiles(request) + |> Requests.notificationSuccess + ) + "$/setTrace", + serverRequestHandling (fun server request -> + server.SetTrace(request) + |> Requests.notificationSuccess + ) + "$/cancelRequest", + serverRequestHandling (fun server request -> + server.CancelRequest(request) + |> Requests.notificationSuccess + ) + "$/progress", + serverRequestHandling (fun server request -> + server.Progress(request) + |> Requests.notificationSuccess + ) + ] \ No newline at end of file diff --git a/src/Ionide.LanguageServerProtocol.fsproj b/src/Ionide.LanguageServerProtocol.fsproj index 9b7c28d..b81b129 100644 --- a/src/Ionide.LanguageServerProtocol.fsproj +++ b/src/Ionide.LanguageServerProtocol.fsproj @@ -1,7 +1,7 @@  - netstandard2.0 + net10.0 true $(MSBuildThisFileDirectory)../CHANGELOG.md Library for implementing Language Server Protocol in F#. @@ -36,8 +36,7 @@ - - + diff --git a/src/JsonRpc.fs b/src/JsonRpc.fs index 7e73b88..4696ab1 100644 --- a/src/JsonRpc.fs +++ b/src/JsonRpc.fs @@ -1,10 +1,10 @@ module Ionide.LanguageServerProtocol.JsonRpc -open Newtonsoft.Json -open Newtonsoft.Json.Linq +open System.Text.Json +open System.Text.Json.Serialization type MessageTypeTest = { - [] + [] Version: string Id: int option Method: string option @@ -25,14 +25,14 @@ let getMessageType messageTest = | _ -> MessageType.Error type Request = { - [] + [] Version: string Id: int Method: string - Params: JToken option + Params: JsonElement option } with - static member Create(id: int, method': string, rpcParams: JToken option) = { + static member Create(id: int, method': string, rpcParams: JsonElement option) = { Version = "2.0" Id = id Method = method' @@ -40,13 +40,13 @@ type Request = { } type Notification = { - [] + [] Version: string Method: string - Params: JToken option + Params: JsonElement option } with - static member Create(method': string, rpcParams: JToken option) = { + static member Create(method': string, rpcParams: JsonElement option) = { Version = "2.0" Method = method' Params = rpcParams @@ -72,7 +72,7 @@ open Ionide.LanguageServerProtocol.Types type Error = { Code: int Message: string - Data: JToken option + Data: JsonElement option } with static member Create(code: int, message: string) = { Code = code; Message = message; Data = None } @@ -102,18 +102,14 @@ type Error = { Error.Create(int LSPErrorCodes.RequestCancelled, message) type Response = { - [] + [] Version: string Id: int option Error: Error option - [] - Result: JToken option + Result: JsonElement option } with - /// Json.NET conditional property serialization, controlled by naming convention - member x.ShouldSerializeResult() = x.Error.IsNone - - static member Success(id: int, result: JToken option) = { + static member Success(id: int, result: JsonElement option) = { Version = "2.0" Id = Some id Result = result @@ -122,6 +118,71 @@ type Response = { static member Failure(id: int, error: Error) = { Version = "2.0"; Id = Some id; Result = None; Error = Some error } +/// Custom STJ converter for Response: +/// - Always writes "result" (as null) when Error is None +/// - Omits "result" when Error is Some +type ResponseConverter() = + inherit JsonConverter() + + override _.Read(reader, _t, opts) = + // Parse manually to avoid infinite recursion + let mutable version = "" + let mutable id: int option = None + let mutable error: Error option = None + let mutable result: JsonElement option = None + + if reader.TokenType = JsonTokenType.StartObject then + while reader.Read() + && reader.TokenType + <> JsonTokenType.EndObject do + if reader.TokenType = JsonTokenType.PropertyName then + let propName = reader.GetString() + + reader.Read() + |> ignore + + match propName with + | "jsonrpc" -> version <- reader.GetString() + | "id" when + reader.TokenType + <> JsonTokenType.Null + -> + id <- Some(reader.GetInt32()) + | "error" when + reader.TokenType + <> JsonTokenType.Null + -> + error <- Some(JsonSerializer.Deserialize(&reader, opts)) + | "result" when + reader.TokenType + <> JsonTokenType.Null + -> + result <- Some(JsonSerializer.Deserialize(&reader, opts)) + | _ -> reader.Skip() + + { Version = version; Id = id; Error = error; Result = result } + + override _.Write(writer, value, opts) = + writer.WriteStartObject() + writer.WriteString("jsonrpc", value.Version) + + match value.Id with + | Some id -> writer.WriteNumber("id", id) + | None -> () + + match value.Error with + | Some err -> + writer.WritePropertyName("error") + JsonSerializer.Serialize(writer, err, opts) + | None -> + writer.WritePropertyName("result") + + match value.Result with + | Some je -> je.WriteTo(writer) + | None -> writer.WriteNullValue() + + writer.WriteEndObject() + /// Result type composed of a success value or an error of type JsonRpc.Error type LspResult<'t> = Result<'t, Error> @@ -180,6 +241,7 @@ module Requests = rpcException.ErrorData <- error.Data + |> Option.map (fun je -> je :> obj) |> Option.defaultValue null raise rpcException diff --git a/src/JsonUtils.fs b/src/JsonUtils.fs index 8e1d182..dc2ff40 100644 --- a/src/JsonUtils.fs +++ b/src/JsonUtils.fs @@ -1,142 +1,27 @@ namespace Ionide.LanguageServerProtocol.JsonUtils open Microsoft.FSharp.Reflection -open Newtonsoft.Json open System -open System.Collections.Concurrent -open Ionide.LanguageServerProtocol.Types -open Newtonsoft.Json.Linq -open Newtonsoft.Json.Serialization +open System.Text.Json +open System.Text.Json.Serialization open System.Reflection +open Ionide.LanguageServerProtocol.Types open Converters -/// Handles fields of type `Option`: -/// * Allows missing json properties when `Option` -> Optional -/// * Fails when missing json property when not `Option` -> Required -/// * Additional properties in json are always ignored -/// -/// Example: -/// ```fsharp -/// type Data = { Name: string; Value: int option } -/// ``` -/// ```json -/// { "name": "foo", "value": 42 } // ok -/// { "name": "foo" } // ok -/// { "value": 42 } // error -/// {} // error -/// { "name": "foo", "data": "bar" } // ok -/// ``` -[] -type OptionAndCamelCasePropertyNamesContractResolver() as this = - inherit CamelCasePropertyNamesContractResolver() - - do this.NamingStrategy.ProcessDictionaryKeys <- false - - let isOptionType (ty: Type) = - ty.IsGenericType - && ty.GetGenericTypeDefinition() = typedefof> - - override _.CreateProperty(memberInfo, memberSerialization) = - // mutable properties in records have their corresponding field deserialized too - // field has postfix `@` - // -> exclude everything ending in `@` (-> ~ private fields) - if memberInfo.Name.EndsWith "@" then - null - else - let prop = ``base``.CreateProperty(memberInfo, memberSerialization) - - let shouldUpdateRequired = - // change nothing when specified: - // * `JsonProperty.Required` - // * Don't know if specified -> compare with `Default` - match memberInfo.GetCustomAttribute() with - | null -> true - | jp -> jp.Required = Required.Default - - if shouldUpdateRequired then - if Type.isOption prop.PropertyType then - prop.Required <- Required.Default - else - prop.Required <- Required.Always - - prop - - -/// Newtonsoft.Json parses parses a number inside quotations as number too: -/// `"42"` -> can be parsed to `42: int` -/// This converter prevents that. `"42"` cannot be parsed to `int` (or `float`) any more -[] -type StrictNumberConverter() = - inherit JsonConverter() - - static let defaultSerializer = JsonSerializer() - - override _.CanConvert(t) = - t - |> Type.isNumeric - - override __.ReadJson(reader, t, _, serializer) = - match reader.TokenType with - | JsonToken.Integer - | JsonToken.Float -> - // cannot use `serializer`: Endless recursion into StrictNumberConverter for same value - defaultSerializer.Deserialize(reader, t) - | _ -> failwith $"Expected a number, but was {reader.TokenType}" - - override _.CanWrite = false - override _.WriteJson(_, _, _) = raise (NotImplementedException()) - -/// Like `StrictNumberConverter`, but prevents numbers to be parsed as string: -/// `42` -> no quotation marks -> not a string -[] -type StrictStringConverter() = - inherit JsonConverter() - - override _.CanConvert(t) = - t - |> Type.isString - - override __.ReadJson(reader, t, _, serializer) = - match reader.TokenType with - | JsonToken.String -> reader.Value - | JsonToken.Null -> null - | _ -> failwith $"Expected a string, but was {reader.TokenType}" - - override _.CanWrite = false - override _.WriteJson(_, _, _) = raise (NotImplementedException()) - -/// Like `StrictNumberConverter`, but prevents boolean to be parsed as string: -/// `true` -> no quotation marks -> not a string -[] -type StrictBoolConverter() = - inherit JsonConverter() - - override _.CanConvert(t) = - t - |> Type.isBool - - override __.ReadJson(reader, t, _, serializer) = - match reader.TokenType with - | JsonToken.Boolean -> reader.Value - | _ -> failwith $"Expected a bool, but was {reader.TokenType}" - - override _.CanWrite = false - override _.WriteJson(_, _, _) = raise (NotImplementedException()) - +/// Newtonsoft ErasedUnionConverter kept for the legacy Client module in LanguageServerProtocol.fs. +/// Do not use in new code — prefer ErasedUnionConverterFactory (STJ). [] type ErasedUnionConverter() = - inherit JsonConverter() + inherit Newtonsoft.Json.JsonConverter() let canConvert = - memoriseByHash (fun t -> + memorise (fun t -> FSharpType.IsUnion t - && ( - // Union - t.GetCustomAttributes(typedefof, false).Length > 0 - || - // Case - t.BaseType.GetCustomAttributes(typedefof, false).Length > 0) + && (t.GetCustomAttributes(typedefof, false).Length > 0 + || t.BaseType + <> null + && t.BaseType.GetCustomAttributes(typedefof, false).Length > 0) ) override __.CanConvert(t) = canConvert t @@ -144,65 +29,41 @@ type ErasedUnionConverter() = override __.WriteJson(writer, value, serializer) = let union = UnionInfo.get (value.GetType()) let case = union.GetCaseOf value - // Must be exactly 1 field - // Deliberately fail here to signal incorrect usage - // (vs. `CanConvert` = `false` -> silent and fallback to serialization with `case` & `fields`) + match case.GetFieldValues value with - | [| value |] -> serializer.Serialize(writer, value) + | [| v |] -> serializer.Serialize(writer, v) | values -> failwith $"Expected exactly one field for case `{value.GetType().Name}`, but were {values.Length}" - override __.ReadJson(reader: JsonReader, t, _existingValue, serializer) = - let tryReadPrimitive (json: JToken) (targetType: Type) = + override __.ReadJson(reader, t, _existingValue, serializer) = + let json = Newtonsoft.Json.Linq.JToken.ReadFrom reader + + let tryReadPrimitive (json: Newtonsoft.Json.Linq.JToken) (targetType: Type) = if Type.isString targetType then - if json.Type = JTokenType.String then + if json.Type = Newtonsoft.Json.Linq.JTokenType.String then reader.Value |> Some else None elif Type.isBool targetType then - if json.Type = JTokenType.Boolean then + if json.Type = Newtonsoft.Json.Linq.JTokenType.Boolean then reader.Value |> Some else None elif Type.isNumeric targetType then match json.Type with - | JTokenType.Integer - | JTokenType.Float -> + | Newtonsoft.Json.Linq.JTokenType.Integer + | Newtonsoft.Json.Linq.JTokenType.Float -> json.ToObject(targetType, serializer) |> Some | _ -> None else None - let tryReadUnionKind (json: JToken) (targetType: Type) = - try - let fields = json.Children() - let props = targetType.GetProperties() - - match - fields - |> Seq.tryFind (fun f -> f.Name.ToLowerInvariant() = "kind"), - props - |> Seq.tryFind (fun p -> p.Name.ToLowerInvariant() = "kind") - with - | Some f, Some p -> - match - p.GetCustomAttribute(typeof) - |> Option.ofObj - with - | Some(:? UnionKindAttribute as k) when k.Value = string f.Value -> - json.ToObject(targetType, serializer) - |> Some - | _ -> None - | _ -> None - with _ -> - None - - let tryReadAllMatchingFields (json: JToken) (targetType: Type) = + let tryReadAllMatchingFields (json: Newtonsoft.Json.Linq.JToken) (targetType: Type) = try let fields = - json.Children() + json.Children() |> Seq.map (fun f -> f.Name.ToLowerInvariant()) let props = @@ -224,14 +85,11 @@ type ErasedUnionConverter() = None let union = UnionInfo.get t - let json = JToken.ReadFrom reader - let tryMakeUnionCase tryReadValue (json: JToken) (case: CaseInfo) = + let tryMakeUnionCase tryReadValue (json: Newtonsoft.Json.Linq.JToken) (case: CaseInfo) = match case.Fields with | [| field |] -> - let ty = field.PropertyType - - match tryReadValue json ty with + match tryReadValue json field.PropertyType with | None -> None | Some value -> case.Create [| value |] @@ -243,10 +101,6 @@ type ErasedUnionConverter() = let c = union.Cases |> Array.tryPick (tryMakeUnionCase tryReadPrimitive json) - |> Option.orElseWith (fun () -> - union.Cases - |> Array.tryPick (tryMakeUnionCase tryReadUnionKind json) - ) |> Option.orElseWith (fun () -> union.Cases |> Array.tryPick (tryMakeUnionCase tryReadAllMatchingFields json) @@ -256,28 +110,111 @@ type ErasedUnionConverter() = | None -> failwith $"Could not create an instance of the type '%s{t.Name}'" | Some c -> c -/// converter that can convert enum-style DUs -[] -type SingleCaseUnionConverter() = - inherit JsonConverter() - let canConvert = - let allCases (t: System.Type) = FSharpType.GetUnionCases t +/// STJ JsonConverter for .NET enum types whose cases carry [] attributes. +/// These LSP enums are serialized as strings (e.g. ResourceOperationKind: "create"/"rename"/"delete"), +/// not as integers. Reads case-insensitively against the EnumMember Value; writes the Value string. +type EnumMemberConverter<'T when 'T: struct and 'T :> Enum and 'T: equality>(options: JsonSerializerOptions) = + inherit JsonConverter<'T>() - memoriseByHash (fun t -> - FSharpType.IsUnion t - && allCases t - |> Array.forall (fun c -> c.GetFields().Length = 0) + // Build a bidirectional map between the string Value and the enum case. + let enumType = typeof<'T> + + let valueToEnum: System.Collections.Generic.Dictionary = + let d = System.Collections.Generic.Dictionary(StringComparer.OrdinalIgnoreCase) + + for case in Enum.GetValues(enumType) :?> 'T[] do + let field = enumType.GetField(string case) + + let attr = + field.GetCustomAttribute(typeof) + :?> System.Runtime.Serialization.EnumMemberAttribute + + let key = + if + attr + <> null + && attr.Value + <> null + then + attr.Value + else + string case + + d.[key] <- case + + d + + let enumToValue: System.Collections.Generic.Dictionary<'T, string> = + let d = System.Collections.Generic.Dictionary<'T, string>() + + for case in Enum.GetValues(enumType) :?> 'T[] do + let field = enumType.GetField(string case) + + let attr = + field.GetCustomAttribute(typeof) + :?> System.Runtime.Serialization.EnumMemberAttribute + + let value = + if + attr + <> null + && attr.Value + <> null + then + attr.Value + else + string case + + d.[case] <- value + + d + + override _.Read(reader, _t, _opts) = + let s = reader.GetString() + + match valueToEnum.TryGetValue(s) with + | true, v -> v + | _ -> failwith $"Could not convert string '{s}' to enum type '{enumType.Name}'" + + override _.Write(writer, value, _opts) = + match enumToValue.TryGetValue(value) with + | true, s -> writer.WriteStringValue(s) + | _ -> writer.WriteStringValue(string value) + +/// STJ JsonConverterFactory that creates EnumMemberConverter<'T> for any .NET enum type +/// where at least one case carries a [] attribute (i.e. string-valued LSP enums). +[] +type EnumMemberConverterFactory() = + inherit JsonConverterFactory() + + let hasEnumMemberAttr = + memorise (fun (t: Type) -> + t.IsEnum + && t.GetFields( + BindingFlags.Public + ||| BindingFlags.Static + ) + |> Array.exists (fun f -> + f.GetCustomAttribute(typeof) + <> null + ) ) - override _.CanConvert t = canConvert t + override _.CanConvert(t) = hasEnumMemberAttr t + + override _.CreateConverter(t, opts) = + let converterType = typedefof>.GetGenericTypeDefinition().MakeGenericType(t) + Activator.CreateInstance(converterType, opts) :?> System.Text.Json.Serialization.JsonConverter - override _.WriteJson(writer: Newtonsoft.Json.JsonWriter, value: obj, serializer: Newtonsoft.Json.JsonSerializer) = - serializer.Serialize(writer, string value) - override _.ReadJson(reader: Newtonsoft.Json.JsonReader, t, _existingValue, serializer) = - let caseName = string reader.Value +/// STJ JsonConverter for F# single-case (enum-style) discriminated unions. +/// Writes the union case name as a string; reads by case-insensitive name match. +type SingleCaseUnionConverter<'T>(options: JsonSerializerOptions) = + inherit JsonConverter<'T>() + override _.Read(reader, t, _opts) = + let caseName = reader.GetString() let union = UnionInfo.get t let case = @@ -285,5 +222,289 @@ type SingleCaseUnionConverter() = |> Array.tryFind (fun c -> c.Info.Name.Equals(caseName, StringComparison.OrdinalIgnoreCase)) match case with - | Some case -> case.Create [||] - | None -> failwith $"Could not create an instance of the type '%s{t.Name}' with the name '%s{caseName}'" \ No newline at end of file + | Some case -> case.Create [||] :?> 'T + | None -> failwith $"Could not create an instance of the type '%s{t.Name}' with the name '%s{caseName}'" + + override _.Write(writer, value, _opts) = writer.WriteStringValue(string (box value)) + +/// STJ JsonConverterFactory that creates SingleCaseUnionConverter<'T> for zero-field F# union types. +[] +type SingleCaseUnionConverterFactory() = + inherit JsonConverterFactory() + + let canConvert = + memorise (fun t -> + FSharpType.IsUnion t + && FSharpType.GetUnionCases t + |> Array.forall (fun c -> c.GetFields().Length = 0) + ) + + override _.CanConvert(t) = canConvert t + + override _.CreateConverter(t, opts) = + let converterType = typedefof>.MakeGenericType(t) + Activator.CreateInstance(converterType, opts) :?> System.Text.Json.Serialization.JsonConverter + + +/// STJ JsonConverter for erased-union F# types (U2, U3, U4, and types marked []). +/// Reads by trying each union case in order: primitives first, then UnionKind, then field-subset. +/// Writes by unwrapping the single field value and serializing it. +type ErasedUnionConverter<'T>(options: JsonSerializerOptions) = + inherit JsonConverter<'T>() + + override _.Read(reader, t, opts) = + // Capture the token upfront — Utf8JsonReader is forward-only and can't be rewound. + use doc = JsonDocument.ParseValue(&reader) + let json = doc.RootElement.Clone() + + let union = UnionInfo.get t + + let tryReadPrimitive (json: JsonElement) (targetType: Type) = + if Type.isString targetType then + if json.ValueKind = JsonValueKind.String then + json.GetString() :> obj + |> Some + else + None + elif Type.isBool targetType then + if json.ValueKind = JsonValueKind.True then + (true :> obj) + |> Some + elif json.ValueKind = JsonValueKind.False then + (false :> obj) + |> Some + else + None + elif Type.isNumeric targetType then + match json.ValueKind with + | JsonValueKind.Number -> + try + JsonSerializer.Deserialize(json, targetType, opts) + |> Some + with :? JsonException -> + None + | _ -> None + else + None + + let tryReadUnionKind (json: JsonElement) (targetType: Type) = + try + if + json.ValueKind + <> JsonValueKind.Object + then + None + else + let props = targetType.GetProperties() + + let kindField = + match json.TryGetProperty("kind") with + | true, v -> Some v + | _ -> + // case-insensitive search + json.EnumerateObject() + |> Seq.tryFind (fun p -> p.Name.Equals("kind", StringComparison.OrdinalIgnoreCase)) + |> Option.map (fun p -> p.Value) + + let kindProp = + props + |> Seq.tryFind (fun p -> p.Name.Equals("kind", StringComparison.OrdinalIgnoreCase)) + + match kindField, kindProp with + | Some f, Some p -> + match + p.GetCustomAttribute(typeof) + |> Option.ofObj + with + | Some(:? UnionKindAttribute as k) when + f.ValueKind = JsonValueKind.String + && k.Value = f.GetString() + -> + JsonSerializer.Deserialize(json, targetType, opts) + |> Some + | _ -> None + | _ -> None + with :? JsonException -> + None + + let tryReadArray (json: JsonElement) (targetType: Type) = + try + if + json.ValueKind + <> JsonValueKind.Array + then + None + elif targetType.IsArray then + // For plain array types, guard against false positives by checking that every + // field in the first JSON element is a known property of the element type. + // Without this, e.g. DocumentSymbol[] elements would silently deserialize as + // SymbolInformation[] because STJ ignores unknown properties by default, and + // SymbolInformation appears first in the union case ordering. + let elemType = targetType.GetElementType() + + let firstElemOk = + match + json.EnumerateArray() + |> Seq.tryHead + with + | None -> true // empty array — always valid + | Some firstElem -> + if + firstElem.ValueKind + <> JsonValueKind.Object + then + true // primitive/bool/number elements — no field check needed + else + let propNames = + elemType.GetProperties() + |> Seq.map (fun p -> p.Name.ToLowerInvariant()) + |> Set.ofSeq + + firstElem.EnumerateObject() + |> Seq.forall (fun p -> + propNames + |> Set.contains (p.Name.ToLowerInvariant()) + ) + + if firstElemOk then + JsonSerializer.Deserialize(json, targetType, opts) + |> Some + else + None + else + // For erased-union types that wrap an array (e.g. Definition = U2), + // delegate to the recursive ErasedUnionConverter — it will handle nested dispatch. + JsonSerializer.Deserialize(json, targetType, opts) + |> Some + with :? JsonException -> + None + + // Exact match: every JSON field maps to a type property AND every type property + // appears in the JSON. This wins over the subset check below so that, e.g., + // U2<{range;rangeLength;text}, {text}> correctly picks the second case for + // JSON {"text":""} instead of the first. + let tryReadExactMatchingFields (json: JsonElement) (targetType: Type) = + try + if + json.ValueKind + <> JsonValueKind.Object + then + None + else + let fieldNames = + json.EnumerateObject() + |> Seq.map (fun p -> p.Name.ToLowerInvariant()) + |> Set.ofSeq + + let propNames = + targetType.GetProperties() + |> Seq.map (fun p -> p.Name.ToLowerInvariant()) + |> Set.ofSeq + + if fieldNames = propNames then + JsonSerializer.Deserialize(json, targetType, opts) + |> Some + else + None + with :? JsonException -> + None + + // Subset match: every JSON field maps to a type property (type may have more). + let tryReadAllMatchingFields (json: JsonElement) (targetType: Type) = + try + if + json.ValueKind + <> JsonValueKind.Object + then + None + else + let fieldNames = + json.EnumerateObject() + |> Seq.map (fun p -> p.Name.ToLowerInvariant()) + |> Set.ofSeq + + let propNames = + targetType.GetProperties() + |> Seq.map (fun p -> p.Name.ToLowerInvariant()) + |> Set.ofSeq + + if + fieldNames + |> Set.forall (fun f -> + propNames + |> Set.contains f + ) + then + JsonSerializer.Deserialize(json, targetType, opts) + |> Some + else + None + with :? JsonException -> + None + + let tryMakeUnionCase tryReadValue (json: JsonElement) (case: CaseInfo) = + match case.Fields with + | [| field |] -> + let ty = field.PropertyType + + match tryReadValue json ty with + | None -> None + | Some value -> + case.Create [| value |] + |> Some + | fields -> + failwith + $"Expected union {case.Info.DeclaringType.Name} to have exactly one field in each case, but case {case.Info.Name} has {fields.Length} fields" + + let c = + union.Cases + |> Array.tryPick (tryMakeUnionCase tryReadPrimitive json) + |> Option.orElseWith (fun () -> + union.Cases + |> Array.tryPick (tryMakeUnionCase tryReadUnionKind json) + ) + |> Option.orElseWith (fun () -> + union.Cases + |> Array.tryPick (tryMakeUnionCase tryReadArray json) + ) + |> Option.orElseWith (fun () -> + union.Cases + |> Array.tryPick (tryMakeUnionCase tryReadExactMatchingFields json) + ) + |> Option.orElseWith (fun () -> + union.Cases + |> Array.tryPick (tryMakeUnionCase tryReadAllMatchingFields json) + ) + + match c with + | None -> failwith $"Could not create an instance of the type '%s{t.Name}'" + | Some c -> c :?> 'T + + override _.Write(writer, value, opts) = + let union = UnionInfo.get (value.GetType()) + let case = union.GetCaseOf(value :> obj) + + match case.GetFieldValues(value :> obj) with + | [| v |] -> JsonSerializer.Serialize(writer, v, opts) + | values -> + failwith $"Expected exactly one field for case `{(value :> obj).GetType().Name}`, but were {values.Length}" + +/// STJ JsonConverterFactory that creates ErasedUnionConverter<'T> for erased union types. +[] +type ErasedUnionConverterFactory() = + inherit JsonConverterFactory() + + let canConvert = + memorise (fun t -> + FSharpType.IsUnion t + && (t.GetCustomAttributes(typedefof, false).Length > 0 + || t.BaseType + <> null + && t.BaseType.GetCustomAttributes(typedefof, false).Length > 0) + ) + + override _.CanConvert(t) = canConvert t + + override _.CreateConverter(t, opts) = + let converterType = typedefof>.MakeGenericType(t) + Activator.CreateInstance(converterType, opts) :?> System.Text.Json.Serialization.JsonConverter \ No newline at end of file diff --git a/src/LanguageServerProtocol.fs b/src/LanguageServerProtocol.fs index fdfb11e..d904b4d 100644 --- a/src/LanguageServerProtocol.fs +++ b/src/LanguageServerProtocol.fs @@ -19,50 +19,126 @@ module Server = let logger = LogProvider.getLoggerByName "LSP Server" + /// STJ JsonSerializerOptions configured with all LSP converters. + let lspSerializerOptions = + let opts = + System.Text.Json.JsonSerializerOptions( + DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull, + PropertyNamingPolicy = System.Text.Json.JsonNamingPolicy.CamelCase + ) + + opts.Converters.Add(UnitConverterFactory()) + opts.Converters.Add(FSharpOptionConverterFactory()) + opts.Converters.Add(EnumMemberConverterFactory()) + opts.Converters.Add(ErasedUnionConverterFactory()) + opts.Converters.Add(SingleCaseUnionConverterFactory()) + opts.Converters.Add(Ionide.LanguageServerProtocol.JsonRpc.ResponseConverter()) + opts + + let deserialize<'t> (element: System.Text.Json.JsonElement) : 't = + System.Text.Json.JsonSerializer.Deserialize<'t>(element, lspSerializerOptions) + + let serialize<'t> (o: 't) : System.Text.Json.JsonElement = + System.Text.Json.JsonSerializer.SerializeToElement(o, lspSerializerOptions) + + // Internal bridge helpers — used only by JsonElementConverter below. + let internal jeToJToken (je: System.Text.Json.JsonElement) : JToken = JToken.Parse(je.GetRawText()) + + let internal jtokenToJe (token: JToken) : System.Text.Json.JsonElement = + use doc = System.Text.Json.JsonDocument.Parse(token.ToString(Formatting.None)) + doc.RootElement.Clone() + + /// Newtonsoft converter that lets StreamJsonRpc round-trip JsonElement and LSPAny fields + /// through its existing Newtonsoft pipeline. + type JsonElementConverter() = + inherit JsonConverter() + + override _.CanConvert(t) = + t = typeof + || t = typeof + + override _.WriteJson(writer: Newtonsoft.Json.JsonWriter, value: obj, _serializer: JsonSerializer) = + match value with + | :? Ionide.LanguageServerProtocol.Types.LSPAny as lspAny -> jeToJToken(lspAny.JsonElement).WriteTo(writer) + | :? System.Text.Json.JsonElement as je -> jeToJToken(je).WriteTo(writer) + | _ -> () + + override _.ReadJson + (reader: Newtonsoft.Json.JsonReader, t: System.Type, _existing: obj, _serializer: JsonSerializer) + = + let je = jtokenToJe (JToken.ReadFrom(reader)) + + if t = typeof then + Ionide.LanguageServerProtocol.Types.LSPAny je :> obj + else + je :> obj + let defaultJsonRpcFormatter () = let jsonRpcFormatter = new JsonMessageFormatter() jsonRpcFormatter.JsonSerializer.NullValueHandling <- NullValueHandling.Ignore jsonRpcFormatter.JsonSerializer.ConstructorHandling <- ConstructorHandling.AllowNonPublicDefaultConstructor jsonRpcFormatter.JsonSerializer.MissingMemberHandling <- MissingMemberHandling.Ignore - jsonRpcFormatter.JsonSerializer.Converters.Add(StrictNumberConverter()) - jsonRpcFormatter.JsonSerializer.Converters.Add(StrictStringConverter()) - jsonRpcFormatter.JsonSerializer.Converters.Add(StrictBoolConverter()) - jsonRpcFormatter.JsonSerializer.Converters.Add(SingleCaseUnionConverter()) - jsonRpcFormatter.JsonSerializer.Converters.Add(OptionConverter()) - jsonRpcFormatter.JsonSerializer.Converters.Add(ErasedUnionConverter()) - jsonRpcFormatter.JsonSerializer.ContractResolver <- OptionAndCamelCasePropertyNamesContractResolver() + jsonRpcFormatter.JsonSerializer.Converters.Add(JsonElementConverter()) jsonRpcFormatter let jsonRpcFormatter = defaultJsonRpcFormatter () - let deserialize<'t> (token: JToken) = token.ToObject<'t>(jsonRpcFormatter.JsonSerializer) - let serialize<'t> (o: 't) = JToken.FromObject(o, jsonRpcFormatter.JsonSerializer) - let requestHandling<'param, 'result> (run: 'param -> AsyncLspResult<'result>) : Delegate = - let runAsTask param ct = + let runAsTask param (ct: CancellationToken) = // Execute non-async portion of `run` before forking the async portion into a task. // This is needed to avoid reordering of messages from a client. let asyncLspResult = run param - let asyncContinuation = - async { - let! lspResult = asyncLspResult + let cts = new CancellationTokenSource() + let tcs = TaskCompletionSource>() + + // Start unconditionally with a fresh (non-cancelled) token + Async.StartWithContinuations( + asyncLspResult, + (fun result -> + cts.Dispose() + + tcs.TrySetResult(result) + |> ignore + ), + (fun ex -> + cts.Dispose() + + tcs.TrySetException(ex) + |> ignore + ), + (fun _ -> + cts.Dispose() + + tcs.TrySetCanceled() + |> ignore + ), + cts.Token + ) - return - match lspResult with - | Ok result -> result - | Error error -> - let rpcException = LocalRpcException(error.Message) - rpcException.ErrorCode <- error.Code + // NOW link: if ct is already cancelled, this fires immediately, + // but the async is already running so TryCancelled will see it + ct.Register(fun () -> + Thread.Sleep(100) + cts.Cancel() + ) + |> ignore - rpcException.ErrorData <- - error.Data - |> Option.defaultValue null + let lspResultTranslation (lspResultTask: Task>) = + match lspResultTask.Result with + | Ok result -> result + | Error error -> + let rpcException = LocalRpcException(error.Message) + rpcException.ErrorCode <- error.Code - raise rpcException - } + rpcException.ErrorData <- + error.Data + |> Option.map (fun je -> je :> obj) + |> Option.defaultValue null - Async.StartAsTask(asyncContinuation, cancellationToken = ct) + raise rpcException + + tcs.Task.ContinueWith(lspResultTranslation, TaskContinuationOptions.OnlyOnRanToCompletion) Func<'param, CancellationToken, Task<'result>>(runAsTask) :> Delegate @@ -299,27 +375,43 @@ module Client = let result = JsonSerializerSettings(NullValueHandling = NullValueHandling.Ignore) result.Converters.Add(OptionConverter()) result.Converters.Add(ErasedUnionConverter()) + result.Converters.Add(Server.JsonElementConverter()) result.ContractResolver <- CamelCasePropertyNamesContractResolver() result let internal jsonSerializer = JsonSerializer.Create(jsonSettings) - let internal deserialize (token: JToken) = token.ToObject<'t>(jsonSerializer) + let internal jeToJToken (je: System.Text.Json.JsonElement) : JToken = JToken.Parse(je.GetRawText()) + + let internal jtokenToJe (token: JToken) : System.Text.Json.JsonElement = + use doc = System.Text.Json.JsonDocument.Parse(token.ToString(Formatting.None)) + doc.RootElement.Clone() + + let internal deserialize<'t> (token: JToken) = token.ToObject<'t>(jsonSerializer) let internal serialize (o: 't) = JToken.FromObject(o, jsonSerializer) - type NotificationHandler = { Run: JToken -> Async } + type NotificationHandler = { + Run: System.Text.Json.JsonElement -> Async + } let notificationHandling<'p, 'r> (handler: 'p -> Async<'r option>) : NotificationHandler = - let run (token: JToken) = + let run (je: System.Text.Json.JsonElement) = async { try - let p = token.ToObject<'p>(jsonSerializer) + let p = + je + |> jeToJToken + |> (fun t -> t.ToObject<'p>(jsonSerializer)) + let! res = handler p return res - |> Option.map (fun n -> JToken.FromObject(n, jsonSerializer)) + |> Option.map (fun n -> + JToken.FromObject(n, jsonSerializer) + |> jtokenToJe + ) with _ -> return None } @@ -571,7 +663,10 @@ module Client = |> ignore member __.SendNotification (rpcMethod: string) (requestObj: obj) = - let serializedResponse = JToken.FromObject(requestObj, jsonSerializer) + let serializedResponse = + JToken.FromObject(requestObj, jsonSerializer) + |> jtokenToJe + let notification = JsonRpc.Notification.Create(rpcMethod, Some serializedResponse) let notString = JsonConvert.SerializeObject(notification, jsonSettings) sender.Post(notString) diff --git a/src/OptionConverter.fs b/src/OptionConverter.fs index 5d9431a..03120b4 100644 --- a/src/OptionConverter.fs +++ b/src/OptionConverter.fs @@ -1,6 +1,5 @@ namespace Ionide.LanguageServerProtocol.JsonUtils -open Newtonsoft.Json open Microsoft.FSharp.Reflection open System open System.Collections.Concurrent @@ -14,22 +13,6 @@ module internal Converters = let d = ConcurrentDictionary<'a, 'b>() fun key -> d.GetOrAdd(key, f) - let inline memoriseByHash (f: 'a -> 'b) : 'a -> 'b = - let d = ConcurrentDictionary() - - fun key -> - let hash = key.GetHashCode() - - match d.TryGetValue(hash) with - | (true, value) -> value - | _ -> - let value = f key - - d.TryAdd(hash, value) - |> ignore - - value - open Converters @@ -69,7 +52,7 @@ module private UnionInfo = { Cases = cases; GetTag = FSharpValue.PreComputeUnionTagReader ty } - let get: Type -> _ = memoriseByHash (create) + let get: Type -> _ = memorise (create) module Type = let numerics = [| @@ -80,32 +63,87 @@ module Type = //ENHANCEMENT: other number types |] - let numericHashes = - numerics - |> Array.map (fun t -> t.GetHashCode()) - - let stringHash = typeof.GetHashCode() - let boolHash = typeof.GetHashCode() - let inline isOption (t: Type) = t.IsGenericType && t.GetGenericTypeDefinition() = typedefof<_ option> - let inline isString (t: Type) = t.GetHashCode() = stringHash - let inline isBool (t: Type) = t.GetHashCode() = boolHash + let inline isString (t: Type) = t = typeof + let inline isBool (t: Type) = t = typeof let inline isNumeric (t: Type) = - let hash = t.GetHashCode() + numerics + |> Array.contains t + + +// Backing converter for UnitConverterFactory. +// Must be defined at module level — F# does not allow nested type definitions. +// We inherit JsonConverter rather than JsonConverter to avoid FS0017: +// when 'T = unit, F# unifies the abstract Read return type with the void-unit, +// which the compiler rejects as a signature mismatch. +// STJ invokes CreateConverter (below) and receives this converter; the factory's +// CanConvert guards ensure it is only ever applied to the `unit` type. +[] +type private UnitInnerConverter() = + inherit System.Text.Json.Serialization.JsonConverter() + + override _.Read(reader, _t, _opts) = + reader.Skip() + null // unit has no runtime representation beyond null/() + + override _.Write(writer, _value, _opts) = writer.WriteNullValue() + + override _.CanConvert(t) = t = typeof + +/// STJ JsonConverterFactory for F# unit type. +/// Reads (and discards) any JSON value — null, object, or primitive — and produces unit. +/// Writes unit as JSON null. +/// This is needed because STJ cannot construct Unit (it has no public parameterless constructor), +/// but LSP notification handlers that take `unit` params still go through the generic +/// `deserialize` path in wrapHandler. +[] +type UnitConverterFactory() = + inherit System.Text.Json.Serialization.JsonConverterFactory() + + override _.CanConvert(t) = t = typeof + + override _.CreateConverter(_t, _opts) = UnitInnerConverter() :> System.Text.Json.Serialization.JsonConverter + +/// STJ JsonConverter for F# option types. +/// None serializes as JSON null; Some v serializes as v. +type FSharpOptionConverter<'T>(options: System.Text.Json.JsonSerializerOptions) = + inherit System.Text.Json.Serialization.JsonConverter<'T option>() + + override _.Read(reader, _, opts) = + if reader.TokenType = System.Text.Json.JsonTokenType.Null then + None + else + Some(System.Text.Json.JsonSerializer.Deserialize<'T>(&reader, opts)) + + override _.Write(writer, value, opts) = + match value with + | None -> writer.WriteNullValue() + | Some v -> System.Text.Json.JsonSerializer.Serialize(writer, v, opts) + +/// STJ JsonConverterFactory that creates FSharpOptionConverter<'T> for any 'T option type. +[] +type FSharpOptionConverterFactory() = + inherit System.Text.Json.Serialization.JsonConverterFactory() + + override _.CanConvert(t) = Type.isOption t - numericHashes - |> Array.contains hash + override _.CreateConverter(t, opts) = + let inner = t.GetGenericArguments().[0] + let converterType = typedefof>.MakeGenericType(inner) + Activator.CreateInstance(converterType, opts) :?> System.Text.Json.Serialization.JsonConverter +/// Newtonsoft JsonConverter for F# option types. +/// Kept for use by MetaModelGenerator (which uses Newtonsoft to parse metaModel.json). [] type OptionConverter() = - inherit JsonConverter() + inherit Newtonsoft.Json.JsonConverter() let getInnerType = - memoriseByHash (fun (t: Type) -> + memorise (fun (t: Type) -> let innerType = t.GetGenericArguments()[0] if innerType.IsValueType then @@ -114,7 +152,7 @@ type OptionConverter() = innerType ) - let canConvert = memoriseByHash (Type.isOption) + let canConvert = memorise (Type.isOption) override __.CanConvert(t) = canConvert t @@ -133,7 +171,7 @@ type OptionConverter() = override __.ReadJson(reader, t, _existingValue, serializer) = match reader.TokenType with - | JsonToken.Null -> null // = None + | Newtonsoft.Json.JsonToken.Null -> null // = None | _ -> let innerType = getInnerType t diff --git a/src/Types.cg.fs b/src/Types.cg.fs index 3ac9317..f41e3ab 100644 --- a/src/Types.cg.fs +++ b/src/Types.cg.fs @@ -3,8 +3,8 @@ namespace rec Ionide.LanguageServerProtocol.Types open System open System.Runtime.Serialization open System.Diagnostics -open Newtonsoft.Json -open Newtonsoft.Json.Linq +open System.Text.Json +open System.Text.Json.Serialization /// URI's are transferred as strings. The URI's format is defined in https://tools.ietf.org/html/rfc3986 /// /// See: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#uri @@ -19,361 +19,361 @@ type DocumentUri = string type RegExp = string type IWorkDoneProgressOptions = - abstract WorkDoneProgress: bool option + abstract WorkDoneProgress: bool option type IWorkDoneProgressParams = - /// An optional token that a server can use to report work done progress. - abstract WorkDoneToken: ProgressToken option + /// An optional token that a server can use to report work done progress. + abstract WorkDoneToken: ProgressToken option type IPartialResultParams = - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - abstract PartialResultToken: ProgressToken option + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + abstract PartialResultToken: ProgressToken option /// A parameter literal used in requests to pass a text document and a position inside that /// document. type ITextDocumentPositionParams = - /// The text document. - abstract TextDocument: TextDocumentIdentifier - /// The position inside the text document. - abstract Position: Position + /// The text document. + abstract TextDocument: TextDocumentIdentifier + /// The position inside the text document. + abstract Position: Position /// General text document registration options. type ITextDocumentRegistrationOptions = - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - abstract DocumentSelector: DocumentSelector option + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + abstract DocumentSelector: DocumentSelector option type IImplementationOptions = - inherit IWorkDoneProgressOptions + inherit IWorkDoneProgressOptions type ITypeDefinitionOptions = - inherit IWorkDoneProgressOptions + inherit IWorkDoneProgressOptions type IDocumentColorOptions = - inherit IWorkDoneProgressOptions + inherit IWorkDoneProgressOptions type IFoldingRangeOptions = - inherit IWorkDoneProgressOptions + inherit IWorkDoneProgressOptions type IDeclarationOptions = - inherit IWorkDoneProgressOptions + inherit IWorkDoneProgressOptions type ISelectionRangeOptions = - inherit IWorkDoneProgressOptions + inherit IWorkDoneProgressOptions /// Call hierarchy options used during static registration. /// /// @since 3.16.0 type ICallHierarchyOptions = - inherit IWorkDoneProgressOptions + inherit IWorkDoneProgressOptions /// @since 3.16.0 type ISemanticTokensOptions = - /// The legend used by the server - abstract Legend: SemanticTokensLegend - /// Server supports providing semantic tokens for a specific range - /// of a document. - abstract Range: U2 option - /// Server supports providing semantic tokens for a full document. - abstract Full: U2 option - inherit IWorkDoneProgressOptions + /// The legend used by the server + abstract Legend: SemanticTokensLegend + /// Server supports providing semantic tokens for a specific range + /// of a document. + abstract Range: U2 option + /// Server supports providing semantic tokens for a full document. + abstract Full: U2 option + inherit IWorkDoneProgressOptions type ILinkedEditingRangeOptions = - inherit IWorkDoneProgressOptions + inherit IWorkDoneProgressOptions type IMonikerOptions = - inherit IWorkDoneProgressOptions + inherit IWorkDoneProgressOptions /// Type hierarchy options used during static registration. /// /// @since 3.17.0 type ITypeHierarchyOptions = - inherit IWorkDoneProgressOptions + inherit IWorkDoneProgressOptions /// Inline value options used during static registration. /// /// @since 3.17.0 type IInlineValueOptions = - inherit IWorkDoneProgressOptions + inherit IWorkDoneProgressOptions /// Inlay hint options used during static registration. /// /// @since 3.17.0 type IInlayHintOptions = - /// The server provides support to resolve additional - /// information for an inlay hint item. - abstract ResolveProvider: bool option - inherit IWorkDoneProgressOptions + /// The server provides support to resolve additional + /// information for an inlay hint item. + abstract ResolveProvider: bool option + inherit IWorkDoneProgressOptions /// Diagnostic options. /// /// @since 3.17.0 type IDiagnosticOptions = - /// An optional identifier under which the diagnostics are - /// managed by the client. - abstract Identifier: string option - /// Whether the language has inter file dependencies meaning that - /// editing code in one file can result in a different diagnostic - /// set in another file. Inter file dependencies are common for - /// most programming languages and typically uncommon for linters. - abstract InterFileDependencies: bool - /// The server provides support for workspace diagnostics as well. - abstract WorkspaceDiagnostics: bool - inherit IWorkDoneProgressOptions + /// An optional identifier under which the diagnostics are + /// managed by the client. + abstract Identifier: string option + /// Whether the language has inter file dependencies meaning that + /// editing code in one file can result in a different diagnostic + /// set in another file. Inter file dependencies are common for + /// most programming languages and typically uncommon for linters. + abstract InterFileDependencies: bool + /// The server provides support for workspace diagnostics as well. + abstract WorkspaceDiagnostics: bool + inherit IWorkDoneProgressOptions /// The initialize parameters type I_InitializeParams = - /// The process Id of the parent process that started - /// the server. - /// - /// Is `null` if the process has not been started by another process. - /// If the parent process is not alive then the server should exit. - abstract ProcessId: int32 option - /// Information about the client - /// - /// @since 3.15.0 - abstract ClientInfo: _InitializeParamsClientInfo option - /// The locale the client is currently showing the user interface - /// in. This must not necessarily be the locale of the operating - /// system. - /// - /// Uses IETF language tags as the value's syntax - /// (See https://en.wikipedia.org/wiki/IETF_language_tag) - /// - /// @since 3.16.0 - abstract Locale: string option - /// The rootPath of the workspace. Is null - /// if no folder is open. - /// - /// @deprecated in favour of rootUri. - abstract RootPath: string option - /// The rootUri of the workspace. Is null if no - /// folder is open. If both `rootPath` and `rootUri` are set - /// `rootUri` wins. - /// - /// @deprecated in favour of workspaceFolders. - abstract RootUri: DocumentUri option - /// The capabilities provided by the client (editor or tool) - abstract Capabilities: ClientCapabilities - /// User provided initialization options. - abstract InitializationOptions: LSPAny option - /// The initial trace setting. If omitted trace is disabled ('off'). - abstract Trace: TraceValues option - inherit IWorkDoneProgressParams + /// The process Id of the parent process that started + /// the server. + /// + /// Is `null` if the process has not been started by another process. + /// If the parent process is not alive then the server should exit. + abstract ProcessId: int32 option + /// Information about the client + /// + /// @since 3.15.0 + abstract ClientInfo: _InitializeParamsClientInfo option + /// The locale the client is currently showing the user interface + /// in. This must not necessarily be the locale of the operating + /// system. + /// + /// Uses IETF language tags as the value's syntax + /// (See https://en.wikipedia.org/wiki/IETF_language_tag) + /// + /// @since 3.16.0 + abstract Locale: string option + /// The rootPath of the workspace. Is null + /// if no folder is open. + /// + /// @deprecated in favour of rootUri. + abstract RootPath: string option + /// The rootUri of the workspace. Is null if no + /// folder is open. If both `rootPath` and `rootUri` are set + /// `rootUri` wins. + /// + /// @deprecated in favour of workspaceFolders. + abstract RootUri: DocumentUri option + /// The capabilities provided by the client (editor or tool) + abstract Capabilities: ClientCapabilities + /// User provided initialization options. + abstract InitializationOptions: LSPAny option + /// The initial trace setting. If omitted trace is disabled ('off'). + abstract Trace: TraceValues option + inherit IWorkDoneProgressParams type IWorkspaceFoldersInitializeParams = - /// The workspace folders configured in the client when the server starts. - /// - /// This property is only available if the client supports workspace folders. - /// It can be `null` if the client supports workspace folders but none are - /// configured. - /// - /// @since 3.6.0 - abstract WorkspaceFolders: WorkspaceFolder[] option + /// The workspace folders configured in the client when the server starts. + /// + /// This property is only available if the client supports workspace folders. + /// It can be `null` if the client supports workspace folders but none are + /// configured. + /// + /// @since 3.6.0 + abstract WorkspaceFolders: WorkspaceFolder[] option /// Save options. type ISaveOptions = - /// The client is supposed to include the content on save. - abstract IncludeText: bool option + /// The client is supposed to include the content on save. + abstract IncludeText: bool option /// Completion options. type ICompletionOptions = - /// Most tools trigger completion request automatically without explicitly requesting - /// it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user - /// starts to type an identifier. For example if the user types `c` in a JavaScript file - /// code complete will automatically pop up present `console` besides others as a - /// completion item. Characters that make up identifiers don't need to be listed here. - /// - /// If code complete should automatically be trigger on characters not being valid inside - /// an identifier (for example `.` in JavaScript) list them in `triggerCharacters`. - abstract TriggerCharacters: string[] option - /// The list of all possible characters that commit a completion. This field can be used - /// if clients don't support individual commit characters per completion item. See - /// `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport` - /// - /// If a server provides both `allCommitCharacters` and commit characters on an individual - /// completion item the ones on the completion item win. - /// - /// @since 3.2.0 - abstract AllCommitCharacters: string[] option - /// The server provides support to resolve additional - /// information for a completion item. - abstract ResolveProvider: bool option - /// The server supports the following `CompletionItem` specific - /// capabilities. - /// - /// @since 3.17.0 - abstract CompletionItem: CompletionOptionsCompletionItem option - inherit IWorkDoneProgressOptions + /// Most tools trigger completion request automatically without explicitly requesting + /// it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user + /// starts to type an identifier. For example if the user types `c` in a JavaScript file + /// code complete will automatically pop up present `console` besides others as a + /// completion item. Characters that make up identifiers don't need to be listed here. + /// + /// If code complete should automatically be trigger on characters not being valid inside + /// an identifier (for example `.` in JavaScript) list them in `triggerCharacters`. + abstract TriggerCharacters: string[] option + /// The list of all possible characters that commit a completion. This field can be used + /// if clients don't support individual commit characters per completion item. See + /// `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport` + /// + /// If a server provides both `allCommitCharacters` and commit characters on an individual + /// completion item the ones on the completion item win. + /// + /// @since 3.2.0 + abstract AllCommitCharacters: string[] option + /// The server provides support to resolve additional + /// information for a completion item. + abstract ResolveProvider: bool option + /// The server supports the following `CompletionItem` specific + /// capabilities. + /// + /// @since 3.17.0 + abstract CompletionItem: CompletionOptionsCompletionItem option + inherit IWorkDoneProgressOptions /// Hover options. type IHoverOptions = - inherit IWorkDoneProgressOptions + inherit IWorkDoneProgressOptions /// Server Capabilities for a {@link SignatureHelpRequest}. type ISignatureHelpOptions = - /// List of characters that trigger signature help automatically. - abstract TriggerCharacters: string[] option - /// List of characters that re-trigger signature help. - /// - /// These trigger characters are only active when signature help is already showing. All trigger characters - /// are also counted as re-trigger characters. - /// - /// @since 3.15.0 - abstract RetriggerCharacters: string[] option - inherit IWorkDoneProgressOptions + /// List of characters that trigger signature help automatically. + abstract TriggerCharacters: string[] option + /// List of characters that re-trigger signature help. + /// + /// These trigger characters are only active when signature help is already showing. All trigger characters + /// are also counted as re-trigger characters. + /// + /// @since 3.15.0 + abstract RetriggerCharacters: string[] option + inherit IWorkDoneProgressOptions /// Server Capabilities for a {@link DefinitionRequest}. type IDefinitionOptions = - inherit IWorkDoneProgressOptions + inherit IWorkDoneProgressOptions /// Reference options. type IReferenceOptions = - inherit IWorkDoneProgressOptions + inherit IWorkDoneProgressOptions /// Provider options for a {@link DocumentHighlightRequest}. type IDocumentHighlightOptions = - inherit IWorkDoneProgressOptions + inherit IWorkDoneProgressOptions /// A base for all symbol information. type IBaseSymbolInformation = - /// The name of this symbol. - abstract Name: string - /// The kind of this symbol. - abstract Kind: SymbolKind - /// Tags for this symbol. - /// - /// @since 3.16.0 - abstract Tags: SymbolTag[] option - /// The name of the symbol containing this symbol. This information is for - /// user interface purposes (e.g. to render a qualifier in the user interface - /// if necessary). It can't be used to re-infer a hierarchy for the document - /// symbols. - abstract ContainerName: string option + /// The name of this symbol. + abstract Name: string + /// The kind of this symbol. + abstract Kind: SymbolKind + /// Tags for this symbol. + /// + /// @since 3.16.0 + abstract Tags: SymbolTag[] option + /// The name of the symbol containing this symbol. This information is for + /// user interface purposes (e.g. to render a qualifier in the user interface + /// if necessary). It can't be used to re-infer a hierarchy for the document + /// symbols. + abstract ContainerName: string option /// Provider options for a {@link DocumentSymbolRequest}. type IDocumentSymbolOptions = - /// A human-readable string that is shown when multiple outlines trees - /// are shown for the same document. - /// - /// @since 3.16.0 - abstract Label: string option - inherit IWorkDoneProgressOptions + /// A human-readable string that is shown when multiple outlines trees + /// are shown for the same document. + /// + /// @since 3.16.0 + abstract Label: string option + inherit IWorkDoneProgressOptions /// Provider options for a {@link CodeActionRequest}. type ICodeActionOptions = - /// CodeActionKinds that this server may return. - /// - /// The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server - /// may list out every specific kind they provide. - abstract CodeActionKinds: CodeActionKind[] option - /// The server provides support to resolve additional - /// information for a code action. - /// - /// @since 3.16.0 - abstract ResolveProvider: bool option - inherit IWorkDoneProgressOptions + /// CodeActionKinds that this server may return. + /// + /// The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server + /// may list out every specific kind they provide. + abstract CodeActionKinds: CodeActionKind[] option + /// The server provides support to resolve additional + /// information for a code action. + /// + /// @since 3.16.0 + abstract ResolveProvider: bool option + inherit IWorkDoneProgressOptions /// Server capabilities for a {@link WorkspaceSymbolRequest}. type IWorkspaceSymbolOptions = - /// The server provides support to resolve additional - /// information for a workspace symbol. - /// - /// @since 3.17.0 - abstract ResolveProvider: bool option - inherit IWorkDoneProgressOptions + /// The server provides support to resolve additional + /// information for a workspace symbol. + /// + /// @since 3.17.0 + abstract ResolveProvider: bool option + inherit IWorkDoneProgressOptions /// Code Lens provider options of a {@link CodeLensRequest}. type ICodeLensOptions = - /// Code lens has a resolve provider as well. - abstract ResolveProvider: bool option - inherit IWorkDoneProgressOptions + /// Code lens has a resolve provider as well. + abstract ResolveProvider: bool option + inherit IWorkDoneProgressOptions /// Provider options for a {@link DocumentLinkRequest}. type IDocumentLinkOptions = - /// Document links have a resolve provider as well. - abstract ResolveProvider: bool option - inherit IWorkDoneProgressOptions + /// Document links have a resolve provider as well. + abstract ResolveProvider: bool option + inherit IWorkDoneProgressOptions /// Provider options for a {@link DocumentFormattingRequest}. type IDocumentFormattingOptions = - inherit IWorkDoneProgressOptions + inherit IWorkDoneProgressOptions /// Provider options for a {@link DocumentRangeFormattingRequest}. type IDocumentRangeFormattingOptions = - inherit IWorkDoneProgressOptions + inherit IWorkDoneProgressOptions /// Provider options for a {@link DocumentOnTypeFormattingRequest}. type IDocumentOnTypeFormattingOptions = - /// A character on which formatting should be triggered, like `{`. - abstract FirstTriggerCharacter: string - /// More trigger characters. - abstract MoreTriggerCharacter: string[] option + /// A character on which formatting should be triggered, like `{`. + abstract FirstTriggerCharacter: string + /// More trigger characters. + abstract MoreTriggerCharacter: string[] option /// Provider options for a {@link RenameRequest}. type IRenameOptions = - /// Renames should be checked and tested before being executed. - /// - /// @since version 3.12.0 - abstract PrepareProvider: bool option - inherit IWorkDoneProgressOptions + /// Renames should be checked and tested before being executed. + /// + /// @since version 3.12.0 + abstract PrepareProvider: bool option + inherit IWorkDoneProgressOptions /// The server capabilities of a {@link ExecuteCommandRequest}. type IExecuteCommandOptions = - /// The commands to be executed on the server - abstract Commands: string[] - inherit IWorkDoneProgressOptions + /// The commands to be executed on the server + abstract Commands: string[] + inherit IWorkDoneProgressOptions /// A generic resource operation. type IResourceOperation = - /// The resource operation kind. - abstract Kind: string - /// An optional annotation identifier describing the operation. - /// - /// @since 3.16.0 - abstract AnnotationId: ChangeAnnotationIdentifier option + /// The resource operation kind. + abstract Kind: string + /// An optional annotation identifier describing the operation. + /// + /// @since 3.16.0 + abstract AnnotationId: ChangeAnnotationIdentifier option /// A diagnostic report with a full set of problems. /// /// @since 3.17.0 type IFullDocumentDiagnosticReport = - /// A full document diagnostic report. - abstract Kind: string - /// An optional result id. If provided it will - /// be sent on the next diagnostic request for the - /// same document. - abstract ResultId: string option - /// The actual items. - abstract Items: Diagnostic[] + /// A full document diagnostic report. + abstract Kind: string + /// An optional result id. If provided it will + /// be sent on the next diagnostic request for the + /// same document. + abstract ResultId: string option + /// The actual items. + abstract Items: Diagnostic[] /// A diagnostic report indicating that the last returned /// report is still accurate. /// /// @since 3.17.0 type IUnchangedDocumentDiagnosticReport = - /// A document diagnostic report indicating - /// no changes to the last result. A server can - /// only return `unchanged` if result ids are - /// provided. - abstract Kind: string - /// A result id which will be sent on the next - /// diagnostic request for the same document. - abstract ResultId: string + /// A document diagnostic report indicating + /// no changes to the last result. A server can + /// only return `unchanged` if result ids are + /// provided. + abstract Kind: string + /// A result id which will be sent on the next + /// diagnostic request for the same document. + abstract ResultId: string /// A literal to identify a text document in the client. type ITextDocumentIdentifier = - /// The text document's uri. - abstract Uri: DocumentUri + /// The text document's uri. + abstract Uri: DocumentUri /// A text edit applicable to a text document. type ITextEdit = - /// The range of the text document to be manipulated. To insert - /// text into a document create a range where start === end. - abstract Range: Range - /// The string to be inserted. For delete operations use an - /// empty string. - abstract NewText: string + /// The range of the text document to be manipulated. To insert + /// text into a document create a range where start === end. + abstract Range: Range + /// The string to be inserted. For delete operations use an + /// empty string. + abstract NewText: string /// Options specific to a notebook plus its cells /// to be synced to the server. @@ -389,772 +389,805 @@ type ITextEdit = /// /// @since 3.17.0 type INotebookDocumentSyncOptions = - /// The notebooks to be synced - abstract NotebookSelector: NotebookDocumentSyncOptionsNotebookSelector[] - /// Whether save notification should be forwarded to - /// the server. Will only be honored if mode === `notebook`. - abstract Save: bool option + /// The notebooks to be synced + abstract NotebookSelector: NotebookDocumentSyncOptionsNotebookSelector[] + /// Whether save notification should be forwarded to + /// the server. Will only be honored if mode === `notebook`. + abstract Save: bool option type InitializedParams = obj -type ImplementationParams = { - /// The text document. - TextDocument: TextDocumentIdentifier - /// The position inside the text document. - Position: Position - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - PartialResultToken: ProgressToken option -} with - - interface ITextDocumentPositionParams with - /// The text document. - member x.TextDocument = x.TextDocument - /// The position inside the text document. - member x.Position = x.Position - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken - - interface IPartialResultParams with - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - member x.PartialResultToken = x.PartialResultToken +type ImplementationParams = + { + /// The text document. + TextDocument: TextDocumentIdentifier + /// The position inside the text document. + Position: Position + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + PartialResultToken: ProgressToken option + } + + interface ITextDocumentPositionParams with + /// The text document. + member x.TextDocument = x.TextDocument + /// The position inside the text document. + member x.Position = x.Position + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + + interface IPartialResultParams with + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + member x.PartialResultToken = x.PartialResultToken /// Represents a location inside a resource, such as a line /// inside a text file. type Location = { Uri: DocumentUri; Range: Range } -type ImplementationRegistrationOptions = { - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - WorkDoneProgress: bool option - /// The id used to register the request. The id can be used to deregister - /// the request again. See also Registration#id. - Id: string option -} with - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector - - interface IImplementationOptions - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress - -type TypeDefinitionParams = { - /// The text document. - TextDocument: TextDocumentIdentifier - /// The position inside the text document. - Position: Position - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - PartialResultToken: ProgressToken option -} with - - interface ITextDocumentPositionParams with - /// The text document. - member x.TextDocument = x.TextDocument - /// The position inside the text document. - member x.Position = x.Position - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken - - interface IPartialResultParams with - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - member x.PartialResultToken = x.PartialResultToken - -type TypeDefinitionRegistrationOptions = { - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - WorkDoneProgress: bool option - /// The id used to register the request. The id can be used to deregister - /// the request again. See also Registration#id. - Id: string option -} with - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector - - interface ITypeDefinitionOptions - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress +type ImplementationRegistrationOptions = + { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + WorkDoneProgress: bool option + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + Id: string option + } + + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector + + interface IImplementationOptions + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress + +type TypeDefinitionParams = + { + /// The text document. + TextDocument: TextDocumentIdentifier + /// The position inside the text document. + Position: Position + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + PartialResultToken: ProgressToken option + } + + interface ITextDocumentPositionParams with + /// The text document. + member x.TextDocument = x.TextDocument + /// The position inside the text document. + member x.Position = x.Position + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + + interface IPartialResultParams with + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + member x.PartialResultToken = x.PartialResultToken + +type TypeDefinitionRegistrationOptions = + { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + WorkDoneProgress: bool option + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + Id: string option + } + + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector + + interface ITypeDefinitionOptions + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// A workspace folder inside a client. -type WorkspaceFolder = { - /// The associated URI for this workspace folder. - Uri: URI - /// The name of the workspace folder. Used to refer to this - /// workspace folder in the user interface. - Name: string -} +type WorkspaceFolder = + { + /// The associated URI for this workspace folder. + Uri: URI + /// The name of the workspace folder. Used to refer to this + /// workspace folder in the user interface. + Name: string + } /// The parameters of a `workspace/didChangeWorkspaceFolders` notification. -type DidChangeWorkspaceFoldersParams = { - /// The actual workspace folder change event. - Event: WorkspaceFoldersChangeEvent -} +type DidChangeWorkspaceFoldersParams = + { + /// The actual workspace folder change event. + Event: WorkspaceFoldersChangeEvent + } /// The parameters of a configuration request. type ConfigurationParams = { Items: ConfigurationItem[] } /// Parameters for a {@link DocumentColorRequest}. -type DocumentColorParams = { - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - PartialResultToken: ProgressToken option - /// The text document. - TextDocument: TextDocumentIdentifier -} with - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken - - interface IPartialResultParams with - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - member x.PartialResultToken = x.PartialResultToken +type DocumentColorParams = + { + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + PartialResultToken: ProgressToken option + /// The text document. + TextDocument: TextDocumentIdentifier + } + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + + interface IPartialResultParams with + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + member x.PartialResultToken = x.PartialResultToken /// Represents a color range from a document. -type ColorInformation = { - /// The range in the document where this color appears. - Range: Range - /// The actual color value for this color range. - Color: Color -} - -type DocumentColorRegistrationOptions = { - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - WorkDoneProgress: bool option - /// The id used to register the request. The id can be used to deregister - /// the request again. See also Registration#id. - Id: string option -} with - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector - - interface IDocumentColorOptions - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress +type ColorInformation = + { + /// The range in the document where this color appears. + Range: Range + /// The actual color value for this color range. + Color: Color + } + +type DocumentColorRegistrationOptions = + { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + WorkDoneProgress: bool option + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + Id: string option + } + + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector + + interface IDocumentColorOptions + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// Parameters for a {@link ColorPresentationRequest}. -type ColorPresentationParams = { - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - PartialResultToken: ProgressToken option - /// The text document. - TextDocument: TextDocumentIdentifier - /// The color to request presentations for. - Color: Color - /// The range where the color would be inserted. Serves as a context. - Range: Range -} with - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken - - interface IPartialResultParams with - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - member x.PartialResultToken = x.PartialResultToken - -type ColorPresentation = { - /// The label of this color presentation. It will be shown on the color - /// picker header. By default this is also the text that is inserted when selecting - /// this color presentation. - Label: string - /// An {@link TextEdit edit} which is applied to a document when selecting - /// this presentation for the color. When `falsy` the {@link ColorPresentation.label label} - /// is used. - TextEdit: TextEdit option - /// An optional array of additional {@link TextEdit text edits} that are applied when - /// selecting this color presentation. Edits must not overlap with the main {@link ColorPresentation.textEdit edit} nor with themselves. - AdditionalTextEdits: TextEdit[] option -} - -type WorkDoneProgressOptions = { - WorkDoneProgress: bool option -} with - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress +type ColorPresentationParams = + { + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + PartialResultToken: ProgressToken option + /// The text document. + TextDocument: TextDocumentIdentifier + /// The color to request presentations for. + Color: Color + /// The range where the color would be inserted. Serves as a context. + Range: Range + } + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + + interface IPartialResultParams with + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + member x.PartialResultToken = x.PartialResultToken + +type ColorPresentation = + { + /// The label of this color presentation. It will be shown on the color + /// picker header. By default this is also the text that is inserted when selecting + /// this color presentation. + Label: string + /// An {@link TextEdit edit} which is applied to a document when selecting + /// this presentation for the color. When `falsy` the {@link ColorPresentation.label label} + /// is used. + TextEdit: TextEdit option + /// An optional array of additional {@link TextEdit text edits} that are applied when + /// selecting this color presentation. Edits must not overlap with the main {@link ColorPresentation.textEdit edit} nor with themselves. + AdditionalTextEdits: TextEdit[] option + } + +type WorkDoneProgressOptions = + { + WorkDoneProgress: bool option + } + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// General text document registration options. -type TextDocumentRegistrationOptions = { - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option -} with - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector +type TextDocumentRegistrationOptions = + { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + } + + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector /// Parameters for a {@link FoldingRangeRequest}. -type FoldingRangeParams = { - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - PartialResultToken: ProgressToken option - /// The text document. - TextDocument: TextDocumentIdentifier -} with - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken - - interface IPartialResultParams with - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - member x.PartialResultToken = x.PartialResultToken +type FoldingRangeParams = + { + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + PartialResultToken: ProgressToken option + /// The text document. + TextDocument: TextDocumentIdentifier + } + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + + interface IPartialResultParams with + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + member x.PartialResultToken = x.PartialResultToken /// Represents a folding range. To be valid, start and end line must be bigger than zero and smaller /// than the number of lines in the document. Clients are free to ignore invalid ranges. -type FoldingRange = { - /// The zero-based start line of the range to fold. The folded area starts after the line's last character. - /// To be valid, the end must be zero or larger and smaller than the number of lines in the document. - StartLine: uint32 - /// The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line. - StartCharacter: uint32 option - /// The zero-based end line of the range to fold. The folded area ends with the line's last character. - /// To be valid, the end must be zero or larger and smaller than the number of lines in the document. - EndLine: uint32 - /// The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line. - EndCharacter: uint32 option - /// Describes the kind of the folding range such as `comment' or 'region'. The kind - /// is used to categorize folding ranges and used by commands like 'Fold all comments'. - /// See {@link FoldingRangeKind} for an enumeration of standardized kinds. - Kind: FoldingRangeKind option - /// The text that the client should show when the specified range is - /// collapsed. If not defined or not supported by the client, a default - /// will be chosen by the client. - /// - /// @since 3.17.0 - CollapsedText: string option -} - -type FoldingRangeRegistrationOptions = { - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - WorkDoneProgress: bool option - /// The id used to register the request. The id can be used to deregister - /// the request again. See also Registration#id. - Id: string option -} with - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector - - interface IFoldingRangeOptions - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress - -type DeclarationParams = { - /// The text document. - TextDocument: TextDocumentIdentifier - /// The position inside the text document. - Position: Position - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - PartialResultToken: ProgressToken option -} with - - interface ITextDocumentPositionParams with - /// The text document. - member x.TextDocument = x.TextDocument - /// The position inside the text document. - member x.Position = x.Position - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken - - interface IPartialResultParams with - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - member x.PartialResultToken = x.PartialResultToken - -type DeclarationRegistrationOptions = { - WorkDoneProgress: bool option - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - /// The id used to register the request. The id can be used to deregister - /// the request again. See also Registration#id. - Id: string option -} with - - interface IDeclarationOptions - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector +type FoldingRange = + { + /// The zero-based start line of the range to fold. The folded area starts after the line's last character. + /// To be valid, the end must be zero or larger and smaller than the number of lines in the document. + StartLine: uint32 + /// The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line. + StartCharacter: uint32 option + /// The zero-based end line of the range to fold. The folded area ends with the line's last character. + /// To be valid, the end must be zero or larger and smaller than the number of lines in the document. + EndLine: uint32 + /// The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line. + EndCharacter: uint32 option + /// Describes the kind of the folding range such as `comment' or 'region'. The kind + /// is used to categorize folding ranges and used by commands like 'Fold all comments'. + /// See {@link FoldingRangeKind} for an enumeration of standardized kinds. + Kind: FoldingRangeKind option + /// The text that the client should show when the specified range is + /// collapsed. If not defined or not supported by the client, a default + /// will be chosen by the client. + /// + /// @since 3.17.0 + CollapsedText: string option + } + +type FoldingRangeRegistrationOptions = + { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + WorkDoneProgress: bool option + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + Id: string option + } + + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector + + interface IFoldingRangeOptions + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress + +type DeclarationParams = + { + /// The text document. + TextDocument: TextDocumentIdentifier + /// The position inside the text document. + Position: Position + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + PartialResultToken: ProgressToken option + } + + interface ITextDocumentPositionParams with + /// The text document. + member x.TextDocument = x.TextDocument + /// The position inside the text document. + member x.Position = x.Position + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + + interface IPartialResultParams with + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + member x.PartialResultToken = x.PartialResultToken + +type DeclarationRegistrationOptions = + { + WorkDoneProgress: bool option + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + Id: string option + } + + interface IDeclarationOptions + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress + + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector /// A parameter literal used in selection range requests. -type SelectionRangeParams = { - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - PartialResultToken: ProgressToken option - /// The text document. - TextDocument: TextDocumentIdentifier - /// The positions inside the text document. - Positions: Position[] -} with - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken - - interface IPartialResultParams with - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - member x.PartialResultToken = x.PartialResultToken +type SelectionRangeParams = + { + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + PartialResultToken: ProgressToken option + /// The text document. + TextDocument: TextDocumentIdentifier + /// The positions inside the text document. + Positions: Position[] + } + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + + interface IPartialResultParams with + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + member x.PartialResultToken = x.PartialResultToken /// A selection range represents a part of a selection hierarchy. A selection range /// may have a parent selection range that contains it. -type SelectionRange = { - /// The {@link Range range} of this selection range. - Range: Range - /// The parent selection range containing this range. Therefore `parent.range` must contain `this.range`. - Parent: SelectionRange option -} - -type SelectionRangeRegistrationOptions = { - WorkDoneProgress: bool option - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - /// The id used to register the request. The id can be used to deregister - /// the request again. See also Registration#id. - Id: string option -} with - - interface ISelectionRangeOptions - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector - -type WorkDoneProgressCreateParams = { - /// The token to be used to report progress. - Token: ProgressToken -} - -type WorkDoneProgressCancelParams = { - /// The token to be used to report progress. - Token: ProgressToken -} +type SelectionRange = + { + /// The {@link Range range} of this selection range. + Range: Range + /// The parent selection range containing this range. Therefore `parent.range` must contain `this.range`. + Parent: SelectionRange option + } + +type SelectionRangeRegistrationOptions = + { + WorkDoneProgress: bool option + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + Id: string option + } + + interface ISelectionRangeOptions + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress + + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector + +type WorkDoneProgressCreateParams = + { + /// The token to be used to report progress. + Token: ProgressToken + } + +type WorkDoneProgressCancelParams = + { + /// The token to be used to report progress. + Token: ProgressToken + } /// The parameter of a `textDocument/prepareCallHierarchy` request. /// /// @since 3.16.0 -type CallHierarchyPrepareParams = { - /// The text document. - TextDocument: TextDocumentIdentifier - /// The position inside the text document. - Position: Position - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option -} with - - interface ITextDocumentPositionParams with - /// The text document. - member x.TextDocument = x.TextDocument - /// The position inside the text document. - member x.Position = x.Position - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken +type CallHierarchyPrepareParams = + { + /// The text document. + TextDocument: TextDocumentIdentifier + /// The position inside the text document. + Position: Position + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + } + + interface ITextDocumentPositionParams with + /// The text document. + member x.TextDocument = x.TextDocument + /// The position inside the text document. + member x.Position = x.Position + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken /// Represents programming constructs like functions or constructors in the context /// of call hierarchy. /// /// @since 3.16.0 -type CallHierarchyItem = { - /// The name of this item. - Name: string - /// The kind of this item. - Kind: SymbolKind - /// Tags for this item. - Tags: SymbolTag[] option - /// More detail for this item, e.g. the signature of a function. - Detail: string option - /// The resource identifier of this item. - Uri: DocumentUri - /// The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code. - Range: Range - /// The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function. - /// Must be contained by the {@link CallHierarchyItem.range `range`}. - SelectionRange: Range - /// A data entry field that is preserved between a call hierarchy prepare and - /// incoming calls or outgoing calls requests. - Data: LSPAny option -} +type CallHierarchyItem = + { + /// The name of this item. + Name: string + /// The kind of this item. + Kind: SymbolKind + /// Tags for this item. + Tags: SymbolTag[] option + /// More detail for this item, e.g. the signature of a function. + Detail: string option + /// The resource identifier of this item. + Uri: DocumentUri + /// The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code. + Range: Range + /// The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function. + /// Must be contained by the {@link CallHierarchyItem.range `range`}. + SelectionRange: Range + /// A data entry field that is preserved between a call hierarchy prepare and + /// incoming calls or outgoing calls requests. + Data: LSPAny option + } /// Call hierarchy options used during static or dynamic registration. /// /// @since 3.16.0 -type CallHierarchyRegistrationOptions = { - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - WorkDoneProgress: bool option - /// The id used to register the request. The id can be used to deregister - /// the request again. See also Registration#id. - Id: string option -} with - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector - - interface ICallHierarchyOptions - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress +type CallHierarchyRegistrationOptions = + { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + WorkDoneProgress: bool option + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + Id: string option + } + + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector + + interface ICallHierarchyOptions + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// The parameter of a `callHierarchy/incomingCalls` request. /// /// @since 3.16.0 -type CallHierarchyIncomingCallsParams = { - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - PartialResultToken: ProgressToken option - Item: CallHierarchyItem -} with - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken - - interface IPartialResultParams with - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - member x.PartialResultToken = x.PartialResultToken +type CallHierarchyIncomingCallsParams = + { + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + PartialResultToken: ProgressToken option + Item: CallHierarchyItem + } + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + + interface IPartialResultParams with + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + member x.PartialResultToken = x.PartialResultToken /// Represents an incoming call, e.g. a caller of a method or constructor. /// /// @since 3.16.0 -type CallHierarchyIncomingCall = { - /// The item that makes the call. - From: CallHierarchyItem - /// The ranges at which the calls appear. This is relative to the caller - /// denoted by {@link CallHierarchyIncomingCall.from `this.from`}. - FromRanges: Range[] -} +type CallHierarchyIncomingCall = + { + /// The item that makes the call. + From: CallHierarchyItem + /// The ranges at which the calls appear. This is relative to the caller + /// denoted by {@link CallHierarchyIncomingCall.from `this.from`}. + FromRanges: Range[] + } /// The parameter of a `callHierarchy/outgoingCalls` request. /// /// @since 3.16.0 -type CallHierarchyOutgoingCallsParams = { - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - PartialResultToken: ProgressToken option - Item: CallHierarchyItem -} with - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken - - interface IPartialResultParams with - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - member x.PartialResultToken = x.PartialResultToken +type CallHierarchyOutgoingCallsParams = + { + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + PartialResultToken: ProgressToken option + Item: CallHierarchyItem + } + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + + interface IPartialResultParams with + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + member x.PartialResultToken = x.PartialResultToken /// Represents an outgoing call, e.g. calling a getter from a method or a method from a constructor etc. /// /// @since 3.16.0 -type CallHierarchyOutgoingCall = { - /// The item that is called. - To: CallHierarchyItem - /// The range at which this item is called. This is the range relative to the caller, e.g the item - /// passed to {@link CallHierarchyItemProvider.provideCallHierarchyOutgoingCalls `provideCallHierarchyOutgoingCalls`} - /// and not {@link CallHierarchyOutgoingCall.to `this.to`}. - FromRanges: Range[] -} +type CallHierarchyOutgoingCall = + { + /// The item that is called. + To: CallHierarchyItem + /// The range at which this item is called. This is the range relative to the caller, e.g the item + /// passed to {@link CallHierarchyItemProvider.provideCallHierarchyOutgoingCalls `provideCallHierarchyOutgoingCalls`} + /// and not {@link CallHierarchyOutgoingCall.to `this.to`}. + FromRanges: Range[] + } /// @since 3.16.0 -type SemanticTokensParams = { - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - PartialResultToken: ProgressToken option - /// The text document. - TextDocument: TextDocumentIdentifier -} with - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken - - interface IPartialResultParams with - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - member x.PartialResultToken = x.PartialResultToken +type SemanticTokensParams = + { + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + PartialResultToken: ProgressToken option + /// The text document. + TextDocument: TextDocumentIdentifier + } + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + + interface IPartialResultParams with + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + member x.PartialResultToken = x.PartialResultToken /// @since 3.16.0 -type SemanticTokens = { - /// An optional result id. If provided and clients support delta updating - /// the client will include the result id in the next semantic token request. - /// A server can then instead of computing all semantic tokens again simply - /// send a delta. - ResultId: string option - /// The actual tokens. - Data: uint32[] -} +type SemanticTokens = + { + /// An optional result id. If provided and clients support delta updating + /// the client will include the result id in the next semantic token request. + /// A server can then instead of computing all semantic tokens again simply + /// send a delta. + ResultId: string option + /// The actual tokens. + Data: uint32[] + } /// @since 3.16.0 type SemanticTokensPartialResult = { Data: uint32[] } -type SemanticTokensOptionsFullC2 = { - /// The server supports deltas for full documents. - Delta: bool option -} +type SemanticTokensOptionsFullC2 = + { + /// The server supports deltas for full documents. + Delta: bool option + } /// @since 3.16.0 -type SemanticTokensRegistrationOptions = { - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - WorkDoneProgress: bool option - /// The legend used by the server - Legend: SemanticTokensLegend - /// Server supports providing semantic tokens for a specific range - /// of a document. - Range: U2 option - /// Server supports providing semantic tokens for a full document. - Full: U2 option - /// The id used to register the request. The id can be used to deregister - /// the request again. See also Registration#id. - Id: string option -} with - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector - - interface ISemanticTokensOptions with - /// The legend used by the server - member x.Legend = x.Legend - /// Server supports providing semantic tokens for a specific range - /// of a document. - member x.Range = x.Range - /// Server supports providing semantic tokens for a full document. - member x.Full = x.Full - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress +type SemanticTokensRegistrationOptions = + { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + WorkDoneProgress: bool option + /// The legend used by the server + Legend: SemanticTokensLegend + /// Server supports providing semantic tokens for a specific range + /// of a document. + Range: U2 option + /// Server supports providing semantic tokens for a full document. + Full: U2 option + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + Id: string option + } + + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector + + interface ISemanticTokensOptions with + /// The legend used by the server + member x.Legend = x.Legend + /// Server supports providing semantic tokens for a specific range + /// of a document. + member x.Range = x.Range + /// Server supports providing semantic tokens for a full document. + member x.Full = x.Full + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// @since 3.16.0 -type SemanticTokensDeltaParams = { - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - PartialResultToken: ProgressToken option - /// The text document. - TextDocument: TextDocumentIdentifier - /// The result id of a previous response. The result Id can either point to a full response - /// or a delta response depending on what was received last. - PreviousResultId: string -} with - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken - - interface IPartialResultParams with - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - member x.PartialResultToken = x.PartialResultToken +type SemanticTokensDeltaParams = + { + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + PartialResultToken: ProgressToken option + /// The text document. + TextDocument: TextDocumentIdentifier + /// The result id of a previous response. The result Id can either point to a full response + /// or a delta response depending on what was received last. + PreviousResultId: string + } + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + + interface IPartialResultParams with + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + member x.PartialResultToken = x.PartialResultToken /// @since 3.16.0 -type SemanticTokensDelta = { - ResultId: string option - /// The semantic token edits to transform a previous result into a new result. - Edits: SemanticTokensEdit[] -} +type SemanticTokensDelta = + { + ResultId: string option + /// The semantic token edits to transform a previous result into a new result. + Edits: SemanticTokensEdit[] + } /// @since 3.16.0 type SemanticTokensDeltaPartialResult = { Edits: SemanticTokensEdit[] } /// @since 3.16.0 -type SemanticTokensRangeParams = { - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - PartialResultToken: ProgressToken option - /// The text document. - TextDocument: TextDocumentIdentifier - /// The range the semantic tokens are requested for. - Range: Range -} with - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken - - interface IPartialResultParams with - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - member x.PartialResultToken = x.PartialResultToken +type SemanticTokensRangeParams = + { + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + PartialResultToken: ProgressToken option + /// The text document. + TextDocument: TextDocumentIdentifier + /// The range the semantic tokens are requested for. + Range: Range + } + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + + interface IPartialResultParams with + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + member x.PartialResultToken = x.PartialResultToken /// Params to show a resource in the UI. /// /// @since 3.16.0 -type ShowDocumentParams = { - /// The uri to show. - Uri: URI - /// Indicates to show the resource in an external program. - /// To show, for example, `https://code.visualstudio.com/` - /// in the default WEB browser set `external` to `true`. - External: bool option - /// An optional property to indicate whether the editor - /// showing the document should take focus or not. - /// Clients might ignore this property if an external - /// program is started. - TakeFocus: bool option - /// An optional selection range if the document is a text - /// document. Clients might ignore the property if an - /// external program is started or the file is not a text - /// file. - Selection: Range option -} +type ShowDocumentParams = + { + /// The uri to show. + Uri: URI + /// Indicates to show the resource in an external program. + /// To show, for example, `https://code.visualstudio.com/` + /// in the default WEB browser set `external` to `true`. + External: bool option + /// An optional property to indicate whether the editor + /// showing the document should take focus or not. + /// Clients might ignore this property if an external + /// program is started. + TakeFocus: bool option + /// An optional selection range if the document is a text + /// document. Clients might ignore the property if an + /// external program is started or the file is not a text + /// file. + Selection: Range option + } /// The result of a showDocument request. /// /// @since 3.16.0 -type ShowDocumentResult = { - /// A boolean indicating if the show was successful. - Success: bool -} - -type LinkedEditingRangeParams = { - /// The text document. - TextDocument: TextDocumentIdentifier - /// The position inside the text document. - Position: Position - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option -} with - - interface ITextDocumentPositionParams with - /// The text document. - member x.TextDocument = x.TextDocument - /// The position inside the text document. - member x.Position = x.Position - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken +type ShowDocumentResult = + { + /// A boolean indicating if the show was successful. + Success: bool + } + +type LinkedEditingRangeParams = + { + /// The text document. + TextDocument: TextDocumentIdentifier + /// The position inside the text document. + Position: Position + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + } + + interface ITextDocumentPositionParams with + /// The text document. + member x.TextDocument = x.TextDocument + /// The position inside the text document. + member x.Position = x.Position + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken /// The result of a linked editing range request. /// /// @since 3.16.0 -type LinkedEditingRanges = { - /// A list of ranges that can be edited together. The ranges must have - /// identical length and contain identical text content. The ranges cannot overlap. - Ranges: Range[] - /// An optional word pattern (regular expression) that describes valid contents for - /// the given ranges. If no pattern is provided, the client configuration's word - /// pattern will be used. - WordPattern: string option -} - -type LinkedEditingRangeRegistrationOptions = { - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - WorkDoneProgress: bool option - /// The id used to register the request. The id can be used to deregister - /// the request again. See also Registration#id. - Id: string option -} with - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector - - interface ILinkedEditingRangeOptions - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress +type LinkedEditingRanges = + { + /// A list of ranges that can be edited together. The ranges must have + /// identical length and contain identical text content. The ranges cannot overlap. + Ranges: Range[] + /// An optional word pattern (regular expression) that describes valid contents for + /// the given ranges. If no pattern is provided, the client configuration's word + /// pattern will be used. + WordPattern: string option + } + +type LinkedEditingRangeRegistrationOptions = + { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + WorkDoneProgress: bool option + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + Id: string option + } + + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector + + interface ILinkedEditingRangeOptions + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// The parameters sent in notifications/requests for user-initiated creation of /// files. /// /// @since 3.16.0 -type CreateFilesParams = { - /// An array of all files/folders created in this operation. - Files: FileCreate[] -} +type CreateFilesParams = + { + /// An array of all files/folders created in this operation. + Files: FileCreate[] + } /// A workspace edit represents changes to many resources managed in the workspace. The edit /// should either provide `changes` or `documentChanges`. If documentChanges are present @@ -1168,393 +1201,408 @@ type CreateFilesParams = { /// An invalid sequence (e.g. (1) delete file a.txt and (2) insert text into file a.txt) will /// cause failure of the operation. How the client recovers from the failure is described by /// the client capability: `workspace.workspaceEdit.failureHandling` -type WorkspaceEdit = { - /// Holds changes to existing resources. - Changes: Map option - /// Depending on the client capability `workspace.workspaceEdit.resourceOperations` document changes - /// are either an array of `TextDocumentEdit`s to express changes to n different text documents - /// where each text document edit addresses a specific version of a text document. Or it can contain - /// above `TextDocumentEdit`s mixed with create, rename and delete file / folder operations. - /// - /// Whether a client supports versioned document edits is expressed via - /// `workspace.workspaceEdit.documentChanges` client capability. - /// - /// If a client neither supports `documentChanges` nor `workspace.workspaceEdit.resourceOperations` then - /// only plain `TextEdit`s using the `changes` property are supported. - DocumentChanges: U4[] option - /// A map of change annotations that can be referenced in `AnnotatedTextEdit`s or create, rename and - /// delete file / folder operations. - /// - /// Whether clients honor this property depends on the client capability `workspace.changeAnnotationSupport`. - /// - /// @since 3.16.0 - ChangeAnnotations: Map option -} +type WorkspaceEdit = + { + /// Holds changes to existing resources. + Changes: Map option + /// Depending on the client capability `workspace.workspaceEdit.resourceOperations` document changes + /// are either an array of `TextDocumentEdit`s to express changes to n different text documents + /// where each text document edit addresses a specific version of a text document. Or it can contain + /// above `TextDocumentEdit`s mixed with create, rename and delete file / folder operations. + /// + /// Whether a client supports versioned document edits is expressed via + /// `workspace.workspaceEdit.documentChanges` client capability. + /// + /// If a client neither supports `documentChanges` nor `workspace.workspaceEdit.resourceOperations` then + /// only plain `TextEdit`s using the `changes` property are supported. + DocumentChanges: U4[] option + /// A map of change annotations that can be referenced in `AnnotatedTextEdit`s or create, rename and + /// delete file / folder operations. + /// + /// Whether clients honor this property depends on the client capability `workspace.changeAnnotationSupport`. + /// + /// @since 3.16.0 + ChangeAnnotations: Map option + } /// The options to register for file operations. /// /// @since 3.16.0 -type FileOperationRegistrationOptions = { - /// The actual filters. - Filters: FileOperationFilter[] -} +type FileOperationRegistrationOptions = + { + /// The actual filters. + Filters: FileOperationFilter[] + } /// The parameters sent in notifications/requests for user-initiated renames of /// files. /// /// @since 3.16.0 -type RenameFilesParams = { - /// An array of all files/folders renamed in this operation. When a folder is renamed, only - /// the folder will be included, and not its children. - Files: FileRename[] -} +type RenameFilesParams = + { + /// An array of all files/folders renamed in this operation. When a folder is renamed, only + /// the folder will be included, and not its children. + Files: FileRename[] + } /// The parameters sent in notifications/requests for user-initiated deletes of /// files. /// /// @since 3.16.0 -type DeleteFilesParams = { - /// An array of all files/folders deleted in this operation. - Files: FileDelete[] -} - -type MonikerParams = { - /// The text document. - TextDocument: TextDocumentIdentifier - /// The position inside the text document. - Position: Position - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - PartialResultToken: ProgressToken option -} with - - interface ITextDocumentPositionParams with - /// The text document. - member x.TextDocument = x.TextDocument - /// The position inside the text document. - member x.Position = x.Position - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken - - interface IPartialResultParams with - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - member x.PartialResultToken = x.PartialResultToken +type DeleteFilesParams = + { + /// An array of all files/folders deleted in this operation. + Files: FileDelete[] + } + +type MonikerParams = + { + /// The text document. + TextDocument: TextDocumentIdentifier + /// The position inside the text document. + Position: Position + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + PartialResultToken: ProgressToken option + } + + interface ITextDocumentPositionParams with + /// The text document. + member x.TextDocument = x.TextDocument + /// The position inside the text document. + member x.Position = x.Position + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + + interface IPartialResultParams with + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + member x.PartialResultToken = x.PartialResultToken /// Moniker definition to match LSIF 0.5 moniker definition. /// /// @since 3.16.0 -type Moniker = { - /// The scheme of the moniker. For example tsc or .Net - Scheme: string - /// The identifier of the moniker. The value is opaque in LSIF however - /// schema owners are allowed to define the structure if they want. - Identifier: string - /// The scope in which the moniker is unique - Unique: UniquenessLevel - /// The moniker kind if known. - Kind: MonikerKind option -} - -type MonikerRegistrationOptions = { - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - WorkDoneProgress: bool option -} with - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector - - interface IMonikerOptions - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress +type Moniker = + { + /// The scheme of the moniker. For example tsc or .Net + Scheme: string + /// The identifier of the moniker. The value is opaque in LSIF however + /// schema owners are allowed to define the structure if they want. + Identifier: string + /// The scope in which the moniker is unique + Unique: UniquenessLevel + /// The moniker kind if known. + Kind: MonikerKind option + } + +type MonikerRegistrationOptions = + { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + WorkDoneProgress: bool option + } + + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector + + interface IMonikerOptions + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// The parameter of a `textDocument/prepareTypeHierarchy` request. /// /// @since 3.17.0 -type TypeHierarchyPrepareParams = { - /// The text document. - TextDocument: TextDocumentIdentifier - /// The position inside the text document. - Position: Position - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option -} with - - interface ITextDocumentPositionParams with - /// The text document. - member x.TextDocument = x.TextDocument - /// The position inside the text document. - member x.Position = x.Position - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken +type TypeHierarchyPrepareParams = + { + /// The text document. + TextDocument: TextDocumentIdentifier + /// The position inside the text document. + Position: Position + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + } + + interface ITextDocumentPositionParams with + /// The text document. + member x.TextDocument = x.TextDocument + /// The position inside the text document. + member x.Position = x.Position + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken /// @since 3.17.0 -type TypeHierarchyItem = { - /// The name of this item. - Name: string - /// The kind of this item. - Kind: SymbolKind - /// Tags for this item. - Tags: SymbolTag[] option - /// More detail for this item, e.g. the signature of a function. - Detail: string option - /// The resource identifier of this item. - Uri: DocumentUri - /// The range enclosing this symbol not including leading/trailing whitespace - /// but everything else, e.g. comments and code. - Range: Range - /// The range that should be selected and revealed when this symbol is being - /// picked, e.g. the name of a function. Must be contained by the - /// {@link TypeHierarchyItem.range `range`}. - SelectionRange: Range - /// A data entry field that is preserved between a type hierarchy prepare and - /// supertypes or subtypes requests. It could also be used to identify the - /// type hierarchy in the server, helping improve the performance on - /// resolving supertypes and subtypes. - Data: LSPAny option -} +type TypeHierarchyItem = + { + /// The name of this item. + Name: string + /// The kind of this item. + Kind: SymbolKind + /// Tags for this item. + Tags: SymbolTag[] option + /// More detail for this item, e.g. the signature of a function. + Detail: string option + /// The resource identifier of this item. + Uri: DocumentUri + /// The range enclosing this symbol not including leading/trailing whitespace + /// but everything else, e.g. comments and code. + Range: Range + /// The range that should be selected and revealed when this symbol is being + /// picked, e.g. the name of a function. Must be contained by the + /// {@link TypeHierarchyItem.range `range`}. + SelectionRange: Range + /// A data entry field that is preserved between a type hierarchy prepare and + /// supertypes or subtypes requests. It could also be used to identify the + /// type hierarchy in the server, helping improve the performance on + /// resolving supertypes and subtypes. + Data: LSPAny option + } /// Type hierarchy options used during static or dynamic registration. /// /// @since 3.17.0 -type TypeHierarchyRegistrationOptions = { - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - WorkDoneProgress: bool option - /// The id used to register the request. The id can be used to deregister - /// the request again. See also Registration#id. - Id: string option -} with - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector - - interface ITypeHierarchyOptions - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress +type TypeHierarchyRegistrationOptions = + { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + WorkDoneProgress: bool option + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + Id: string option + } + + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector + + interface ITypeHierarchyOptions + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// The parameter of a `typeHierarchy/supertypes` request. /// /// @since 3.17.0 -type TypeHierarchySupertypesParams = { - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - PartialResultToken: ProgressToken option - Item: TypeHierarchyItem -} with - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken - - interface IPartialResultParams with - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - member x.PartialResultToken = x.PartialResultToken +type TypeHierarchySupertypesParams = + { + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + PartialResultToken: ProgressToken option + Item: TypeHierarchyItem + } + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + + interface IPartialResultParams with + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + member x.PartialResultToken = x.PartialResultToken /// The parameter of a `typeHierarchy/subtypes` request. /// /// @since 3.17.0 -type TypeHierarchySubtypesParams = { - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - PartialResultToken: ProgressToken option - Item: TypeHierarchyItem -} with - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken - - interface IPartialResultParams with - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - member x.PartialResultToken = x.PartialResultToken +type TypeHierarchySubtypesParams = + { + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + PartialResultToken: ProgressToken option + Item: TypeHierarchyItem + } + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + + interface IPartialResultParams with + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + member x.PartialResultToken = x.PartialResultToken /// A parameter literal used in inline value requests. /// /// @since 3.17.0 -type InlineValueParams = { - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// The text document. - TextDocument: TextDocumentIdentifier - /// The document range for which inline values should be computed. - Range: Range - /// Additional information about the context in which inline values were - /// requested. - Context: InlineValueContext -} with - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken +type InlineValueParams = + { + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// The text document. + TextDocument: TextDocumentIdentifier + /// The document range for which inline values should be computed. + Range: Range + /// Additional information about the context in which inline values were + /// requested. + Context: InlineValueContext + } + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken /// Inline value options used during static or dynamic registration. /// /// @since 3.17.0 -type InlineValueRegistrationOptions = { - WorkDoneProgress: bool option - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - /// The id used to register the request. The id can be used to deregister - /// the request again. See also Registration#id. - Id: string option -} with - - interface IInlineValueOptions - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector +type InlineValueRegistrationOptions = + { + WorkDoneProgress: bool option + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + Id: string option + } + + interface IInlineValueOptions + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress + + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector /// A parameter literal used in inlay hint requests. /// /// @since 3.17.0 -type InlayHintParams = { - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// The text document. - TextDocument: TextDocumentIdentifier - /// The document range for which inlay hints should be computed. - Range: Range -} with - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken +type InlayHintParams = + { + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// The text document. + TextDocument: TextDocumentIdentifier + /// The document range for which inlay hints should be computed. + Range: Range + } + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken /// Inlay hint information. /// /// @since 3.17.0 -type InlayHint = { - /// The position of this hint. - /// - /// If multiple hints have the same position, they will be shown in the order - /// they appear in the response. - Position: Position - /// The label of this hint. A human readable string or an array of - /// InlayHintLabelPart label parts. - /// - /// *Note* that neither the string nor the label part can be empty. - Label: U2 - /// The kind of this hint. Can be omitted in which case the client - /// should fall back to a reasonable default. - Kind: InlayHintKind option - /// Optional text edits that are performed when accepting this inlay hint. - /// - /// *Note* that edits are expected to change the document so that the inlay - /// hint (or its nearest variant) is now part of the document and the inlay - /// hint itself is now obsolete. - TextEdits: TextEdit[] option - /// The tooltip text when you hover over this item. - Tooltip: U2 option - /// Render padding before the hint. - /// - /// Note: Padding should use the editor's background color, not the - /// background color of the hint itself. That means padding can be used - /// to visually align/separate an inlay hint. - PaddingLeft: bool option - /// Render padding after the hint. - /// - /// Note: Padding should use the editor's background color, not the - /// background color of the hint itself. That means padding can be used - /// to visually align/separate an inlay hint. - PaddingRight: bool option - /// A data entry field that is preserved on an inlay hint between - /// a `textDocument/inlayHint` and a `inlayHint/resolve` request. - Data: LSPAny option -} +type InlayHint = + { + /// The position of this hint. + /// + /// If multiple hints have the same position, they will be shown in the order + /// they appear in the response. + Position: Position + /// The label of this hint. A human readable string or an array of + /// InlayHintLabelPart label parts. + /// + /// *Note* that neither the string nor the label part can be empty. + Label: U2 + /// The kind of this hint. Can be omitted in which case the client + /// should fall back to a reasonable default. + Kind: InlayHintKind option + /// Optional text edits that are performed when accepting this inlay hint. + /// + /// *Note* that edits are expected to change the document so that the inlay + /// hint (or its nearest variant) is now part of the document and the inlay + /// hint itself is now obsolete. + TextEdits: TextEdit[] option + /// The tooltip text when you hover over this item. + Tooltip: U2 option + /// Render padding before the hint. + /// + /// Note: Padding should use the editor's background color, not the + /// background color of the hint itself. That means padding can be used + /// to visually align/separate an inlay hint. + PaddingLeft: bool option + /// Render padding after the hint. + /// + /// Note: Padding should use the editor's background color, not the + /// background color of the hint itself. That means padding can be used + /// to visually align/separate an inlay hint. + PaddingRight: bool option + /// A data entry field that is preserved on an inlay hint between + /// a `textDocument/inlayHint` and a `inlayHint/resolve` request. + Data: LSPAny option + } /// Inlay hint options used during static or dynamic registration. /// /// @since 3.17.0 -type InlayHintRegistrationOptions = { - WorkDoneProgress: bool option - /// The server provides support to resolve additional - /// information for an inlay hint item. - ResolveProvider: bool option - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - /// The id used to register the request. The id can be used to deregister - /// the request again. See also Registration#id. - Id: string option -} with - - interface IInlayHintOptions with - /// The server provides support to resolve additional - /// information for an inlay hint item. - member x.ResolveProvider = x.ResolveProvider - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector +type InlayHintRegistrationOptions = + { + WorkDoneProgress: bool option + /// The server provides support to resolve additional + /// information for an inlay hint item. + ResolveProvider: bool option + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + Id: string option + } + + interface IInlayHintOptions with + /// The server provides support to resolve additional + /// information for an inlay hint item. + member x.ResolveProvider = x.ResolveProvider + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress + + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector /// Parameters of the document diagnostic request. /// /// @since 3.17.0 -type DocumentDiagnosticParams = { - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - PartialResultToken: ProgressToken option - /// The text document. - TextDocument: TextDocumentIdentifier - /// The additional identifier provided during registration. - Identifier: string option - /// The result id of a previous response if provided. - PreviousResultId: string option -} with - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken - - interface IPartialResultParams with - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - member x.PartialResultToken = x.PartialResultToken +type DocumentDiagnosticParams = + { + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + PartialResultToken: ProgressToken option + /// The text document. + TextDocument: TextDocumentIdentifier + /// The additional identifier provided during registration. + Identifier: string option + /// The result id of a previous response if provided. + PreviousResultId: string option + } + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + + interface IPartialResultParams with + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + member x.PartialResultToken = x.PartialResultToken /// A partial result for a document diagnostic report. /// /// @since 3.17.0 -type DocumentDiagnosticReportPartialResult = { - RelatedDocuments: Map> -} +type DocumentDiagnosticReportPartialResult = + { + RelatedDocuments: Map> + } /// Cancellation data returned from a diagnostic request. /// @@ -1564,71 +1612,72 @@ type DiagnosticServerCancellationData = { RetriggerRequest: bool } /// Diagnostic registration options. /// /// @since 3.17.0 -type DiagnosticRegistrationOptions = { - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - WorkDoneProgress: bool option - /// An optional identifier under which the diagnostics are - /// managed by the client. - Identifier: string option - /// Whether the language has inter file dependencies meaning that - /// editing code in one file can result in a different diagnostic - /// set in another file. Inter file dependencies are common for - /// most programming languages and typically uncommon for linters. - InterFileDependencies: bool - /// The server provides support for workspace diagnostics as well. - WorkspaceDiagnostics: bool - /// The id used to register the request. The id can be used to deregister - /// the request again. See also Registration#id. - Id: string option -} with - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector - - interface IDiagnosticOptions with - /// An optional identifier under which the diagnostics are - /// managed by the client. - member x.Identifier = x.Identifier - /// Whether the language has inter file dependencies meaning that - /// editing code in one file can result in a different diagnostic - /// set in another file. Inter file dependencies are common for - /// most programming languages and typically uncommon for linters. - member x.InterFileDependencies = x.InterFileDependencies - /// The server provides support for workspace diagnostics as well. - member x.WorkspaceDiagnostics = x.WorkspaceDiagnostics - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress +type DiagnosticRegistrationOptions = + { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + WorkDoneProgress: bool option + /// An optional identifier under which the diagnostics are + /// managed by the client. + Identifier: string option + /// Whether the language has inter file dependencies meaning that + /// editing code in one file can result in a different diagnostic + /// set in another file. Inter file dependencies are common for + /// most programming languages and typically uncommon for linters. + InterFileDependencies: bool + /// The server provides support for workspace diagnostics as well. + WorkspaceDiagnostics: bool + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + Id: string option + } + + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector + + interface IDiagnosticOptions with + /// An optional identifier under which the diagnostics are + /// managed by the client. + member x.Identifier = x.Identifier + /// Whether the language has inter file dependencies meaning that + /// editing code in one file can result in a different diagnostic + /// set in another file. Inter file dependencies are common for + /// most programming languages and typically uncommon for linters. + member x.InterFileDependencies = x.InterFileDependencies + /// The server provides support for workspace diagnostics as well. + member x.WorkspaceDiagnostics = x.WorkspaceDiagnostics + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// Parameters of the workspace diagnostic request. /// /// @since 3.17.0 -type WorkspaceDiagnosticParams = { - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - PartialResultToken: ProgressToken option - /// The additional identifier provided during registration. - Identifier: string option - /// The currently known diagnostic reports with their - /// previous result ids. - PreviousResultIds: PreviousResultId[] -} with - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken - - interface IPartialResultParams with - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - member x.PartialResultToken = x.PartialResultToken +type WorkspaceDiagnosticParams = + { + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + PartialResultToken: ProgressToken option + /// The additional identifier provided during registration. + Identifier: string option + /// The currently known diagnostic reports with their + /// previous result ids. + PreviousResultIds: PreviousResultId[] + } + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + + interface IPartialResultParams with + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + member x.PartialResultToken = x.PartialResultToken /// A workspace diagnostic report. /// @@ -1642,1214 +1691,1256 @@ type WorkspaceDiagnosticReportPartialResult = { Items: WorkspaceDocumentDiagnost /// The params sent in an open notebook document notification. /// /// @since 3.17.0 -type DidOpenNotebookDocumentParams = { - /// The notebook document that got opened. - NotebookDocument: NotebookDocument - /// The text documents that represent the content - /// of a notebook cell. - CellTextDocuments: TextDocumentItem[] -} +type DidOpenNotebookDocumentParams = + { + /// The notebook document that got opened. + NotebookDocument: NotebookDocument + /// The text documents that represent the content + /// of a notebook cell. + CellTextDocuments: TextDocumentItem[] + } /// The params sent in a change notebook document notification. /// /// @since 3.17.0 -type DidChangeNotebookDocumentParams = { - /// The notebook document that did change. The version number points - /// to the version after all provided changes have been applied. If - /// only the text document content of a cell changes the notebook version - /// doesn't necessarily have to change. - NotebookDocument: VersionedNotebookDocumentIdentifier - /// The actual changes to the notebook document. - /// - /// The changes describe single state changes to the notebook document. - /// So if there are two changes c1 (at array index 0) and c2 (at array - /// index 1) for a notebook in state S then c1 moves the notebook from - /// S to S' and c2 from S' to S''. So c1 is computed on the state S and - /// c2 is computed on the state S'. - /// - /// To mirror the content of a notebook using change events use the following approach: - /// - start with the same initial content - /// - apply the 'notebookDocument/didChange' notifications in the order you receive them. - /// - apply the `NotebookChangeEvent`s in a single notification in the order - /// you receive them. - Change: NotebookDocumentChangeEvent -} +type DidChangeNotebookDocumentParams = + { + /// The notebook document that did change. The version number points + /// to the version after all provided changes have been applied. If + /// only the text document content of a cell changes the notebook version + /// doesn't necessarily have to change. + NotebookDocument: VersionedNotebookDocumentIdentifier + /// The actual changes to the notebook document. + /// + /// The changes describe single state changes to the notebook document. + /// So if there are two changes c1 (at array index 0) and c2 (at array + /// index 1) for a notebook in state S then c1 moves the notebook from + /// S to S' and c2 from S' to S''. So c1 is computed on the state S and + /// c2 is computed on the state S'. + /// + /// To mirror the content of a notebook using change events use the following approach: + /// - start with the same initial content + /// - apply the 'notebookDocument/didChange' notifications in the order you receive them. + /// - apply the `NotebookChangeEvent`s in a single notification in the order + /// you receive them. + Change: NotebookDocumentChangeEvent + } /// The params sent in a save notebook document notification. /// /// @since 3.17.0 -type DidSaveNotebookDocumentParams = { - /// The notebook document that got saved. - NotebookDocument: NotebookDocumentIdentifier -} +type DidSaveNotebookDocumentParams = + { + /// The notebook document that got saved. + NotebookDocument: NotebookDocumentIdentifier + } /// The params sent in a close notebook document notification. /// /// @since 3.17.0 -type DidCloseNotebookDocumentParams = { - /// The notebook document that got closed. - NotebookDocument: NotebookDocumentIdentifier - /// The text documents that represent the content - /// of a notebook cell that got closed. - CellTextDocuments: TextDocumentIdentifier[] -} +type DidCloseNotebookDocumentParams = + { + /// The notebook document that got closed. + NotebookDocument: NotebookDocumentIdentifier + /// The text documents that represent the content + /// of a notebook cell that got closed. + CellTextDocuments: TextDocumentIdentifier[] + } type RegistrationParams = { Registrations: Registration[] } type UnregistrationParams = { Unregisterations: Unregistration[] } -type _InitializeParamsClientInfo = { - /// The name of the client as defined by the client. - Name: string - /// The client's version as defined by the client. - Version: string option -} - -type InitializeParams = { - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// The process Id of the parent process that started - /// the server. - /// - /// Is `null` if the process has not been started by another process. - /// If the parent process is not alive then the server should exit. - [] - ProcessId: int32 option - /// Information about the client - /// - /// @since 3.15.0 - ClientInfo: _InitializeParamsClientInfo option - /// The locale the client is currently showing the user interface - /// in. This must not necessarily be the locale of the operating - /// system. - /// - /// Uses IETF language tags as the value's syntax - /// (See https://en.wikipedia.org/wiki/IETF_language_tag) - /// - /// @since 3.16.0 - Locale: string option - /// The rootPath of the workspace. Is null - /// if no folder is open. - /// - /// @deprecated in favour of rootUri. - RootPath: string option - /// The rootUri of the workspace. Is null if no - /// folder is open. If both `rootPath` and `rootUri` are set - /// `rootUri` wins. - /// - /// @deprecated in favour of workspaceFolders. - [] - RootUri: DocumentUri option - /// The capabilities provided by the client (editor or tool) - Capabilities: ClientCapabilities - /// User provided initialization options. - InitializationOptions: LSPAny option - /// The initial trace setting. If omitted trace is disabled ('off'). - Trace: TraceValues option - /// The workspace folders configured in the client when the server starts. - /// - /// This property is only available if the client supports workspace folders. - /// It can be `null` if the client supports workspace folders but none are - /// configured. - /// - /// @since 3.6.0 - WorkspaceFolders: WorkspaceFolder[] option -} with - - interface I_InitializeParams with - /// The process Id of the parent process that started - /// the server. - /// - /// Is `null` if the process has not been started by another process. - /// If the parent process is not alive then the server should exit. - member x.ProcessId = x.ProcessId - /// Information about the client - /// - /// @since 3.15.0 - member x.ClientInfo = x.ClientInfo - /// The locale the client is currently showing the user interface - /// in. This must not necessarily be the locale of the operating - /// system. - /// - /// Uses IETF language tags as the value's syntax - /// (See https://en.wikipedia.org/wiki/IETF_language_tag) - /// - /// @since 3.16.0 - member x.Locale = x.Locale - /// The rootPath of the workspace. Is null - /// if no folder is open. - /// - /// @deprecated in favour of rootUri. - member x.RootPath = x.RootPath - /// The rootUri of the workspace. Is null if no - /// folder is open. If both `rootPath` and `rootUri` are set - /// `rootUri` wins. - /// - /// @deprecated in favour of workspaceFolders. - member x.RootUri = x.RootUri - /// The capabilities provided by the client (editor or tool) - member x.Capabilities = x.Capabilities - /// User provided initialization options. - member x.InitializationOptions = x.InitializationOptions - /// The initial trace setting. If omitted trace is disabled ('off'). - member x.Trace = x.Trace - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken - - interface IWorkspaceFoldersInitializeParams with - /// The workspace folders configured in the client when the server starts. - /// - /// This property is only available if the client supports workspace folders. - /// It can be `null` if the client supports workspace folders but none are - /// configured. - /// - /// @since 3.6.0 - member x.WorkspaceFolders = x.WorkspaceFolders - -type InitializeResultServerInfo = { - /// The name of the server as defined by the server. - Name: string - /// The server's version as defined by the server. - Version: string option -} +type _InitializeParamsClientInfo = + { + /// The name of the client as defined by the client. + Name: string + /// The client's version as defined by the client. + Version: string option + } + +type InitializeParams = + { + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// The process Id of the parent process that started + /// the server. + /// + /// Is `null` if the process has not been started by another process. + /// If the parent process is not alive then the server should exit. + ProcessId: int32 option + /// Information about the client + /// + /// @since 3.15.0 + ClientInfo: _InitializeParamsClientInfo option + /// The locale the client is currently showing the user interface + /// in. This must not necessarily be the locale of the operating + /// system. + /// + /// Uses IETF language tags as the value's syntax + /// (See https://en.wikipedia.org/wiki/IETF_language_tag) + /// + /// @since 3.16.0 + Locale: string option + /// The rootPath of the workspace. Is null + /// if no folder is open. + /// + /// @deprecated in favour of rootUri. + RootPath: string option + /// The rootUri of the workspace. Is null if no + /// folder is open. If both `rootPath` and `rootUri` are set + /// `rootUri` wins. + /// + /// @deprecated in favour of workspaceFolders. + RootUri: DocumentUri option + /// The capabilities provided by the client (editor or tool) + Capabilities: ClientCapabilities + /// User provided initialization options. + InitializationOptions: LSPAny option + /// The initial trace setting. If omitted trace is disabled ('off'). + Trace: TraceValues option + /// The workspace folders configured in the client when the server starts. + /// + /// This property is only available if the client supports workspace folders. + /// It can be `null` if the client supports workspace folders but none are + /// configured. + /// + /// @since 3.6.0 + WorkspaceFolders: WorkspaceFolder[] option + } + + interface I_InitializeParams with + /// The process Id of the parent process that started + /// the server. + /// + /// Is `null` if the process has not been started by another process. + /// If the parent process is not alive then the server should exit. + member x.ProcessId = x.ProcessId + /// Information about the client + /// + /// @since 3.15.0 + member x.ClientInfo = x.ClientInfo + /// The locale the client is currently showing the user interface + /// in. This must not necessarily be the locale of the operating + /// system. + /// + /// Uses IETF language tags as the value's syntax + /// (See https://en.wikipedia.org/wiki/IETF_language_tag) + /// + /// @since 3.16.0 + member x.Locale = x.Locale + /// The rootPath of the workspace. Is null + /// if no folder is open. + /// + /// @deprecated in favour of rootUri. + member x.RootPath = x.RootPath + /// The rootUri of the workspace. Is null if no + /// folder is open. If both `rootPath` and `rootUri` are set + /// `rootUri` wins. + /// + /// @deprecated in favour of workspaceFolders. + member x.RootUri = x.RootUri + /// The capabilities provided by the client (editor or tool) + member x.Capabilities = x.Capabilities + /// User provided initialization options. + member x.InitializationOptions = x.InitializationOptions + /// The initial trace setting. If omitted trace is disabled ('off'). + member x.Trace = x.Trace + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + + interface IWorkspaceFoldersInitializeParams with + /// The workspace folders configured in the client when the server starts. + /// + /// This property is only available if the client supports workspace folders. + /// It can be `null` if the client supports workspace folders but none are + /// configured. + /// + /// @since 3.6.0 + member x.WorkspaceFolders = x.WorkspaceFolders + +type InitializeResultServerInfo = + { + /// The name of the server as defined by the server. + Name: string + /// The server's version as defined by the server. + Version: string option + } /// The result returned from an initialize request. -type InitializeResult = { - /// The capabilities the language server provides. - Capabilities: ServerCapabilities - /// Information about the server. - /// - /// @since 3.15.0 - ServerInfo: InitializeResultServerInfo option -} +type InitializeResult = + { + /// The capabilities the language server provides. + Capabilities: ServerCapabilities + /// Information about the server. + /// + /// @since 3.15.0 + ServerInfo: InitializeResultServerInfo option + } /// The data type of the ResponseError if the /// initialize request fails. -type InitializeError = { - /// Indicates whether the client execute the following retry logic: - /// (1) show the message provided by the ResponseError to the user - /// (2) user selects retry or cancel - /// (3) if user selected retry the initialize method is sent again. - Retry: bool -} +type InitializeError = + { + /// Indicates whether the client execute the following retry logic: + /// (1) show the message provided by the ResponseError to the user + /// (2) user selects retry or cancel + /// (3) if user selected retry the initialize method is sent again. + Retry: bool + } /// The parameters of a change configuration notification. -type DidChangeConfigurationParams = { - /// The actual changed settings - Settings: LSPAny -} +type DidChangeConfigurationParams = + { + /// The actual changed settings + Settings: LSPAny + } type DidChangeConfigurationRegistrationOptions = { Section: U2 option } /// The parameters of a notification message. -type ShowMessageParams = { - /// The message type. See {@link MessageType} - Type: MessageType - /// The actual message. - Message: string -} - -type ShowMessageRequestParams = { - /// The message type. See {@link MessageType} - Type: MessageType - /// The actual message. - Message: string - /// The message action items to present. - Actions: MessageActionItem[] option -} - -type MessageActionItem = { - /// A short title like 'Retry', 'Open Log' etc. - Title: string -} +type ShowMessageParams = + { + /// The message type. See {@link MessageType} + Type: MessageType + /// The actual message. + Message: string + } + +type ShowMessageRequestParams = + { + /// The message type. See {@link MessageType} + Type: MessageType + /// The actual message. + Message: string + /// The message action items to present. + Actions: MessageActionItem[] option + } + +type MessageActionItem = + { + /// A short title like 'Retry', 'Open Log' etc. + Title: string + } /// The log message parameters. -type LogMessageParams = { - /// The message type. See {@link MessageType} - Type: MessageType - /// The actual message. - Message: string -} +type LogMessageParams = + { + /// The message type. See {@link MessageType} + Type: MessageType + /// The actual message. + Message: string + } /// The parameters sent in an open text document notification -type DidOpenTextDocumentParams = { - /// The document that was opened. - TextDocument: TextDocumentItem -} +type DidOpenTextDocumentParams = + { + /// The document that was opened. + TextDocument: TextDocumentItem + } /// The change text document notification's parameters. -type DidChangeTextDocumentParams = { - /// The document that did change. The version number points - /// to the version after all provided content changes have - /// been applied. - TextDocument: VersionedTextDocumentIdentifier - /// The actual content changes. The content changes describe single state changes - /// to the document. So if there are two content changes c1 (at array index 0) and - /// c2 (at array index 1) for a document in state S then c1 moves the document from - /// S to S' and c2 from S' to S''. So c1 is computed on the state S and c2 is computed - /// on the state S'. - /// - /// To mirror the content of a document using change events use the following approach: - /// - start with the same initial content - /// - apply the 'textDocument/didChange' notifications in the order you receive them. - /// - apply the `TextDocumentContentChangeEvent`s in a single notification in the order - /// you receive them. - ContentChanges: TextDocumentContentChangeEvent[] -} +type DidChangeTextDocumentParams = + { + /// The document that did change. The version number points + /// to the version after all provided content changes have + /// been applied. + TextDocument: VersionedTextDocumentIdentifier + /// The actual content changes. The content changes describe single state changes + /// to the document. So if there are two content changes c1 (at array index 0) and + /// c2 (at array index 1) for a document in state S then c1 moves the document from + /// S to S' and c2 from S' to S''. So c1 is computed on the state S and c2 is computed + /// on the state S'. + /// + /// To mirror the content of a document using change events use the following approach: + /// - start with the same initial content + /// - apply the 'textDocument/didChange' notifications in the order you receive them. + /// - apply the `TextDocumentContentChangeEvent`s in a single notification in the order + /// you receive them. + ContentChanges: TextDocumentContentChangeEvent[] + } /// Describe options to be used when registered for text document change events. -type TextDocumentChangeRegistrationOptions = { - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - /// How documents are synced to the server. - SyncKind: TextDocumentSyncKind -} with - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector +type TextDocumentChangeRegistrationOptions = + { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + /// How documents are synced to the server. + SyncKind: TextDocumentSyncKind + } + + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector /// The parameters sent in a close text document notification -type DidCloseTextDocumentParams = { - /// The document that was closed. - TextDocument: TextDocumentIdentifier -} +type DidCloseTextDocumentParams = + { + /// The document that was closed. + TextDocument: TextDocumentIdentifier + } /// The parameters sent in a save text document notification -type DidSaveTextDocumentParams = { - /// The document that was saved. - TextDocument: TextDocumentIdentifier - /// Optional the content when saved. Depends on the includeText value - /// when the save notification was requested. - Text: string option -} +type DidSaveTextDocumentParams = + { + /// The document that was saved. + TextDocument: TextDocumentIdentifier + /// Optional the content when saved. Depends on the includeText value + /// when the save notification was requested. + Text: string option + } /// Save registration options. -type TextDocumentSaveRegistrationOptions = { - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - /// The client is supposed to include the content on save. - IncludeText: bool option -} with - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector - - interface ISaveOptions with - /// The client is supposed to include the content on save. - member x.IncludeText = x.IncludeText +type TextDocumentSaveRegistrationOptions = + { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + /// The client is supposed to include the content on save. + IncludeText: bool option + } + + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector + + interface ISaveOptions with + /// The client is supposed to include the content on save. + member x.IncludeText = x.IncludeText /// The parameters sent in a will save text document notification. -type WillSaveTextDocumentParams = { - /// The document that will be saved. - TextDocument: TextDocumentIdentifier - /// The 'TextDocumentSaveReason'. - Reason: TextDocumentSaveReason -} +type WillSaveTextDocumentParams = + { + /// The document that will be saved. + TextDocument: TextDocumentIdentifier + /// The 'TextDocumentSaveReason'. + Reason: TextDocumentSaveReason + } /// A text edit applicable to a text document. -type TextEdit = { - /// The range of the text document to be manipulated. To insert - /// text into a document create a range where start === end. - Range: Range - /// The string to be inserted. For delete operations use an - /// empty string. - NewText: string -} with - - interface ITextEdit with - /// The range of the text document to be manipulated. To insert - /// text into a document create a range where start === end. - member x.Range = x.Range - /// The string to be inserted. For delete operations use an - /// empty string. - member x.NewText = x.NewText +type TextEdit = + { + /// The range of the text document to be manipulated. To insert + /// text into a document create a range where start === end. + Range: Range + /// The string to be inserted. For delete operations use an + /// empty string. + NewText: string + } + + interface ITextEdit with + /// The range of the text document to be manipulated. To insert + /// text into a document create a range where start === end. + member x.Range = x.Range + /// The string to be inserted. For delete operations use an + /// empty string. + member x.NewText = x.NewText /// The watched files change notification's parameters. -type DidChangeWatchedFilesParams = { - /// The actual file events. - Changes: FileEvent[] -} +type DidChangeWatchedFilesParams = + { + /// The actual file events. + Changes: FileEvent[] + } /// Describe options to be used when registered for text document change events. -type DidChangeWatchedFilesRegistrationOptions = { - /// The watchers to register. - Watchers: FileSystemWatcher[] -} +type DidChangeWatchedFilesRegistrationOptions = + { + /// The watchers to register. + Watchers: FileSystemWatcher[] + } /// The publish diagnostic notification's parameters. -type PublishDiagnosticsParams = { - /// The URI for which diagnostic information is reported. - Uri: DocumentUri - /// Optional the version number of the document the diagnostics are published for. - /// - /// @since 3.15.0 - Version: int32 option - /// An array of diagnostic information items. - Diagnostics: Diagnostic[] -} +type PublishDiagnosticsParams = + { + /// The URI for which diagnostic information is reported. + Uri: DocumentUri + /// Optional the version number of the document the diagnostics are published for. + /// + /// @since 3.15.0 + Version: int32 option + /// An array of diagnostic information items. + Diagnostics: Diagnostic[] + } /// Completion parameters -type CompletionParams = { - /// The text document. - TextDocument: TextDocumentIdentifier - /// The position inside the text document. - Position: Position - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - PartialResultToken: ProgressToken option - /// The completion context. This is only available it the client specifies - /// to send this using the client capability `textDocument.completion.contextSupport === true` - Context: CompletionContext option -} with - - interface ITextDocumentPositionParams with - /// The text document. - member x.TextDocument = x.TextDocument - /// The position inside the text document. - member x.Position = x.Position - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken - - interface IPartialResultParams with - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - member x.PartialResultToken = x.PartialResultToken +type CompletionParams = + { + /// The text document. + TextDocument: TextDocumentIdentifier + /// The position inside the text document. + Position: Position + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + PartialResultToken: ProgressToken option + /// The completion context. This is only available it the client specifies + /// to send this using the client capability `textDocument.completion.contextSupport === true` + Context: CompletionContext option + } + + interface ITextDocumentPositionParams with + /// The text document. + member x.TextDocument = x.TextDocument + /// The position inside the text document. + member x.Position = x.Position + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + + interface IPartialResultParams with + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + member x.PartialResultToken = x.PartialResultToken /// A completion item represents a text snippet that is /// proposed to complete text that is being typed. -type CompletionItem = { - /// The label of this completion item. - /// - /// The label property is also by default the text that - /// is inserted when selecting this completion. - /// - /// If label details are provided the label itself should - /// be an unqualified name of the completion item. - Label: string - /// Additional details for the label - /// - /// @since 3.17.0 - LabelDetails: CompletionItemLabelDetails option - /// The kind of this completion item. Based of the kind - /// an icon is chosen by the editor. - Kind: CompletionItemKind option - /// Tags for this completion item. - /// - /// @since 3.15.0 - Tags: CompletionItemTag[] option - /// A human-readable string with additional information - /// about this item, like type or symbol information. - Detail: string option - /// A human-readable string that represents a doc-comment. - Documentation: U2 option - /// Indicates if this item is deprecated. - /// @deprecated Use `tags` instead. - Deprecated: bool option - /// Select this item when showing. - /// - /// *Note* that only one completion item can be selected and that the - /// tool / client decides which item that is. The rule is that the *first* - /// item of those that match best is selected. - Preselect: bool option - /// A string that should be used when comparing this item - /// with other items. When `falsy` the {@link CompletionItem.label label} - /// is used. - SortText: string option - /// A string that should be used when filtering a set of - /// completion items. When `falsy` the {@link CompletionItem.label label} - /// is used. - FilterText: string option - /// A string that should be inserted into a document when selecting - /// this completion. When `falsy` the {@link CompletionItem.label label} - /// is used. - /// - /// The `insertText` is subject to interpretation by the client side. - /// Some tools might not take the string literally. For example - /// VS Code when code complete is requested in this example - /// `con` and a completion item with an `insertText` of - /// `console` is provided it will only insert `sole`. Therefore it is - /// recommended to use `textEdit` instead since it avoids additional client - /// side interpretation. - InsertText: string option - /// The format of the insert text. The format applies to both the - /// `insertText` property and the `newText` property of a provided - /// `textEdit`. If omitted defaults to `InsertTextFormat.PlainText`. - /// - /// Please note that the insertTextFormat doesn't apply to - /// `additionalTextEdits`. - InsertTextFormat: InsertTextFormat option - /// How whitespace and indentation is handled during completion - /// item insertion. If not provided the clients default value depends on - /// the `textDocument.completion.insertTextMode` client capability. - /// - /// @since 3.16.0 - InsertTextMode: InsertTextMode option - /// An {@link TextEdit edit} which is applied to a document when selecting - /// this completion. When an edit is provided the value of - /// {@link CompletionItem.insertText insertText} is ignored. - /// - /// Most editors support two different operations when accepting a completion - /// item. One is to insert a completion text and the other is to replace an - /// existing text with a completion text. Since this can usually not be - /// predetermined by a server it can report both ranges. Clients need to - /// signal support for `InsertReplaceEdits` via the - /// `textDocument.completion.insertReplaceSupport` client capability - /// property. - /// - /// *Note 1:* The text edit's range as well as both ranges from an insert - /// replace edit must be a [single line] and they must contain the position - /// at which completion has been requested. - /// *Note 2:* If an `InsertReplaceEdit` is returned the edit's insert range - /// must be a prefix of the edit's replace range, that means it must be - /// contained and starting at the same position. - /// - /// @since 3.16.0 additional type `InsertReplaceEdit` - TextEdit: U2 option - /// The edit text used if the completion item is part of a CompletionList and - /// CompletionList defines an item default for the text edit range. - /// - /// Clients will only honor this property if they opt into completion list - /// item defaults using the capability `completionList.itemDefaults`. - /// - /// If not provided and a list's default range is provided the label - /// property is used as a text. - /// - /// @since 3.17.0 - TextEditText: string option - /// An optional array of additional {@link TextEdit text edits} that are applied when - /// selecting this completion. Edits must not overlap (including the same insert position) - /// with the main {@link CompletionItem.textEdit edit} nor with themselves. - /// - /// Additional text edits should be used to change text unrelated to the current cursor position - /// (for example adding an import statement at the top of the file if the completion item will - /// insert an unqualified type). - AdditionalTextEdits: TextEdit[] option - /// An optional set of characters that when pressed while this completion is active will accept it first and - /// then type that character. *Note* that all commit characters should have `length=1` and that superfluous - /// characters will be ignored. - CommitCharacters: string[] option - /// An optional {@link Command command} that is executed *after* inserting this completion. *Note* that - /// additional modifications to the current document should be described with the - /// {@link CompletionItem.additionalTextEdits additionalTextEdits}-property. - Command: Command option - /// A data entry field that is preserved on a completion item between a - /// {@link CompletionRequest} and a {@link CompletionResolveRequest}. - Data: LSPAny option -} - -type CompletionListItemDefaults = { - /// A default commit character set. - /// - /// @since 3.17.0 - CommitCharacters: string[] option - /// A default edit range. - /// - /// @since 3.17.0 - EditRange: U2 option - /// A default insert text format. - /// - /// @since 3.17.0 - InsertTextFormat: InsertTextFormat option - /// A default insert text mode. - /// - /// @since 3.17.0 - InsertTextMode: InsertTextMode option - /// A default data value. - /// - /// @since 3.17.0 - Data: LSPAny option -} +type CompletionItem = + { + /// The label of this completion item. + /// + /// The label property is also by default the text that + /// is inserted when selecting this completion. + /// + /// If label details are provided the label itself should + /// be an unqualified name of the completion item. + Label: string + /// Additional details for the label + /// + /// @since 3.17.0 + LabelDetails: CompletionItemLabelDetails option + /// The kind of this completion item. Based of the kind + /// an icon is chosen by the editor. + Kind: CompletionItemKind option + /// Tags for this completion item. + /// + /// @since 3.15.0 + Tags: CompletionItemTag[] option + /// A human-readable string with additional information + /// about this item, like type or symbol information. + Detail: string option + /// A human-readable string that represents a doc-comment. + Documentation: U2 option + /// Indicates if this item is deprecated. + /// @deprecated Use `tags` instead. + Deprecated: bool option + /// Select this item when showing. + /// + /// *Note* that only one completion item can be selected and that the + /// tool / client decides which item that is. The rule is that the *first* + /// item of those that match best is selected. + Preselect: bool option + /// A string that should be used when comparing this item + /// with other items. When `falsy` the {@link CompletionItem.label label} + /// is used. + SortText: string option + /// A string that should be used when filtering a set of + /// completion items. When `falsy` the {@link CompletionItem.label label} + /// is used. + FilterText: string option + /// A string that should be inserted into a document when selecting + /// this completion. When `falsy` the {@link CompletionItem.label label} + /// is used. + /// + /// The `insertText` is subject to interpretation by the client side. + /// Some tools might not take the string literally. For example + /// VS Code when code complete is requested in this example + /// `con` and a completion item with an `insertText` of + /// `console` is provided it will only insert `sole`. Therefore it is + /// recommended to use `textEdit` instead since it avoids additional client + /// side interpretation. + InsertText: string option + /// The format of the insert text. The format applies to both the + /// `insertText` property and the `newText` property of a provided + /// `textEdit`. If omitted defaults to `InsertTextFormat.PlainText`. + /// + /// Please note that the insertTextFormat doesn't apply to + /// `additionalTextEdits`. + InsertTextFormat: InsertTextFormat option + /// How whitespace and indentation is handled during completion + /// item insertion. If not provided the clients default value depends on + /// the `textDocument.completion.insertTextMode` client capability. + /// + /// @since 3.16.0 + InsertTextMode: InsertTextMode option + /// An {@link TextEdit edit} which is applied to a document when selecting + /// this completion. When an edit is provided the value of + /// {@link CompletionItem.insertText insertText} is ignored. + /// + /// Most editors support two different operations when accepting a completion + /// item. One is to insert a completion text and the other is to replace an + /// existing text with a completion text. Since this can usually not be + /// predetermined by a server it can report both ranges. Clients need to + /// signal support for `InsertReplaceEdits` via the + /// `textDocument.completion.insertReplaceSupport` client capability + /// property. + /// + /// *Note 1:* The text edit's range as well as both ranges from an insert + /// replace edit must be a [single line] and they must contain the position + /// at which completion has been requested. + /// *Note 2:* If an `InsertReplaceEdit` is returned the edit's insert range + /// must be a prefix of the edit's replace range, that means it must be + /// contained and starting at the same position. + /// + /// @since 3.16.0 additional type `InsertReplaceEdit` + TextEdit: U2 option + /// The edit text used if the completion item is part of a CompletionList and + /// CompletionList defines an item default for the text edit range. + /// + /// Clients will only honor this property if they opt into completion list + /// item defaults using the capability `completionList.itemDefaults`. + /// + /// If not provided and a list's default range is provided the label + /// property is used as a text. + /// + /// @since 3.17.0 + TextEditText: string option + /// An optional array of additional {@link TextEdit text edits} that are applied when + /// selecting this completion. Edits must not overlap (including the same insert position) + /// with the main {@link CompletionItem.textEdit edit} nor with themselves. + /// + /// Additional text edits should be used to change text unrelated to the current cursor position + /// (for example adding an import statement at the top of the file if the completion item will + /// insert an unqualified type). + AdditionalTextEdits: TextEdit[] option + /// An optional set of characters that when pressed while this completion is active will accept it first and + /// then type that character. *Note* that all commit characters should have `length=1` and that superfluous + /// characters will be ignored. + CommitCharacters: string[] option + /// An optional {@link Command command} that is executed *after* inserting this completion. *Note* that + /// additional modifications to the current document should be described with the + /// {@link CompletionItem.additionalTextEdits additionalTextEdits}-property. + Command: Command option + /// A data entry field that is preserved on a completion item between a + /// {@link CompletionRequest} and a {@link CompletionResolveRequest}. + Data: LSPAny option + } + +type CompletionListItemDefaults = + { + /// A default commit character set. + /// + /// @since 3.17.0 + CommitCharacters: string[] option + /// A default edit range. + /// + /// @since 3.17.0 + EditRange: U2 option + /// A default insert text format. + /// + /// @since 3.17.0 + InsertTextFormat: InsertTextFormat option + /// A default insert text mode. + /// + /// @since 3.17.0 + InsertTextMode: InsertTextMode option + /// A default data value. + /// + /// @since 3.17.0 + Data: LSPAny option + } type CompletionListItemDefaultsEditRangeC2 = { Insert: Range; Replace: Range } /// Represents a collection of {@link CompletionItem completion items} to be presented /// in the editor. -type CompletionList = { - /// This list it not complete. Further typing results in recomputing this list. - /// - /// Recomputed lists have all their items replaced (not appended) in the - /// incomplete completion sessions. - IsIncomplete: bool - /// In many cases the items of an actual completion result share the same - /// value for properties like `commitCharacters` or the range of a text - /// edit. A completion list can therefore define item defaults which will - /// be used if a completion item itself doesn't specify the value. - /// - /// If a completion list specifies a default value and a completion item - /// also specifies a corresponding value the one from the item is used. - /// - /// Servers are only allowed to return default values if the client - /// signals support for this via the `completionList.itemDefaults` - /// capability. - /// - /// @since 3.17.0 - ItemDefaults: CompletionListItemDefaults option - /// The completion items. - Items: CompletionItem[] -} - -type CompletionOptionsCompletionItem = { - /// The server has support for completion item label - /// details (see also `CompletionItemLabelDetails`) when - /// receiving a completion item in a resolve call. - /// - /// @since 3.17.0 - LabelDetailsSupport: bool option -} +type CompletionList = + { + /// This list it not complete. Further typing results in recomputing this list. + /// + /// Recomputed lists have all their items replaced (not appended) in the + /// incomplete completion sessions. + IsIncomplete: bool + /// In many cases the items of an actual completion result share the same + /// value for properties like `commitCharacters` or the range of a text + /// edit. A completion list can therefore define item defaults which will + /// be used if a completion item itself doesn't specify the value. + /// + /// If a completion list specifies a default value and a completion item + /// also specifies a corresponding value the one from the item is used. + /// + /// Servers are only allowed to return default values if the client + /// signals support for this via the `completionList.itemDefaults` + /// capability. + /// + /// @since 3.17.0 + ItemDefaults: CompletionListItemDefaults option + /// The completion items. + Items: CompletionItem[] + } + +type CompletionOptionsCompletionItem = + { + /// The server has support for completion item label + /// details (see also `CompletionItemLabelDetails`) when + /// receiving a completion item in a resolve call. + /// + /// @since 3.17.0 + LabelDetailsSupport: bool option + } /// Registration options for a {@link CompletionRequest}. -type CompletionRegistrationOptions = { - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - WorkDoneProgress: bool option - /// Most tools trigger completion request automatically without explicitly requesting - /// it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user - /// starts to type an identifier. For example if the user types `c` in a JavaScript file - /// code complete will automatically pop up present `console` besides others as a - /// completion item. Characters that make up identifiers don't need to be listed here. - /// - /// If code complete should automatically be trigger on characters not being valid inside - /// an identifier (for example `.` in JavaScript) list them in `triggerCharacters`. - TriggerCharacters: string[] option - /// The list of all possible characters that commit a completion. This field can be used - /// if clients don't support individual commit characters per completion item. See - /// `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport` - /// - /// If a server provides both `allCommitCharacters` and commit characters on an individual - /// completion item the ones on the completion item win. - /// - /// @since 3.2.0 - AllCommitCharacters: string[] option - /// The server provides support to resolve additional - /// information for a completion item. - ResolveProvider: bool option - /// The server supports the following `CompletionItem` specific - /// capabilities. - /// - /// @since 3.17.0 - CompletionItem: CompletionOptionsCompletionItem option -} with - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector - - interface ICompletionOptions with - /// Most tools trigger completion request automatically without explicitly requesting - /// it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user - /// starts to type an identifier. For example if the user types `c` in a JavaScript file - /// code complete will automatically pop up present `console` besides others as a - /// completion item. Characters that make up identifiers don't need to be listed here. - /// - /// If code complete should automatically be trigger on characters not being valid inside - /// an identifier (for example `.` in JavaScript) list them in `triggerCharacters`. - member x.TriggerCharacters = x.TriggerCharacters - /// The list of all possible characters that commit a completion. This field can be used - /// if clients don't support individual commit characters per completion item. See - /// `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport` - /// - /// If a server provides both `allCommitCharacters` and commit characters on an individual - /// completion item the ones on the completion item win. - /// - /// @since 3.2.0 - member x.AllCommitCharacters = x.AllCommitCharacters - /// The server provides support to resolve additional - /// information for a completion item. - member x.ResolveProvider = x.ResolveProvider - /// The server supports the following `CompletionItem` specific - /// capabilities. - /// - /// @since 3.17.0 - member x.CompletionItem = x.CompletionItem - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress +type CompletionRegistrationOptions = + { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + WorkDoneProgress: bool option + /// Most tools trigger completion request automatically without explicitly requesting + /// it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user + /// starts to type an identifier. For example if the user types `c` in a JavaScript file + /// code complete will automatically pop up present `console` besides others as a + /// completion item. Characters that make up identifiers don't need to be listed here. + /// + /// If code complete should automatically be trigger on characters not being valid inside + /// an identifier (for example `.` in JavaScript) list them in `triggerCharacters`. + TriggerCharacters: string[] option + /// The list of all possible characters that commit a completion. This field can be used + /// if clients don't support individual commit characters per completion item. See + /// `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport` + /// + /// If a server provides both `allCommitCharacters` and commit characters on an individual + /// completion item the ones on the completion item win. + /// + /// @since 3.2.0 + AllCommitCharacters: string[] option + /// The server provides support to resolve additional + /// information for a completion item. + ResolveProvider: bool option + /// The server supports the following `CompletionItem` specific + /// capabilities. + /// + /// @since 3.17.0 + CompletionItem: CompletionOptionsCompletionItem option + } + + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector + + interface ICompletionOptions with + /// Most tools trigger completion request automatically without explicitly requesting + /// it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user + /// starts to type an identifier. For example if the user types `c` in a JavaScript file + /// code complete will automatically pop up present `console` besides others as a + /// completion item. Characters that make up identifiers don't need to be listed here. + /// + /// If code complete should automatically be trigger on characters not being valid inside + /// an identifier (for example `.` in JavaScript) list them in `triggerCharacters`. + member x.TriggerCharacters = x.TriggerCharacters + /// The list of all possible characters that commit a completion. This field can be used + /// if clients don't support individual commit characters per completion item. See + /// `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport` + /// + /// If a server provides both `allCommitCharacters` and commit characters on an individual + /// completion item the ones on the completion item win. + /// + /// @since 3.2.0 + member x.AllCommitCharacters = x.AllCommitCharacters + /// The server provides support to resolve additional + /// information for a completion item. + member x.ResolveProvider = x.ResolveProvider + /// The server supports the following `CompletionItem` specific + /// capabilities. + /// + /// @since 3.17.0 + member x.CompletionItem = x.CompletionItem + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// Parameters for a {@link HoverRequest}. -type HoverParams = { - /// The text document. - TextDocument: TextDocumentIdentifier - /// The position inside the text document. - Position: Position - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option -} with - - interface ITextDocumentPositionParams with - /// The text document. - member x.TextDocument = x.TextDocument - /// The position inside the text document. - member x.Position = x.Position - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken +type HoverParams = + { + /// The text document. + TextDocument: TextDocumentIdentifier + /// The position inside the text document. + Position: Position + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + } + + interface ITextDocumentPositionParams with + /// The text document. + member x.TextDocument = x.TextDocument + /// The position inside the text document. + member x.Position = x.Position + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken /// The result of a hover request. -type Hover = { - /// The hover's content - Contents: U3 - /// An optional range inside the text document that is used to - /// visualize the hover, e.g. by changing the background color. - Range: Range option -} +type Hover = + { + /// The hover's content + Contents: U3 + /// An optional range inside the text document that is used to + /// visualize the hover, e.g. by changing the background color. + Range: Range option + } /// Registration options for a {@link HoverRequest}. -type HoverRegistrationOptions = { - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - WorkDoneProgress: bool option -} with - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector +type HoverRegistrationOptions = + { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + WorkDoneProgress: bool option + } - interface IHoverOptions + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + interface IHoverOptions -/// Parameters for a {@link SignatureHelpRequest}. -type SignatureHelpParams = { - /// The text document. - TextDocument: TextDocumentIdentifier - /// The position inside the text document. - Position: Position - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// The signature help context. This is only available if the client specifies - /// to send this using the client capability `textDocument.signatureHelp.contextSupport === true` - /// - /// @since 3.15.0 - Context: SignatureHelpContext option -} with - - interface ITextDocumentPositionParams with - /// The text document. - member x.TextDocument = x.TextDocument - /// The position inside the text document. - member x.Position = x.Position + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken +/// Parameters for a {@link SignatureHelpRequest}. +type SignatureHelpParams = + { + /// The text document. + TextDocument: TextDocumentIdentifier + /// The position inside the text document. + Position: Position + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// The signature help context. This is only available if the client specifies + /// to send this using the client capability `textDocument.signatureHelp.contextSupport === true` + /// + /// @since 3.15.0 + Context: SignatureHelpContext option + } + + interface ITextDocumentPositionParams with + /// The text document. + member x.TextDocument = x.TextDocument + /// The position inside the text document. + member x.Position = x.Position + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken /// Signature help represents the signature of something /// callable. There can be multiple signature but only one /// active and only one active parameter. -type SignatureHelp = { - /// One or more signatures. - Signatures: SignatureInformation[] - /// The active signature. If omitted or the value lies outside the - /// range of `signatures` the value defaults to zero or is ignored if - /// the `SignatureHelp` has no signatures. - /// - /// Whenever possible implementors should make an active decision about - /// the active signature and shouldn't rely on a default value. - /// - /// In future version of the protocol this property might become - /// mandatory to better express this. - ActiveSignature: uint32 option - /// The active parameter of the active signature. If omitted or the value - /// lies outside the range of `signatures[activeSignature].parameters` - /// defaults to 0 if the active signature has parameters. If - /// the active signature has no parameters it is ignored. - /// In future version of the protocol this property might become - /// mandatory to better express the active parameter if the - /// active signature does have any. - ActiveParameter: uint32 option -} +type SignatureHelp = + { + /// One or more signatures. + Signatures: SignatureInformation[] + /// The active signature. If omitted or the value lies outside the + /// range of `signatures` the value defaults to zero or is ignored if + /// the `SignatureHelp` has no signatures. + /// + /// Whenever possible implementors should make an active decision about + /// the active signature and shouldn't rely on a default value. + /// + /// In future version of the protocol this property might become + /// mandatory to better express this. + ActiveSignature: uint32 option + /// The active parameter of the active signature. If omitted or the value + /// lies outside the range of `signatures[activeSignature].parameters` + /// defaults to 0 if the active signature has parameters. If + /// the active signature has no parameters it is ignored. + /// In future version of the protocol this property might become + /// mandatory to better express the active parameter if the + /// active signature does have any. + ActiveParameter: uint32 option + } /// Registration options for a {@link SignatureHelpRequest}. -type SignatureHelpRegistrationOptions = { - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - WorkDoneProgress: bool option - /// List of characters that trigger signature help automatically. - TriggerCharacters: string[] option - /// List of characters that re-trigger signature help. - /// - /// These trigger characters are only active when signature help is already showing. All trigger characters - /// are also counted as re-trigger characters. - /// - /// @since 3.15.0 - RetriggerCharacters: string[] option -} with - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector - - interface ISignatureHelpOptions with - /// List of characters that trigger signature help automatically. - member x.TriggerCharacters = x.TriggerCharacters - /// List of characters that re-trigger signature help. - /// - /// These trigger characters are only active when signature help is already showing. All trigger characters - /// are also counted as re-trigger characters. - /// - /// @since 3.15.0 - member x.RetriggerCharacters = x.RetriggerCharacters - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress +type SignatureHelpRegistrationOptions = + { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + WorkDoneProgress: bool option + /// List of characters that trigger signature help automatically. + TriggerCharacters: string[] option + /// List of characters that re-trigger signature help. + /// + /// These trigger characters are only active when signature help is already showing. All trigger characters + /// are also counted as re-trigger characters. + /// + /// @since 3.15.0 + RetriggerCharacters: string[] option + } + + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector + + interface ISignatureHelpOptions with + /// List of characters that trigger signature help automatically. + member x.TriggerCharacters = x.TriggerCharacters + /// List of characters that re-trigger signature help. + /// + /// These trigger characters are only active when signature help is already showing. All trigger characters + /// are also counted as re-trigger characters. + /// + /// @since 3.15.0 + member x.RetriggerCharacters = x.RetriggerCharacters + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// Parameters for a {@link DefinitionRequest}. -type DefinitionParams = { - /// The text document. - TextDocument: TextDocumentIdentifier - /// The position inside the text document. - Position: Position - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - PartialResultToken: ProgressToken option -} with - - interface ITextDocumentPositionParams with - /// The text document. - member x.TextDocument = x.TextDocument - /// The position inside the text document. - member x.Position = x.Position - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken - - interface IPartialResultParams with - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - member x.PartialResultToken = x.PartialResultToken +type DefinitionParams = + { + /// The text document. + TextDocument: TextDocumentIdentifier + /// The position inside the text document. + Position: Position + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + PartialResultToken: ProgressToken option + } + + interface ITextDocumentPositionParams with + /// The text document. + member x.TextDocument = x.TextDocument + /// The position inside the text document. + member x.Position = x.Position + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + + interface IPartialResultParams with + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + member x.PartialResultToken = x.PartialResultToken /// Registration options for a {@link DefinitionRequest}. -type DefinitionRegistrationOptions = { - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - WorkDoneProgress: bool option -} with - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector +type DefinitionRegistrationOptions = + { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + WorkDoneProgress: bool option + } - interface IDefinitionOptions + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress - -/// Parameters for a {@link ReferencesRequest}. -type ReferenceParams = { - /// The text document. - TextDocument: TextDocumentIdentifier - /// The position inside the text document. - Position: Position - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - PartialResultToken: ProgressToken option - Context: ReferenceContext -} with - - interface ITextDocumentPositionParams with - /// The text document. - member x.TextDocument = x.TextDocument - /// The position inside the text document. - member x.Position = x.Position + interface IDefinitionOptions - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress - interface IPartialResultParams with - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - member x.PartialResultToken = x.PartialResultToken +/// Parameters for a {@link ReferencesRequest}. +type ReferenceParams = + { + /// The text document. + TextDocument: TextDocumentIdentifier + /// The position inside the text document. + Position: Position + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + PartialResultToken: ProgressToken option + Context: ReferenceContext + } + + interface ITextDocumentPositionParams with + /// The text document. + member x.TextDocument = x.TextDocument + /// The position inside the text document. + member x.Position = x.Position + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + + interface IPartialResultParams with + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + member x.PartialResultToken = x.PartialResultToken /// Registration options for a {@link ReferencesRequest}. -type ReferenceRegistrationOptions = { - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - WorkDoneProgress: bool option -} with - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector +type ReferenceRegistrationOptions = + { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + WorkDoneProgress: bool option + } - interface IReferenceOptions + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + interface IReferenceOptions -/// Parameters for a {@link DocumentHighlightRequest}. -type DocumentHighlightParams = { - /// The text document. - TextDocument: TextDocumentIdentifier - /// The position inside the text document. - Position: Position - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - PartialResultToken: ProgressToken option -} with - - interface ITextDocumentPositionParams with - /// The text document. - member x.TextDocument = x.TextDocument - /// The position inside the text document. - member x.Position = x.Position - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress - interface IPartialResultParams with - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - member x.PartialResultToken = x.PartialResultToken +/// Parameters for a {@link DocumentHighlightRequest}. +type DocumentHighlightParams = + { + /// The text document. + TextDocument: TextDocumentIdentifier + /// The position inside the text document. + Position: Position + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + PartialResultToken: ProgressToken option + } + + interface ITextDocumentPositionParams with + /// The text document. + member x.TextDocument = x.TextDocument + /// The position inside the text document. + member x.Position = x.Position + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + + interface IPartialResultParams with + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + member x.PartialResultToken = x.PartialResultToken /// A document highlight is a range inside a text document which deserves /// special attention. Usually a document highlight is visualized by changing /// the background color of its range. -type DocumentHighlight = { - /// The range this highlight applies to. - Range: Range - /// The highlight kind, default is {@link DocumentHighlightKind.Text text}. - Kind: DocumentHighlightKind option -} +type DocumentHighlight = + { + /// The range this highlight applies to. + Range: Range + /// The highlight kind, default is {@link DocumentHighlightKind.Text text}. + Kind: DocumentHighlightKind option + } /// Registration options for a {@link DocumentHighlightRequest}. -type DocumentHighlightRegistrationOptions = { - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - WorkDoneProgress: bool option -} with - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector +type DocumentHighlightRegistrationOptions = + { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + WorkDoneProgress: bool option + } - interface IDocumentHighlightOptions + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + interface IDocumentHighlightOptions -/// Parameters for a {@link DocumentSymbolRequest}. -type DocumentSymbolParams = { - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - PartialResultToken: ProgressToken option - /// The text document. - TextDocument: TextDocumentIdentifier -} with - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress - interface IPartialResultParams with - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - member x.PartialResultToken = x.PartialResultToken +/// Parameters for a {@link DocumentSymbolRequest}. +type DocumentSymbolParams = + { + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + PartialResultToken: ProgressToken option + /// The text document. + TextDocument: TextDocumentIdentifier + } + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + + interface IPartialResultParams with + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + member x.PartialResultToken = x.PartialResultToken /// Represents information about programming constructs like variables, classes, /// interfaces etc. -type SymbolInformation = { - /// The name of this symbol. - Name: string - /// The kind of this symbol. - Kind: SymbolKind - /// Tags for this symbol. - /// - /// @since 3.16.0 - Tags: SymbolTag[] option - /// The name of the symbol containing this symbol. This information is for - /// user interface purposes (e.g. to render a qualifier in the user interface - /// if necessary). It can't be used to re-infer a hierarchy for the document - /// symbols. - ContainerName: string option - /// Indicates if this symbol is deprecated. - /// - /// @deprecated Use tags instead - Deprecated: bool option - /// The location of this symbol. The location's range is used by a tool - /// to reveal the location in the editor. If the symbol is selected in the - /// tool the range's start information is used to position the cursor. So - /// the range usually spans more than the actual symbol's name and does - /// normally include things like visibility modifiers. - /// - /// The range doesn't have to denote a node range in the sense of an abstract - /// syntax tree. It can therefore not be used to re-construct a hierarchy of - /// the symbols. - Location: Location -} with - - interface IBaseSymbolInformation with - /// The name of this symbol. - member x.Name = x.Name - /// The kind of this symbol. - member x.Kind = x.Kind - /// Tags for this symbol. - /// - /// @since 3.16.0 - member x.Tags = x.Tags - /// The name of the symbol containing this symbol. This information is for - /// user interface purposes (e.g. to render a qualifier in the user interface - /// if necessary). It can't be used to re-infer a hierarchy for the document - /// symbols. - member x.ContainerName = x.ContainerName +type SymbolInformation = + { + /// The name of this symbol. + Name: string + /// The kind of this symbol. + Kind: SymbolKind + /// Tags for this symbol. + /// + /// @since 3.16.0 + Tags: SymbolTag[] option + /// The name of the symbol containing this symbol. This information is for + /// user interface purposes (e.g. to render a qualifier in the user interface + /// if necessary). It can't be used to re-infer a hierarchy for the document + /// symbols. + ContainerName: string option + /// Indicates if this symbol is deprecated. + /// + /// @deprecated Use tags instead + Deprecated: bool option + /// The location of this symbol. The location's range is used by a tool + /// to reveal the location in the editor. If the symbol is selected in the + /// tool the range's start information is used to position the cursor. So + /// the range usually spans more than the actual symbol's name and does + /// normally include things like visibility modifiers. + /// + /// The range doesn't have to denote a node range in the sense of an abstract + /// syntax tree. It can therefore not be used to re-construct a hierarchy of + /// the symbols. + Location: Location + } + + interface IBaseSymbolInformation with + /// The name of this symbol. + member x.Name = x.Name + /// The kind of this symbol. + member x.Kind = x.Kind + /// Tags for this symbol. + /// + /// @since 3.16.0 + member x.Tags = x.Tags + /// The name of the symbol containing this symbol. This information is for + /// user interface purposes (e.g. to render a qualifier in the user interface + /// if necessary). It can't be used to re-infer a hierarchy for the document + /// symbols. + member x.ContainerName = x.ContainerName /// Represents programming constructs like variables, classes, interfaces etc. /// that appear in a document. Document symbols can be hierarchical and they /// have two ranges: one that encloses its definition and one that points to /// its most interesting range, e.g. the range of an identifier. -type DocumentSymbol = { - /// The name of this symbol. Will be displayed in the user interface and therefore must not be - /// an empty string or a string only consisting of white spaces. - Name: string - /// More detail for this symbol, e.g the signature of a function. - Detail: string option - /// The kind of this symbol. - Kind: SymbolKind - /// Tags for this document symbol. - /// - /// @since 3.16.0 - Tags: SymbolTag[] option - /// Indicates if this symbol is deprecated. - /// - /// @deprecated Use tags instead - Deprecated: bool option - /// The range enclosing this symbol not including leading/trailing whitespace but everything else - /// like comments. This information is typically used to determine if the clients cursor is - /// inside the symbol to reveal in the symbol in the UI. - Range: Range - /// The range that should be selected and revealed when this symbol is being picked, e.g the name of a function. - /// Must be contained by the `range`. - SelectionRange: Range - /// Children of this symbol, e.g. properties of a class. - Children: DocumentSymbol[] option -} +type DocumentSymbol = + { + /// The name of this symbol. Will be displayed in the user interface and therefore must not be + /// an empty string or a string only consisting of white spaces. + Name: string + /// More detail for this symbol, e.g the signature of a function. + Detail: string option + /// The kind of this symbol. + Kind: SymbolKind + /// Tags for this document symbol. + /// + /// @since 3.16.0 + Tags: SymbolTag[] option + /// Indicates if this symbol is deprecated. + /// + /// @deprecated Use tags instead + Deprecated: bool option + /// The range enclosing this symbol not including leading/trailing whitespace but everything else + /// like comments. This information is typically used to determine if the clients cursor is + /// inside the symbol to reveal in the symbol in the UI. + Range: Range + /// The range that should be selected and revealed when this symbol is being picked, e.g the name of a function. + /// Must be contained by the `range`. + SelectionRange: Range + /// Children of this symbol, e.g. properties of a class. + Children: DocumentSymbol[] option + } /// Registration options for a {@link DocumentSymbolRequest}. -type DocumentSymbolRegistrationOptions = { - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - WorkDoneProgress: bool option - /// A human-readable string that is shown when multiple outlines trees - /// are shown for the same document. - /// - /// @since 3.16.0 - Label: string option -} with - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector - - interface IDocumentSymbolOptions with - /// A human-readable string that is shown when multiple outlines trees - /// are shown for the same document. - /// - /// @since 3.16.0 - member x.Label = x.Label - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress +type DocumentSymbolRegistrationOptions = + { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + WorkDoneProgress: bool option + /// A human-readable string that is shown when multiple outlines trees + /// are shown for the same document. + /// + /// @since 3.16.0 + Label: string option + } + + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector + + interface IDocumentSymbolOptions with + /// A human-readable string that is shown when multiple outlines trees + /// are shown for the same document. + /// + /// @since 3.16.0 + member x.Label = x.Label + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// The parameters of a {@link CodeActionRequest}. -type CodeActionParams = { - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - PartialResultToken: ProgressToken option - /// The document in which the command was invoked. - TextDocument: TextDocumentIdentifier - /// The range for which the command was invoked. - Range: Range - /// Context carrying additional information. - Context: CodeActionContext -} with - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken - - interface IPartialResultParams with - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - member x.PartialResultToken = x.PartialResultToken +type CodeActionParams = + { + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + PartialResultToken: ProgressToken option + /// The document in which the command was invoked. + TextDocument: TextDocumentIdentifier + /// The range for which the command was invoked. + Range: Range + /// Context carrying additional information. + Context: CodeActionContext + } + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + + interface IPartialResultParams with + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + member x.PartialResultToken = x.PartialResultToken /// Represents a reference to a command. Provides a title which /// will be used to represent a command in the UI and, optionally, /// an array of arguments which will be passed to the command handler /// function when invoked. -type Command = { - /// Title of the command, like `save`. - Title: string - /// The identifier of the actual command handler. - Command: string - /// Arguments that the command handler should be - /// invoked with. - Arguments: LSPAny[] option -} - -type CodeActionDisabled = { - /// Human readable description of why the code action is currently disabled. - /// - /// This is displayed in the code actions UI. - Reason: string -} +type Command = + { + /// Title of the command, like `save`. + Title: string + /// The identifier of the actual command handler. + Command: string + /// Arguments that the command handler should be + /// invoked with. + Arguments: LSPAny[] option + } + +type CodeActionDisabled = + { + /// Human readable description of why the code action is currently disabled. + /// + /// This is displayed in the code actions UI. + Reason: string + } /// A code action represents a change that can be performed in code, e.g. to fix a problem or /// to refactor code. /// /// A CodeAction must set either `edit` and/or a `command`. If both are supplied, the `edit` is applied first, then the `command` is executed. -type CodeAction = { - /// A short, human-readable, title for this code action. - Title: string - /// The kind of the code action. - /// - /// Used to filter code actions. - Kind: CodeActionKind option - /// The diagnostics that this code action resolves. - Diagnostics: Diagnostic[] option - /// Marks this as a preferred action. Preferred actions are used by the `auto fix` command and can be targeted - /// by keybindings. - /// - /// A quick fix should be marked preferred if it properly addresses the underlying error. - /// A refactoring should be marked preferred if it is the most reasonable choice of actions to take. - /// - /// @since 3.15.0 - IsPreferred: bool option - /// Marks that the code action cannot currently be applied. - /// - /// Clients should follow the following guidelines regarding disabled code actions: - /// - /// - Disabled code actions are not shown in automatic [lightbulbs](https://code.visualstudio.com/docs/editor/editingevolved#_code-action) - /// code action menus. - /// - /// - Disabled actions are shown as faded out in the code action menu when the user requests a more specific type - /// of code action, such as refactorings. - /// - /// - If the user has a [keybinding](https://code.visualstudio.com/docs/editor/refactoring#_keybindings-for-code-actions) - /// that auto applies a code action and only disabled code actions are returned, the client should show the user an - /// error message with `reason` in the editor. - /// - /// @since 3.16.0 - Disabled: CodeActionDisabled option - /// The workspace edit this code action performs. - Edit: WorkspaceEdit option - /// A command this code action executes. If a code action - /// provides an edit and a command, first the edit is - /// executed and then the command. - Command: Command option - /// A data entry field that is preserved on a code action between - /// a `textDocument/codeAction` and a `codeAction/resolve` request. - /// - /// @since 3.16.0 - Data: LSPAny option -} +type CodeAction = + { + /// A short, human-readable, title for this code action. + Title: string + /// The kind of the code action. + /// + /// Used to filter code actions. + Kind: CodeActionKind option + /// The diagnostics that this code action resolves. + Diagnostics: Diagnostic[] option + /// Marks this as a preferred action. Preferred actions are used by the `auto fix` command and can be targeted + /// by keybindings. + /// + /// A quick fix should be marked preferred if it properly addresses the underlying error. + /// A refactoring should be marked preferred if it is the most reasonable choice of actions to take. + /// + /// @since 3.15.0 + IsPreferred: bool option + /// Marks that the code action cannot currently be applied. + /// + /// Clients should follow the following guidelines regarding disabled code actions: + /// + /// - Disabled code actions are not shown in automatic [lightbulbs](https://code.visualstudio.com/docs/editor/editingevolved#_code-action) + /// code action menus. + /// + /// - Disabled actions are shown as faded out in the code action menu when the user requests a more specific type + /// of code action, such as refactorings. + /// + /// - If the user has a [keybinding](https://code.visualstudio.com/docs/editor/refactoring#_keybindings-for-code-actions) + /// that auto applies a code action and only disabled code actions are returned, the client should show the user an + /// error message with `reason` in the editor. + /// + /// @since 3.16.0 + Disabled: CodeActionDisabled option + /// The workspace edit this code action performs. + Edit: WorkspaceEdit option + /// A command this code action executes. If a code action + /// provides an edit and a command, first the edit is + /// executed and then the command. + Command: Command option + /// A data entry field that is preserved on a code action between + /// a `textDocument/codeAction` and a `codeAction/resolve` request. + /// + /// @since 3.16.0 + Data: LSPAny option + } /// Registration options for a {@link CodeActionRequest}. -type CodeActionRegistrationOptions = { - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - WorkDoneProgress: bool option - /// CodeActionKinds that this server may return. - /// - /// The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server - /// may list out every specific kind they provide. - CodeActionKinds: CodeActionKind[] option - /// The server provides support to resolve additional - /// information for a code action. - /// - /// @since 3.16.0 - ResolveProvider: bool option -} with - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector - - interface ICodeActionOptions with - /// CodeActionKinds that this server may return. - /// - /// The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server - /// may list out every specific kind they provide. - member x.CodeActionKinds = x.CodeActionKinds - /// The server provides support to resolve additional - /// information for a code action. - /// - /// @since 3.16.0 - member x.ResolveProvider = x.ResolveProvider - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress +type CodeActionRegistrationOptions = + { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + WorkDoneProgress: bool option + /// CodeActionKinds that this server may return. + /// + /// The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server + /// may list out every specific kind they provide. + CodeActionKinds: CodeActionKind[] option + /// The server provides support to resolve additional + /// information for a code action. + /// + /// @since 3.16.0 + ResolveProvider: bool option + } + + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector + + interface ICodeActionOptions with + /// CodeActionKinds that this server may return. + /// + /// The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server + /// may list out every specific kind they provide. + member x.CodeActionKinds = x.CodeActionKinds + /// The server provides support to resolve additional + /// information for a code action. + /// + /// @since 3.16.0 + member x.ResolveProvider = x.ResolveProvider + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// The parameters of a {@link WorkspaceSymbolRequest}. -type WorkspaceSymbolParams = { - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - PartialResultToken: ProgressToken option - /// A query string to filter symbols by. Clients may send an empty - /// string here to request all symbols. - Query: string -} with - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken - - interface IPartialResultParams with - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - member x.PartialResultToken = x.PartialResultToken +type WorkspaceSymbolParams = + { + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + PartialResultToken: ProgressToken option + /// A query string to filter symbols by. Clients may send an empty + /// string here to request all symbols. + Query: string + } + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + + interface IPartialResultParams with + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + member x.PartialResultToken = x.PartialResultToken type WorkspaceSymbolLocationC2 = { Uri: DocumentUri } @@ -2858,539 +2949,563 @@ type WorkspaceSymbolLocationC2 = { Uri: DocumentUri } /// See also SymbolInformation. /// /// @since 3.17.0 -type WorkspaceSymbol = { - /// The name of this symbol. - Name: string - /// The kind of this symbol. - Kind: SymbolKind - /// Tags for this symbol. - /// - /// @since 3.16.0 - Tags: SymbolTag[] option - /// The name of the symbol containing this symbol. This information is for - /// user interface purposes (e.g. to render a qualifier in the user interface - /// if necessary). It can't be used to re-infer a hierarchy for the document - /// symbols. - ContainerName: string option - /// The location of the symbol. Whether a server is allowed to - /// return a location without a range depends on the client - /// capability `workspace.symbol.resolveSupport`. - /// - /// See SymbolInformation#location for more details. - Location: U2 - /// A data entry field that is preserved on a workspace symbol between a - /// workspace symbol request and a workspace symbol resolve request. - Data: LSPAny option -} with - - interface IBaseSymbolInformation with - /// The name of this symbol. - member x.Name = x.Name - /// The kind of this symbol. - member x.Kind = x.Kind - /// Tags for this symbol. - /// - /// @since 3.16.0 - member x.Tags = x.Tags - /// The name of the symbol containing this symbol. This information is for - /// user interface purposes (e.g. to render a qualifier in the user interface - /// if necessary). It can't be used to re-infer a hierarchy for the document - /// symbols. - member x.ContainerName = x.ContainerName +type WorkspaceSymbol = + { + /// The name of this symbol. + Name: string + /// The kind of this symbol. + Kind: SymbolKind + /// Tags for this symbol. + /// + /// @since 3.16.0 + Tags: SymbolTag[] option + /// The name of the symbol containing this symbol. This information is for + /// user interface purposes (e.g. to render a qualifier in the user interface + /// if necessary). It can't be used to re-infer a hierarchy for the document + /// symbols. + ContainerName: string option + /// The location of the symbol. Whether a server is allowed to + /// return a location without a range depends on the client + /// capability `workspace.symbol.resolveSupport`. + /// + /// See SymbolInformation#location for more details. + Location: U2 + /// A data entry field that is preserved on a workspace symbol between a + /// workspace symbol request and a workspace symbol resolve request. + Data: LSPAny option + } + + interface IBaseSymbolInformation with + /// The name of this symbol. + member x.Name = x.Name + /// The kind of this symbol. + member x.Kind = x.Kind + /// Tags for this symbol. + /// + /// @since 3.16.0 + member x.Tags = x.Tags + /// The name of the symbol containing this symbol. This information is for + /// user interface purposes (e.g. to render a qualifier in the user interface + /// if necessary). It can't be used to re-infer a hierarchy for the document + /// symbols. + member x.ContainerName = x.ContainerName /// Registration options for a {@link WorkspaceSymbolRequest}. -type WorkspaceSymbolRegistrationOptions = { - WorkDoneProgress: bool option - /// The server provides support to resolve additional - /// information for a workspace symbol. - /// - /// @since 3.17.0 - ResolveProvider: bool option -} with - - interface IWorkspaceSymbolOptions with - /// The server provides support to resolve additional - /// information for a workspace symbol. - /// - /// @since 3.17.0 - member x.ResolveProvider = x.ResolveProvider - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress +type WorkspaceSymbolRegistrationOptions = + { + WorkDoneProgress: bool option + /// The server provides support to resolve additional + /// information for a workspace symbol. + /// + /// @since 3.17.0 + ResolveProvider: bool option + } + + interface IWorkspaceSymbolOptions with + /// The server provides support to resolve additional + /// information for a workspace symbol. + /// + /// @since 3.17.0 + member x.ResolveProvider = x.ResolveProvider + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// The parameters of a {@link CodeLensRequest}. -type CodeLensParams = { - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - PartialResultToken: ProgressToken option - /// The document to request code lens for. - TextDocument: TextDocumentIdentifier -} with - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken - - interface IPartialResultParams with - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - member x.PartialResultToken = x.PartialResultToken +type CodeLensParams = + { + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + PartialResultToken: ProgressToken option + /// The document to request code lens for. + TextDocument: TextDocumentIdentifier + } + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + + interface IPartialResultParams with + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + member x.PartialResultToken = x.PartialResultToken /// A code lens represents a {@link Command command} that should be shown along with /// source text, like the number of references, a way to run tests, etc. /// /// A code lens is _unresolved_ when no command is associated to it. For performance /// reasons the creation of a code lens and resolving should be done in two stages. -type CodeLens = { - /// The range in which this code lens is valid. Should only span a single line. - Range: Range - /// The command this code lens represents. - Command: Command option - /// A data entry field that is preserved on a code lens item between - /// a {@link CodeLensRequest} and a {@link CodeLensResolveRequest} - Data: LSPAny option -} +type CodeLens = + { + /// The range in which this code lens is valid. Should only span a single line. + Range: Range + /// The command this code lens represents. + Command: Command option + /// A data entry field that is preserved on a code lens item between + /// a {@link CodeLensRequest} and a {@link CodeLensResolveRequest} + Data: LSPAny option + } /// Registration options for a {@link CodeLensRequest}. -type CodeLensRegistrationOptions = { - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - WorkDoneProgress: bool option - /// Code lens has a resolve provider as well. - ResolveProvider: bool option -} with - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector - - interface ICodeLensOptions with - /// Code lens has a resolve provider as well. - member x.ResolveProvider = x.ResolveProvider - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress +type CodeLensRegistrationOptions = + { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + WorkDoneProgress: bool option + /// Code lens has a resolve provider as well. + ResolveProvider: bool option + } + + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector + + interface ICodeLensOptions with + /// Code lens has a resolve provider as well. + member x.ResolveProvider = x.ResolveProvider + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// The parameters of a {@link DocumentLinkRequest}. -type DocumentLinkParams = { - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - PartialResultToken: ProgressToken option - /// The document to provide document links for. - TextDocument: TextDocumentIdentifier -} with - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken - - interface IPartialResultParams with - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - member x.PartialResultToken = x.PartialResultToken +type DocumentLinkParams = + { + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + PartialResultToken: ProgressToken option + /// The document to provide document links for. + TextDocument: TextDocumentIdentifier + } + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + + interface IPartialResultParams with + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + member x.PartialResultToken = x.PartialResultToken /// A document link is a range in a text document that links to an internal or external resource, like another /// text document or a web site. -type DocumentLink = { - /// The range this link applies to. - Range: Range - /// The uri this link points to. If missing a resolve request is sent later. - Target: URI option - /// The tooltip text when you hover over this link. - /// - /// If a tooltip is provided, is will be displayed in a string that includes instructions on how to - /// trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary depending on OS, - /// user settings, and localization. - /// - /// @since 3.15.0 - Tooltip: string option - /// A data entry field that is preserved on a document link between a - /// DocumentLinkRequest and a DocumentLinkResolveRequest. - Data: LSPAny option -} +type DocumentLink = + { + /// The range this link applies to. + Range: Range + /// The uri this link points to. If missing a resolve request is sent later. + Target: URI option + /// The tooltip text when you hover over this link. + /// + /// If a tooltip is provided, is will be displayed in a string that includes instructions on how to + /// trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary depending on OS, + /// user settings, and localization. + /// + /// @since 3.15.0 + Tooltip: string option + /// A data entry field that is preserved on a document link between a + /// DocumentLinkRequest and a DocumentLinkResolveRequest. + Data: LSPAny option + } /// Registration options for a {@link DocumentLinkRequest}. -type DocumentLinkRegistrationOptions = { - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - WorkDoneProgress: bool option - /// Document links have a resolve provider as well. - ResolveProvider: bool option -} with - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector - - interface IDocumentLinkOptions with - /// Document links have a resolve provider as well. - member x.ResolveProvider = x.ResolveProvider - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress +type DocumentLinkRegistrationOptions = + { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + WorkDoneProgress: bool option + /// Document links have a resolve provider as well. + ResolveProvider: bool option + } + + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector + + interface IDocumentLinkOptions with + /// Document links have a resolve provider as well. + member x.ResolveProvider = x.ResolveProvider + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// The parameters of a {@link DocumentFormattingRequest}. -type DocumentFormattingParams = { - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// The document to format. - TextDocument: TextDocumentIdentifier - /// The format options. - Options: FormattingOptions -} with - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken +type DocumentFormattingParams = + { + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// The document to format. + TextDocument: TextDocumentIdentifier + /// The format options. + Options: FormattingOptions + } + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken /// Registration options for a {@link DocumentFormattingRequest}. -type DocumentFormattingRegistrationOptions = { - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - WorkDoneProgress: bool option -} with - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector +type DocumentFormattingRegistrationOptions = + { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + WorkDoneProgress: bool option + } + + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector - interface IDocumentFormattingOptions + interface IDocumentFormattingOptions - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// The parameters of a {@link DocumentRangeFormattingRequest}. -type DocumentRangeFormattingParams = { - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// The document to format. - TextDocument: TextDocumentIdentifier - /// The range to format - Range: Range - /// The format options - Options: FormattingOptions -} with - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken +type DocumentRangeFormattingParams = + { + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// The document to format. + TextDocument: TextDocumentIdentifier + /// The range to format + Range: Range + /// The format options + Options: FormattingOptions + } + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken /// Registration options for a {@link DocumentRangeFormattingRequest}. -type DocumentRangeFormattingRegistrationOptions = { - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - WorkDoneProgress: bool option -} with - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector +type DocumentRangeFormattingRegistrationOptions = + { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + WorkDoneProgress: bool option + } + + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector - interface IDocumentRangeFormattingOptions + interface IDocumentRangeFormattingOptions - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// The parameters of a {@link DocumentOnTypeFormattingRequest}. -type DocumentOnTypeFormattingParams = { - /// The document to format. - TextDocument: TextDocumentIdentifier - /// The position around which the on type formatting should happen. - /// This is not necessarily the exact position where the character denoted - /// by the property `ch` got typed. - Position: Position - /// The character that has been typed that triggered the formatting - /// on type request. That is not necessarily the last character that - /// got inserted into the document since the client could auto insert - /// characters as well (e.g. like automatic brace completion). - Ch: string - /// The formatting options. - Options: FormattingOptions -} +type DocumentOnTypeFormattingParams = + { + /// The document to format. + TextDocument: TextDocumentIdentifier + /// The position around which the on type formatting should happen. + /// This is not necessarily the exact position where the character denoted + /// by the property `ch` got typed. + Position: Position + /// The character that has been typed that triggered the formatting + /// on type request. That is not necessarily the last character that + /// got inserted into the document since the client could auto insert + /// characters as well (e.g. like automatic brace completion). + Ch: string + /// The formatting options. + Options: FormattingOptions + } /// Registration options for a {@link DocumentOnTypeFormattingRequest}. -type DocumentOnTypeFormattingRegistrationOptions = { - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - /// A character on which formatting should be triggered, like `{`. - FirstTriggerCharacter: string - /// More trigger characters. - MoreTriggerCharacter: string[] option -} with - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector - - interface IDocumentOnTypeFormattingOptions with - /// A character on which formatting should be triggered, like `{`. - member x.FirstTriggerCharacter = x.FirstTriggerCharacter - /// More trigger characters. - member x.MoreTriggerCharacter = x.MoreTriggerCharacter +type DocumentOnTypeFormattingRegistrationOptions = + { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + /// A character on which formatting should be triggered, like `{`. + FirstTriggerCharacter: string + /// More trigger characters. + MoreTriggerCharacter: string[] option + } + + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector + + interface IDocumentOnTypeFormattingOptions with + /// A character on which formatting should be triggered, like `{`. + member x.FirstTriggerCharacter = x.FirstTriggerCharacter + /// More trigger characters. + member x.MoreTriggerCharacter = x.MoreTriggerCharacter /// The parameters of a {@link RenameRequest}. -type RenameParams = { - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// The document to rename. - TextDocument: TextDocumentIdentifier - /// The position at which this request was sent. - Position: Position - /// The new name of the symbol. If the given name is not valid the - /// request must return a {@link ResponseError} with an - /// appropriate message set. - NewName: string -} with - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken +type RenameParams = + { + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// The document to rename. + TextDocument: TextDocumentIdentifier + /// The position at which this request was sent. + Position: Position + /// The new name of the symbol. If the given name is not valid the + /// request must return a {@link ResponseError} with an + /// appropriate message set. + NewName: string + } + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken /// Registration options for a {@link RenameRequest}. -type RenameRegistrationOptions = { - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - [] - DocumentSelector: DocumentSelector option - WorkDoneProgress: bool option - /// Renames should be checked and tested before being executed. - /// - /// @since version 3.12.0 - PrepareProvider: bool option -} with - - interface ITextDocumentRegistrationOptions with - /// A document selector to identify the scope of the registration. If set to null - /// the document selector provided on the client side will be used. - member x.DocumentSelector = x.DocumentSelector - - interface IRenameOptions with - /// Renames should be checked and tested before being executed. - /// - /// @since version 3.12.0 - member x.PrepareProvider = x.PrepareProvider - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress - -type PrepareRenameParams = { - /// The text document. - TextDocument: TextDocumentIdentifier - /// The position inside the text document. - Position: Position - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option -} with - - interface ITextDocumentPositionParams with - /// The text document. - member x.TextDocument = x.TextDocument - /// The position inside the text document. - member x.Position = x.Position - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken +type RenameRegistrationOptions = + { + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + DocumentSelector: DocumentSelector option + WorkDoneProgress: bool option + /// Renames should be checked and tested before being executed. + /// + /// @since version 3.12.0 + PrepareProvider: bool option + } + + interface ITextDocumentRegistrationOptions with + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + member x.DocumentSelector = x.DocumentSelector + + interface IRenameOptions with + /// Renames should be checked and tested before being executed. + /// + /// @since version 3.12.0 + member x.PrepareProvider = x.PrepareProvider + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress + +type PrepareRenameParams = + { + /// The text document. + TextDocument: TextDocumentIdentifier + /// The position inside the text document. + Position: Position + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + } + + interface ITextDocumentPositionParams with + /// The text document. + member x.TextDocument = x.TextDocument + /// The position inside the text document. + member x.Position = x.Position + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken /// The parameters of a {@link ExecuteCommandRequest}. -type ExecuteCommandParams = { - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// The identifier of the actual command handler. - Command: string - /// Arguments that the command should be invoked with. - Arguments: LSPAny[] option -} with - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken +type ExecuteCommandParams = + { + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// The identifier of the actual command handler. + Command: string + /// Arguments that the command should be invoked with. + Arguments: LSPAny[] option + } + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken /// Registration options for a {@link ExecuteCommandRequest}. -type ExecuteCommandRegistrationOptions = { - WorkDoneProgress: bool option - /// The commands to be executed on the server - Commands: string[] -} with +type ExecuteCommandRegistrationOptions = + { + WorkDoneProgress: bool option + /// The commands to be executed on the server + Commands: string[] + } - interface IExecuteCommandOptions with - /// The commands to be executed on the server - member x.Commands = x.Commands + interface IExecuteCommandOptions with + /// The commands to be executed on the server + member x.Commands = x.Commands - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// The parameters passed via an apply workspace edit request. -type ApplyWorkspaceEditParams = { - /// An optional label of the workspace edit. This label is - /// presented in the user interface for example on an undo - /// stack to undo the workspace edit. - Label: string option - /// The edits to apply. - Edit: WorkspaceEdit -} +type ApplyWorkspaceEditParams = + { + /// An optional label of the workspace edit. This label is + /// presented in the user interface for example on an undo + /// stack to undo the workspace edit. + Label: string option + /// The edits to apply. + Edit: WorkspaceEdit + } /// The result returned from the apply workspace edit request. /// /// @since 3.17 renamed from ApplyWorkspaceEditResponse -type ApplyWorkspaceEditResult = { - /// Indicates whether the edit was applied or not. - Applied: bool - /// An optional textual description for why the edit was not applied. - /// This may be used by the server for diagnostic logging or to provide - /// a suitable error for a request that triggered the edit. - FailureReason: string option - /// Depending on the client's failure handling strategy `failedChange` might - /// contain the index of the change that failed. This property is only available - /// if the client signals a `failureHandlingStrategy` in its client capabilities. - FailedChange: uint32 option -} - -type WorkDoneProgressBegin = { - [] - Kind: string - /// Mandatory title of the progress operation. Used to briefly inform about - /// the kind of operation being performed. - /// - /// Examples: "Indexing" or "Linking dependencies". - Title: string - /// Controls if a cancel button should show to allow the user to cancel the - /// long running operation. Clients that don't support cancellation are allowed - /// to ignore the setting. - Cancellable: bool option - /// Optional, more detailed associated progress message. Contains - /// complementary information to the `title`. - /// - /// Examples: "3/25 files", "project/src/module2", "node_modules/some_dep". - /// If unset, the previous progress message (if any) is still valid. - Message: string option - /// Optional progress percentage to display (value 100 is considered 100%). - /// If not provided infinite progress is assumed and clients are allowed - /// to ignore the `percentage` value in subsequent in report notifications. - /// - /// The value should be steadily rising. Clients are free to ignore values - /// that are not following this rule. The value range is [0, 100]. - Percentage: uint32 option -} - -type WorkDoneProgressReport = { - [] - Kind: string - /// Controls enablement state of a cancel button. - /// - /// Clients that don't support cancellation or don't support controlling the button's - /// enablement state are allowed to ignore the property. - Cancellable: bool option - /// Optional, more detailed associated progress message. Contains - /// complementary information to the `title`. - /// - /// Examples: "3/25 files", "project/src/module2", "node_modules/some_dep". - /// If unset, the previous progress message (if any) is still valid. - Message: string option - /// Optional progress percentage to display (value 100 is considered 100%). - /// If not provided infinite progress is assumed and clients are allowed - /// to ignore the `percentage` value in subsequent in report notifications. - /// - /// The value should be steadily rising. Clients are free to ignore values - /// that are not following this rule. The value range is [0, 100] - Percentage: uint32 option -} - -type WorkDoneProgressEnd = { - [] - Kind: string - /// Optional, a final message indicating to for example indicate the outcome - /// of the operation. - Message: string option -} +type ApplyWorkspaceEditResult = + { + /// Indicates whether the edit was applied or not. + Applied: bool + /// An optional textual description for why the edit was not applied. + /// This may be used by the server for diagnostic logging or to provide + /// a suitable error for a request that triggered the edit. + FailureReason: string option + /// Depending on the client's failure handling strategy `failedChange` might + /// contain the index of the change that failed. This property is only available + /// if the client signals a `failureHandlingStrategy` in its client capabilities. + FailedChange: uint32 option + } + +type WorkDoneProgressBegin = + { + [] + Kind: string + /// Mandatory title of the progress operation. Used to briefly inform about + /// the kind of operation being performed. + /// + /// Examples: "Indexing" or "Linking dependencies". + Title: string + /// Controls if a cancel button should show to allow the user to cancel the + /// long running operation. Clients that don't support cancellation are allowed + /// to ignore the setting. + Cancellable: bool option + /// Optional, more detailed associated progress message. Contains + /// complementary information to the `title`. + /// + /// Examples: "3/25 files", "project/src/module2", "node_modules/some_dep". + /// If unset, the previous progress message (if any) is still valid. + Message: string option + /// Optional progress percentage to display (value 100 is considered 100%). + /// If not provided infinite progress is assumed and clients are allowed + /// to ignore the `percentage` value in subsequent in report notifications. + /// + /// The value should be steadily rising. Clients are free to ignore values + /// that are not following this rule. The value range is [0, 100]. + Percentage: uint32 option + } + +type WorkDoneProgressReport = + { + [] + Kind: string + /// Controls enablement state of a cancel button. + /// + /// Clients that don't support cancellation or don't support controlling the button's + /// enablement state are allowed to ignore the property. + Cancellable: bool option + /// Optional, more detailed associated progress message. Contains + /// complementary information to the `title`. + /// + /// Examples: "3/25 files", "project/src/module2", "node_modules/some_dep". + /// If unset, the previous progress message (if any) is still valid. + Message: string option + /// Optional progress percentage to display (value 100 is considered 100%). + /// If not provided infinite progress is assumed and clients are allowed + /// to ignore the `percentage` value in subsequent in report notifications. + /// + /// The value should be steadily rising. Clients are free to ignore values + /// that are not following this rule. The value range is [0, 100] + Percentage: uint32 option + } + +type WorkDoneProgressEnd = + { + [] + Kind: string + /// Optional, a final message indicating to for example indicate the outcome + /// of the operation. + Message: string option + } type SetTraceParams = { Value: TraceValues } type LogTraceParams = { Message: string; Verbose: string option } -type CancelParams = { - /// The request id to cancel. - Id: U2 -} +type CancelParams = + { + /// The request id to cancel. + Id: U2 + } -type ProgressParams = { - /// The progress token provided by the client or server. - Token: ProgressToken - /// The progress data. - Value: LSPAny -} +type ProgressParams = + { + /// The progress token provided by the client or server. + Token: ProgressToken + /// The progress data. + Value: LSPAny + } /// A parameter literal used in requests to pass a text document and a position inside that /// document. -type TextDocumentPositionParams = { - /// The text document. - TextDocument: TextDocumentIdentifier - /// The position inside the text document. - Position: Position -} with - - interface ITextDocumentPositionParams with - /// The text document. - member x.TextDocument = x.TextDocument - /// The position inside the text document. - member x.Position = x.Position - -type WorkDoneProgressParams = { - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option -} with - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken - -type PartialResultParams = { - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - PartialResultToken: ProgressToken option -} with - - interface IPartialResultParams with - /// An optional token that a server can use to report partial results (e.g. streaming) to - /// the client. - member x.PartialResultToken = x.PartialResultToken +type TextDocumentPositionParams = + { + /// The text document. + TextDocument: TextDocumentIdentifier + /// The position inside the text document. + Position: Position + } + + interface ITextDocumentPositionParams with + /// The text document. + member x.TextDocument = x.TextDocument + /// The position inside the text document. + member x.Position = x.Position + +type WorkDoneProgressParams = + { + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + } + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + +type PartialResultParams = + { + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + PartialResultToken: ProgressToken option + } + + interface IPartialResultParams with + /// An optional token that a server can use to report partial results (e.g. streaming) to + /// the client. + member x.PartialResultToken = x.PartialResultToken /// Represents the connection of two locations. Provides additional metadata over normal {@link Location locations}, /// including an origin range. -type LocationLink = { - /// Span of the origin of this link. - /// - /// Used as the underlined span for mouse interaction. Defaults to the word range at - /// the definition position. - OriginSelectionRange: Range option - /// The target resource identifier of this link. - TargetUri: DocumentUri - /// The full target range of this link. If the target for example is a symbol then target range is the - /// range enclosing this symbol not including leading/trailing whitespace but everything else - /// like comments. This information is typically used to highlight the range in the editor. - TargetRange: Range - /// The range that should be selected and revealed when this link is being followed, e.g the name of a function. - /// Must be contained by the `targetRange`. See also `DocumentSymbol#range` - TargetSelectionRange: Range -} +type LocationLink = + { + /// Span of the origin of this link. + /// + /// Used as the underlined span for mouse interaction. Defaults to the word range at + /// the definition position. + OriginSelectionRange: Range option + /// The target resource identifier of this link. + TargetUri: DocumentUri + /// The full target range of this link. If the target for example is a symbol then target range is the + /// range enclosing this symbol not including leading/trailing whitespace but everything else + /// like comments. This information is typically used to highlight the range in the editor. + TargetRange: Range + /// The range that should be selected and revealed when this link is being followed, e.g the name of a function. + /// Must be contained by the `targetRange`. See also `DocumentSymbol#range` + TargetSelectionRange: Range + } /// A range in a text document expressed as (zero-based) start and end positions. /// @@ -3404,105 +3519,116 @@ type LocationLink = { /// } /// ``` [] -type Range = { - /// The range's start position. - Start: Position - /// The range's end position. - End: Position -} with +type Range = + { + /// The range's start position. + Start: Position + /// The range's end position. + End: Position + } - [] - member x.DebuggerDisplay = $"{x.Start.DebuggerDisplay}-{x.End.DebuggerDisplay}" + [] + member x.DebuggerDisplay = $"{x.Start.DebuggerDisplay}-{x.End.DebuggerDisplay}" -type ImplementationOptions = { - WorkDoneProgress: bool option -} with +type ImplementationOptions = + { + WorkDoneProgress: bool option + } - interface IImplementationOptions + interface IImplementationOptions - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// Static registration options to be returned in the initialize /// request. -type StaticRegistrationOptions = { - /// The id used to register the request. The id can be used to deregister - /// the request again. See also Registration#id. - Id: string option -} +type StaticRegistrationOptions = + { + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + Id: string option + } -type TypeDefinitionOptions = { - WorkDoneProgress: bool option -} with +type TypeDefinitionOptions = + { + WorkDoneProgress: bool option + } - interface ITypeDefinitionOptions + interface ITypeDefinitionOptions - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// The workspace folder change event. -type WorkspaceFoldersChangeEvent = { - /// The array of added workspace folders - Added: WorkspaceFolder[] - /// The array of the removed workspace folders - Removed: WorkspaceFolder[] -} - -type ConfigurationItem = { - /// The scope to get the configuration section for. - ScopeUri: URI option - /// The configuration section asked for. - Section: string option -} +type WorkspaceFoldersChangeEvent = + { + /// The array of added workspace folders + Added: WorkspaceFolder[] + /// The array of the removed workspace folders + Removed: WorkspaceFolder[] + } + +type ConfigurationItem = + { + /// The scope to get the configuration section for. + ScopeUri: URI option + /// The configuration section asked for. + Section: string option + } /// A literal to identify a text document in the client. -type TextDocumentIdentifier = { - /// The text document's uri. - Uri: DocumentUri -} with +type TextDocumentIdentifier = + { + /// The text document's uri. + Uri: DocumentUri + } - interface ITextDocumentIdentifier with - /// The text document's uri. - member x.Uri = x.Uri + interface ITextDocumentIdentifier with + /// The text document's uri. + member x.Uri = x.Uri /// Represents a color in RGBA space. -type Color = { - /// The red component of this color in the range [0-1]. - Red: decimal - /// The green component of this color in the range [0-1]. - Green: decimal - /// The blue component of this color in the range [0-1]. - Blue: decimal - /// The alpha component of this color in the range [0-1]. - Alpha: decimal -} +type Color = + { + /// The red component of this color in the range [0-1]. + Red: decimal + /// The green component of this color in the range [0-1]. + Green: decimal + /// The blue component of this color in the range [0-1]. + Blue: decimal + /// The alpha component of this color in the range [0-1]. + Alpha: decimal + } -type DocumentColorOptions = { - WorkDoneProgress: bool option -} with +type DocumentColorOptions = + { + WorkDoneProgress: bool option + } - interface IDocumentColorOptions + interface IDocumentColorOptions - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress -type FoldingRangeOptions = { - WorkDoneProgress: bool option -} with +type FoldingRangeOptions = + { + WorkDoneProgress: bool option + } - interface IFoldingRangeOptions + interface IFoldingRangeOptions - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress -type DeclarationOptions = { - WorkDoneProgress: bool option -} with +type DeclarationOptions = + { + WorkDoneProgress: bool option + } - interface IDeclarationOptions + interface IDeclarationOptions - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// Position in a text document expressed as zero-based line and character /// offset. Prior to 3.17 the offsets were always based on a UTF-16 string @@ -3532,335 +3658,358 @@ type DeclarationOptions = { /// /// @since 3.17.0 - support for negotiated position encoding. [] -type Position = { - /// Line position in a document (zero-based). - /// - /// If a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document. - /// If a line number is negative, it defaults to 0. - Line: uint32 - /// Character offset on a line in a document (zero-based). - /// - /// The meaning of this offset is determined by the negotiated - /// `PositionEncodingKind`. - /// - /// If the character value is greater than the line length it defaults back to the - /// line length. - Character: uint32 -} with - - [] - member x.DebuggerDisplay = $"({x.Line},{x.Character})" - -type SelectionRangeOptions = { - WorkDoneProgress: bool option -} with - - interface ISelectionRangeOptions - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress +type Position = + { + /// Line position in a document (zero-based). + /// + /// If a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document. + /// If a line number is negative, it defaults to 0. + Line: uint32 + /// Character offset on a line in a document (zero-based). + /// + /// The meaning of this offset is determined by the negotiated + /// `PositionEncodingKind`. + /// + /// If the character value is greater than the line length it defaults back to the + /// line length. + Character: uint32 + } + + [] + member x.DebuggerDisplay = $"({x.Line},{x.Character})" + +type SelectionRangeOptions = + { + WorkDoneProgress: bool option + } + + interface ISelectionRangeOptions + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// Call hierarchy options used during static registration. /// /// @since 3.16.0 -type CallHierarchyOptions = { - WorkDoneProgress: bool option -} with +type CallHierarchyOptions = + { + WorkDoneProgress: bool option + } - interface ICallHierarchyOptions + interface ICallHierarchyOptions - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// @since 3.16.0 -type SemanticTokensOptions = { - WorkDoneProgress: bool option - /// The legend used by the server - Legend: SemanticTokensLegend - /// Server supports providing semantic tokens for a specific range - /// of a document. - Range: U2 option - /// Server supports providing semantic tokens for a full document. - Full: U2 option -} with - - interface ISemanticTokensOptions with - /// The legend used by the server - member x.Legend = x.Legend - /// Server supports providing semantic tokens for a specific range - /// of a document. - member x.Range = x.Range - /// Server supports providing semantic tokens for a full document. - member x.Full = x.Full - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress +type SemanticTokensOptions = + { + WorkDoneProgress: bool option + /// The legend used by the server + Legend: SemanticTokensLegend + /// Server supports providing semantic tokens for a specific range + /// of a document. + Range: U2 option + /// Server supports providing semantic tokens for a full document. + Full: U2 option + } + + interface ISemanticTokensOptions with + /// The legend used by the server + member x.Legend = x.Legend + /// Server supports providing semantic tokens for a specific range + /// of a document. + member x.Range = x.Range + /// Server supports providing semantic tokens for a full document. + member x.Full = x.Full + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// @since 3.16.0 -type SemanticTokensEdit = { - /// The start offset of the edit. - Start: uint32 - /// The count of elements to remove. - DeleteCount: uint32 - /// The elements to insert. - Data: uint32[] option -} - -type LinkedEditingRangeOptions = { - WorkDoneProgress: bool option -} with - - interface ILinkedEditingRangeOptions - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress +type SemanticTokensEdit = + { + /// The start offset of the edit. + Start: uint32 + /// The count of elements to remove. + DeleteCount: uint32 + /// The elements to insert. + Data: uint32[] option + } + +type LinkedEditingRangeOptions = + { + WorkDoneProgress: bool option + } + + interface ILinkedEditingRangeOptions + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// Represents information on a file/folder create. /// /// @since 3.16.0 -type FileCreate = { - /// A file:// URI for the location of the file/folder being created. - Uri: string -} +type FileCreate = + { + /// A file:// URI for the location of the file/folder being created. + Uri: string + } /// Describes textual changes on a text document. A TextDocumentEdit describes all changes /// on a document version Si and after they are applied move the document to version Si+1. /// So the creator of a TextDocumentEdit doesn't need to sort the array of edits or do any /// kind of ordering. However the edits must be non overlapping. -type TextDocumentEdit = { - /// The text document to change. - TextDocument: OptionalVersionedTextDocumentIdentifier - /// The edits to be applied. - /// - /// @since 3.16.0 - support for AnnotatedTextEdit. This is guarded using a - /// client capability. - Edits: U2[] -} +type TextDocumentEdit = + { + /// The text document to change. + TextDocument: OptionalVersionedTextDocumentIdentifier + /// The edits to be applied. + /// + /// @since 3.16.0 - support for AnnotatedTextEdit. This is guarded using a + /// client capability. + Edits: U2[] + } /// Create file operation. -type CreateFile = { - /// A create - [] - Kind: string - /// An optional annotation identifier describing the operation. - /// - /// @since 3.16.0 - AnnotationId: ChangeAnnotationIdentifier option - /// The resource to create. - Uri: DocumentUri - /// Additional options - Options: CreateFileOptions option -} with - - interface IResourceOperation with - /// The resource operation kind. - member x.Kind = x.Kind - /// An optional annotation identifier describing the operation. - /// - /// @since 3.16.0 - member x.AnnotationId = x.AnnotationId +type CreateFile = + { + /// A create + [] + Kind: string + /// An optional annotation identifier describing the operation. + /// + /// @since 3.16.0 + AnnotationId: ChangeAnnotationIdentifier option + /// The resource to create. + Uri: DocumentUri + /// Additional options + Options: CreateFileOptions option + } + + interface IResourceOperation with + /// The resource operation kind. + member x.Kind = x.Kind + /// An optional annotation identifier describing the operation. + /// + /// @since 3.16.0 + member x.AnnotationId = x.AnnotationId /// Rename file operation -type RenameFile = { - /// A rename - [] - Kind: string - /// An optional annotation identifier describing the operation. - /// - /// @since 3.16.0 - AnnotationId: ChangeAnnotationIdentifier option - /// The old (existing) location. - OldUri: DocumentUri - /// The new location. - NewUri: DocumentUri - /// Rename options. - Options: RenameFileOptions option -} with - - interface IResourceOperation with - /// The resource operation kind. - member x.Kind = x.Kind - /// An optional annotation identifier describing the operation. - /// - /// @since 3.16.0 - member x.AnnotationId = x.AnnotationId +type RenameFile = + { + /// A rename + [] + Kind: string + /// An optional annotation identifier describing the operation. + /// + /// @since 3.16.0 + AnnotationId: ChangeAnnotationIdentifier option + /// The old (existing) location. + OldUri: DocumentUri + /// The new location. + NewUri: DocumentUri + /// Rename options. + Options: RenameFileOptions option + } + + interface IResourceOperation with + /// The resource operation kind. + member x.Kind = x.Kind + /// An optional annotation identifier describing the operation. + /// + /// @since 3.16.0 + member x.AnnotationId = x.AnnotationId /// Delete file operation -type DeleteFile = { - /// A delete - [] - Kind: string - /// An optional annotation identifier describing the operation. - /// - /// @since 3.16.0 - AnnotationId: ChangeAnnotationIdentifier option - /// The file to delete. - Uri: DocumentUri - /// Delete options. - Options: DeleteFileOptions option -} with - - interface IResourceOperation with - /// The resource operation kind. - member x.Kind = x.Kind - /// An optional annotation identifier describing the operation. - /// - /// @since 3.16.0 - member x.AnnotationId = x.AnnotationId +type DeleteFile = + { + /// A delete + [] + Kind: string + /// An optional annotation identifier describing the operation. + /// + /// @since 3.16.0 + AnnotationId: ChangeAnnotationIdentifier option + /// The file to delete. + Uri: DocumentUri + /// Delete options. + Options: DeleteFileOptions option + } + + interface IResourceOperation with + /// The resource operation kind. + member x.Kind = x.Kind + /// An optional annotation identifier describing the operation. + /// + /// @since 3.16.0 + member x.AnnotationId = x.AnnotationId /// Additional information that describes document changes. /// /// @since 3.16.0 -type ChangeAnnotation = { - /// A human-readable string describing the actual change. The string - /// is rendered prominent in the user interface. - Label: string - /// A flag which indicates that user confirmation is needed - /// before applying the change. - NeedsConfirmation: bool option - /// A human-readable string which is rendered less prominent in - /// the user interface. - Description: string option -} +type ChangeAnnotation = + { + /// A human-readable string describing the actual change. The string + /// is rendered prominent in the user interface. + Label: string + /// A flag which indicates that user confirmation is needed + /// before applying the change. + NeedsConfirmation: bool option + /// A human-readable string which is rendered less prominent in + /// the user interface. + Description: string option + } /// A filter to describe in which file operation requests or notifications /// the server is interested in receiving. /// /// @since 3.16.0 -type FileOperationFilter = { - /// A Uri scheme like `file` or `untitled`. - Scheme: string option - /// The actual file operation pattern. - Pattern: FileOperationPattern -} +type FileOperationFilter = + { + /// A Uri scheme like `file` or `untitled`. + Scheme: string option + /// The actual file operation pattern. + Pattern: FileOperationPattern + } /// Represents information on a file/folder rename. /// /// @since 3.16.0 -type FileRename = { - /// A file:// URI for the original location of the file/folder being renamed. - OldUri: string - /// A file:// URI for the new location of the file/folder being renamed. - NewUri: string -} +type FileRename = + { + /// A file:// URI for the original location of the file/folder being renamed. + OldUri: string + /// A file:// URI for the new location of the file/folder being renamed. + NewUri: string + } /// Represents information on a file/folder delete. /// /// @since 3.16.0 -type FileDelete = { - /// A file:// URI for the location of the file/folder being deleted. - Uri: string -} +type FileDelete = + { + /// A file:// URI for the location of the file/folder being deleted. + Uri: string + } -type MonikerOptions = { - WorkDoneProgress: bool option -} with +type MonikerOptions = + { + WorkDoneProgress: bool option + } - interface IMonikerOptions + interface IMonikerOptions - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// Type hierarchy options used during static registration. /// /// @since 3.17.0 -type TypeHierarchyOptions = { - WorkDoneProgress: bool option -} with +type TypeHierarchyOptions = + { + WorkDoneProgress: bool option + } - interface ITypeHierarchyOptions + interface ITypeHierarchyOptions - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// @since 3.17.0 -type InlineValueContext = { - /// The stack frame (as a DAP Id) where the execution has stopped. - FrameId: int32 - /// The document range where execution has stopped. - /// Typically the end position of the range denotes the line where the inline values are shown. - StoppedLocation: Range -} +type InlineValueContext = + { + /// The stack frame (as a DAP Id) where the execution has stopped. + FrameId: int32 + /// The document range where execution has stopped. + /// Typically the end position of the range denotes the line where the inline values are shown. + StoppedLocation: Range + } /// Provide inline value as text. /// /// @since 3.17.0 -type InlineValueText = { - /// The document range for which the inline value applies. - Range: Range - /// The text of the inline value. - Text: string -} +type InlineValueText = + { + /// The document range for which the inline value applies. + Range: Range + /// The text of the inline value. + Text: string + } /// Provide inline value through a variable lookup. /// If only a range is specified, the variable name will be extracted from the underlying document. /// An optional variable name can be used to override the extracted name. /// /// @since 3.17.0 -type InlineValueVariableLookup = { - /// The document range for which the inline value applies. - /// The range is used to extract the variable name from the underlying document. - Range: Range - /// If specified the name of the variable to look up. - VariableName: string option - /// How to perform the lookup. - CaseSensitiveLookup: bool -} +type InlineValueVariableLookup = + { + /// The document range for which the inline value applies. + /// The range is used to extract the variable name from the underlying document. + Range: Range + /// If specified the name of the variable to look up. + VariableName: string option + /// How to perform the lookup. + CaseSensitiveLookup: bool + } /// Provide an inline value through an expression evaluation. /// If only a range is specified, the expression will be extracted from the underlying document. /// An optional expression can be used to override the extracted expression. /// /// @since 3.17.0 -type InlineValueEvaluatableExpression = { - /// The document range for which the inline value applies. - /// The range is used to extract the evaluatable expression from the underlying document. - Range: Range - /// If specified the expression overrides the extracted expression. - Expression: string option -} +type InlineValueEvaluatableExpression = + { + /// The document range for which the inline value applies. + /// The range is used to extract the evaluatable expression from the underlying document. + Range: Range + /// If specified the expression overrides the extracted expression. + Expression: string option + } /// Inline value options used during static registration. /// /// @since 3.17.0 -type InlineValueOptions = { - WorkDoneProgress: bool option -} with +type InlineValueOptions = + { + WorkDoneProgress: bool option + } - interface IInlineValueOptions + interface IInlineValueOptions - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// An inlay hint label part allows for interactive and composite labels /// of inlay hints. /// /// @since 3.17.0 -type InlayHintLabelPart = { - /// The value of this label part. - Value: string - /// The tooltip text when you hover over this label part. Depending on - /// the client capability `inlayHint.resolveSupport` clients might resolve - /// this property late using the resolve request. - Tooltip: U2 option - /// An optional source code location that represents this - /// label part. - /// - /// The editor will use this location for the hover and for code navigation - /// features: This part will become a clickable link that resolves to the - /// definition of the symbol at the given location (not necessarily the - /// location itself), it shows the hover that shows at the given location, - /// and it shows a context menu with further code navigation commands. - /// - /// Depending on the client capability `inlayHint.resolveSupport` clients - /// might resolve this property late using the resolve request. - Location: Location option - /// An optional command for this label part. - /// - /// Depending on the client capability `inlayHint.resolveSupport` clients - /// might resolve this property late using the resolve request. - Command: Command option -} +type InlayHintLabelPart = + { + /// The value of this label part. + Value: string + /// The tooltip text when you hover over this label part. Depending on + /// the client capability `inlayHint.resolveSupport` clients might resolve + /// this property late using the resolve request. + Tooltip: U2 option + /// An optional source code location that represents this + /// label part. + /// + /// The editor will use this location for the hover and for code navigation + /// features: This part will become a clickable link that resolves to the + /// definition of the symbol at the given location (not necessarily the + /// location itself), it shows the hover that shows at the given location, + /// and it shows a context menu with further code navigation commands. + /// + /// Depending on the client capability `inlayHint.resolveSupport` clients + /// might resolve this property late using the resolve request. + Location: Location option + /// An optional command for this label part. + /// + /// Depending on the client capability `inlayHint.resolveSupport` clients + /// might resolve this property late using the resolve request. + Command: Command option + } /// A `MarkupContent` literal represents a string value which content is interpreted base on its /// kind flag. Currently the protocol supports `plaintext` and `markdown` as markup kinds. @@ -3884,1225 +4033,1282 @@ type InlayHintLabelPart = { /// /// *Please Note* that clients might sanitize the return markdown. A client could decide to /// remove HTML from the markdown to avoid script execution. -type MarkupContent = { - /// The type of the Markup - Kind: MarkupKind - /// The content itself - Value: string -} +type MarkupContent = + { + /// The type of the Markup + Kind: MarkupKind + /// The content itself + Value: string + } /// Inlay hint options used during static registration. /// /// @since 3.17.0 -type InlayHintOptions = { - WorkDoneProgress: bool option - /// The server provides support to resolve additional - /// information for an inlay hint item. - ResolveProvider: bool option -} with - - interface IInlayHintOptions with - /// The server provides support to resolve additional - /// information for an inlay hint item. - member x.ResolveProvider = x.ResolveProvider - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress +type InlayHintOptions = + { + WorkDoneProgress: bool option + /// The server provides support to resolve additional + /// information for an inlay hint item. + ResolveProvider: bool option + } + + interface IInlayHintOptions with + /// The server provides support to resolve additional + /// information for an inlay hint item. + member x.ResolveProvider = x.ResolveProvider + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// A full diagnostic report with a set of related documents. /// /// @since 3.17.0 -type RelatedFullDocumentDiagnosticReport = { - /// A full document diagnostic report. - [] - Kind: string - /// An optional result id. If provided it will - /// be sent on the next diagnostic request for the - /// same document. - ResultId: string option - /// The actual items. - Items: Diagnostic[] - /// Diagnostics of related documents. This information is useful - /// in programming languages where code in a file A can generate - /// diagnostics in a file B which A depends on. An example of - /// such a language is C/C++ where marco definitions in a file - /// a.cpp and result in errors in a header file b.hpp. - /// - /// @since 3.17.0 - RelatedDocuments: Map> option -} with - - interface IFullDocumentDiagnosticReport with - /// A full document diagnostic report. - member x.Kind = x.Kind - /// An optional result id. If provided it will - /// be sent on the next diagnostic request for the - /// same document. - member x.ResultId = x.ResultId - /// The actual items. - member x.Items = x.Items +type RelatedFullDocumentDiagnosticReport = + { + /// A full document diagnostic report. + [] + Kind: string + /// An optional result id. If provided it will + /// be sent on the next diagnostic request for the + /// same document. + ResultId: string option + /// The actual items. + Items: Diagnostic[] + /// Diagnostics of related documents. This information is useful + /// in programming languages where code in a file A can generate + /// diagnostics in a file B which A depends on. An example of + /// such a language is C/C++ where marco definitions in a file + /// a.cpp and result in errors in a header file b.hpp. + /// + /// @since 3.17.0 + RelatedDocuments: Map> option + } + + interface IFullDocumentDiagnosticReport with + /// A full document diagnostic report. + member x.Kind = x.Kind + /// An optional result id. If provided it will + /// be sent on the next diagnostic request for the + /// same document. + member x.ResultId = x.ResultId + /// The actual items. + member x.Items = x.Items /// An unchanged diagnostic report with a set of related documents. /// /// @since 3.17.0 -type RelatedUnchangedDocumentDiagnosticReport = { - /// A document diagnostic report indicating - /// no changes to the last result. A server can - /// only return `unchanged` if result ids are - /// provided. - [] - Kind: string - /// A result id which will be sent on the next - /// diagnostic request for the same document. - ResultId: string - /// Diagnostics of related documents. This information is useful - /// in programming languages where code in a file A can generate - /// diagnostics in a file B which A depends on. An example of - /// such a language is C/C++ where marco definitions in a file - /// a.cpp and result in errors in a header file b.hpp. - /// - /// @since 3.17.0 - RelatedDocuments: Map> option -} with - - interface IUnchangedDocumentDiagnosticReport with - /// A document diagnostic report indicating - /// no changes to the last result. A server can - /// only return `unchanged` if result ids are - /// provided. - member x.Kind = x.Kind - /// A result id which will be sent on the next - /// diagnostic request for the same document. - member x.ResultId = x.ResultId +type RelatedUnchangedDocumentDiagnosticReport = + { + /// A document diagnostic report indicating + /// no changes to the last result. A server can + /// only return `unchanged` if result ids are + /// provided. + [] + Kind: string + /// A result id which will be sent on the next + /// diagnostic request for the same document. + ResultId: string + /// Diagnostics of related documents. This information is useful + /// in programming languages where code in a file A can generate + /// diagnostics in a file B which A depends on. An example of + /// such a language is C/C++ where marco definitions in a file + /// a.cpp and result in errors in a header file b.hpp. + /// + /// @since 3.17.0 + RelatedDocuments: Map> option + } + + interface IUnchangedDocumentDiagnosticReport with + /// A document diagnostic report indicating + /// no changes to the last result. A server can + /// only return `unchanged` if result ids are + /// provided. + member x.Kind = x.Kind + /// A result id which will be sent on the next + /// diagnostic request for the same document. + member x.ResultId = x.ResultId /// A diagnostic report with a full set of problems. /// /// @since 3.17.0 -type FullDocumentDiagnosticReport = { - /// A full document diagnostic report. - [] - Kind: string - /// An optional result id. If provided it will - /// be sent on the next diagnostic request for the - /// same document. - ResultId: string option - /// The actual items. - Items: Diagnostic[] -} with - - interface IFullDocumentDiagnosticReport with - /// A full document diagnostic report. - member x.Kind = x.Kind - /// An optional result id. If provided it will - /// be sent on the next diagnostic request for the - /// same document. - member x.ResultId = x.ResultId - /// The actual items. - member x.Items = x.Items +type FullDocumentDiagnosticReport = + { + /// A full document diagnostic report. + [] + Kind: string + /// An optional result id. If provided it will + /// be sent on the next diagnostic request for the + /// same document. + ResultId: string option + /// The actual items. + Items: Diagnostic[] + } + + interface IFullDocumentDiagnosticReport with + /// A full document diagnostic report. + member x.Kind = x.Kind + /// An optional result id. If provided it will + /// be sent on the next diagnostic request for the + /// same document. + member x.ResultId = x.ResultId + /// The actual items. + member x.Items = x.Items /// A diagnostic report indicating that the last returned /// report is still accurate. /// /// @since 3.17.0 -type UnchangedDocumentDiagnosticReport = { - /// A document diagnostic report indicating - /// no changes to the last result. A server can - /// only return `unchanged` if result ids are - /// provided. - [] - Kind: string - /// A result id which will be sent on the next - /// diagnostic request for the same document. - ResultId: string -} with - - interface IUnchangedDocumentDiagnosticReport with - /// A document diagnostic report indicating - /// no changes to the last result. A server can - /// only return `unchanged` if result ids are - /// provided. - member x.Kind = x.Kind - /// A result id which will be sent on the next - /// diagnostic request for the same document. - member x.ResultId = x.ResultId +type UnchangedDocumentDiagnosticReport = + { + /// A document diagnostic report indicating + /// no changes to the last result. A server can + /// only return `unchanged` if result ids are + /// provided. + [] + Kind: string + /// A result id which will be sent on the next + /// diagnostic request for the same document. + ResultId: string + } + + interface IUnchangedDocumentDiagnosticReport with + /// A document diagnostic report indicating + /// no changes to the last result. A server can + /// only return `unchanged` if result ids are + /// provided. + member x.Kind = x.Kind + /// A result id which will be sent on the next + /// diagnostic request for the same document. + member x.ResultId = x.ResultId /// Diagnostic options. /// /// @since 3.17.0 -type DiagnosticOptions = { - WorkDoneProgress: bool option - /// An optional identifier under which the diagnostics are - /// managed by the client. - Identifier: string option - /// Whether the language has inter file dependencies meaning that - /// editing code in one file can result in a different diagnostic - /// set in another file. Inter file dependencies are common for - /// most programming languages and typically uncommon for linters. - InterFileDependencies: bool - /// The server provides support for workspace diagnostics as well. - WorkspaceDiagnostics: bool -} with - - interface IDiagnosticOptions with - /// An optional identifier under which the diagnostics are - /// managed by the client. - member x.Identifier = x.Identifier - /// Whether the language has inter file dependencies meaning that - /// editing code in one file can result in a different diagnostic - /// set in another file. Inter file dependencies are common for - /// most programming languages and typically uncommon for linters. - member x.InterFileDependencies = x.InterFileDependencies - /// The server provides support for workspace diagnostics as well. - member x.WorkspaceDiagnostics = x.WorkspaceDiagnostics - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress +type DiagnosticOptions = + { + WorkDoneProgress: bool option + /// An optional identifier under which the diagnostics are + /// managed by the client. + Identifier: string option + /// Whether the language has inter file dependencies meaning that + /// editing code in one file can result in a different diagnostic + /// set in another file. Inter file dependencies are common for + /// most programming languages and typically uncommon for linters. + InterFileDependencies: bool + /// The server provides support for workspace diagnostics as well. + WorkspaceDiagnostics: bool + } + + interface IDiagnosticOptions with + /// An optional identifier under which the diagnostics are + /// managed by the client. + member x.Identifier = x.Identifier + /// Whether the language has inter file dependencies meaning that + /// editing code in one file can result in a different diagnostic + /// set in another file. Inter file dependencies are common for + /// most programming languages and typically uncommon for linters. + member x.InterFileDependencies = x.InterFileDependencies + /// The server provides support for workspace diagnostics as well. + member x.WorkspaceDiagnostics = x.WorkspaceDiagnostics + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// A previous result id in a workspace pull request. /// /// @since 3.17.0 -type PreviousResultId = { - /// The URI for which the client knowns a - /// result id. - Uri: DocumentUri - /// The value of the previous result id. - Value: string -} +type PreviousResultId = + { + /// The URI for which the client knowns a + /// result id. + Uri: DocumentUri + /// The value of the previous result id. + Value: string + } /// A notebook document. /// /// @since 3.17.0 -type NotebookDocument = { - /// The notebook document's uri. - Uri: URI - /// The type of the notebook. - NotebookType: string - /// The version number of this document (it will increase after each - /// change, including undo/redo). - Version: int32 - /// Additional metadata stored with the notebook - /// document. - /// - /// Note: should always be an object literal (e.g. LSPObject) - Metadata: LSPObject option - /// The cells of a notebook. - Cells: NotebookCell[] -} +type NotebookDocument = + { + /// The notebook document's uri. + Uri: URI + /// The type of the notebook. + NotebookType: string + /// The version number of this document (it will increase after each + /// change, including undo/redo). + Version: int32 + /// Additional metadata stored with the notebook + /// document. + /// + /// Note: should always be an object literal (e.g. LSPObject) + Metadata: LSPObject option + /// The cells of a notebook. + Cells: NotebookCell[] + } /// An item to transfer a text document from the client to the /// server. -type TextDocumentItem = { - /// The text document's uri. - Uri: DocumentUri - /// The text document's language identifier. - LanguageId: string - /// The version number of this document (it will increase after each - /// change, including undo/redo). - Version: int32 - /// The content of the opened text document. - Text: string -} +type TextDocumentItem = + { + /// The text document's uri. + Uri: DocumentUri + /// The text document's language identifier. + LanguageId: string + /// The version number of this document (it will increase after each + /// change, including undo/redo). + Version: int32 + /// The content of the opened text document. + Text: string + } /// A versioned notebook document identifier. /// /// @since 3.17.0 -type VersionedNotebookDocumentIdentifier = { - /// The version number of this notebook document. - Version: int32 - /// The notebook document's uri. - Uri: URI -} - -type NotebookDocumentChangeEventCells = { - /// Changes to the cell structure to add or - /// remove cells. - Structure: NotebookDocumentChangeEventCellsStructure option - /// Changes to notebook cells properties like its - /// kind, execution summary or metadata. - Data: NotebookCell[] option - /// Changes to the text content of notebook cells. - TextContent: NotebookDocumentChangeEventCellsTextContent[] option -} - -type NotebookDocumentChangeEventCellsStructure = { - /// The change to the cell array. - Array: NotebookCellArrayChange - /// Additional opened cell text documents. - DidOpen: TextDocumentItem[] option - /// Additional closed cell text documents. - DidClose: TextDocumentIdentifier[] option -} - -type NotebookDocumentChangeEventCellsTextContent = { - Document: VersionedTextDocumentIdentifier - Changes: TextDocumentContentChangeEvent[] -} +type VersionedNotebookDocumentIdentifier = + { + /// The version number of this notebook document. + Version: int32 + /// The notebook document's uri. + Uri: URI + } + +type NotebookDocumentChangeEventCells = + { + /// Changes to the cell structure to add or + /// remove cells. + Structure: NotebookDocumentChangeEventCellsStructure option + /// Changes to notebook cells properties like its + /// kind, execution summary or metadata. + Data: NotebookCell[] option + /// Changes to the text content of notebook cells. + TextContent: NotebookDocumentChangeEventCellsTextContent[] option + } + +type NotebookDocumentChangeEventCellsStructure = + { + /// The change to the cell array. + Array: NotebookCellArrayChange + /// Additional opened cell text documents. + DidOpen: TextDocumentItem[] option + /// Additional closed cell text documents. + DidClose: TextDocumentIdentifier[] option + } + +type NotebookDocumentChangeEventCellsTextContent = + { + Document: VersionedTextDocumentIdentifier + Changes: TextDocumentContentChangeEvent[] + } /// A change event for a notebook document. /// /// @since 3.17.0 -type NotebookDocumentChangeEvent = { - /// The changed meta data if any. - /// - /// Note: should always be an object literal (e.g. LSPObject) - Metadata: LSPObject option - /// Changes to cells - Cells: NotebookDocumentChangeEventCells option -} +type NotebookDocumentChangeEvent = + { + /// The changed meta data if any. + /// + /// Note: should always be an object literal (e.g. LSPObject) + Metadata: LSPObject option + /// Changes to cells + Cells: NotebookDocumentChangeEventCells option + } /// A literal to identify a notebook document in the client. /// /// @since 3.17.0 -type NotebookDocumentIdentifier = { - /// The notebook document's uri. - Uri: URI -} +type NotebookDocumentIdentifier = + { + /// The notebook document's uri. + Uri: URI + } /// General parameters to register for a notification or to register a provider. -type Registration = { - /// The id used to register the request. The id can be used to deregister - /// the request again. - Id: string - /// The method / capability to register for. - Method: string - /// Options necessary for the registration. - RegisterOptions: LSPAny option -} +type Registration = + { + /// The id used to register the request. The id can be used to deregister + /// the request again. + Id: string + /// The method / capability to register for. + Method: string + /// Options necessary for the registration. + RegisterOptions: LSPAny option + } /// General parameters to unregister a request or notification. -type Unregistration = { - /// The id used to unregister the request or notification. Usually an id - /// provided during the register request. - Id: string - /// The method to unregister for. - Method: string -} +type Unregistration = + { + /// The id used to unregister the request or notification. Usually an id + /// provided during the register request. + Id: string + /// The method to unregister for. + Method: string + } /// The initialize parameters -type _InitializeParams = { - /// An optional token that a server can use to report work done progress. - WorkDoneToken: ProgressToken option - /// The process Id of the parent process that started - /// the server. - /// - /// Is `null` if the process has not been started by another process. - /// If the parent process is not alive then the server should exit. - [] - ProcessId: int32 option - /// Information about the client - /// - /// @since 3.15.0 - ClientInfo: _InitializeParamsClientInfo option - /// The locale the client is currently showing the user interface - /// in. This must not necessarily be the locale of the operating - /// system. - /// - /// Uses IETF language tags as the value's syntax - /// (See https://en.wikipedia.org/wiki/IETF_language_tag) - /// - /// @since 3.16.0 - Locale: string option - /// The rootPath of the workspace. Is null - /// if no folder is open. - /// - /// @deprecated in favour of rootUri. - RootPath: string option - /// The rootUri of the workspace. Is null if no - /// folder is open. If both `rootPath` and `rootUri` are set - /// `rootUri` wins. - /// - /// @deprecated in favour of workspaceFolders. - [] - RootUri: DocumentUri option - /// The capabilities provided by the client (editor or tool) - Capabilities: ClientCapabilities - /// User provided initialization options. - InitializationOptions: LSPAny option - /// The initial trace setting. If omitted trace is disabled ('off'). - Trace: TraceValues option -} with - - interface I_InitializeParams with - /// The process Id of the parent process that started - /// the server. - /// - /// Is `null` if the process has not been started by another process. - /// If the parent process is not alive then the server should exit. - member x.ProcessId = x.ProcessId - /// Information about the client - /// - /// @since 3.15.0 - member x.ClientInfo = x.ClientInfo - /// The locale the client is currently showing the user interface - /// in. This must not necessarily be the locale of the operating - /// system. - /// - /// Uses IETF language tags as the value's syntax - /// (See https://en.wikipedia.org/wiki/IETF_language_tag) - /// - /// @since 3.16.0 - member x.Locale = x.Locale - /// The rootPath of the workspace. Is null - /// if no folder is open. - /// - /// @deprecated in favour of rootUri. - member x.RootPath = x.RootPath - /// The rootUri of the workspace. Is null if no - /// folder is open. If both `rootPath` and `rootUri` are set - /// `rootUri` wins. - /// - /// @deprecated in favour of workspaceFolders. - member x.RootUri = x.RootUri - /// The capabilities provided by the client (editor or tool) - member x.Capabilities = x.Capabilities - /// User provided initialization options. - member x.InitializationOptions = x.InitializationOptions - /// The initial trace setting. If omitted trace is disabled ('off'). - member x.Trace = x.Trace - - interface IWorkDoneProgressParams with - /// An optional token that a server can use to report work done progress. - member x.WorkDoneToken = x.WorkDoneToken - -type WorkspaceFoldersInitializeParams = { - /// The workspace folders configured in the client when the server starts. - /// - /// This property is only available if the client supports workspace folders. - /// It can be `null` if the client supports workspace folders but none are - /// configured. - /// - /// @since 3.6.0 - WorkspaceFolders: WorkspaceFolder[] option -} with - - interface IWorkspaceFoldersInitializeParams with - /// The workspace folders configured in the client when the server starts. - /// - /// This property is only available if the client supports workspace folders. - /// It can be `null` if the client supports workspace folders but none are - /// configured. - /// - /// @since 3.6.0 - member x.WorkspaceFolders = x.WorkspaceFolders - -type ServerCapabilitiesWorkspace = { - /// The server supports workspace folder. - /// - /// @since 3.6.0 - WorkspaceFolders: WorkspaceFoldersServerCapabilities option - /// The server is interested in notifications/requests for operations on files. - /// - /// @since 3.16.0 - FileOperations: FileOperationOptions option -} +type _InitializeParams = + { + /// An optional token that a server can use to report work done progress. + WorkDoneToken: ProgressToken option + /// The process Id of the parent process that started + /// the server. + /// + /// Is `null` if the process has not been started by another process. + /// If the parent process is not alive then the server should exit. + ProcessId: int32 option + /// Information about the client + /// + /// @since 3.15.0 + ClientInfo: _InitializeParamsClientInfo option + /// The locale the client is currently showing the user interface + /// in. This must not necessarily be the locale of the operating + /// system. + /// + /// Uses IETF language tags as the value's syntax + /// (See https://en.wikipedia.org/wiki/IETF_language_tag) + /// + /// @since 3.16.0 + Locale: string option + /// The rootPath of the workspace. Is null + /// if no folder is open. + /// + /// @deprecated in favour of rootUri. + RootPath: string option + /// The rootUri of the workspace. Is null if no + /// folder is open. If both `rootPath` and `rootUri` are set + /// `rootUri` wins. + /// + /// @deprecated in favour of workspaceFolders. + RootUri: DocumentUri option + /// The capabilities provided by the client (editor or tool) + Capabilities: ClientCapabilities + /// User provided initialization options. + InitializationOptions: LSPAny option + /// The initial trace setting. If omitted trace is disabled ('off'). + Trace: TraceValues option + } + + interface I_InitializeParams with + /// The process Id of the parent process that started + /// the server. + /// + /// Is `null` if the process has not been started by another process. + /// If the parent process is not alive then the server should exit. + member x.ProcessId = x.ProcessId + /// Information about the client + /// + /// @since 3.15.0 + member x.ClientInfo = x.ClientInfo + /// The locale the client is currently showing the user interface + /// in. This must not necessarily be the locale of the operating + /// system. + /// + /// Uses IETF language tags as the value's syntax + /// (See https://en.wikipedia.org/wiki/IETF_language_tag) + /// + /// @since 3.16.0 + member x.Locale = x.Locale + /// The rootPath of the workspace. Is null + /// if no folder is open. + /// + /// @deprecated in favour of rootUri. + member x.RootPath = x.RootPath + /// The rootUri of the workspace. Is null if no + /// folder is open. If both `rootPath` and `rootUri` are set + /// `rootUri` wins. + /// + /// @deprecated in favour of workspaceFolders. + member x.RootUri = x.RootUri + /// The capabilities provided by the client (editor or tool) + member x.Capabilities = x.Capabilities + /// User provided initialization options. + member x.InitializationOptions = x.InitializationOptions + /// The initial trace setting. If omitted trace is disabled ('off'). + member x.Trace = x.Trace + + interface IWorkDoneProgressParams with + /// An optional token that a server can use to report work done progress. + member x.WorkDoneToken = x.WorkDoneToken + +type WorkspaceFoldersInitializeParams = + { + /// The workspace folders configured in the client when the server starts. + /// + /// This property is only available if the client supports workspace folders. + /// It can be `null` if the client supports workspace folders but none are + /// configured. + /// + /// @since 3.6.0 + WorkspaceFolders: WorkspaceFolder[] option + } + + interface IWorkspaceFoldersInitializeParams with + /// The workspace folders configured in the client when the server starts. + /// + /// This property is only available if the client supports workspace folders. + /// It can be `null` if the client supports workspace folders but none are + /// configured. + /// + /// @since 3.6.0 + member x.WorkspaceFolders = x.WorkspaceFolders + +type ServerCapabilitiesWorkspace = + { + /// The server supports workspace folder. + /// + /// @since 3.6.0 + WorkspaceFolders: WorkspaceFoldersServerCapabilities option + /// The server is interested in notifications/requests for operations on files. + /// + /// @since 3.16.0 + FileOperations: FileOperationOptions option + } /// Defines the capabilities provided by a language /// server. -type ServerCapabilities = { - /// The position encoding the server picked from the encodings offered - /// by the client via the client capability `general.positionEncodings`. - /// - /// If the client didn't provide any position encodings the only valid - /// value that a server can return is 'utf-16'. - /// - /// If omitted it defaults to 'utf-16'. - /// - /// @since 3.17.0 - PositionEncoding: PositionEncodingKind option - /// Defines how text documents are synced. Is either a detailed structure - /// defining each notification or for backwards compatibility the - /// TextDocumentSyncKind number. - TextDocumentSync: U2 option - /// Defines how notebook documents are synced. - /// - /// @since 3.17.0 - NotebookDocumentSync: U2 option - /// The server provides completion support. - CompletionProvider: CompletionOptions option - /// The server provides hover support. - HoverProvider: U2 option - /// The server provides signature help support. - SignatureHelpProvider: SignatureHelpOptions option - /// The server provides Goto Declaration support. - DeclarationProvider: U3 option - /// The server provides goto definition support. - DefinitionProvider: U2 option - /// The server provides Goto Type Definition support. - TypeDefinitionProvider: U3 option - /// The server provides Goto Implementation support. - ImplementationProvider: U3 option - /// The server provides find references support. - ReferencesProvider: U2 option - /// The server provides document highlight support. - DocumentHighlightProvider: U2 option - /// The server provides document symbol support. - DocumentSymbolProvider: U2 option - /// The server provides code actions. CodeActionOptions may only be - /// specified if the client states that it supports - /// `codeActionLiteralSupport` in its initial `initialize` request. - CodeActionProvider: U2 option - /// The server provides code lens. - CodeLensProvider: CodeLensOptions option - /// The server provides document link support. - DocumentLinkProvider: DocumentLinkOptions option - /// The server provides color provider support. - ColorProvider: U3 option - /// The server provides workspace symbol support. - WorkspaceSymbolProvider: U2 option - /// The server provides document formatting. - DocumentFormattingProvider: U2 option - /// The server provides document range formatting. - DocumentRangeFormattingProvider: U2 option - /// The server provides document formatting on typing. - DocumentOnTypeFormattingProvider: DocumentOnTypeFormattingOptions option - /// The server provides rename support. RenameOptions may only be - /// specified if the client states that it supports - /// `prepareSupport` in its initial `initialize` request. - RenameProvider: U2 option - /// The server provides folding provider support. - FoldingRangeProvider: U3 option - /// The server provides selection range support. - SelectionRangeProvider: U3 option - /// The server provides execute command support. - ExecuteCommandProvider: ExecuteCommandOptions option - /// The server provides call hierarchy support. - /// - /// @since 3.16.0 - CallHierarchyProvider: U3 option - /// The server provides linked editing range support. - /// - /// @since 3.16.0 - LinkedEditingRangeProvider: U3 option - /// The server provides semantic tokens support. - /// - /// @since 3.16.0 - SemanticTokensProvider: U2 option - /// The server provides moniker support. - /// - /// @since 3.16.0 - MonikerProvider: U3 option - /// The server provides type hierarchy support. - /// - /// @since 3.17.0 - TypeHierarchyProvider: U3 option - /// The server provides inline values. - /// - /// @since 3.17.0 - InlineValueProvider: U3 option - /// The server provides inlay hints. - /// - /// @since 3.17.0 - InlayHintProvider: U3 option - /// The server has support for pull model diagnostics. - /// - /// @since 3.17.0 - DiagnosticProvider: U2 option - /// Workspace specific server capabilities. - Workspace: ServerCapabilitiesWorkspace option - /// Experimental server capabilities. - Experimental: LSPAny option -} +type ServerCapabilities = + { + /// The position encoding the server picked from the encodings offered + /// by the client via the client capability `general.positionEncodings`. + /// + /// If the client didn't provide any position encodings the only valid + /// value that a server can return is 'utf-16'. + /// + /// If omitted it defaults to 'utf-16'. + /// + /// @since 3.17.0 + PositionEncoding: PositionEncodingKind option + /// Defines how text documents are synced. Is either a detailed structure + /// defining each notification or for backwards compatibility the + /// TextDocumentSyncKind number. + TextDocumentSync: U2 option + /// Defines how notebook documents are synced. + /// + /// @since 3.17.0 + NotebookDocumentSync: U2 option + /// The server provides completion support. + CompletionProvider: CompletionOptions option + /// The server provides hover support. + HoverProvider: U2 option + /// The server provides signature help support. + SignatureHelpProvider: SignatureHelpOptions option + /// The server provides Goto Declaration support. + DeclarationProvider: U3 option + /// The server provides goto definition support. + DefinitionProvider: U2 option + /// The server provides Goto Type Definition support. + TypeDefinitionProvider: U3 option + /// The server provides Goto Implementation support. + ImplementationProvider: U3 option + /// The server provides find references support. + ReferencesProvider: U2 option + /// The server provides document highlight support. + DocumentHighlightProvider: U2 option + /// The server provides document symbol support. + DocumentSymbolProvider: U2 option + /// The server provides code actions. CodeActionOptions may only be + /// specified if the client states that it supports + /// `codeActionLiteralSupport` in its initial `initialize` request. + CodeActionProvider: U2 option + /// The server provides code lens. + CodeLensProvider: CodeLensOptions option + /// The server provides document link support. + DocumentLinkProvider: DocumentLinkOptions option + /// The server provides color provider support. + ColorProvider: U3 option + /// The server provides workspace symbol support. + WorkspaceSymbolProvider: U2 option + /// The server provides document formatting. + DocumentFormattingProvider: U2 option + /// The server provides document range formatting. + DocumentRangeFormattingProvider: U2 option + /// The server provides document formatting on typing. + DocumentOnTypeFormattingProvider: DocumentOnTypeFormattingOptions option + /// The server provides rename support. RenameOptions may only be + /// specified if the client states that it supports + /// `prepareSupport` in its initial `initialize` request. + RenameProvider: U2 option + /// The server provides folding provider support. + FoldingRangeProvider: U3 option + /// The server provides selection range support. + SelectionRangeProvider: U3 option + /// The server provides execute command support. + ExecuteCommandProvider: ExecuteCommandOptions option + /// The server provides call hierarchy support. + /// + /// @since 3.16.0 + CallHierarchyProvider: U3 option + /// The server provides linked editing range support. + /// + /// @since 3.16.0 + LinkedEditingRangeProvider: U3 option + /// The server provides semantic tokens support. + /// + /// @since 3.16.0 + SemanticTokensProvider: U2 option + /// The server provides moniker support. + /// + /// @since 3.16.0 + MonikerProvider: U3 option + /// The server provides type hierarchy support. + /// + /// @since 3.17.0 + TypeHierarchyProvider: U3 option + /// The server provides inline values. + /// + /// @since 3.17.0 + InlineValueProvider: U3 option + /// The server provides inlay hints. + /// + /// @since 3.17.0 + InlayHintProvider: U3 option + /// The server has support for pull model diagnostics. + /// + /// @since 3.17.0 + DiagnosticProvider: U2 option + /// Workspace specific server capabilities. + Workspace: ServerCapabilitiesWorkspace option + /// Experimental server capabilities. + Experimental: LSPAny option + } /// A text document identifier to denote a specific version of a text document. -type VersionedTextDocumentIdentifier = { - /// The text document's uri. - Uri: DocumentUri - /// The version number of this document. - Version: int32 -} with - - interface ITextDocumentIdentifier with - /// The text document's uri. - member x.Uri = x.Uri +type VersionedTextDocumentIdentifier = + { + /// The text document's uri. + Uri: DocumentUri + /// The version number of this document. + Version: int32 + } + + interface ITextDocumentIdentifier with + /// The text document's uri. + member x.Uri = x.Uri /// Save options. -type SaveOptions = { - /// The client is supposed to include the content on save. - IncludeText: bool option -} with +type SaveOptions = + { + /// The client is supposed to include the content on save. + IncludeText: bool option + } - interface ISaveOptions with - /// The client is supposed to include the content on save. - member x.IncludeText = x.IncludeText + interface ISaveOptions with + /// The client is supposed to include the content on save. + member x.IncludeText = x.IncludeText /// An event describing a file change. -type FileEvent = { - /// The file's uri. - Uri: DocumentUri - /// The change type. - Type: FileChangeType -} - -type FileSystemWatcher = { - /// The glob pattern to watch. See {@link GlobPattern glob pattern} for more detail. - /// - /// @since 3.17.0 support for relative patterns. - GlobPattern: GlobPattern - /// The kind of events of interest. If omitted it defaults - /// to WatchKind.Create | WatchKind.Change | WatchKind.Delete - /// which is 7. - Kind: WatchKind option -} +type FileEvent = + { + /// The file's uri. + Uri: DocumentUri + /// The change type. + Type: FileChangeType + } + +type FileSystemWatcher = + { + /// The glob pattern to watch. See {@link GlobPattern glob pattern} for more detail. + /// + /// @since 3.17.0 support for relative patterns. + GlobPattern: GlobPattern + /// The kind of events of interest. If omitted it defaults + /// to WatchKind.Create | WatchKind.Change | WatchKind.Delete + /// which is 7. + Kind: WatchKind option + } /// Represents a diagnostic, such as a compiler error or warning. Diagnostic objects /// are only valid in the scope of a resource. [] -type Diagnostic = { - /// The range at which the message applies - Range: Range - /// The diagnostic's severity. Can be omitted. If omitted it is up to the - /// client to interpret diagnostics as error, warning, info or hint. - Severity: DiagnosticSeverity option - /// The diagnostic's code, which usually appear in the user interface. - Code: U2 option - /// An optional property to describe the error code. - /// Requires the code field (above) to be present/not null. - /// - /// @since 3.16.0 - CodeDescription: CodeDescription option - /// A human-readable string describing the source of this - /// diagnostic, e.g. 'typescript' or 'super lint'. It usually - /// appears in the user interface. - Source: string option - /// The diagnostic's message. It usually appears in the user interface - Message: string - /// Additional metadata about the diagnostic. - /// - /// @since 3.15.0 - Tags: DiagnosticTag[] option - /// An array of related diagnostic information, e.g. when symbol-names within - /// a scope collide all definitions can be marked via this property. - RelatedInformation: DiagnosticRelatedInformation[] option - /// A data entry field that is preserved between a `textDocument/publishDiagnostics` - /// notification and `textDocument/codeAction` request. - /// - /// @since 3.16.0 - Data: LSPAny option -} with - - [] - member x.DebuggerDisplay = - $"[{defaultArg x.Severity DiagnosticSeverity.Error}] ({x.Range.DebuggerDisplay}) {x.Message} ({Option.map string x.Code |> Option.defaultValue String.Empty})" +type Diagnostic = + { + /// The range at which the message applies + Range: Range + /// The diagnostic's severity. Can be omitted. If omitted it is up to the + /// client to interpret diagnostics as error, warning, info or hint. + Severity: DiagnosticSeverity option + /// The diagnostic's code, which usually appear in the user interface. + Code: U2 option + /// An optional property to describe the error code. + /// Requires the code field (above) to be present/not null. + /// + /// @since 3.16.0 + CodeDescription: CodeDescription option + /// A human-readable string describing the source of this + /// diagnostic, e.g. 'typescript' or 'super lint'. It usually + /// appears in the user interface. + Source: string option + /// The diagnostic's message. It usually appears in the user interface + Message: string + /// Additional metadata about the diagnostic. + /// + /// @since 3.15.0 + Tags: DiagnosticTag[] option + /// An array of related diagnostic information, e.g. when symbol-names within + /// a scope collide all definitions can be marked via this property. + RelatedInformation: DiagnosticRelatedInformation[] option + /// A data entry field that is preserved between a `textDocument/publishDiagnostics` + /// notification and `textDocument/codeAction` request. + /// + /// @since 3.16.0 + Data: LSPAny option + } + + [] + member x.DebuggerDisplay = + $"[{defaultArg x.Severity DiagnosticSeverity.Error}] ({x.Range.DebuggerDisplay}) {x.Message} ({Option.map string x.Code |> Option.defaultValue String.Empty})" /// Contains additional information about the context in which a completion request is triggered. -type CompletionContext = { - /// How the completion was triggered. - TriggerKind: CompletionTriggerKind - /// The trigger character (a single character) that has trigger code complete. - /// Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter` - TriggerCharacter: string option -} +type CompletionContext = + { + /// How the completion was triggered. + TriggerKind: CompletionTriggerKind + /// The trigger character (a single character) that has trigger code complete. + /// Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter` + TriggerCharacter: string option + } /// Additional details for a completion item label. /// /// @since 3.17.0 -type CompletionItemLabelDetails = { - /// An optional string which is rendered less prominently directly after {@link CompletionItem.label label}, - /// without any spacing. Should be used for function signatures and type annotations. - Detail: string option - /// An optional string which is rendered less prominently after {@link CompletionItem.detail}. Should be used - /// for fully qualified names and file paths. - Description: string option -} +type CompletionItemLabelDetails = + { + /// An optional string which is rendered less prominently directly after {@link CompletionItem.label label}, + /// without any spacing. Should be used for function signatures and type annotations. + Detail: string option + /// An optional string which is rendered less prominently after {@link CompletionItem.detail}. Should be used + /// for fully qualified names and file paths. + Description: string option + } /// A special text edit to provide an insert and a replace operation. /// /// @since 3.16.0 -type InsertReplaceEdit = { - /// The string to be inserted. - NewText: string - /// The range if the insert is requested - Insert: Range - /// The range if the replace is requested. - Replace: Range -} +type InsertReplaceEdit = + { + /// The string to be inserted. + NewText: string + /// The range if the insert is requested + Insert: Range + /// The range if the replace is requested. + Replace: Range + } /// Completion options. -type CompletionOptions = { - WorkDoneProgress: bool option - /// Most tools trigger completion request automatically without explicitly requesting - /// it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user - /// starts to type an identifier. For example if the user types `c` in a JavaScript file - /// code complete will automatically pop up present `console` besides others as a - /// completion item. Characters that make up identifiers don't need to be listed here. - /// - /// If code complete should automatically be trigger on characters not being valid inside - /// an identifier (for example `.` in JavaScript) list them in `triggerCharacters`. - TriggerCharacters: string[] option - /// The list of all possible characters that commit a completion. This field can be used - /// if clients don't support individual commit characters per completion item. See - /// `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport` - /// - /// If a server provides both `allCommitCharacters` and commit characters on an individual - /// completion item the ones on the completion item win. - /// - /// @since 3.2.0 - AllCommitCharacters: string[] option - /// The server provides support to resolve additional - /// information for a completion item. - ResolveProvider: bool option - /// The server supports the following `CompletionItem` specific - /// capabilities. - /// - /// @since 3.17.0 - CompletionItem: CompletionOptionsCompletionItem option -} with - - interface ICompletionOptions with - /// Most tools trigger completion request automatically without explicitly requesting - /// it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user - /// starts to type an identifier. For example if the user types `c` in a JavaScript file - /// code complete will automatically pop up present `console` besides others as a - /// completion item. Characters that make up identifiers don't need to be listed here. - /// - /// If code complete should automatically be trigger on characters not being valid inside - /// an identifier (for example `.` in JavaScript) list them in `triggerCharacters`. - member x.TriggerCharacters = x.TriggerCharacters - /// The list of all possible characters that commit a completion. This field can be used - /// if clients don't support individual commit characters per completion item. See - /// `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport` - /// - /// If a server provides both `allCommitCharacters` and commit characters on an individual - /// completion item the ones on the completion item win. - /// - /// @since 3.2.0 - member x.AllCommitCharacters = x.AllCommitCharacters - /// The server provides support to resolve additional - /// information for a completion item. - member x.ResolveProvider = x.ResolveProvider - /// The server supports the following `CompletionItem` specific - /// capabilities. - /// - /// @since 3.17.0 - member x.CompletionItem = x.CompletionItem - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress +type CompletionOptions = + { + WorkDoneProgress: bool option + /// Most tools trigger completion request automatically without explicitly requesting + /// it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user + /// starts to type an identifier. For example if the user types `c` in a JavaScript file + /// code complete will automatically pop up present `console` besides others as a + /// completion item. Characters that make up identifiers don't need to be listed here. + /// + /// If code complete should automatically be trigger on characters not being valid inside + /// an identifier (for example `.` in JavaScript) list them in `triggerCharacters`. + TriggerCharacters: string[] option + /// The list of all possible characters that commit a completion. This field can be used + /// if clients don't support individual commit characters per completion item. See + /// `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport` + /// + /// If a server provides both `allCommitCharacters` and commit characters on an individual + /// completion item the ones on the completion item win. + /// + /// @since 3.2.0 + AllCommitCharacters: string[] option + /// The server provides support to resolve additional + /// information for a completion item. + ResolveProvider: bool option + /// The server supports the following `CompletionItem` specific + /// capabilities. + /// + /// @since 3.17.0 + CompletionItem: CompletionOptionsCompletionItem option + } + + interface ICompletionOptions with + /// Most tools trigger completion request automatically without explicitly requesting + /// it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user + /// starts to type an identifier. For example if the user types `c` in a JavaScript file + /// code complete will automatically pop up present `console` besides others as a + /// completion item. Characters that make up identifiers don't need to be listed here. + /// + /// If code complete should automatically be trigger on characters not being valid inside + /// an identifier (for example `.` in JavaScript) list them in `triggerCharacters`. + member x.TriggerCharacters = x.TriggerCharacters + /// The list of all possible characters that commit a completion. This field can be used + /// if clients don't support individual commit characters per completion item. See + /// `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport` + /// + /// If a server provides both `allCommitCharacters` and commit characters on an individual + /// completion item the ones on the completion item win. + /// + /// @since 3.2.0 + member x.AllCommitCharacters = x.AllCommitCharacters + /// The server provides support to resolve additional + /// information for a completion item. + member x.ResolveProvider = x.ResolveProvider + /// The server supports the following `CompletionItem` specific + /// capabilities. + /// + /// @since 3.17.0 + member x.CompletionItem = x.CompletionItem + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// Hover options. -type HoverOptions = { - WorkDoneProgress: bool option -} with +type HoverOptions = + { + WorkDoneProgress: bool option + } - interface IHoverOptions + interface IHoverOptions - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// Additional information about the context in which a signature help request was triggered. /// /// @since 3.15.0 -type SignatureHelpContext = { - /// Action that caused signature help to be triggered. - TriggerKind: SignatureHelpTriggerKind - /// Character that caused signature help to be triggered. - /// - /// This is undefined when `triggerKind !== SignatureHelpTriggerKind.TriggerCharacter` - TriggerCharacter: string option - /// `true` if signature help was already showing when it was triggered. - /// - /// Retriggers occurs when the signature help is already active and can be caused by actions such as - /// typing a trigger character, a cursor move, or document content changes. - IsRetrigger: bool - /// The currently active `SignatureHelp`. - /// - /// The `activeSignatureHelp` has its `SignatureHelp.activeSignature` field updated based on - /// the user navigating through available signatures. - ActiveSignatureHelp: SignatureHelp option -} +type SignatureHelpContext = + { + /// Action that caused signature help to be triggered. + TriggerKind: SignatureHelpTriggerKind + /// Character that caused signature help to be triggered. + /// + /// This is undefined when `triggerKind !== SignatureHelpTriggerKind.TriggerCharacter` + TriggerCharacter: string option + /// `true` if signature help was already showing when it was triggered. + /// + /// Retriggers occurs when the signature help is already active and can be caused by actions such as + /// typing a trigger character, a cursor move, or document content changes. + IsRetrigger: bool + /// The currently active `SignatureHelp`. + /// + /// The `activeSignatureHelp` has its `SignatureHelp.activeSignature` field updated based on + /// the user navigating through available signatures. + ActiveSignatureHelp: SignatureHelp option + } /// Represents the signature of something callable. A signature /// can have a label, like a function-name, a doc-comment, and /// a set of parameters. -type SignatureInformation = { - /// The label of this signature. Will be shown in - /// the UI. - Label: string - /// The human-readable doc-comment of this signature. Will be shown - /// in the UI but can be omitted. - Documentation: U2 option - /// The parameters of this signature. - Parameters: ParameterInformation[] option - /// The index of the active parameter. - /// - /// If provided, this is used in place of `SignatureHelp.activeParameter`. - /// - /// @since 3.16.0 - ActiveParameter: uint32 option -} +type SignatureInformation = + { + /// The label of this signature. Will be shown in + /// the UI. + Label: string + /// The human-readable doc-comment of this signature. Will be shown + /// in the UI but can be omitted. + Documentation: U2 option + /// The parameters of this signature. + Parameters: ParameterInformation[] option + /// The index of the active parameter. + /// + /// If provided, this is used in place of `SignatureHelp.activeParameter`. + /// + /// @since 3.16.0 + ActiveParameter: uint32 option + } /// Server Capabilities for a {@link SignatureHelpRequest}. -type SignatureHelpOptions = { - WorkDoneProgress: bool option - /// List of characters that trigger signature help automatically. - TriggerCharacters: string[] option - /// List of characters that re-trigger signature help. - /// - /// These trigger characters are only active when signature help is already showing. All trigger characters - /// are also counted as re-trigger characters. - /// - /// @since 3.15.0 - RetriggerCharacters: string[] option -} with - - interface ISignatureHelpOptions with - /// List of characters that trigger signature help automatically. - member x.TriggerCharacters = x.TriggerCharacters - /// List of characters that re-trigger signature help. - /// - /// These trigger characters are only active when signature help is already showing. All trigger characters - /// are also counted as re-trigger characters. - /// - /// @since 3.15.0 - member x.RetriggerCharacters = x.RetriggerCharacters - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress +type SignatureHelpOptions = + { + WorkDoneProgress: bool option + /// List of characters that trigger signature help automatically. + TriggerCharacters: string[] option + /// List of characters that re-trigger signature help. + /// + /// These trigger characters are only active when signature help is already showing. All trigger characters + /// are also counted as re-trigger characters. + /// + /// @since 3.15.0 + RetriggerCharacters: string[] option + } + + interface ISignatureHelpOptions with + /// List of characters that trigger signature help automatically. + member x.TriggerCharacters = x.TriggerCharacters + /// List of characters that re-trigger signature help. + /// + /// These trigger characters are only active when signature help is already showing. All trigger characters + /// are also counted as re-trigger characters. + /// + /// @since 3.15.0 + member x.RetriggerCharacters = x.RetriggerCharacters + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// Server Capabilities for a {@link DefinitionRequest}. -type DefinitionOptions = { - WorkDoneProgress: bool option -} with +type DefinitionOptions = + { + WorkDoneProgress: bool option + } - interface IDefinitionOptions + interface IDefinitionOptions - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// Value-object that contains additional information when /// requesting references. -type ReferenceContext = { - /// Include the declaration of the current symbol. - IncludeDeclaration: bool -} +type ReferenceContext = + { + /// Include the declaration of the current symbol. + IncludeDeclaration: bool + } /// Reference options. -type ReferenceOptions = { - WorkDoneProgress: bool option -} with +type ReferenceOptions = + { + WorkDoneProgress: bool option + } - interface IReferenceOptions + interface IReferenceOptions - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// Provider options for a {@link DocumentHighlightRequest}. -type DocumentHighlightOptions = { - WorkDoneProgress: bool option -} with +type DocumentHighlightOptions = + { + WorkDoneProgress: bool option + } - interface IDocumentHighlightOptions + interface IDocumentHighlightOptions - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// A base for all symbol information. -type BaseSymbolInformation = { - /// The name of this symbol. - Name: string - /// The kind of this symbol. - Kind: SymbolKind - /// Tags for this symbol. - /// - /// @since 3.16.0 - Tags: SymbolTag[] option - /// The name of the symbol containing this symbol. This information is for - /// user interface purposes (e.g. to render a qualifier in the user interface - /// if necessary). It can't be used to re-infer a hierarchy for the document - /// symbols. - ContainerName: string option -} with - - interface IBaseSymbolInformation with - /// The name of this symbol. - member x.Name = x.Name - /// The kind of this symbol. - member x.Kind = x.Kind - /// Tags for this symbol. - /// - /// @since 3.16.0 - member x.Tags = x.Tags - /// The name of the symbol containing this symbol. This information is for - /// user interface purposes (e.g. to render a qualifier in the user interface - /// if necessary). It can't be used to re-infer a hierarchy for the document - /// symbols. - member x.ContainerName = x.ContainerName +type BaseSymbolInformation = + { + /// The name of this symbol. + Name: string + /// The kind of this symbol. + Kind: SymbolKind + /// Tags for this symbol. + /// + /// @since 3.16.0 + Tags: SymbolTag[] option + /// The name of the symbol containing this symbol. This information is for + /// user interface purposes (e.g. to render a qualifier in the user interface + /// if necessary). It can't be used to re-infer a hierarchy for the document + /// symbols. + ContainerName: string option + } + + interface IBaseSymbolInformation with + /// The name of this symbol. + member x.Name = x.Name + /// The kind of this symbol. + member x.Kind = x.Kind + /// Tags for this symbol. + /// + /// @since 3.16.0 + member x.Tags = x.Tags + /// The name of the symbol containing this symbol. This information is for + /// user interface purposes (e.g. to render a qualifier in the user interface + /// if necessary). It can't be used to re-infer a hierarchy for the document + /// symbols. + member x.ContainerName = x.ContainerName /// Provider options for a {@link DocumentSymbolRequest}. -type DocumentSymbolOptions = { - WorkDoneProgress: bool option - /// A human-readable string that is shown when multiple outlines trees - /// are shown for the same document. - /// - /// @since 3.16.0 - Label: string option -} with - - interface IDocumentSymbolOptions with - /// A human-readable string that is shown when multiple outlines trees - /// are shown for the same document. - /// - /// @since 3.16.0 - member x.Label = x.Label - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress +type DocumentSymbolOptions = + { + WorkDoneProgress: bool option + /// A human-readable string that is shown when multiple outlines trees + /// are shown for the same document. + /// + /// @since 3.16.0 + Label: string option + } + + interface IDocumentSymbolOptions with + /// A human-readable string that is shown when multiple outlines trees + /// are shown for the same document. + /// + /// @since 3.16.0 + member x.Label = x.Label + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// Contains additional diagnostic information about the context in which /// a {@link CodeActionProvider.provideCodeActions code action} is run. -type CodeActionContext = { - /// An array of diagnostics known on the client side overlapping the range provided to the - /// `textDocument/codeAction` request. They are provided so that the server knows which - /// errors are currently presented to the user for the given range. There is no guarantee - /// that these accurately reflect the error state of the resource. The primary parameter - /// to compute code actions is the provided range. - Diagnostics: Diagnostic[] - /// Requested kind of actions to return. - /// - /// Actions not of this kind are filtered out by the client before being shown. So servers - /// can omit computing them. - Only: CodeActionKind[] option - /// The reason why code actions were requested. - /// - /// @since 3.17.0 - TriggerKind: CodeActionTriggerKind option -} +type CodeActionContext = + { + /// An array of diagnostics known on the client side overlapping the range provided to the + /// `textDocument/codeAction` request. They are provided so that the server knows which + /// errors are currently presented to the user for the given range. There is no guarantee + /// that these accurately reflect the error state of the resource. The primary parameter + /// to compute code actions is the provided range. + Diagnostics: Diagnostic[] + /// Requested kind of actions to return. + /// + /// Actions not of this kind are filtered out by the client before being shown. So servers + /// can omit computing them. + Only: CodeActionKind[] option + /// The reason why code actions were requested. + /// + /// @since 3.17.0 + TriggerKind: CodeActionTriggerKind option + } /// Provider options for a {@link CodeActionRequest}. -type CodeActionOptions = { - WorkDoneProgress: bool option - /// CodeActionKinds that this server may return. - /// - /// The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server - /// may list out every specific kind they provide. - CodeActionKinds: CodeActionKind[] option - /// The server provides support to resolve additional - /// information for a code action. - /// - /// @since 3.16.0 - ResolveProvider: bool option -} with - - interface ICodeActionOptions with - /// CodeActionKinds that this server may return. - /// - /// The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server - /// may list out every specific kind they provide. - member x.CodeActionKinds = x.CodeActionKinds - /// The server provides support to resolve additional - /// information for a code action. - /// - /// @since 3.16.0 - member x.ResolveProvider = x.ResolveProvider - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress +type CodeActionOptions = + { + WorkDoneProgress: bool option + /// CodeActionKinds that this server may return. + /// + /// The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server + /// may list out every specific kind they provide. + CodeActionKinds: CodeActionKind[] option + /// The server provides support to resolve additional + /// information for a code action. + /// + /// @since 3.16.0 + ResolveProvider: bool option + } + + interface ICodeActionOptions with + /// CodeActionKinds that this server may return. + /// + /// The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server + /// may list out every specific kind they provide. + member x.CodeActionKinds = x.CodeActionKinds + /// The server provides support to resolve additional + /// information for a code action. + /// + /// @since 3.16.0 + member x.ResolveProvider = x.ResolveProvider + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// Server capabilities for a {@link WorkspaceSymbolRequest}. -type WorkspaceSymbolOptions = { - WorkDoneProgress: bool option - /// The server provides support to resolve additional - /// information for a workspace symbol. - /// - /// @since 3.17.0 - ResolveProvider: bool option -} with - - interface IWorkspaceSymbolOptions with - /// The server provides support to resolve additional - /// information for a workspace symbol. - /// - /// @since 3.17.0 - member x.ResolveProvider = x.ResolveProvider - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress +type WorkspaceSymbolOptions = + { + WorkDoneProgress: bool option + /// The server provides support to resolve additional + /// information for a workspace symbol. + /// + /// @since 3.17.0 + ResolveProvider: bool option + } + + interface IWorkspaceSymbolOptions with + /// The server provides support to resolve additional + /// information for a workspace symbol. + /// + /// @since 3.17.0 + member x.ResolveProvider = x.ResolveProvider + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// Code Lens provider options of a {@link CodeLensRequest}. -type CodeLensOptions = { - WorkDoneProgress: bool option - /// Code lens has a resolve provider as well. - ResolveProvider: bool option -} with +type CodeLensOptions = + { + WorkDoneProgress: bool option + /// Code lens has a resolve provider as well. + ResolveProvider: bool option + } - interface ICodeLensOptions with - /// Code lens has a resolve provider as well. - member x.ResolveProvider = x.ResolveProvider + interface ICodeLensOptions with + /// Code lens has a resolve provider as well. + member x.ResolveProvider = x.ResolveProvider - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// Provider options for a {@link DocumentLinkRequest}. -type DocumentLinkOptions = { - WorkDoneProgress: bool option - /// Document links have a resolve provider as well. - ResolveProvider: bool option -} with +type DocumentLinkOptions = + { + WorkDoneProgress: bool option + /// Document links have a resolve provider as well. + ResolveProvider: bool option + } - interface IDocumentLinkOptions with - /// Document links have a resolve provider as well. - member x.ResolveProvider = x.ResolveProvider + interface IDocumentLinkOptions with + /// Document links have a resolve provider as well. + member x.ResolveProvider = x.ResolveProvider - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// Value-object describing what options formatting should use. -type FormattingOptions = { - /// Size of a tab in spaces. - TabSize: uint32 - /// Prefer spaces over tabs. - InsertSpaces: bool - /// Trim trailing whitespace on a line. - /// - /// @since 3.15.0 - TrimTrailingWhitespace: bool option - /// Insert a newline character at the end of the file if one does not exist. - /// - /// @since 3.15.0 - InsertFinalNewline: bool option - /// Trim all newlines after the final newline at the end of the file. - /// - /// @since 3.15.0 - TrimFinalNewlines: bool option -} +type FormattingOptions = + { + /// Size of a tab in spaces. + TabSize: uint32 + /// Prefer spaces over tabs. + InsertSpaces: bool + /// Trim trailing whitespace on a line. + /// + /// @since 3.15.0 + TrimTrailingWhitespace: bool option + /// Insert a newline character at the end of the file if one does not exist. + /// + /// @since 3.15.0 + InsertFinalNewline: bool option + /// Trim all newlines after the final newline at the end of the file. + /// + /// @since 3.15.0 + TrimFinalNewlines: bool option + } /// Provider options for a {@link DocumentFormattingRequest}. -type DocumentFormattingOptions = { - WorkDoneProgress: bool option -} with +type DocumentFormattingOptions = + { + WorkDoneProgress: bool option + } - interface IDocumentFormattingOptions + interface IDocumentFormattingOptions - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// Provider options for a {@link DocumentRangeFormattingRequest}. -type DocumentRangeFormattingOptions = { - WorkDoneProgress: bool option -} with +type DocumentRangeFormattingOptions = + { + WorkDoneProgress: bool option + } - interface IDocumentRangeFormattingOptions + interface IDocumentRangeFormattingOptions - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// Provider options for a {@link DocumentOnTypeFormattingRequest}. -type DocumentOnTypeFormattingOptions = { - /// A character on which formatting should be triggered, like `{`. - FirstTriggerCharacter: string - /// More trigger characters. - MoreTriggerCharacter: string[] option -} with - - interface IDocumentOnTypeFormattingOptions with - /// A character on which formatting should be triggered, like `{`. - member x.FirstTriggerCharacter = x.FirstTriggerCharacter - /// More trigger characters. - member x.MoreTriggerCharacter = x.MoreTriggerCharacter +type DocumentOnTypeFormattingOptions = + { + /// A character on which formatting should be triggered, like `{`. + FirstTriggerCharacter: string + /// More trigger characters. + MoreTriggerCharacter: string[] option + } + + interface IDocumentOnTypeFormattingOptions with + /// A character on which formatting should be triggered, like `{`. + member x.FirstTriggerCharacter = x.FirstTriggerCharacter + /// More trigger characters. + member x.MoreTriggerCharacter = x.MoreTriggerCharacter /// Provider options for a {@link RenameRequest}. -type RenameOptions = { - WorkDoneProgress: bool option - /// Renames should be checked and tested before being executed. - /// - /// @since version 3.12.0 - PrepareProvider: bool option -} with - - interface IRenameOptions with - /// Renames should be checked and tested before being executed. - /// - /// @since version 3.12.0 - member x.PrepareProvider = x.PrepareProvider - - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress +type RenameOptions = + { + WorkDoneProgress: bool option + /// Renames should be checked and tested before being executed. + /// + /// @since version 3.12.0 + PrepareProvider: bool option + } + + interface IRenameOptions with + /// Renames should be checked and tested before being executed. + /// + /// @since version 3.12.0 + member x.PrepareProvider = x.PrepareProvider + + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// The server capabilities of a {@link ExecuteCommandRequest}. -type ExecuteCommandOptions = { - WorkDoneProgress: bool option - /// The commands to be executed on the server - Commands: string[] -} with +type ExecuteCommandOptions = + { + WorkDoneProgress: bool option + /// The commands to be executed on the server + Commands: string[] + } - interface IExecuteCommandOptions with - /// The commands to be executed on the server - member x.Commands = x.Commands + interface IExecuteCommandOptions with + /// The commands to be executed on the server + member x.Commands = x.Commands - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// @since 3.16.0 -type SemanticTokensLegend = { - /// The token types a server uses. - TokenTypes: string[] - /// The token modifiers a server uses. - TokenModifiers: string[] -} +type SemanticTokensLegend = + { + /// The token types a server uses. + TokenTypes: string[] + /// The token modifiers a server uses. + TokenModifiers: string[] + } /// A text document identifier to optionally denote a specific version of a text document. -type OptionalVersionedTextDocumentIdentifier = { - /// The text document's uri. - Uri: DocumentUri - /// The version number of this document. If a versioned text document identifier - /// is sent from the server to the client and the file is not open in the editor - /// (the server has not received an open notification before) the server can send - /// `null` to indicate that the version is unknown and the content on disk is the - /// truth (as specified with document content ownership). - [] - Version: int32 option -} with - - interface ITextDocumentIdentifier with - /// The text document's uri. - member x.Uri = x.Uri +type OptionalVersionedTextDocumentIdentifier = + { + /// The text document's uri. + Uri: DocumentUri + /// The version number of this document. If a versioned text document identifier + /// is sent from the server to the client and the file is not open in the editor + /// (the server has not received an open notification before) the server can send + /// `null` to indicate that the version is unknown and the content on disk is the + /// truth (as specified with document content ownership). + Version: int32 option + } + + interface ITextDocumentIdentifier with + /// The text document's uri. + member x.Uri = x.Uri /// A special text edit with an additional change annotation. /// /// @since 3.16.0. -type AnnotatedTextEdit = { - /// The range of the text document to be manipulated. To insert - /// text into a document create a range where start === end. - Range: Range - /// The string to be inserted. For delete operations use an - /// empty string. - NewText: string - /// The actual identifier of the change annotation - AnnotationId: ChangeAnnotationIdentifier -} with - - interface ITextEdit with - /// The range of the text document to be manipulated. To insert - /// text into a document create a range where start === end. - member x.Range = x.Range - /// The string to be inserted. For delete operations use an - /// empty string. - member x.NewText = x.NewText +type AnnotatedTextEdit = + { + /// The range of the text document to be manipulated. To insert + /// text into a document create a range where start === end. + Range: Range + /// The string to be inserted. For delete operations use an + /// empty string. + NewText: string + /// The actual identifier of the change annotation + AnnotationId: ChangeAnnotationIdentifier + } + + interface ITextEdit with + /// The range of the text document to be manipulated. To insert + /// text into a document create a range where start === end. + member x.Range = x.Range + /// The string to be inserted. For delete operations use an + /// empty string. + member x.NewText = x.NewText /// A generic resource operation. -type ResourceOperation = { - /// The resource operation kind. - Kind: string - /// An optional annotation identifier describing the operation. - /// - /// @since 3.16.0 - AnnotationId: ChangeAnnotationIdentifier option -} with - - interface IResourceOperation with - /// The resource operation kind. - member x.Kind = x.Kind - /// An optional annotation identifier describing the operation. - /// - /// @since 3.16.0 - member x.AnnotationId = x.AnnotationId +type ResourceOperation = + { + /// The resource operation kind. + Kind: string + /// An optional annotation identifier describing the operation. + /// + /// @since 3.16.0 + AnnotationId: ChangeAnnotationIdentifier option + } + + interface IResourceOperation with + /// The resource operation kind. + member x.Kind = x.Kind + /// An optional annotation identifier describing the operation. + /// + /// @since 3.16.0 + member x.AnnotationId = x.AnnotationId /// Options to create a file. -type CreateFileOptions = { - /// Overwrite existing file. Overwrite wins over `ignoreIfExists` - Overwrite: bool option - /// Ignore if exists. - IgnoreIfExists: bool option -} +type CreateFileOptions = + { + /// Overwrite existing file. Overwrite wins over `ignoreIfExists` + Overwrite: bool option + /// Ignore if exists. + IgnoreIfExists: bool option + } /// Rename file options -type RenameFileOptions = { - /// Overwrite target if existing. Overwrite wins over `ignoreIfExists` - Overwrite: bool option - /// Ignores if target exists. - IgnoreIfExists: bool option -} +type RenameFileOptions = + { + /// Overwrite target if existing. Overwrite wins over `ignoreIfExists` + Overwrite: bool option + /// Ignores if target exists. + IgnoreIfExists: bool option + } /// Delete file options -type DeleteFileOptions = { - /// Delete the content recursively if a folder is denoted. - Recursive: bool option - /// Ignore the operation if the file doesn't exist. - IgnoreIfNotExists: bool option -} +type DeleteFileOptions = + { + /// Delete the content recursively if a folder is denoted. + Recursive: bool option + /// Ignore the operation if the file doesn't exist. + IgnoreIfNotExists: bool option + } /// A pattern to describe in which file operation requests or notifications /// the server is interested in receiving. /// /// @since 3.16.0 -type FileOperationPattern = { - /// The glob pattern to match. Glob patterns can have the following syntax: - /// - `*` to match one or more characters in a path segment - /// - `?` to match on one character in a path segment - /// - `**` to match any number of path segments, including none - /// - `{}` to group sub patterns into an OR expression. (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files) - /// - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) - /// - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`) - Glob: string - /// Whether to match files or folders with this pattern. - /// - /// Matches both if undefined. - Matches: FileOperationPatternKind option - /// Additional options used during matching. - Options: FileOperationPatternOptions option -} +type FileOperationPattern = + { + /// The glob pattern to match. Glob patterns can have the following syntax: + /// - `*` to match one or more characters in a path segment + /// - `?` to match on one character in a path segment + /// - `**` to match any number of path segments, including none + /// - `{}` to group sub patterns into an OR expression. (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files) + /// - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) + /// - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`) + Glob: string + /// Whether to match files or folders with this pattern. + /// + /// Matches both if undefined. + Matches: FileOperationPatternKind option + /// Additional options used during matching. + Options: FileOperationPatternOptions option + } /// A full document diagnostic report for a workspace diagnostic result. /// /// @since 3.17.0 -type WorkspaceFullDocumentDiagnosticReport = { - /// A full document diagnostic report. - [] - Kind: string - /// An optional result id. If provided it will - /// be sent on the next diagnostic request for the - /// same document. - ResultId: string option - /// The actual items. - Items: Diagnostic[] - /// The URI for which diagnostic information is reported. - Uri: DocumentUri - /// The version number for which the diagnostics are reported. - /// If the document is not marked as open `null` can be provided. - [] - Version: int32 option -} with - - interface IFullDocumentDiagnosticReport with - /// A full document diagnostic report. - member x.Kind = x.Kind - /// An optional result id. If provided it will - /// be sent on the next diagnostic request for the - /// same document. - member x.ResultId = x.ResultId - /// The actual items. - member x.Items = x.Items +type WorkspaceFullDocumentDiagnosticReport = + { + /// A full document diagnostic report. + [] + Kind: string + /// An optional result id. If provided it will + /// be sent on the next diagnostic request for the + /// same document. + ResultId: string option + /// The actual items. + Items: Diagnostic[] + /// The URI for which diagnostic information is reported. + Uri: DocumentUri + /// The version number for which the diagnostics are reported. + /// If the document is not marked as open `null` can be provided. + Version: int32 option + } + + interface IFullDocumentDiagnosticReport with + /// A full document diagnostic report. + member x.Kind = x.Kind + /// An optional result id. If provided it will + /// be sent on the next diagnostic request for the + /// same document. + member x.ResultId = x.ResultId + /// The actual items. + member x.Items = x.Items /// An unchanged document diagnostic report for a workspace diagnostic result. /// /// @since 3.17.0 -type WorkspaceUnchangedDocumentDiagnosticReport = { - /// A document diagnostic report indicating - /// no changes to the last result. A server can - /// only return `unchanged` if result ids are - /// provided. - [] - Kind: string - /// A result id which will be sent on the next - /// diagnostic request for the same document. - ResultId: string - /// The URI for which diagnostic information is reported. - Uri: DocumentUri - /// The version number for which the diagnostics are reported. - /// If the document is not marked as open `null` can be provided. - [] - Version: int32 option -} with - - interface IUnchangedDocumentDiagnosticReport with - /// A document diagnostic report indicating - /// no changes to the last result. A server can - /// only return `unchanged` if result ids are - /// provided. - member x.Kind = x.Kind - /// A result id which will be sent on the next - /// diagnostic request for the same document. - member x.ResultId = x.ResultId +type WorkspaceUnchangedDocumentDiagnosticReport = + { + /// A document diagnostic report indicating + /// no changes to the last result. A server can + /// only return `unchanged` if result ids are + /// provided. + [] + Kind: string + /// A result id which will be sent on the next + /// diagnostic request for the same document. + ResultId: string + /// The URI for which diagnostic information is reported. + Uri: DocumentUri + /// The version number for which the diagnostics are reported. + /// If the document is not marked as open `null` can be provided. + Version: int32 option + } + + interface IUnchangedDocumentDiagnosticReport with + /// A document diagnostic report indicating + /// no changes to the last result. A server can + /// only return `unchanged` if result ids are + /// provided. + member x.Kind = x.Kind + /// A result id which will be sent on the next + /// diagnostic request for the same document. + member x.ResultId = x.ResultId /// A notebook cell. /// @@ -5111,80 +5317,85 @@ type WorkspaceUnchangedDocumentDiagnosticReport = { /// notebook cell or the cell's text document. /// /// @since 3.17.0 -type NotebookCell = { - /// The cell's kind - Kind: NotebookCellKind - /// The URI of the cell's text document - /// content. - Document: DocumentUri - /// Additional metadata stored with the cell. - /// - /// Note: should always be an object literal (e.g. LSPObject) - Metadata: LSPObject option - /// Additional execution summary information - /// if supported by the client. - ExecutionSummary: ExecutionSummary option -} +type NotebookCell = + { + /// The cell's kind + Kind: NotebookCellKind + /// The URI of the cell's text document + /// content. + Document: DocumentUri + /// Additional metadata stored with the cell. + /// + /// Note: should always be an object literal (e.g. LSPObject) + Metadata: LSPObject option + /// Additional execution summary information + /// if supported by the client. + ExecutionSummary: ExecutionSummary option + } /// A change describing how to move a `NotebookCell` /// array from state S to S'. /// /// @since 3.17.0 -type NotebookCellArrayChange = { - /// The start oftest of the cell that changed. - Start: uint32 - /// The deleted cells - DeleteCount: uint32 - /// The new cells, if any - Cells: NotebookCell[] option -} +type NotebookCellArrayChange = + { + /// The start oftest of the cell that changed. + Start: uint32 + /// The deleted cells + DeleteCount: uint32 + /// The new cells, if any + Cells: NotebookCell[] option + } /// Defines the capabilities provided by the client. -type ClientCapabilities = { - /// Workspace specific client capabilities. - Workspace: WorkspaceClientCapabilities option - /// Text document specific client capabilities. - TextDocument: TextDocumentClientCapabilities option - /// Capabilities specific to the notebook document support. - /// - /// @since 3.17.0 - NotebookDocument: NotebookDocumentClientCapabilities option - /// Window specific client capabilities. - Window: WindowClientCapabilities option - /// General client capabilities. - /// - /// @since 3.16.0 - General: GeneralClientCapabilities option - /// Experimental client capabilities. - Experimental: LSPAny option -} - -type TextDocumentSyncOptions = { - /// Open and close notifications are sent to the server. If omitted open close notification should not - /// be sent. - OpenClose: bool option - /// Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full - /// and TextDocumentSyncKind.Incremental. If omitted it defaults to TextDocumentSyncKind.None. - Change: TextDocumentSyncKind option - /// If present will save notifications are sent to the server. If omitted the notification should not be - /// sent. - WillSave: bool option - /// If present will save wait until requests are sent to the server. If omitted the request should not be - /// sent. - WillSaveWaitUntil: bool option - /// If present save notifications are sent to the server. If omitted the notification should not be - /// sent. - Save: U2 option -} - -type NotebookDocumentSyncOptionsNotebookSelector = { - /// The notebook to be synced If a string - /// value is provided it matches against the - /// notebook type. '*' matches every notebook. - Notebook: U2 option - /// The cells of the matching notebook to be synced. - Cells: NotebookDocumentSyncOptionsNotebookSelectorCells[] option -} +type ClientCapabilities = + { + /// Workspace specific client capabilities. + Workspace: WorkspaceClientCapabilities option + /// Text document specific client capabilities. + TextDocument: TextDocumentClientCapabilities option + /// Capabilities specific to the notebook document support. + /// + /// @since 3.17.0 + NotebookDocument: NotebookDocumentClientCapabilities option + /// Window specific client capabilities. + Window: WindowClientCapabilities option + /// General client capabilities. + /// + /// @since 3.16.0 + General: GeneralClientCapabilities option + /// Experimental client capabilities. + Experimental: LSPAny option + } + +type TextDocumentSyncOptions = + { + /// Open and close notifications are sent to the server. If omitted open close notification should not + /// be sent. + OpenClose: bool option + /// Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full + /// and TextDocumentSyncKind.Incremental. If omitted it defaults to TextDocumentSyncKind.None. + Change: TextDocumentSyncKind option + /// If present will save notifications are sent to the server. If omitted the notification should not be + /// sent. + WillSave: bool option + /// If present will save wait until requests are sent to the server. If omitted the request should not be + /// sent. + WillSaveWaitUntil: bool option + /// If present save notifications are sent to the server. If omitted the notification should not be + /// sent. + Save: U2 option + } + +type NotebookDocumentSyncOptionsNotebookSelector = + { + /// The notebook to be synced If a string + /// value is provided it matches against the + /// notebook type. '*' matches every notebook. + Notebook: U2 option + /// The cells of the matching notebook to be synced. + Cells: NotebookDocumentSyncOptionsNotebookSelectorCells[] option + } type NotebookDocumentSyncOptionsNotebookSelectorCells = { Language: string } @@ -5201,507 +5412,535 @@ type NotebookDocumentSyncOptionsNotebookSelectorCells = { Language: string } /// cell will be synced. /// /// @since 3.17.0 -type NotebookDocumentSyncOptions = { - /// The notebooks to be synced - NotebookSelector: NotebookDocumentSyncOptionsNotebookSelector[] - /// Whether save notification should be forwarded to - /// the server. Will only be honored if mode === `notebook`. - Save: bool option -} with - - interface INotebookDocumentSyncOptions with - /// The notebooks to be synced - member x.NotebookSelector = x.NotebookSelector - /// Whether save notification should be forwarded to - /// the server. Will only be honored if mode === `notebook`. - member x.Save = x.Save +type NotebookDocumentSyncOptions = + { + /// The notebooks to be synced + NotebookSelector: NotebookDocumentSyncOptionsNotebookSelector[] + /// Whether save notification should be forwarded to + /// the server. Will only be honored if mode === `notebook`. + Save: bool option + } + + interface INotebookDocumentSyncOptions with + /// The notebooks to be synced + member x.NotebookSelector = x.NotebookSelector + /// Whether save notification should be forwarded to + /// the server. Will only be honored if mode === `notebook`. + member x.Save = x.Save /// Registration options specific to a notebook. /// /// @since 3.17.0 -type NotebookDocumentSyncRegistrationOptions = { - /// The notebooks to be synced - NotebookSelector: NotebookDocumentSyncOptionsNotebookSelector[] - /// Whether save notification should be forwarded to - /// the server. Will only be honored if mode === `notebook`. - Save: bool option - /// The id used to register the request. The id can be used to deregister - /// the request again. See also Registration#id. - Id: string option -} with - - interface INotebookDocumentSyncOptions with - /// The notebooks to be synced - member x.NotebookSelector = x.NotebookSelector - /// Whether save notification should be forwarded to - /// the server. Will only be honored if mode === `notebook`. - member x.Save = x.Save - -type WorkspaceFoldersServerCapabilities = { - /// The server has support for workspace folders - Supported: bool option - /// Whether the server wants to receive workspace folder - /// change notifications. - /// - /// If a string is provided the string is treated as an ID - /// under which the notification is registered on the client - /// side. The ID can be used to unregister for these events - /// using the `client/unregisterCapability` request. - ChangeNotifications: U2 option -} +type NotebookDocumentSyncRegistrationOptions = + { + /// The notebooks to be synced + NotebookSelector: NotebookDocumentSyncOptionsNotebookSelector[] + /// Whether save notification should be forwarded to + /// the server. Will only be honored if mode === `notebook`. + Save: bool option + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + Id: string option + } + + interface INotebookDocumentSyncOptions with + /// The notebooks to be synced + member x.NotebookSelector = x.NotebookSelector + /// Whether save notification should be forwarded to + /// the server. Will only be honored if mode === `notebook`. + member x.Save = x.Save + +type WorkspaceFoldersServerCapabilities = + { + /// The server has support for workspace folders + Supported: bool option + /// Whether the server wants to receive workspace folder + /// change notifications. + /// + /// If a string is provided the string is treated as an ID + /// under which the notification is registered on the client + /// side. The ID can be used to unregister for these events + /// using the `client/unregisterCapability` request. + ChangeNotifications: U2 option + } /// Options for notifications/requests for user operations on files. /// /// @since 3.16.0 -type FileOperationOptions = { - /// The server is interested in receiving didCreateFiles notifications. - DidCreate: FileOperationRegistrationOptions option - /// The server is interested in receiving willCreateFiles requests. - WillCreate: FileOperationRegistrationOptions option - /// The server is interested in receiving didRenameFiles notifications. - DidRename: FileOperationRegistrationOptions option - /// The server is interested in receiving willRenameFiles requests. - WillRename: FileOperationRegistrationOptions option - /// The server is interested in receiving didDeleteFiles file notifications. - DidDelete: FileOperationRegistrationOptions option - /// The server is interested in receiving willDeleteFiles file requests. - WillDelete: FileOperationRegistrationOptions option -} +type FileOperationOptions = + { + /// The server is interested in receiving didCreateFiles notifications. + DidCreate: FileOperationRegistrationOptions option + /// The server is interested in receiving willCreateFiles requests. + WillCreate: FileOperationRegistrationOptions option + /// The server is interested in receiving didRenameFiles notifications. + DidRename: FileOperationRegistrationOptions option + /// The server is interested in receiving willRenameFiles requests. + WillRename: FileOperationRegistrationOptions option + /// The server is interested in receiving didDeleteFiles file notifications. + DidDelete: FileOperationRegistrationOptions option + /// The server is interested in receiving willDeleteFiles file requests. + WillDelete: FileOperationRegistrationOptions option + } /// Structure to capture a description for an error code. /// /// @since 3.16.0 -type CodeDescription = { - /// An URI to open with more information about the diagnostic error. - Href: URI -} +type CodeDescription = + { + /// An URI to open with more information about the diagnostic error. + Href: URI + } /// Represents a related message and source code location for a diagnostic. This should be /// used to point to code locations that cause or related to a diagnostics, e.g when duplicating /// a symbol in a scope. -type DiagnosticRelatedInformation = { - /// The location of this related diagnostic information. - Location: Location - /// The message of this related diagnostic information. - Message: string -} +type DiagnosticRelatedInformation = + { + /// The location of this related diagnostic information. + Location: Location + /// The message of this related diagnostic information. + Message: string + } /// Represents a parameter of a callable-signature. A parameter can /// have a label and a doc-comment. -type ParameterInformation = { - /// The label of this parameter information. - /// - /// Either a string or an inclusive start and exclusive end offsets within its containing - /// signature label. (see SignatureInformation.label). The offsets are based on a UTF-16 - /// string representation as `Position` and `Range` does. - /// - /// *Note*: a label of type string should be a substring of its containing signature label. - /// Its intended use case is to highlight the parameter label part in the `SignatureInformation.label`. - Label: U2 - /// The human-readable doc-comment of this parameter. Will be shown - /// in the UI but can be omitted. - Documentation: U2 option -} +type ParameterInformation = + { + /// The label of this parameter information. + /// + /// Either a string or an inclusive start and exclusive end offsets within its containing + /// signature label. (see SignatureInformation.label). The offsets are based on a UTF-16 + /// string representation as `Position` and `Range` does. + /// + /// *Note*: a label of type string should be a substring of its containing signature label. + /// Its intended use case is to highlight the parameter label part in the `SignatureInformation.label`. + Label: U2 + /// The human-readable doc-comment of this parameter. Will be shown + /// in the UI but can be omitted. + Documentation: U2 option + } /// A notebook cell text document filter denotes a cell text /// document by different properties. /// /// @since 3.17.0 -type NotebookCellTextDocumentFilter = { - /// A filter that matches against the notebook - /// containing the notebook cell. If a string - /// value is provided it matches against the - /// notebook type. '*' matches every notebook. - Notebook: U2 - /// A language id like `python`. - /// - /// Will be matched against the language id of the - /// notebook cell document. '*' matches every language. - Language: string option -} +type NotebookCellTextDocumentFilter = + { + /// A filter that matches against the notebook + /// containing the notebook cell. If a string + /// value is provided it matches against the + /// notebook type. '*' matches every notebook. + Notebook: U2 + /// A language id like `python`. + /// + /// Will be matched against the language id of the + /// notebook cell document. '*' matches every language. + Language: string option + } /// Matching options for the file operation pattern. /// /// @since 3.16.0 -type FileOperationPatternOptions = { - /// The pattern should be matched ignoring casing. - IgnoreCase: bool option -} - -type ExecutionSummary = { - /// A strict monotonically increasing value - /// indicating the execution order of a cell - /// inside a notebook. - ExecutionOrder: uint32 - /// Whether the execution was successful or - /// not if known by the client. - Success: bool option -} +type FileOperationPatternOptions = + { + /// The pattern should be matched ignoring casing. + IgnoreCase: bool option + } + +type ExecutionSummary = + { + /// A strict monotonically increasing value + /// indicating the execution order of a cell + /// inside a notebook. + ExecutionOrder: uint32 + /// Whether the execution was successful or + /// not if known by the client. + Success: bool option + } /// Workspace specific client capabilities. -type WorkspaceClientCapabilities = { - /// The client supports applying batch edits - /// to the workspace by supporting the request - /// 'workspace/applyEdit' - ApplyEdit: bool option - /// Capabilities specific to `WorkspaceEdit`s. - WorkspaceEdit: WorkspaceEditClientCapabilities option - /// Capabilities specific to the `workspace/didChangeConfiguration` notification. - DidChangeConfiguration: DidChangeConfigurationClientCapabilities option - /// Capabilities specific to the `workspace/didChangeWatchedFiles` notification. - DidChangeWatchedFiles: DidChangeWatchedFilesClientCapabilities option - /// Capabilities specific to the `workspace/symbol` request. - Symbol: WorkspaceSymbolClientCapabilities option - /// Capabilities specific to the `workspace/executeCommand` request. - ExecuteCommand: ExecuteCommandClientCapabilities option - /// The client has support for workspace folders. - /// - /// @since 3.6.0 - WorkspaceFolders: bool option - /// The client supports `workspace/configuration` requests. - /// - /// @since 3.6.0 - Configuration: bool option - /// Capabilities specific to the semantic token requests scoped to the - /// workspace. - /// - /// @since 3.16.0. - SemanticTokens: SemanticTokensWorkspaceClientCapabilities option - /// Capabilities specific to the code lens requests scoped to the - /// workspace. - /// - /// @since 3.16.0. - CodeLens: CodeLensWorkspaceClientCapabilities option - /// The client has support for file notifications/requests for user operations on files. - /// - /// Since 3.16.0 - FileOperations: FileOperationClientCapabilities option - /// Capabilities specific to the inline values requests scoped to the - /// workspace. - /// - /// @since 3.17.0. - InlineValue: InlineValueWorkspaceClientCapabilities option - /// Capabilities specific to the inlay hint requests scoped to the - /// workspace. - /// - /// @since 3.17.0. - InlayHint: InlayHintWorkspaceClientCapabilities option - /// Capabilities specific to the diagnostic requests scoped to the - /// workspace. - /// - /// @since 3.17.0. - Diagnostics: DiagnosticWorkspaceClientCapabilities option -} +type WorkspaceClientCapabilities = + { + /// The client supports applying batch edits + /// to the workspace by supporting the request + /// 'workspace/applyEdit' + ApplyEdit: bool option + /// Capabilities specific to `WorkspaceEdit`s. + WorkspaceEdit: WorkspaceEditClientCapabilities option + /// Capabilities specific to the `workspace/didChangeConfiguration` notification. + DidChangeConfiguration: DidChangeConfigurationClientCapabilities option + /// Capabilities specific to the `workspace/didChangeWatchedFiles` notification. + DidChangeWatchedFiles: DidChangeWatchedFilesClientCapabilities option + /// Capabilities specific to the `workspace/symbol` request. + Symbol: WorkspaceSymbolClientCapabilities option + /// Capabilities specific to the `workspace/executeCommand` request. + ExecuteCommand: ExecuteCommandClientCapabilities option + /// The client has support for workspace folders. + /// + /// @since 3.6.0 + WorkspaceFolders: bool option + /// The client supports `workspace/configuration` requests. + /// + /// @since 3.6.0 + Configuration: bool option + /// Capabilities specific to the semantic token requests scoped to the + /// workspace. + /// + /// @since 3.16.0. + SemanticTokens: SemanticTokensWorkspaceClientCapabilities option + /// Capabilities specific to the code lens requests scoped to the + /// workspace. + /// + /// @since 3.16.0. + CodeLens: CodeLensWorkspaceClientCapabilities option + /// The client has support for file notifications/requests for user operations on files. + /// + /// Since 3.16.0 + FileOperations: FileOperationClientCapabilities option + /// Capabilities specific to the inline values requests scoped to the + /// workspace. + /// + /// @since 3.17.0. + InlineValue: InlineValueWorkspaceClientCapabilities option + /// Capabilities specific to the inlay hint requests scoped to the + /// workspace. + /// + /// @since 3.17.0. + InlayHint: InlayHintWorkspaceClientCapabilities option + /// Capabilities specific to the diagnostic requests scoped to the + /// workspace. + /// + /// @since 3.17.0. + Diagnostics: DiagnosticWorkspaceClientCapabilities option + } /// Text document specific client capabilities. -type TextDocumentClientCapabilities = { - /// Defines which synchronization capabilities the client supports. - Synchronization: TextDocumentSyncClientCapabilities option - /// Capabilities specific to the `textDocument/completion` request. - Completion: CompletionClientCapabilities option - /// Capabilities specific to the `textDocument/hover` request. - Hover: HoverClientCapabilities option - /// Capabilities specific to the `textDocument/signatureHelp` request. - SignatureHelp: SignatureHelpClientCapabilities option - /// Capabilities specific to the `textDocument/declaration` request. - /// - /// @since 3.14.0 - Declaration: DeclarationClientCapabilities option - /// Capabilities specific to the `textDocument/definition` request. - Definition: DefinitionClientCapabilities option - /// Capabilities specific to the `textDocument/typeDefinition` request. - /// - /// @since 3.6.0 - TypeDefinition: TypeDefinitionClientCapabilities option - /// Capabilities specific to the `textDocument/implementation` request. - /// - /// @since 3.6.0 - Implementation: ImplementationClientCapabilities option - /// Capabilities specific to the `textDocument/references` request. - References: ReferenceClientCapabilities option - /// Capabilities specific to the `textDocument/documentHighlight` request. - DocumentHighlight: DocumentHighlightClientCapabilities option - /// Capabilities specific to the `textDocument/documentSymbol` request. - DocumentSymbol: DocumentSymbolClientCapabilities option - /// Capabilities specific to the `textDocument/codeAction` request. - CodeAction: CodeActionClientCapabilities option - /// Capabilities specific to the `textDocument/codeLens` request. - CodeLens: CodeLensClientCapabilities option - /// Capabilities specific to the `textDocument/documentLink` request. - DocumentLink: DocumentLinkClientCapabilities option - /// Capabilities specific to the `textDocument/documentColor` and the - /// `textDocument/colorPresentation` request. - /// - /// @since 3.6.0 - ColorProvider: DocumentColorClientCapabilities option - /// Capabilities specific to the `textDocument/formatting` request. - Formatting: DocumentFormattingClientCapabilities option - /// Capabilities specific to the `textDocument/rangeFormatting` request. - RangeFormatting: DocumentRangeFormattingClientCapabilities option - /// Capabilities specific to the `textDocument/onTypeFormatting` request. - OnTypeFormatting: DocumentOnTypeFormattingClientCapabilities option - /// Capabilities specific to the `textDocument/rename` request. - Rename: RenameClientCapabilities option - /// Capabilities specific to the `textDocument/foldingRange` request. - /// - /// @since 3.10.0 - FoldingRange: FoldingRangeClientCapabilities option - /// Capabilities specific to the `textDocument/selectionRange` request. - /// - /// @since 3.15.0 - SelectionRange: SelectionRangeClientCapabilities option - /// Capabilities specific to the `textDocument/publishDiagnostics` notification. - PublishDiagnostics: PublishDiagnosticsClientCapabilities option - /// Capabilities specific to the various call hierarchy requests. - /// - /// @since 3.16.0 - CallHierarchy: CallHierarchyClientCapabilities option - /// Capabilities specific to the various semantic token request. - /// - /// @since 3.16.0 - SemanticTokens: SemanticTokensClientCapabilities option - /// Capabilities specific to the `textDocument/linkedEditingRange` request. - /// - /// @since 3.16.0 - LinkedEditingRange: LinkedEditingRangeClientCapabilities option - /// Client capabilities specific to the `textDocument/moniker` request. - /// - /// @since 3.16.0 - Moniker: MonikerClientCapabilities option - /// Capabilities specific to the various type hierarchy requests. - /// - /// @since 3.17.0 - TypeHierarchy: TypeHierarchyClientCapabilities option - /// Capabilities specific to the `textDocument/inlineValue` request. - /// - /// @since 3.17.0 - InlineValue: InlineValueClientCapabilities option - /// Capabilities specific to the `textDocument/inlayHint` request. - /// - /// @since 3.17.0 - InlayHint: InlayHintClientCapabilities option - /// Capabilities specific to the diagnostic pull model. - /// - /// @since 3.17.0 - Diagnostic: DiagnosticClientCapabilities option -} +type TextDocumentClientCapabilities = + { + /// Defines which synchronization capabilities the client supports. + Synchronization: TextDocumentSyncClientCapabilities option + /// Capabilities specific to the `textDocument/completion` request. + Completion: CompletionClientCapabilities option + /// Capabilities specific to the `textDocument/hover` request. + Hover: HoverClientCapabilities option + /// Capabilities specific to the `textDocument/signatureHelp` request. + SignatureHelp: SignatureHelpClientCapabilities option + /// Capabilities specific to the `textDocument/declaration` request. + /// + /// @since 3.14.0 + Declaration: DeclarationClientCapabilities option + /// Capabilities specific to the `textDocument/definition` request. + Definition: DefinitionClientCapabilities option + /// Capabilities specific to the `textDocument/typeDefinition` request. + /// + /// @since 3.6.0 + TypeDefinition: TypeDefinitionClientCapabilities option + /// Capabilities specific to the `textDocument/implementation` request. + /// + /// @since 3.6.0 + Implementation: ImplementationClientCapabilities option + /// Capabilities specific to the `textDocument/references` request. + References: ReferenceClientCapabilities option + /// Capabilities specific to the `textDocument/documentHighlight` request. + DocumentHighlight: DocumentHighlightClientCapabilities option + /// Capabilities specific to the `textDocument/documentSymbol` request. + DocumentSymbol: DocumentSymbolClientCapabilities option + /// Capabilities specific to the `textDocument/codeAction` request. + CodeAction: CodeActionClientCapabilities option + /// Capabilities specific to the `textDocument/codeLens` request. + CodeLens: CodeLensClientCapabilities option + /// Capabilities specific to the `textDocument/documentLink` request. + DocumentLink: DocumentLinkClientCapabilities option + /// Capabilities specific to the `textDocument/documentColor` and the + /// `textDocument/colorPresentation` request. + /// + /// @since 3.6.0 + ColorProvider: DocumentColorClientCapabilities option + /// Capabilities specific to the `textDocument/formatting` request. + Formatting: DocumentFormattingClientCapabilities option + /// Capabilities specific to the `textDocument/rangeFormatting` request. + RangeFormatting: DocumentRangeFormattingClientCapabilities option + /// Capabilities specific to the `textDocument/onTypeFormatting` request. + OnTypeFormatting: DocumentOnTypeFormattingClientCapabilities option + /// Capabilities specific to the `textDocument/rename` request. + Rename: RenameClientCapabilities option + /// Capabilities specific to the `textDocument/foldingRange` request. + /// + /// @since 3.10.0 + FoldingRange: FoldingRangeClientCapabilities option + /// Capabilities specific to the `textDocument/selectionRange` request. + /// + /// @since 3.15.0 + SelectionRange: SelectionRangeClientCapabilities option + /// Capabilities specific to the `textDocument/publishDiagnostics` notification. + PublishDiagnostics: PublishDiagnosticsClientCapabilities option + /// Capabilities specific to the various call hierarchy requests. + /// + /// @since 3.16.0 + CallHierarchy: CallHierarchyClientCapabilities option + /// Capabilities specific to the various semantic token request. + /// + /// @since 3.16.0 + SemanticTokens: SemanticTokensClientCapabilities option + /// Capabilities specific to the `textDocument/linkedEditingRange` request. + /// + /// @since 3.16.0 + LinkedEditingRange: LinkedEditingRangeClientCapabilities option + /// Client capabilities specific to the `textDocument/moniker` request. + /// + /// @since 3.16.0 + Moniker: MonikerClientCapabilities option + /// Capabilities specific to the various type hierarchy requests. + /// + /// @since 3.17.0 + TypeHierarchy: TypeHierarchyClientCapabilities option + /// Capabilities specific to the `textDocument/inlineValue` request. + /// + /// @since 3.17.0 + InlineValue: InlineValueClientCapabilities option + /// Capabilities specific to the `textDocument/inlayHint` request. + /// + /// @since 3.17.0 + InlayHint: InlayHintClientCapabilities option + /// Capabilities specific to the diagnostic pull model. + /// + /// @since 3.17.0 + Diagnostic: DiagnosticClientCapabilities option + } /// Capabilities specific to the notebook document support. /// /// @since 3.17.0 -type NotebookDocumentClientCapabilities = { - /// Capabilities specific to notebook document synchronization - /// - /// @since 3.17.0 - Synchronization: NotebookDocumentSyncClientCapabilities -} - -type WindowClientCapabilities = { - /// It indicates whether the client supports server initiated - /// progress using the `window/workDoneProgress/create` request. - /// - /// The capability also controls Whether client supports handling - /// of progress notifications. If set servers are allowed to report a - /// `workDoneProgress` property in the request specific server - /// capabilities. - /// - /// @since 3.15.0 - WorkDoneProgress: bool option - /// Capabilities specific to the showMessage request. - /// - /// @since 3.16.0 - ShowMessage: ShowMessageRequestClientCapabilities option - /// Capabilities specific to the showDocument request. - /// - /// @since 3.16.0 - ShowDocument: ShowDocumentClientCapabilities option -} - -type GeneralClientCapabilitiesStaleRequestSupport = { - /// The client will actively cancel the request. - Cancel: bool - /// The list of requests for which the client - /// will retry the request if it receives a - /// response with error code `ContentModified` - RetryOnContentModified: string[] -} +type NotebookDocumentClientCapabilities = + { + /// Capabilities specific to notebook document synchronization + /// + /// @since 3.17.0 + Synchronization: NotebookDocumentSyncClientCapabilities + } + +type WindowClientCapabilities = + { + /// It indicates whether the client supports server initiated + /// progress using the `window/workDoneProgress/create` request. + /// + /// The capability also controls Whether client supports handling + /// of progress notifications. If set servers are allowed to report a + /// `workDoneProgress` property in the request specific server + /// capabilities. + /// + /// @since 3.15.0 + WorkDoneProgress: bool option + /// Capabilities specific to the showMessage request. + /// + /// @since 3.16.0 + ShowMessage: ShowMessageRequestClientCapabilities option + /// Capabilities specific to the showDocument request. + /// + /// @since 3.16.0 + ShowDocument: ShowDocumentClientCapabilities option + } + +type GeneralClientCapabilitiesStaleRequestSupport = + { + /// The client will actively cancel the request. + Cancel: bool + /// The list of requests for which the client + /// will retry the request if it receives a + /// response with error code `ContentModified` + RetryOnContentModified: string[] + } /// General client capabilities. /// /// @since 3.16.0 -type GeneralClientCapabilities = { - /// Client capability that signals how the client - /// handles stale requests (e.g. a request - /// for which the client will not process the response - /// anymore since the information is outdated). - /// - /// @since 3.17.0 - StaleRequestSupport: GeneralClientCapabilitiesStaleRequestSupport option - /// Client capabilities specific to regular expressions. - /// - /// @since 3.16.0 - RegularExpressions: RegularExpressionsClientCapabilities option - /// Client capabilities specific to the client's markdown parser. - /// - /// @since 3.16.0 - Markdown: MarkdownClientCapabilities option - /// The position encodings supported by the client. Client and server - /// have to agree on the same position encoding to ensure that offsets - /// (e.g. character position in a line) are interpreted the same on both - /// sides. - /// - /// To keep the protocol backwards compatible the following applies: if - /// the value 'utf-16' is missing from the array of position encodings - /// servers can assume that the client supports UTF-16. UTF-16 is - /// therefore a mandatory encoding. - /// - /// If omitted it defaults to ['utf-16']. - /// - /// Implementation considerations: since the conversion from one encoding - /// into another requires the content of the file / line the conversion - /// is best done where the file is read which is usually on the server - /// side. - /// - /// @since 3.17.0 - PositionEncodings: PositionEncodingKind[] option -} +type GeneralClientCapabilities = + { + /// Client capability that signals how the client + /// handles stale requests (e.g. a request + /// for which the client will not process the response + /// anymore since the information is outdated). + /// + /// @since 3.17.0 + StaleRequestSupport: GeneralClientCapabilitiesStaleRequestSupport option + /// Client capabilities specific to regular expressions. + /// + /// @since 3.16.0 + RegularExpressions: RegularExpressionsClientCapabilities option + /// Client capabilities specific to the client's markdown parser. + /// + /// @since 3.16.0 + Markdown: MarkdownClientCapabilities option + /// The position encodings supported by the client. Client and server + /// have to agree on the same position encoding to ensure that offsets + /// (e.g. character position in a line) are interpreted the same on both + /// sides. + /// + /// To keep the protocol backwards compatible the following applies: if + /// the value 'utf-16' is missing from the array of position encodings + /// servers can assume that the client supports UTF-16. UTF-16 is + /// therefore a mandatory encoding. + /// + /// If omitted it defaults to ['utf-16']. + /// + /// Implementation considerations: since the conversion from one encoding + /// into another requires the content of the file / line the conversion + /// is best done where the file is read which is usually on the server + /// side. + /// + /// @since 3.17.0 + PositionEncodings: PositionEncodingKind[] option + } /// A relative pattern is a helper to construct glob patterns that are matched /// relatively to a base URI. The common value for a `baseUri` is a workspace /// folder root, but it can be another absolute URI as well. /// /// @since 3.17.0 -type RelativePattern = { - /// A workspace folder or a base URI to which this pattern will be matched - /// against relatively. - BaseUri: U2 - /// The actual glob pattern; - Pattern: Pattern -} - -type WorkspaceEditClientCapabilitiesChangeAnnotationSupport = { - /// Whether the client groups edits with equal labels into tree nodes, - /// for instance all edits labelled with "Changes in Strings" would - /// be a tree node. - GroupsOnLabel: bool option -} - -type WorkspaceEditClientCapabilities = { - /// The client supports versioned document changes in `WorkspaceEdit`s - DocumentChanges: bool option - /// The resource operations the client supports. Clients should at least - /// support 'create', 'rename' and 'delete' files and folders. - /// - /// @since 3.13.0 - ResourceOperations: ResourceOperationKind[] option - /// The failure handling strategy of a client if applying the workspace edit - /// fails. - /// - /// @since 3.13.0 - FailureHandling: FailureHandlingKind option - /// Whether the client normalizes line endings to the client specific - /// setting. - /// If set to `true` the client will normalize line ending characters - /// in a workspace edit to the client-specified new line - /// character. - /// - /// @since 3.16.0 - NormalizesLineEndings: bool option - /// Whether the client in general supports change annotations on text edits, - /// create file, rename file and delete file changes. - /// - /// @since 3.16.0 - ChangeAnnotationSupport: WorkspaceEditClientCapabilitiesChangeAnnotationSupport option -} - -type DidChangeConfigurationClientCapabilities = { - /// Did change configuration notification supports dynamic registration. - DynamicRegistration: bool option -} - -type DidChangeWatchedFilesClientCapabilities = { - /// Did change watched files notification supports dynamic registration. Please note - /// that the current protocol doesn't support static configuration for file changes - /// from the server side. - DynamicRegistration: bool option - /// Whether the client has support for {@link RelativePattern relative pattern} - /// or not. - /// - /// @since 3.17.0 - RelativePatternSupport: bool option -} - -type WorkspaceSymbolClientCapabilitiesSymbolKind = { - /// The symbol kind values the client supports. When this - /// property exists the client also guarantees that it will - /// handle values outside its set gracefully and falls back - /// to a default value when unknown. - /// - /// If this property is not present the client only supports - /// the symbol kinds from `File` to `Array` as defined in - /// the initial version of the protocol. - ValueSet: SymbolKind[] option -} - -type WorkspaceSymbolClientCapabilitiesTagSupport = { - /// The tags supported by the client. - ValueSet: SymbolTag[] -} - -type WorkspaceSymbolClientCapabilitiesResolveSupport = { - /// The properties that a client can resolve lazily. Usually - /// `location.range` - Properties: string[] -} +type RelativePattern = + { + /// A workspace folder or a base URI to which this pattern will be matched + /// against relatively. + BaseUri: U2 + /// The actual glob pattern; + Pattern: Pattern + } + +type WorkspaceEditClientCapabilitiesChangeAnnotationSupport = + { + /// Whether the client groups edits with equal labels into tree nodes, + /// for instance all edits labelled with "Changes in Strings" would + /// be a tree node. + GroupsOnLabel: bool option + } + +type WorkspaceEditClientCapabilities = + { + /// The client supports versioned document changes in `WorkspaceEdit`s + DocumentChanges: bool option + /// The resource operations the client supports. Clients should at least + /// support 'create', 'rename' and 'delete' files and folders. + /// + /// @since 3.13.0 + ResourceOperations: ResourceOperationKind[] option + /// The failure handling strategy of a client if applying the workspace edit + /// fails. + /// + /// @since 3.13.0 + FailureHandling: FailureHandlingKind option + /// Whether the client normalizes line endings to the client specific + /// setting. + /// If set to `true` the client will normalize line ending characters + /// in a workspace edit to the client-specified new line + /// character. + /// + /// @since 3.16.0 + NormalizesLineEndings: bool option + /// Whether the client in general supports change annotations on text edits, + /// create file, rename file and delete file changes. + /// + /// @since 3.16.0 + ChangeAnnotationSupport: WorkspaceEditClientCapabilitiesChangeAnnotationSupport option + } + +type DidChangeConfigurationClientCapabilities = + { + /// Did change configuration notification supports dynamic registration. + DynamicRegistration: bool option + } + +type DidChangeWatchedFilesClientCapabilities = + { + /// Did change watched files notification supports dynamic registration. Please note + /// that the current protocol doesn't support static configuration for file changes + /// from the server side. + DynamicRegistration: bool option + /// Whether the client has support for {@link RelativePattern relative pattern} + /// or not. + /// + /// @since 3.17.0 + RelativePatternSupport: bool option + } + +type WorkspaceSymbolClientCapabilitiesSymbolKind = + { + /// The symbol kind values the client supports. When this + /// property exists the client also guarantees that it will + /// handle values outside its set gracefully and falls back + /// to a default value when unknown. + /// + /// If this property is not present the client only supports + /// the symbol kinds from `File` to `Array` as defined in + /// the initial version of the protocol. + ValueSet: SymbolKind[] option + } + +type WorkspaceSymbolClientCapabilitiesTagSupport = + { + /// The tags supported by the client. + ValueSet: SymbolTag[] + } + +type WorkspaceSymbolClientCapabilitiesResolveSupport = + { + /// The properties that a client can resolve lazily. Usually + /// `location.range` + Properties: string[] + } /// Client capabilities for a {@link WorkspaceSymbolRequest}. -type WorkspaceSymbolClientCapabilities = { - /// Symbol request supports dynamic registration. - DynamicRegistration: bool option - /// Specific capabilities for the `SymbolKind` in the `workspace/symbol` request. - SymbolKind: WorkspaceSymbolClientCapabilitiesSymbolKind option - /// The client supports tags on `SymbolInformation`. - /// Clients supporting tags have to handle unknown tags gracefully. - /// - /// @since 3.16.0 - TagSupport: WorkspaceSymbolClientCapabilitiesTagSupport option - /// The client support partial workspace symbols. The client will send the - /// request `workspaceSymbol/resolve` to the server to resolve additional - /// properties. - /// - /// @since 3.17.0 - ResolveSupport: WorkspaceSymbolClientCapabilitiesResolveSupport option -} +type WorkspaceSymbolClientCapabilities = + { + /// Symbol request supports dynamic registration. + DynamicRegistration: bool option + /// Specific capabilities for the `SymbolKind` in the `workspace/symbol` request. + SymbolKind: WorkspaceSymbolClientCapabilitiesSymbolKind option + /// The client supports tags on `SymbolInformation`. + /// Clients supporting tags have to handle unknown tags gracefully. + /// + /// @since 3.16.0 + TagSupport: WorkspaceSymbolClientCapabilitiesTagSupport option + /// The client support partial workspace symbols. The client will send the + /// request `workspaceSymbol/resolve` to the server to resolve additional + /// properties. + /// + /// @since 3.17.0 + ResolveSupport: WorkspaceSymbolClientCapabilitiesResolveSupport option + } /// The client capabilities of a {@link ExecuteCommandRequest}. -type ExecuteCommandClientCapabilities = { - /// Execute command supports dynamic registration. - DynamicRegistration: bool option -} +type ExecuteCommandClientCapabilities = + { + /// Execute command supports dynamic registration. + DynamicRegistration: bool option + } /// @since 3.16.0 -type SemanticTokensWorkspaceClientCapabilities = { - /// Whether the client implementation supports a refresh request sent from - /// the server to the client. - /// - /// Note that this event is global and will force the client to refresh all - /// semantic tokens currently shown. It should be used with absolute care - /// and is useful for situation where a server for example detects a project - /// wide change that requires such a calculation. - RefreshSupport: bool option -} +type SemanticTokensWorkspaceClientCapabilities = + { + /// Whether the client implementation supports a refresh request sent from + /// the server to the client. + /// + /// Note that this event is global and will force the client to refresh all + /// semantic tokens currently shown. It should be used with absolute care + /// and is useful for situation where a server for example detects a project + /// wide change that requires such a calculation. + RefreshSupport: bool option + } /// @since 3.16.0 -type CodeLensWorkspaceClientCapabilities = { - /// Whether the client implementation supports a refresh request sent from the - /// server to the client. - /// - /// Note that this event is global and will force the client to refresh all - /// code lenses currently shown. It should be used with absolute care and is - /// useful for situation where a server for example detect a project wide - /// change that requires such a calculation. - RefreshSupport: bool option -} +type CodeLensWorkspaceClientCapabilities = + { + /// Whether the client implementation supports a refresh request sent from the + /// server to the client. + /// + /// Note that this event is global and will force the client to refresh all + /// code lenses currently shown. It should be used with absolute care and is + /// useful for situation where a server for example detect a project wide + /// change that requires such a calculation. + RefreshSupport: bool option + } /// Capabilities relating to events from file operations by the user in the client. /// @@ -5709,719 +5948,777 @@ type CodeLensWorkspaceClientCapabilities = { /// like renaming a file in the UI. /// /// @since 3.16.0 -type FileOperationClientCapabilities = { - /// Whether the client supports dynamic registration for file requests/notifications. - DynamicRegistration: bool option - /// The client has support for sending didCreateFiles notifications. - DidCreate: bool option - /// The client has support for sending willCreateFiles requests. - WillCreate: bool option - /// The client has support for sending didRenameFiles notifications. - DidRename: bool option - /// The client has support for sending willRenameFiles requests. - WillRename: bool option - /// The client has support for sending didDeleteFiles notifications. - DidDelete: bool option - /// The client has support for sending willDeleteFiles requests. - WillDelete: bool option -} +type FileOperationClientCapabilities = + { + /// Whether the client supports dynamic registration for file requests/notifications. + DynamicRegistration: bool option + /// The client has support for sending didCreateFiles notifications. + DidCreate: bool option + /// The client has support for sending willCreateFiles requests. + WillCreate: bool option + /// The client has support for sending didRenameFiles notifications. + DidRename: bool option + /// The client has support for sending willRenameFiles requests. + WillRename: bool option + /// The client has support for sending didDeleteFiles notifications. + DidDelete: bool option + /// The client has support for sending willDeleteFiles requests. + WillDelete: bool option + } /// Client workspace capabilities specific to inline values. /// /// @since 3.17.0 -type InlineValueWorkspaceClientCapabilities = { - /// Whether the client implementation supports a refresh request sent from the - /// server to the client. - /// - /// Note that this event is global and will force the client to refresh all - /// inline values currently shown. It should be used with absolute care and is - /// useful for situation where a server for example detects a project wide - /// change that requires such a calculation. - RefreshSupport: bool option -} +type InlineValueWorkspaceClientCapabilities = + { + /// Whether the client implementation supports a refresh request sent from the + /// server to the client. + /// + /// Note that this event is global and will force the client to refresh all + /// inline values currently shown. It should be used with absolute care and is + /// useful for situation where a server for example detects a project wide + /// change that requires such a calculation. + RefreshSupport: bool option + } /// Client workspace capabilities specific to inlay hints. /// /// @since 3.17.0 -type InlayHintWorkspaceClientCapabilities = { - /// Whether the client implementation supports a refresh request sent from - /// the server to the client. - /// - /// Note that this event is global and will force the client to refresh all - /// inlay hints currently shown. It should be used with absolute care and - /// is useful for situation where a server for example detects a project wide - /// change that requires such a calculation. - RefreshSupport: bool option -} +type InlayHintWorkspaceClientCapabilities = + { + /// Whether the client implementation supports a refresh request sent from + /// the server to the client. + /// + /// Note that this event is global and will force the client to refresh all + /// inlay hints currently shown. It should be used with absolute care and + /// is useful for situation where a server for example detects a project wide + /// change that requires such a calculation. + RefreshSupport: bool option + } /// Workspace client capabilities specific to diagnostic pull requests. /// /// @since 3.17.0 -type DiagnosticWorkspaceClientCapabilities = { - /// Whether the client implementation supports a refresh request sent from - /// the server to the client. - /// - /// Note that this event is global and will force the client to refresh all - /// pulled diagnostics currently shown. It should be used with absolute care and - /// is useful for situation where a server for example detects a project wide - /// change that requires such a calculation. - RefreshSupport: bool option -} - -type TextDocumentSyncClientCapabilities = { - /// Whether text document synchronization supports dynamic registration. - DynamicRegistration: bool option - /// The client supports sending will save notifications. - WillSave: bool option - /// The client supports sending a will save request and - /// waits for a response providing text edits which will - /// be applied to the document before it is saved. - WillSaveWaitUntil: bool option - /// The client supports did save notifications. - DidSave: bool option -} - -type CompletionClientCapabilitiesCompletionItem = { - /// Client supports snippets as insert text. - /// - /// A snippet can define tab stops and placeholders with `$1`, `$2` - /// and `${3:foo}`. `$0` defines the final tab stop, it defaults to - /// the end of the snippet. Placeholders with equal identifiers are linked, - /// that is typing in one will update others too. - SnippetSupport: bool option - /// Client supports commit characters on a completion item. - CommitCharactersSupport: bool option - /// Client supports the following content formats for the documentation - /// property. The order describes the preferred format of the client. - DocumentationFormat: MarkupKind[] option - /// Client supports the deprecated property on a completion item. - DeprecatedSupport: bool option - /// Client supports the preselect property on a completion item. - PreselectSupport: bool option - /// Client supports the tag property on a completion item. Clients supporting - /// tags have to handle unknown tags gracefully. Clients especially need to - /// preserve unknown tags when sending a completion item back to the server in - /// a resolve call. - /// - /// @since 3.15.0 - TagSupport: CompletionClientCapabilitiesCompletionItemTagSupport option - /// Client support insert replace edit to control different behavior if a - /// completion item is inserted in the text or should replace text. - /// - /// @since 3.16.0 - InsertReplaceSupport: bool option - /// Indicates which properties a client can resolve lazily on a completion - /// item. Before version 3.16.0 only the predefined properties `documentation` - /// and `details` could be resolved lazily. - /// - /// @since 3.16.0 - ResolveSupport: CompletionClientCapabilitiesCompletionItemResolveSupport option - /// The client supports the `insertTextMode` property on - /// a completion item to override the whitespace handling mode - /// as defined by the client (see `insertTextMode`). - /// - /// @since 3.16.0 - InsertTextModeSupport: CompletionClientCapabilitiesCompletionItemInsertTextModeSupport option - /// The client has support for completion item label - /// details (see also `CompletionItemLabelDetails`). - /// - /// @since 3.17.0 - LabelDetailsSupport: bool option -} - -type CompletionClientCapabilitiesCompletionItemTagSupport = { - /// The tags supported by the client. - ValueSet: CompletionItemTag[] -} - -type CompletionClientCapabilitiesCompletionItemResolveSupport = { - /// The properties that a client can resolve lazily. - Properties: string[] -} +type DiagnosticWorkspaceClientCapabilities = + { + /// Whether the client implementation supports a refresh request sent from + /// the server to the client. + /// + /// Note that this event is global and will force the client to refresh all + /// pulled diagnostics currently shown. It should be used with absolute care and + /// is useful for situation where a server for example detects a project wide + /// change that requires such a calculation. + RefreshSupport: bool option + } + +type TextDocumentSyncClientCapabilities = + { + /// Whether text document synchronization supports dynamic registration. + DynamicRegistration: bool option + /// The client supports sending will save notifications. + WillSave: bool option + /// The client supports sending a will save request and + /// waits for a response providing text edits which will + /// be applied to the document before it is saved. + WillSaveWaitUntil: bool option + /// The client supports did save notifications. + DidSave: bool option + } + +type CompletionClientCapabilitiesCompletionItem = + { + /// Client supports snippets as insert text. + /// + /// A snippet can define tab stops and placeholders with `$1`, `$2` + /// and `${3:foo}`. `$0` defines the final tab stop, it defaults to + /// the end of the snippet. Placeholders with equal identifiers are linked, + /// that is typing in one will update others too. + SnippetSupport: bool option + /// Client supports commit characters on a completion item. + CommitCharactersSupport: bool option + /// Client supports the following content formats for the documentation + /// property. The order describes the preferred format of the client. + DocumentationFormat: MarkupKind[] option + /// Client supports the deprecated property on a completion item. + DeprecatedSupport: bool option + /// Client supports the preselect property on a completion item. + PreselectSupport: bool option + /// Client supports the tag property on a completion item. Clients supporting + /// tags have to handle unknown tags gracefully. Clients especially need to + /// preserve unknown tags when sending a completion item back to the server in + /// a resolve call. + /// + /// @since 3.15.0 + TagSupport: CompletionClientCapabilitiesCompletionItemTagSupport option + /// Client support insert replace edit to control different behavior if a + /// completion item is inserted in the text or should replace text. + /// + /// @since 3.16.0 + InsertReplaceSupport: bool option + /// Indicates which properties a client can resolve lazily on a completion + /// item. Before version 3.16.0 only the predefined properties `documentation` + /// and `details` could be resolved lazily. + /// + /// @since 3.16.0 + ResolveSupport: CompletionClientCapabilitiesCompletionItemResolveSupport option + /// The client supports the `insertTextMode` property on + /// a completion item to override the whitespace handling mode + /// as defined by the client (see `insertTextMode`). + /// + /// @since 3.16.0 + InsertTextModeSupport: CompletionClientCapabilitiesCompletionItemInsertTextModeSupport option + /// The client has support for completion item label + /// details (see also `CompletionItemLabelDetails`). + /// + /// @since 3.17.0 + LabelDetailsSupport: bool option + } + +type CompletionClientCapabilitiesCompletionItemTagSupport = + { + /// The tags supported by the client. + ValueSet: CompletionItemTag[] + } + +type CompletionClientCapabilitiesCompletionItemResolveSupport = + { + /// The properties that a client can resolve lazily. + Properties: string[] + } type CompletionClientCapabilitiesCompletionItemInsertTextModeSupport = { ValueSet: InsertTextMode[] } -type CompletionClientCapabilitiesCompletionItemKind = { - /// The completion item kind values the client supports. When this - /// property exists the client also guarantees that it will - /// handle values outside its set gracefully and falls back - /// to a default value when unknown. - /// - /// If this property is not present the client only supports - /// the completion items kinds from `Text` to `Reference` as defined in - /// the initial version of the protocol. - ValueSet: CompletionItemKind[] option -} - -type CompletionClientCapabilitiesCompletionList = { - /// The client supports the following itemDefaults on - /// a completion list. - /// - /// The value lists the supported property names of the - /// `CompletionList.itemDefaults` object. If omitted - /// no properties are supported. - /// - /// @since 3.17.0 - ItemDefaults: string[] option -} +type CompletionClientCapabilitiesCompletionItemKind = + { + /// The completion item kind values the client supports. When this + /// property exists the client also guarantees that it will + /// handle values outside its set gracefully and falls back + /// to a default value when unknown. + /// + /// If this property is not present the client only supports + /// the completion items kinds from `Text` to `Reference` as defined in + /// the initial version of the protocol. + ValueSet: CompletionItemKind[] option + } + +type CompletionClientCapabilitiesCompletionList = + { + /// The client supports the following itemDefaults on + /// a completion list. + /// + /// The value lists the supported property names of the + /// `CompletionList.itemDefaults` object. If omitted + /// no properties are supported. + /// + /// @since 3.17.0 + ItemDefaults: string[] option + } /// Completion client capabilities -type CompletionClientCapabilities = { - /// Whether completion supports dynamic registration. - DynamicRegistration: bool option - /// The client supports the following `CompletionItem` specific - /// capabilities. - CompletionItem: CompletionClientCapabilitiesCompletionItem option - CompletionItemKind: CompletionClientCapabilitiesCompletionItemKind option - /// Defines how the client handles whitespace and indentation - /// when accepting a completion item that uses multi line - /// text in either `insertText` or `textEdit`. - /// - /// @since 3.17.0 - InsertTextMode: InsertTextMode option - /// The client supports to send additional context information for a - /// `textDocument/completion` request. - ContextSupport: bool option - /// The client supports the following `CompletionList` specific - /// capabilities. - /// - /// @since 3.17.0 - CompletionList: CompletionClientCapabilitiesCompletionList option -} - -type HoverClientCapabilities = { - /// Whether hover supports dynamic registration. - DynamicRegistration: bool option - /// Client supports the following content formats for the content - /// property. The order describes the preferred format of the client. - ContentFormat: MarkupKind[] option -} - -type SignatureHelpClientCapabilitiesSignatureInformation = { - /// Client supports the following content formats for the documentation - /// property. The order describes the preferred format of the client. - DocumentationFormat: MarkupKind[] option - /// Client capabilities specific to parameter information. - ParameterInformation: SignatureHelpClientCapabilitiesSignatureInformationParameterInformation option - /// The client supports the `activeParameter` property on `SignatureInformation` - /// literal. - /// - /// @since 3.16.0 - ActiveParameterSupport: bool option -} - -type SignatureHelpClientCapabilitiesSignatureInformationParameterInformation = { - /// The client supports processing label offsets instead of a - /// simple label string. - /// - /// @since 3.14.0 - LabelOffsetSupport: bool option -} +type CompletionClientCapabilities = + { + /// Whether completion supports dynamic registration. + DynamicRegistration: bool option + /// The client supports the following `CompletionItem` specific + /// capabilities. + CompletionItem: CompletionClientCapabilitiesCompletionItem option + CompletionItemKind: CompletionClientCapabilitiesCompletionItemKind option + /// Defines how the client handles whitespace and indentation + /// when accepting a completion item that uses multi line + /// text in either `insertText` or `textEdit`. + /// + /// @since 3.17.0 + InsertTextMode: InsertTextMode option + /// The client supports to send additional context information for a + /// `textDocument/completion` request. + ContextSupport: bool option + /// The client supports the following `CompletionList` specific + /// capabilities. + /// + /// @since 3.17.0 + CompletionList: CompletionClientCapabilitiesCompletionList option + } + +type HoverClientCapabilities = + { + /// Whether hover supports dynamic registration. + DynamicRegistration: bool option + /// Client supports the following content formats for the content + /// property. The order describes the preferred format of the client. + ContentFormat: MarkupKind[] option + } + +type SignatureHelpClientCapabilitiesSignatureInformation = + { + /// Client supports the following content formats for the documentation + /// property. The order describes the preferred format of the client. + DocumentationFormat: MarkupKind[] option + /// Client capabilities specific to parameter information. + ParameterInformation: SignatureHelpClientCapabilitiesSignatureInformationParameterInformation option + /// The client supports the `activeParameter` property on `SignatureInformation` + /// literal. + /// + /// @since 3.16.0 + ActiveParameterSupport: bool option + } + +type SignatureHelpClientCapabilitiesSignatureInformationParameterInformation = + { + /// The client supports processing label offsets instead of a + /// simple label string. + /// + /// @since 3.14.0 + LabelOffsetSupport: bool option + } /// Client Capabilities for a {@link SignatureHelpRequest}. -type SignatureHelpClientCapabilities = { - /// Whether signature help supports dynamic registration. - DynamicRegistration: bool option - /// The client supports the following `SignatureInformation` - /// specific properties. - SignatureInformation: SignatureHelpClientCapabilitiesSignatureInformation option - /// The client supports to send additional context information for a - /// `textDocument/signatureHelp` request. A client that opts into - /// contextSupport will also support the `retriggerCharacters` on - /// `SignatureHelpOptions`. - /// - /// @since 3.15.0 - ContextSupport: bool option -} +type SignatureHelpClientCapabilities = + { + /// Whether signature help supports dynamic registration. + DynamicRegistration: bool option + /// The client supports the following `SignatureInformation` + /// specific properties. + SignatureInformation: SignatureHelpClientCapabilitiesSignatureInformation option + /// The client supports to send additional context information for a + /// `textDocument/signatureHelp` request. A client that opts into + /// contextSupport will also support the `retriggerCharacters` on + /// `SignatureHelpOptions`. + /// + /// @since 3.15.0 + ContextSupport: bool option + } /// @since 3.14.0 -type DeclarationClientCapabilities = { - /// Whether declaration supports dynamic registration. If this is set to `true` - /// the client supports the new `DeclarationRegistrationOptions` return value - /// for the corresponding server capability as well. - DynamicRegistration: bool option - /// The client supports additional metadata in the form of declaration links. - LinkSupport: bool option -} +type DeclarationClientCapabilities = + { + /// Whether declaration supports dynamic registration. If this is set to `true` + /// the client supports the new `DeclarationRegistrationOptions` return value + /// for the corresponding server capability as well. + DynamicRegistration: bool option + /// The client supports additional metadata in the form of declaration links. + LinkSupport: bool option + } /// Client Capabilities for a {@link DefinitionRequest}. -type DefinitionClientCapabilities = { - /// Whether definition supports dynamic registration. - DynamicRegistration: bool option - /// The client supports additional metadata in the form of definition links. - /// - /// @since 3.14.0 - LinkSupport: bool option -} +type DefinitionClientCapabilities = + { + /// Whether definition supports dynamic registration. + DynamicRegistration: bool option + /// The client supports additional metadata in the form of definition links. + /// + /// @since 3.14.0 + LinkSupport: bool option + } /// Since 3.6.0 -type TypeDefinitionClientCapabilities = { - /// Whether implementation supports dynamic registration. If this is set to `true` - /// the client supports the new `TypeDefinitionRegistrationOptions` return value - /// for the corresponding server capability as well. - DynamicRegistration: bool option - /// The client supports additional metadata in the form of definition links. - /// - /// Since 3.14.0 - LinkSupport: bool option -} +type TypeDefinitionClientCapabilities = + { + /// Whether implementation supports dynamic registration. If this is set to `true` + /// the client supports the new `TypeDefinitionRegistrationOptions` return value + /// for the corresponding server capability as well. + DynamicRegistration: bool option + /// The client supports additional metadata in the form of definition links. + /// + /// Since 3.14.0 + LinkSupport: bool option + } /// @since 3.6.0 -type ImplementationClientCapabilities = { - /// Whether implementation supports dynamic registration. If this is set to `true` - /// the client supports the new `ImplementationRegistrationOptions` return value - /// for the corresponding server capability as well. - DynamicRegistration: bool option - /// The client supports additional metadata in the form of definition links. - /// - /// @since 3.14.0 - LinkSupport: bool option -} +type ImplementationClientCapabilities = + { + /// Whether implementation supports dynamic registration. If this is set to `true` + /// the client supports the new `ImplementationRegistrationOptions` return value + /// for the corresponding server capability as well. + DynamicRegistration: bool option + /// The client supports additional metadata in the form of definition links. + /// + /// @since 3.14.0 + LinkSupport: bool option + } /// Client Capabilities for a {@link ReferencesRequest}. -type ReferenceClientCapabilities = { - /// Whether references supports dynamic registration. - DynamicRegistration: bool option -} +type ReferenceClientCapabilities = + { + /// Whether references supports dynamic registration. + DynamicRegistration: bool option + } /// Client Capabilities for a {@link DocumentHighlightRequest}. -type DocumentHighlightClientCapabilities = { - /// Whether document highlight supports dynamic registration. - DynamicRegistration: bool option -} - -type DocumentSymbolClientCapabilitiesSymbolKind = { - /// The symbol kind values the client supports. When this - /// property exists the client also guarantees that it will - /// handle values outside its set gracefully and falls back - /// to a default value when unknown. - /// - /// If this property is not present the client only supports - /// the symbol kinds from `File` to `Array` as defined in - /// the initial version of the protocol. - ValueSet: SymbolKind[] option -} - -type DocumentSymbolClientCapabilitiesTagSupport = { - /// The tags supported by the client. - ValueSet: SymbolTag[] -} +type DocumentHighlightClientCapabilities = + { + /// Whether document highlight supports dynamic registration. + DynamicRegistration: bool option + } + +type DocumentSymbolClientCapabilitiesSymbolKind = + { + /// The symbol kind values the client supports. When this + /// property exists the client also guarantees that it will + /// handle values outside its set gracefully and falls back + /// to a default value when unknown. + /// + /// If this property is not present the client only supports + /// the symbol kinds from `File` to `Array` as defined in + /// the initial version of the protocol. + ValueSet: SymbolKind[] option + } + +type DocumentSymbolClientCapabilitiesTagSupport = + { + /// The tags supported by the client. + ValueSet: SymbolTag[] + } /// Client Capabilities for a {@link DocumentSymbolRequest}. -type DocumentSymbolClientCapabilities = { - /// Whether document symbol supports dynamic registration. - DynamicRegistration: bool option - /// Specific capabilities for the `SymbolKind` in the - /// `textDocument/documentSymbol` request. - SymbolKind: DocumentSymbolClientCapabilitiesSymbolKind option - /// The client supports hierarchical document symbols. - HierarchicalDocumentSymbolSupport: bool option - /// The client supports tags on `SymbolInformation`. Tags are supported on - /// `DocumentSymbol` if `hierarchicalDocumentSymbolSupport` is set to true. - /// Clients supporting tags have to handle unknown tags gracefully. - /// - /// @since 3.16.0 - TagSupport: DocumentSymbolClientCapabilitiesTagSupport option - /// The client supports an additional label presented in the UI when - /// registering a document symbol provider. - /// - /// @since 3.16.0 - LabelSupport: bool option -} - -type CodeActionClientCapabilitiesCodeActionLiteralSupport = { - /// The code action kind is support with the following value - /// set. - CodeActionKind: CodeActionClientCapabilitiesCodeActionLiteralSupportCodeActionKind -} - -type CodeActionClientCapabilitiesCodeActionLiteralSupportCodeActionKind = { - /// The code action kind values the client supports. When this - /// property exists the client also guarantees that it will - /// handle values outside its set gracefully and falls back - /// to a default value when unknown. - ValueSet: CodeActionKind[] -} - -type CodeActionClientCapabilitiesResolveSupport = { - /// The properties that a client can resolve lazily. - Properties: string[] -} +type DocumentSymbolClientCapabilities = + { + /// Whether document symbol supports dynamic registration. + DynamicRegistration: bool option + /// Specific capabilities for the `SymbolKind` in the + /// `textDocument/documentSymbol` request. + SymbolKind: DocumentSymbolClientCapabilitiesSymbolKind option + /// The client supports hierarchical document symbols. + HierarchicalDocumentSymbolSupport: bool option + /// The client supports tags on `SymbolInformation`. Tags are supported on + /// `DocumentSymbol` if `hierarchicalDocumentSymbolSupport` is set to true. + /// Clients supporting tags have to handle unknown tags gracefully. + /// + /// @since 3.16.0 + TagSupport: DocumentSymbolClientCapabilitiesTagSupport option + /// The client supports an additional label presented in the UI when + /// registering a document symbol provider. + /// + /// @since 3.16.0 + LabelSupport: bool option + } + +type CodeActionClientCapabilitiesCodeActionLiteralSupport = + { + /// The code action kind is support with the following value + /// set. + CodeActionKind: CodeActionClientCapabilitiesCodeActionLiteralSupportCodeActionKind + } + +type CodeActionClientCapabilitiesCodeActionLiteralSupportCodeActionKind = + { + /// The code action kind values the client supports. When this + /// property exists the client also guarantees that it will + /// handle values outside its set gracefully and falls back + /// to a default value when unknown. + ValueSet: CodeActionKind[] + } + +type CodeActionClientCapabilitiesResolveSupport = + { + /// The properties that a client can resolve lazily. + Properties: string[] + } /// The Client Capabilities of a {@link CodeActionRequest}. -type CodeActionClientCapabilities = { - /// Whether code action supports dynamic registration. - DynamicRegistration: bool option - /// The client support code action literals of type `CodeAction` as a valid - /// response of the `textDocument/codeAction` request. If the property is not - /// set the request can only return `Command` literals. - /// - /// @since 3.8.0 - CodeActionLiteralSupport: CodeActionClientCapabilitiesCodeActionLiteralSupport option - /// Whether code action supports the `isPreferred` property. - /// - /// @since 3.15.0 - IsPreferredSupport: bool option - /// Whether code action supports the `disabled` property. - /// - /// @since 3.16.0 - DisabledSupport: bool option - /// Whether code action supports the `data` property which is - /// preserved between a `textDocument/codeAction` and a - /// `codeAction/resolve` request. - /// - /// @since 3.16.0 - DataSupport: bool option - /// Whether the client supports resolving additional code action - /// properties via a separate `codeAction/resolve` request. - /// - /// @since 3.16.0 - ResolveSupport: CodeActionClientCapabilitiesResolveSupport option - /// Whether the client honors the change annotations in - /// text edits and resource operations returned via the - /// `CodeAction#edit` property by for example presenting - /// the workspace edit in the user interface and asking - /// for confirmation. - /// - /// @since 3.16.0 - HonorsChangeAnnotations: bool option -} +type CodeActionClientCapabilities = + { + /// Whether code action supports dynamic registration. + DynamicRegistration: bool option + /// The client support code action literals of type `CodeAction` as a valid + /// response of the `textDocument/codeAction` request. If the property is not + /// set the request can only return `Command` literals. + /// + /// @since 3.8.0 + CodeActionLiteralSupport: CodeActionClientCapabilitiesCodeActionLiteralSupport option + /// Whether code action supports the `isPreferred` property. + /// + /// @since 3.15.0 + IsPreferredSupport: bool option + /// Whether code action supports the `disabled` property. + /// + /// @since 3.16.0 + DisabledSupport: bool option + /// Whether code action supports the `data` property which is + /// preserved between a `textDocument/codeAction` and a + /// `codeAction/resolve` request. + /// + /// @since 3.16.0 + DataSupport: bool option + /// Whether the client supports resolving additional code action + /// properties via a separate `codeAction/resolve` request. + /// + /// @since 3.16.0 + ResolveSupport: CodeActionClientCapabilitiesResolveSupport option + /// Whether the client honors the change annotations in + /// text edits and resource operations returned via the + /// `CodeAction#edit` property by for example presenting + /// the workspace edit in the user interface and asking + /// for confirmation. + /// + /// @since 3.16.0 + HonorsChangeAnnotations: bool option + } /// The client capabilities of a {@link CodeLensRequest}. -type CodeLensClientCapabilities = { - /// Whether code lens supports dynamic registration. - DynamicRegistration: bool option -} +type CodeLensClientCapabilities = + { + /// Whether code lens supports dynamic registration. + DynamicRegistration: bool option + } /// The client capabilities of a {@link DocumentLinkRequest}. -type DocumentLinkClientCapabilities = { - /// Whether document link supports dynamic registration. - DynamicRegistration: bool option - /// Whether the client supports the `tooltip` property on `DocumentLink`. - /// - /// @since 3.15.0 - TooltipSupport: bool option -} - -type DocumentColorClientCapabilities = { - /// Whether implementation supports dynamic registration. If this is set to `true` - /// the client supports the new `DocumentColorRegistrationOptions` return value - /// for the corresponding server capability as well. - DynamicRegistration: bool option -} +type DocumentLinkClientCapabilities = + { + /// Whether document link supports dynamic registration. + DynamicRegistration: bool option + /// Whether the client supports the `tooltip` property on `DocumentLink`. + /// + /// @since 3.15.0 + TooltipSupport: bool option + } + +type DocumentColorClientCapabilities = + { + /// Whether implementation supports dynamic registration. If this is set to `true` + /// the client supports the new `DocumentColorRegistrationOptions` return value + /// for the corresponding server capability as well. + DynamicRegistration: bool option + } /// Client capabilities of a {@link DocumentFormattingRequest}. -type DocumentFormattingClientCapabilities = { - /// Whether formatting supports dynamic registration. - DynamicRegistration: bool option -} +type DocumentFormattingClientCapabilities = + { + /// Whether formatting supports dynamic registration. + DynamicRegistration: bool option + } /// Client capabilities of a {@link DocumentRangeFormattingRequest}. -type DocumentRangeFormattingClientCapabilities = { - /// Whether range formatting supports dynamic registration. - DynamicRegistration: bool option -} +type DocumentRangeFormattingClientCapabilities = + { + /// Whether range formatting supports dynamic registration. + DynamicRegistration: bool option + } /// Client capabilities of a {@link DocumentOnTypeFormattingRequest}. -type DocumentOnTypeFormattingClientCapabilities = { - /// Whether on type formatting supports dynamic registration. - DynamicRegistration: bool option -} - -type RenameClientCapabilities = { - /// Whether rename supports dynamic registration. - DynamicRegistration: bool option - /// Client supports testing for validity of rename operations - /// before execution. - /// - /// @since 3.12.0 - PrepareSupport: bool option - /// Client supports the default behavior result. - /// - /// The value indicates the default behavior used by the - /// client. - /// - /// @since 3.16.0 - PrepareSupportDefaultBehavior: PrepareSupportDefaultBehavior option - /// Whether the client honors the change annotations in - /// text edits and resource operations returned via the - /// rename request's workspace edit by for example presenting - /// the workspace edit in the user interface and asking - /// for confirmation. - /// - /// @since 3.16.0 - HonorsChangeAnnotations: bool option -} - -type FoldingRangeClientCapabilitiesFoldingRangeKind = { - /// The folding range kind values the client supports. When this - /// property exists the client also guarantees that it will - /// handle values outside its set gracefully and falls back - /// to a default value when unknown. - ValueSet: FoldingRangeKind[] option -} - -type FoldingRangeClientCapabilitiesFoldingRange = { - /// If set, the client signals that it supports setting collapsedText on - /// folding ranges to display custom labels instead of the default text. - /// - /// @since 3.17.0 - CollapsedText: bool option -} - -type FoldingRangeClientCapabilities = { - /// Whether implementation supports dynamic registration for folding range - /// providers. If this is set to `true` the client supports the new - /// `FoldingRangeRegistrationOptions` return value for the corresponding - /// server capability as well. - DynamicRegistration: bool option - /// The maximum number of folding ranges that the client prefers to receive - /// per document. The value serves as a hint, servers are free to follow the - /// limit. - RangeLimit: uint32 option - /// If set, the client signals that it only supports folding complete lines. - /// If set, client will ignore specified `startCharacter` and `endCharacter` - /// properties in a FoldingRange. - LineFoldingOnly: bool option - /// Specific options for the folding range kind. - /// - /// @since 3.17.0 - FoldingRangeKind: FoldingRangeClientCapabilitiesFoldingRangeKind option - /// Specific options for the folding range. - /// - /// @since 3.17.0 - FoldingRange: FoldingRangeClientCapabilitiesFoldingRange option -} - -type SelectionRangeClientCapabilities = { - /// Whether implementation supports dynamic registration for selection range providers. If this is set to `true` - /// the client supports the new `SelectionRangeRegistrationOptions` return value for the corresponding server - /// capability as well. - DynamicRegistration: bool option -} - -type PublishDiagnosticsClientCapabilitiesTagSupport = { - /// The tags supported by the client. - ValueSet: DiagnosticTag[] -} +type DocumentOnTypeFormattingClientCapabilities = + { + /// Whether on type formatting supports dynamic registration. + DynamicRegistration: bool option + } + +type RenameClientCapabilities = + { + /// Whether rename supports dynamic registration. + DynamicRegistration: bool option + /// Client supports testing for validity of rename operations + /// before execution. + /// + /// @since 3.12.0 + PrepareSupport: bool option + /// Client supports the default behavior result. + /// + /// The value indicates the default behavior used by the + /// client. + /// + /// @since 3.16.0 + PrepareSupportDefaultBehavior: PrepareSupportDefaultBehavior option + /// Whether the client honors the change annotations in + /// text edits and resource operations returned via the + /// rename request's workspace edit by for example presenting + /// the workspace edit in the user interface and asking + /// for confirmation. + /// + /// @since 3.16.0 + HonorsChangeAnnotations: bool option + } + +type FoldingRangeClientCapabilitiesFoldingRangeKind = + { + /// The folding range kind values the client supports. When this + /// property exists the client also guarantees that it will + /// handle values outside its set gracefully and falls back + /// to a default value when unknown. + ValueSet: FoldingRangeKind[] option + } + +type FoldingRangeClientCapabilitiesFoldingRange = + { + /// If set, the client signals that it supports setting collapsedText on + /// folding ranges to display custom labels instead of the default text. + /// + /// @since 3.17.0 + CollapsedText: bool option + } + +type FoldingRangeClientCapabilities = + { + /// Whether implementation supports dynamic registration for folding range + /// providers. If this is set to `true` the client supports the new + /// `FoldingRangeRegistrationOptions` return value for the corresponding + /// server capability as well. + DynamicRegistration: bool option + /// The maximum number of folding ranges that the client prefers to receive + /// per document. The value serves as a hint, servers are free to follow the + /// limit. + RangeLimit: uint32 option + /// If set, the client signals that it only supports folding complete lines. + /// If set, client will ignore specified `startCharacter` and `endCharacter` + /// properties in a FoldingRange. + LineFoldingOnly: bool option + /// Specific options for the folding range kind. + /// + /// @since 3.17.0 + FoldingRangeKind: FoldingRangeClientCapabilitiesFoldingRangeKind option + /// Specific options for the folding range. + /// + /// @since 3.17.0 + FoldingRange: FoldingRangeClientCapabilitiesFoldingRange option + } + +type SelectionRangeClientCapabilities = + { + /// Whether implementation supports dynamic registration for selection range providers. If this is set to `true` + /// the client supports the new `SelectionRangeRegistrationOptions` return value for the corresponding server + /// capability as well. + DynamicRegistration: bool option + } + +type PublishDiagnosticsClientCapabilitiesTagSupport = + { + /// The tags supported by the client. + ValueSet: DiagnosticTag[] + } /// The publish diagnostic client capabilities. -type PublishDiagnosticsClientCapabilities = { - /// Whether the clients accepts diagnostics with related information. - RelatedInformation: bool option - /// Client supports the tag property to provide meta data about a diagnostic. - /// Clients supporting tags have to handle unknown tags gracefully. - /// - /// @since 3.15.0 - TagSupport: PublishDiagnosticsClientCapabilitiesTagSupport option - /// Whether the client interprets the version property of the - /// `textDocument/publishDiagnostics` notification's parameter. - /// - /// @since 3.15.0 - VersionSupport: bool option - /// Client supports a codeDescription property - /// - /// @since 3.16.0 - CodeDescriptionSupport: bool option - /// Whether code action supports the `data` property which is - /// preserved between a `textDocument/publishDiagnostics` and - /// `textDocument/codeAction` request. - /// - /// @since 3.16.0 - DataSupport: bool option -} +type PublishDiagnosticsClientCapabilities = + { + /// Whether the clients accepts diagnostics with related information. + RelatedInformation: bool option + /// Client supports the tag property to provide meta data about a diagnostic. + /// Clients supporting tags have to handle unknown tags gracefully. + /// + /// @since 3.15.0 + TagSupport: PublishDiagnosticsClientCapabilitiesTagSupport option + /// Whether the client interprets the version property of the + /// `textDocument/publishDiagnostics` notification's parameter. + /// + /// @since 3.15.0 + VersionSupport: bool option + /// Client supports a codeDescription property + /// + /// @since 3.16.0 + CodeDescriptionSupport: bool option + /// Whether code action supports the `data` property which is + /// preserved between a `textDocument/publishDiagnostics` and + /// `textDocument/codeAction` request. + /// + /// @since 3.16.0 + DataSupport: bool option + } /// @since 3.16.0 -type CallHierarchyClientCapabilities = { - /// Whether implementation supports dynamic registration. If this is set to `true` - /// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` - /// return value for the corresponding server capability as well. - DynamicRegistration: bool option -} - -type SemanticTokensClientCapabilitiesRequests = { - /// The client will send the `textDocument/semanticTokens/range` request if - /// the server provides a corresponding handler. - Range: U2 option - /// The client will send the `textDocument/semanticTokens/full` request if - /// the server provides a corresponding handler. - Full: U2 option -} - -type SemanticTokensClientCapabilitiesRequestsFullC2 = { - /// The client will send the `textDocument/semanticTokens/full/delta` request if - /// the server provides a corresponding handler. - Delta: bool option -} +type CallHierarchyClientCapabilities = + { + /// Whether implementation supports dynamic registration. If this is set to `true` + /// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` + /// return value for the corresponding server capability as well. + DynamicRegistration: bool option + } + +type SemanticTokensClientCapabilitiesRequests = + { + /// The client will send the `textDocument/semanticTokens/range` request if + /// the server provides a corresponding handler. + Range: U2 option + /// The client will send the `textDocument/semanticTokens/full` request if + /// the server provides a corresponding handler. + Full: U2 option + } + +type SemanticTokensClientCapabilitiesRequestsFullC2 = + { + /// The client will send the `textDocument/semanticTokens/full/delta` request if + /// the server provides a corresponding handler. + Delta: bool option + } /// @since 3.16.0 -type SemanticTokensClientCapabilities = { - /// Whether implementation supports dynamic registration. If this is set to `true` - /// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` - /// return value for the corresponding server capability as well. - DynamicRegistration: bool option - /// Which requests the client supports and might send to the server - /// depending on the server's capability. Please note that clients might not - /// show semantic tokens or degrade some of the user experience if a range - /// or full request is advertised by the client but not provided by the - /// server. If for example the client capability `requests.full` and - /// `request.range` are both set to true but the server only provides a - /// range provider the client might not render a minimap correctly or might - /// even decide to not show any semantic tokens at all. - Requests: SemanticTokensClientCapabilitiesRequests - /// The token types that the client supports. - TokenTypes: string[] - /// The token modifiers that the client supports. - TokenModifiers: string[] - /// The token formats the clients supports. - Formats: TokenFormat[] - /// Whether the client supports tokens that can overlap each other. - OverlappingTokenSupport: bool option - /// Whether the client supports tokens that can span multiple lines. - MultilineTokenSupport: bool option - /// Whether the client allows the server to actively cancel a - /// semantic token request, e.g. supports returning - /// LSPErrorCodes.ServerCancelled. If a server does the client - /// needs to retrigger the request. - /// - /// @since 3.17.0 - ServerCancelSupport: bool option - /// Whether the client uses semantic tokens to augment existing - /// syntax tokens. If set to `true` client side created syntax - /// tokens and semantic tokens are both used for colorization. If - /// set to `false` the client only uses the returned semantic tokens - /// for colorization. - /// - /// If the value is `undefined` then the client behavior is not - /// specified. - /// - /// @since 3.17.0 - AugmentsSyntaxTokens: bool option -} +type SemanticTokensClientCapabilities = + { + /// Whether implementation supports dynamic registration. If this is set to `true` + /// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` + /// return value for the corresponding server capability as well. + DynamicRegistration: bool option + /// Which requests the client supports and might send to the server + /// depending on the server's capability. Please note that clients might not + /// show semantic tokens or degrade some of the user experience if a range + /// or full request is advertised by the client but not provided by the + /// server. If for example the client capability `requests.full` and + /// `request.range` are both set to true but the server only provides a + /// range provider the client might not render a minimap correctly or might + /// even decide to not show any semantic tokens at all. + Requests: SemanticTokensClientCapabilitiesRequests + /// The token types that the client supports. + TokenTypes: string[] + /// The token modifiers that the client supports. + TokenModifiers: string[] + /// The token formats the clients supports. + Formats: TokenFormat[] + /// Whether the client supports tokens that can overlap each other. + OverlappingTokenSupport: bool option + /// Whether the client supports tokens that can span multiple lines. + MultilineTokenSupport: bool option + /// Whether the client allows the server to actively cancel a + /// semantic token request, e.g. supports returning + /// LSPErrorCodes.ServerCancelled. If a server does the client + /// needs to retrigger the request. + /// + /// @since 3.17.0 + ServerCancelSupport: bool option + /// Whether the client uses semantic tokens to augment existing + /// syntax tokens. If set to `true` client side created syntax + /// tokens and semantic tokens are both used for colorization. If + /// set to `false` the client only uses the returned semantic tokens + /// for colorization. + /// + /// If the value is `undefined` then the client behavior is not + /// specified. + /// + /// @since 3.17.0 + AugmentsSyntaxTokens: bool option + } /// Client capabilities for the linked editing range request. /// /// @since 3.16.0 -type LinkedEditingRangeClientCapabilities = { - /// Whether implementation supports dynamic registration. If this is set to `true` - /// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` - /// return value for the corresponding server capability as well. - DynamicRegistration: bool option -} +type LinkedEditingRangeClientCapabilities = + { + /// Whether implementation supports dynamic registration. If this is set to `true` + /// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` + /// return value for the corresponding server capability as well. + DynamicRegistration: bool option + } /// Client capabilities specific to the moniker request. /// /// @since 3.16.0 -type MonikerClientCapabilities = { - /// Whether moniker supports dynamic registration. If this is set to `true` - /// the client supports the new `MonikerRegistrationOptions` return value - /// for the corresponding server capability as well. - DynamicRegistration: bool option -} +type MonikerClientCapabilities = + { + /// Whether moniker supports dynamic registration. If this is set to `true` + /// the client supports the new `MonikerRegistrationOptions` return value + /// for the corresponding server capability as well. + DynamicRegistration: bool option + } /// @since 3.17.0 -type TypeHierarchyClientCapabilities = { - /// Whether implementation supports dynamic registration. If this is set to `true` - /// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` - /// return value for the corresponding server capability as well. - DynamicRegistration: bool option -} +type TypeHierarchyClientCapabilities = + { + /// Whether implementation supports dynamic registration. If this is set to `true` + /// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` + /// return value for the corresponding server capability as well. + DynamicRegistration: bool option + } /// Client capabilities specific to inline values. /// /// @since 3.17.0 -type InlineValueClientCapabilities = { - /// Whether implementation supports dynamic registration for inline value providers. - DynamicRegistration: bool option -} - -type InlayHintClientCapabilitiesResolveSupport = { - /// The properties that a client can resolve lazily. - Properties: string[] -} +type InlineValueClientCapabilities = + { + /// Whether implementation supports dynamic registration for inline value providers. + DynamicRegistration: bool option + } + +type InlayHintClientCapabilitiesResolveSupport = + { + /// The properties that a client can resolve lazily. + Properties: string[] + } /// Inlay hint client capabilities. /// /// @since 3.17.0 -type InlayHintClientCapabilities = { - /// Whether inlay hints support dynamic registration. - DynamicRegistration: bool option - /// Indicates which properties a client can resolve lazily on an inlay - /// hint. - ResolveSupport: InlayHintClientCapabilitiesResolveSupport option -} +type InlayHintClientCapabilities = + { + /// Whether inlay hints support dynamic registration. + DynamicRegistration: bool option + /// Indicates which properties a client can resolve lazily on an inlay + /// hint. + ResolveSupport: InlayHintClientCapabilitiesResolveSupport option + } /// Client capabilities specific to diagnostic pull requests. /// /// @since 3.17.0 -type DiagnosticClientCapabilities = { - /// Whether implementation supports dynamic registration. If this is set to `true` - /// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` - /// return value for the corresponding server capability as well. - DynamicRegistration: bool option - /// Whether the clients supports related documents for document diagnostic pulls. - RelatedDocumentSupport: bool option -} +type DiagnosticClientCapabilities = + { + /// Whether implementation supports dynamic registration. If this is set to `true` + /// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` + /// return value for the corresponding server capability as well. + DynamicRegistration: bool option + /// Whether the clients supports related documents for document diagnostic pulls. + RelatedDocumentSupport: bool option + } /// Notebook specific client capabilities. /// /// @since 3.17.0 -type NotebookDocumentSyncClientCapabilities = { - /// Whether implementation supports dynamic registration. If this is - /// set to `true` the client supports the new - /// `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` - /// return value for the corresponding server capability as well. - DynamicRegistration: bool option - /// The client supports sending execution summary data per cell. - ExecutionSummarySupport: bool option -} - -type ShowMessageRequestClientCapabilitiesMessageActionItem = { - /// Whether the client supports additional attributes which - /// are preserved and send back to the server in the - /// request's response. - AdditionalPropertiesSupport: bool option -} +type NotebookDocumentSyncClientCapabilities = + { + /// Whether implementation supports dynamic registration. If this is + /// set to `true` the client supports the new + /// `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` + /// return value for the corresponding server capability as well. + DynamicRegistration: bool option + /// The client supports sending execution summary data per cell. + ExecutionSummarySupport: bool option + } + +type ShowMessageRequestClientCapabilitiesMessageActionItem = + { + /// Whether the client supports additional attributes which + /// are preserved and send back to the server in the + /// request's response. + AdditionalPropertiesSupport: bool option + } /// Show message request client capabilities -type ShowMessageRequestClientCapabilities = { - /// Capabilities specific to the `MessageActionItem` type. - MessageActionItem: ShowMessageRequestClientCapabilitiesMessageActionItem option -} +type ShowMessageRequestClientCapabilities = + { + /// Capabilities specific to the `MessageActionItem` type. + MessageActionItem: ShowMessageRequestClientCapabilitiesMessageActionItem option + } /// Client capabilities for the showDocument request. /// /// @since 3.16.0 -type ShowDocumentClientCapabilities = { - /// The client has support for the showDocument - /// request. - Support: bool -} +type ShowDocumentClientCapabilities = + { + /// The client has support for the showDocument + /// request. + Support: bool + } /// Client capabilities specific to regular expressions. /// /// @since 3.16.0 -type RegularExpressionsClientCapabilities = { - /// The engine's name. - Engine: string - /// The engine's version. - Version: string option -} +type RegularExpressionsClientCapabilities = + { + /// The engine's name. + Engine: string + /// The engine's version. + Version: string option + } /// Client capabilities specific to the used markdown parser. /// /// @since 3.16.0 -type MarkdownClientCapabilities = { - /// The name of the parser. - Parser: string - /// The version of the parser. - Version: string option - /// A list of HTML tags that the client allows / supports in - /// Markdown. - /// - /// @since 3.17.0 - AllowedTags: string[] option -} +type MarkdownClientCapabilities = + { + /// The name of the parser. + Parser: string + /// The version of the parser. + Version: string option + /// A list of HTML tags that the client allows / supports in + /// Markdown. + /// + /// @since 3.17.0 + AllowedTags: string[] option + } /// The definition of a symbol represented as one or many {@link Location locations}. /// For most programming languages there is only one location at which a symbol is @@ -6438,13 +6735,6 @@ type DefinitionLink = LocationLink /// LSP arrays. /// @since 3.17.0 type LSPArray = LSPAny[] -/// The LSP any type. -/// Please note that strictly speaking a property with the value `undefined` -/// can't be converted into JSON preserving the property name. However for -/// convenience it is allowed and assumed that all these properties are -/// optional as well. -/// @since 3.17.0 -type LSPAny = JToken /// The declaration of a symbol representation as one or many {@link Location locations}. type Declaration = U2 /// Information about where a symbol is declared. @@ -6488,27 +6778,29 @@ type ChangeAnnotationIdentifier = string /// /// @since 3.17.0 type WorkspaceDocumentDiagnosticReport = - U2 + U2 /// An event describing a change to a text document. If only a text is provided /// it is considered to be the full content of the document. type TextDocumentContentChangeEvent = U2 -type TextDocumentContentChangeEventC1 = { - /// The range of the document that changed. - Range: Range - /// The optional length of the range that got replaced. - /// - /// @deprecated use range instead. - RangeLength: uint32 option - /// The new text for the provided range. - Text: string -} - -type TextDocumentContentChangeEventC2 = { - /// The new text of the whole document. - Text: string -} +type TextDocumentContentChangeEventC1 = + { + /// The range of the document that changed. + Range: Range + /// The optional length of the range that got replaced. + /// + /// @deprecated use range instead. + RangeLength: uint32 option + /// The new text for the provided range. + Text: string + } + +type TextDocumentContentChangeEventC2 = + { + /// The new text of the whole document. + Text: string + } /// MarkedString can be used to render human readable text. It is either a markdown string /// or a code-block that provides a language and a code snippet. The language identifier @@ -6553,28 +6845,30 @@ type GlobPattern = U2 /// @sample A language filter that applies to all package.json paths: `{ language: 'json', pattern: '**package.json' }` /// /// @since 3.17.0 -type TextDocumentFilter = { - /// A language id, like `typescript`. - Language: string option - /// A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. - Scheme: string option - /// A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples. - Pattern: string option -} +type TextDocumentFilter = + { + /// A language id, like `typescript`. + Language: string option + /// A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. + Scheme: string option + /// A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples. + Pattern: string option + } /// A notebook document filter denotes a notebook document by /// different properties. The properties will be match /// against the notebook's URI (same as with documents) /// /// @since 3.17.0 -type NotebookDocumentFilter = { - /// The type of the enclosing notebook. - NotebookType: string option - /// A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. - Scheme: string option - /// A glob pattern. - Pattern: string option -} +type NotebookDocumentFilter = + { + /// The type of the enclosing notebook. + NotebookType: string option + /// A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. + Scheme: string option + /// A glob pattern. + Pattern: string option + } /// The glob pattern to watch relative to the base path. Glob patterns can have the following syntax: /// - `*` to match one or more characters in a path segment @@ -6594,77 +6888,77 @@ type Pattern = string type SemanticTokenTypes = string module SemanticTokenTypes = - [] - let ``namespace``: SemanticTokenTypes = "namespace" + [] + let ``namespace``: SemanticTokenTypes = "namespace" - /// Represents a generic type. Acts as a fallback for types which can't be mapped to - /// a specific type like class or enum. - [] - let ``type``: SemanticTokenTypes = "type" + /// Represents a generic type. Acts as a fallback for types which can't be mapped to + /// a specific type like class or enum. + [] + let ``type``: SemanticTokenTypes = "type" - [] - let ``class``: SemanticTokenTypes = "class" + [] + let ``class``: SemanticTokenTypes = "class" - [] - let enum: SemanticTokenTypes = "enum" + [] + let enum: SemanticTokenTypes = "enum" - [] - let ``interface``: SemanticTokenTypes = "interface" + [] + let ``interface``: SemanticTokenTypes = "interface" - [] - let ``struct``: SemanticTokenTypes = "struct" + [] + let ``struct``: SemanticTokenTypes = "struct" - [] - let typeParameter: SemanticTokenTypes = "typeParameter" + [] + let typeParameter: SemanticTokenTypes = "typeParameter" - [] - let parameter: SemanticTokenTypes = "parameter" + [] + let parameter: SemanticTokenTypes = "parameter" - [] - let variable: SemanticTokenTypes = "variable" + [] + let variable: SemanticTokenTypes = "variable" - [] - let property: SemanticTokenTypes = "property" + [] + let property: SemanticTokenTypes = "property" - [] - let enumMember: SemanticTokenTypes = "enumMember" + [] + let enumMember: SemanticTokenTypes = "enumMember" - [] - let event: SemanticTokenTypes = "event" + [] + let event: SemanticTokenTypes = "event" - [] - let ``function``: SemanticTokenTypes = "function" + [] + let ``function``: SemanticTokenTypes = "function" - [] - let method: SemanticTokenTypes = "method" + [] + let method: SemanticTokenTypes = "method" - [] - let macro: SemanticTokenTypes = "macro" + [] + let macro: SemanticTokenTypes = "macro" - [] - let keyword: SemanticTokenTypes = "keyword" + [] + let keyword: SemanticTokenTypes = "keyword" - [] - let modifier: SemanticTokenTypes = "modifier" + [] + let modifier: SemanticTokenTypes = "modifier" - [] - let comment: SemanticTokenTypes = "comment" + [] + let comment: SemanticTokenTypes = "comment" - [] - let string: SemanticTokenTypes = "string" + [] + let string: SemanticTokenTypes = "string" - [] - let number: SemanticTokenTypes = "number" + [] + let number: SemanticTokenTypes = "number" - [] - let regexp: SemanticTokenTypes = "regexp" + [] + let regexp: SemanticTokenTypes = "regexp" - [] - let operator: SemanticTokenTypes = "operator" + [] + let operator: SemanticTokenTypes = "operator" - /// @since 3.17.0 - [] - let decorator: SemanticTokenTypes = "decorator" + /// @since 3.17.0 + [] + let decorator: SemanticTokenTypes = "decorator" /// A set of predefined token modifiers. This set is not fixed /// an clients can specify additional token types via the @@ -6674,386 +6968,386 @@ module SemanticTokenTypes = type SemanticTokenModifiers = string module SemanticTokenModifiers = - [] - let declaration: SemanticTokenModifiers = "declaration" + [] + let declaration: SemanticTokenModifiers = "declaration" - [] - let definition: SemanticTokenModifiers = "definition" + [] + let definition: SemanticTokenModifiers = "definition" - [] - let readonly: SemanticTokenModifiers = "readonly" + [] + let readonly: SemanticTokenModifiers = "readonly" - [] - let ``static``: SemanticTokenModifiers = "static" + [] + let ``static``: SemanticTokenModifiers = "static" - [] - let deprecated: SemanticTokenModifiers = "deprecated" + [] + let deprecated: SemanticTokenModifiers = "deprecated" - [] - let ``abstract``: SemanticTokenModifiers = "abstract" + [] + let ``abstract``: SemanticTokenModifiers = "abstract" - [] - let async: SemanticTokenModifiers = "async" + [] + let async: SemanticTokenModifiers = "async" - [] - let modification: SemanticTokenModifiers = "modification" + [] + let modification: SemanticTokenModifiers = "modification" - [] - let documentation: SemanticTokenModifiers = "documentation" + [] + let documentation: SemanticTokenModifiers = "documentation" - [] - let defaultLibrary: SemanticTokenModifiers = "defaultLibrary" + [] + let defaultLibrary: SemanticTokenModifiers = "defaultLibrary" /// The document diagnostic report kinds. /// /// @since 3.17.0 -[)>] +[)>] type DocumentDiagnosticReportKind = - /// A diagnostic report with a full - /// set of problems. - | [] Full = 0 - /// A report indicating that the last - /// returned report is still accurate. - | [] Unchanged = 1 + /// A diagnostic report with a full + /// set of problems. + | [] Full = 0 + /// A report indicating that the last + /// returned report is still accurate. + | [] Unchanged = 1 /// Predefined error codes. type ErrorCodes = - | ParseError = -32700 - | InvalidRequest = -32600 - | MethodNotFound = -32601 - | InvalidParams = -32602 - | InternalError = -32603 - /// Error code indicating that a server received a notification or - /// request before the server has received the `initialize` request. - | ServerNotInitialized = -32002 - | UnknownErrorCode = -32001 + | ParseError = -32700 + | InvalidRequest = -32600 + | MethodNotFound = -32601 + | InvalidParams = -32602 + | InternalError = -32603 + /// Error code indicating that a server received a notification or + /// request before the server has received the `initialize` request. + | ServerNotInitialized = -32002 + | UnknownErrorCode = -32001 type LSPErrorCodes = - /// A request failed but it was syntactically correct, e.g the - /// method name was known and the parameters were valid. The error - /// message should contain human readable information about why - /// the request failed. - /// - /// @since 3.17.0 - | RequestFailed = -32803 - /// The server cancelled the request. This error code should - /// only be used for requests that explicitly support being - /// server cancellable. - /// - /// @since 3.17.0 - | ServerCancelled = -32802 - /// The server detected that the content of a document got - /// modified outside normal conditions. A server should - /// NOT send this error code if it detects a content change - /// in it unprocessed messages. The result even computed - /// on an older state might still be useful for the client. - /// - /// If a client decides that a result is not of any use anymore - /// the client should cancel the request. - | ContentModified = -32801 - /// The client has canceled a request and a server has detected - /// the cancel. - | RequestCancelled = -32800 + /// A request failed but it was syntactically correct, e.g the + /// method name was known and the parameters were valid. The error + /// message should contain human readable information about why + /// the request failed. + /// + /// @since 3.17.0 + | RequestFailed = -32803 + /// The server cancelled the request. This error code should + /// only be used for requests that explicitly support being + /// server cancellable. + /// + /// @since 3.17.0 + | ServerCancelled = -32802 + /// The server detected that the content of a document got + /// modified outside normal conditions. A server should + /// NOT send this error code if it detects a content change + /// in it unprocessed messages. The result even computed + /// on an older state might still be useful for the client. + /// + /// If a client decides that a result is not of any use anymore + /// the client should cancel the request. + | ContentModified = -32801 + /// The client has canceled a request and a server has detected + /// the cancel. + | RequestCancelled = -32800 /// A set of predefined range kinds. type FoldingRangeKind = string module FoldingRangeKind = - /// Folding range for a comment - [] - let Comment: FoldingRangeKind = "comment" + /// Folding range for a comment + [] + let Comment: FoldingRangeKind = "comment" - /// Folding range for an import or include - [] - let Imports: FoldingRangeKind = "imports" + /// Folding range for an import or include + [] + let Imports: FoldingRangeKind = "imports" - /// Folding range for a region (e.g. `#region`) - [] - let Region: FoldingRangeKind = "region" + /// Folding range for a region (e.g. `#region`) + [] + let Region: FoldingRangeKind = "region" /// A symbol kind. type SymbolKind = - | File = 1 - | Module = 2 - | Namespace = 3 - | Package = 4 - | Class = 5 - | Method = 6 - | Property = 7 - | Field = 8 - | Constructor = 9 - | Enum = 10 - | Interface = 11 - | Function = 12 - | Variable = 13 - | Constant = 14 - | String = 15 - | Number = 16 - | Boolean = 17 - | Array = 18 - | Object = 19 - | Key = 20 - | Null = 21 - | EnumMember = 22 - | Struct = 23 - | Event = 24 - | Operator = 25 - | TypeParameter = 26 + | File = 1 + | Module = 2 + | Namespace = 3 + | Package = 4 + | Class = 5 + | Method = 6 + | Property = 7 + | Field = 8 + | Constructor = 9 + | Enum = 10 + | Interface = 11 + | Function = 12 + | Variable = 13 + | Constant = 14 + | String = 15 + | Number = 16 + | Boolean = 17 + | Array = 18 + | Object = 19 + | Key = 20 + | Null = 21 + | EnumMember = 22 + | Struct = 23 + | Event = 24 + | Operator = 25 + | TypeParameter = 26 /// Symbol tags are extra annotations that tweak the rendering of a symbol. /// /// @since 3.16 type SymbolTag = - /// Render a symbol as obsolete, usually using a strike-out. - | Deprecated = 1 + /// Render a symbol as obsolete, usually using a strike-out. + | Deprecated = 1 /// Moniker uniqueness level to define scope of the moniker. /// /// @since 3.16.0 -[)>] +[)>] type UniquenessLevel = - /// The moniker is only unique inside a document - | [] document = 0 - /// The moniker is unique inside a project for which a dump got created - | [] project = 1 - /// The moniker is unique inside the group to which a project belongs - | [] group = 2 - /// The moniker is unique inside the moniker scheme. - | [] scheme = 3 - /// The moniker is globally unique - | [] ``global`` = 4 + /// The moniker is only unique inside a document + | [] document = 0 + /// The moniker is unique inside a project for which a dump got created + | [] project = 1 + /// The moniker is unique inside the group to which a project belongs + | [] group = 2 + /// The moniker is unique inside the moniker scheme. + | [] scheme = 3 + /// The moniker is globally unique + | [] ``global`` = 4 /// The moniker kind. /// /// @since 3.16.0 -[)>] +[)>] type MonikerKind = - /// The moniker represent a symbol that is imported into a project - | [] import = 0 - /// The moniker represents a symbol that is exported from a project - | [] export = 1 - /// The moniker represents a symbol that is local to a project (e.g. a local - /// variable of a function, a class not visible outside the project, ...) - | [] local = 2 + /// The moniker represent a symbol that is imported into a project + | [] import = 0 + /// The moniker represents a symbol that is exported from a project + | [] export = 1 + /// The moniker represents a symbol that is local to a project (e.g. a local + /// variable of a function, a class not visible outside the project, ...) + | [] local = 2 /// Inlay hint kinds. /// /// @since 3.17.0 type InlayHintKind = - /// An inlay hint that for a type annotation. - | Type = 1 - /// An inlay hint that is for a parameter. - | Parameter = 2 + /// An inlay hint that for a type annotation. + | Type = 1 + /// An inlay hint that is for a parameter. + | Parameter = 2 /// The message type type MessageType = - /// An error message. - | Error = 1 - /// A warning message. - | Warning = 2 - /// An information message. - | Info = 3 - /// A log message. - | Log = 4 - /// A debug message. - /// - /// @since 3.18.0 - | Debug = 5 + /// An error message. + | Error = 1 + /// A warning message. + | Warning = 2 + /// An information message. + | Info = 3 + /// A log message. + | Log = 4 + /// A debug message. + /// + /// @since 3.18.0 + | Debug = 5 /// Defines how the host (editor) should sync /// document changes to the language server. type TextDocumentSyncKind = - /// Documents should not be synced at all. - | None = 0 - /// Documents are synced by always sending the full content - /// of the document. - | Full = 1 - /// Documents are synced by sending the full content on open. - /// After that only incremental updates to the document are - /// send. - | Incremental = 2 + /// Documents should not be synced at all. + | None = 0 + /// Documents are synced by always sending the full content + /// of the document. + | Full = 1 + /// Documents are synced by sending the full content on open. + /// After that only incremental updates to the document are + /// send. + | Incremental = 2 /// Represents reasons why a text document is saved. type TextDocumentSaveReason = - /// Manually triggered, e.g. by the user pressing save, by starting debugging, - /// or by an API call. - | Manual = 1 - /// Automatic after a delay. - | AfterDelay = 2 - /// When the editor lost focus. - | FocusOut = 3 + /// Manually triggered, e.g. by the user pressing save, by starting debugging, + /// or by an API call. + | Manual = 1 + /// Automatic after a delay. + | AfterDelay = 2 + /// When the editor lost focus. + | FocusOut = 3 /// The kind of a completion entry. type CompletionItemKind = - | Text = 1 - | Method = 2 - | Function = 3 - | Constructor = 4 - | Field = 5 - | Variable = 6 - | Class = 7 - | Interface = 8 - | Module = 9 - | Property = 10 - | Unit = 11 - | Value = 12 - | Enum = 13 - | Keyword = 14 - | Snippet = 15 - | Color = 16 - | File = 17 - | Reference = 18 - | Folder = 19 - | EnumMember = 20 - | Constant = 21 - | Struct = 22 - | Event = 23 - | Operator = 24 - | TypeParameter = 25 + | Text = 1 + | Method = 2 + | Function = 3 + | Constructor = 4 + | Field = 5 + | Variable = 6 + | Class = 7 + | Interface = 8 + | Module = 9 + | Property = 10 + | Unit = 11 + | Value = 12 + | Enum = 13 + | Keyword = 14 + | Snippet = 15 + | Color = 16 + | File = 17 + | Reference = 18 + | Folder = 19 + | EnumMember = 20 + | Constant = 21 + | Struct = 22 + | Event = 23 + | Operator = 24 + | TypeParameter = 25 /// Completion item tags are extra annotations that tweak the rendering of a completion /// item. /// /// @since 3.15.0 type CompletionItemTag = - /// Render a completion as obsolete, usually using a strike-out. - | Deprecated = 1 + /// Render a completion as obsolete, usually using a strike-out. + | Deprecated = 1 /// Defines whether the insert text in a completion item should be interpreted as /// plain text or a snippet. type InsertTextFormat = - /// The primary text to be inserted is treated as a plain string. - | PlainText = 1 - /// The primary text to be inserted is treated as a snippet. - /// - /// A snippet can define tab stops and placeholders with `$1`, `$2` - /// and `${3:foo}`. `$0` defines the final tab stop, it defaults to - /// the end of the snippet. Placeholders with equal identifiers are linked, - /// that is typing in one will update others too. - /// - /// See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax - | Snippet = 2 + /// The primary text to be inserted is treated as a plain string. + | PlainText = 1 + /// The primary text to be inserted is treated as a snippet. + /// + /// A snippet can define tab stops and placeholders with `$1`, `$2` + /// and `${3:foo}`. `$0` defines the final tab stop, it defaults to + /// the end of the snippet. Placeholders with equal identifiers are linked, + /// that is typing in one will update others too. + /// + /// See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax + | Snippet = 2 /// How whitespace and indentation is handled during completion /// item insertion. /// /// @since 3.16.0 type InsertTextMode = - /// The insertion or replace strings is taken as it is. If the - /// value is multi line the lines below the cursor will be - /// inserted using the indentation defined in the string value. - /// The client will not apply any kind of adjustments to the - /// string. - | AsIs = 1 - /// The editor adjusts leading whitespace of new lines so that - /// they match the indentation up to the cursor of the line for - /// which the item is accepted. - /// - /// Consider a line like this: <2tabs><3tabs>foo. Accepting a - /// multi line completion item is indented using 2 tabs and all - /// following lines inserted will be indented using 2 tabs as well. - | AdjustIndentation = 2 + /// The insertion or replace strings is taken as it is. If the + /// value is multi line the lines below the cursor will be + /// inserted using the indentation defined in the string value. + /// The client will not apply any kind of adjustments to the + /// string. + | AsIs = 1 + /// The editor adjusts leading whitespace of new lines so that + /// they match the indentation up to the cursor of the line for + /// which the item is accepted. + /// + /// Consider a line like this: <2tabs><3tabs>foo. Accepting a + /// multi line completion item is indented using 2 tabs and all + /// following lines inserted will be indented using 2 tabs as well. + | AdjustIndentation = 2 /// A document highlight kind. type DocumentHighlightKind = - /// A textual occurrence. - | Text = 1 - /// Read-access of a symbol, like reading a variable. - | Read = 2 - /// Write-access of a symbol, like writing to a variable. - | Write = 3 + /// A textual occurrence. + | Text = 1 + /// Read-access of a symbol, like reading a variable. + | Read = 2 + /// Write-access of a symbol, like writing to a variable. + | Write = 3 /// A set of predefined code action kinds type CodeActionKind = string module CodeActionKind = - /// Empty kind. - [] - let Empty: CodeActionKind = "" - - /// Base kind for quickfix actions: 'quickfix' - [] - let QuickFix: CodeActionKind = "quickfix" - - /// Base kind for refactoring actions: 'refactor' - [] - let Refactor: CodeActionKind = "refactor" - - /// Base kind for refactoring extraction actions: 'refactor.extract' - /// - /// Example extract actions: - /// - /// - Extract method - /// - Extract function - /// - Extract variable - /// - Extract interface from class - /// - ... - [] - let RefactorExtract: CodeActionKind = "refactor.extract" - - /// Base kind for refactoring inline actions: 'refactor.inline' - /// - /// Example inline actions: - /// - /// - Inline function - /// - Inline variable - /// - Inline constant - /// - ... - [] - let RefactorInline: CodeActionKind = "refactor.inline" - - /// Base kind for refactoring rewrite actions: 'refactor.rewrite' - /// - /// Example rewrite actions: - /// - /// - Convert JavaScript function to class - /// - Add or remove parameter - /// - Encapsulate field - /// - Make method static - /// - Move method to base class - /// - ... - [] - let RefactorRewrite: CodeActionKind = "refactor.rewrite" - - /// Base kind for source actions: `source` - /// - /// Source code actions apply to the entire file. - [] - let Source: CodeActionKind = "source" - - /// Base kind for an organize imports source action: `source.organizeImports` - [] - let SourceOrganizeImports: CodeActionKind = "source.organizeImports" - - /// Base kind for auto-fix source actions: `source.fixAll`. - /// - /// Fix all actions automatically fix errors that have a clear fix that do not require user input. - /// They should not suppress errors or perform unsafe fixes such as generating new types or classes. - /// - /// @since 3.15.0 - [] - let SourceFixAll: CodeActionKind = "source.fixAll" - -[)>] + /// Empty kind. + [] + let Empty: CodeActionKind = "" + + /// Base kind for quickfix actions: 'quickfix' + [] + let QuickFix: CodeActionKind = "quickfix" + + /// Base kind for refactoring actions: 'refactor' + [] + let Refactor: CodeActionKind = "refactor" + + /// Base kind for refactoring extraction actions: 'refactor.extract' + /// + /// Example extract actions: + /// + /// - Extract method + /// - Extract function + /// - Extract variable + /// - Extract interface from class + /// - ... + [] + let RefactorExtract: CodeActionKind = "refactor.extract" + + /// Base kind for refactoring inline actions: 'refactor.inline' + /// + /// Example inline actions: + /// + /// - Inline function + /// - Inline variable + /// - Inline constant + /// - ... + [] + let RefactorInline: CodeActionKind = "refactor.inline" + + /// Base kind for refactoring rewrite actions: 'refactor.rewrite' + /// + /// Example rewrite actions: + /// + /// - Convert JavaScript function to class + /// - Add or remove parameter + /// - Encapsulate field + /// - Make method static + /// - Move method to base class + /// - ... + [] + let RefactorRewrite: CodeActionKind = "refactor.rewrite" + + /// Base kind for source actions: `source` + /// + /// Source code actions apply to the entire file. + [] + let Source: CodeActionKind = "source" + + /// Base kind for an organize imports source action: `source.organizeImports` + [] + let SourceOrganizeImports: CodeActionKind = "source.organizeImports" + + /// Base kind for auto-fix source actions: `source.fixAll`. + /// + /// Fix all actions automatically fix errors that have a clear fix that do not require user input. + /// They should not suppress errors or perform unsafe fixes such as generating new types or classes. + /// + /// @since 3.15.0 + [] + let SourceFixAll: CodeActionKind = "source.fixAll" + +[)>] type TraceValues = - /// Turn tracing off. - | [] Off = 0 - /// Trace messages only. - | [] Messages = 1 - /// Verbose message tracing. - | [] Verbose = 2 + /// Turn tracing off. + | [] Off = 0 + /// Trace messages only. + | [] Messages = 1 + /// Verbose message tracing. + | [] Verbose = 2 /// Describes the content type that a client supports in various /// result literals like `Hover`, `ParameterInfo` or `CompletionItem`. /// /// Please note that `MarkupKinds` must not start with a `$`. This kinds /// are reserved for internal usage. -[)>] +[)>] type MarkupKind = - /// Plain text is supported as a content format - | [] PlainText = 0 - /// Markdown is supported as a content format - | [] Markdown = 1 + /// Plain text is supported as a content format + | [] PlainText = 0 + /// Markdown is supported as a content format + | [] Markdown = 1 /// A set of predefined position encoding kinds. /// @@ -7061,151 +7355,151 @@ type MarkupKind = type PositionEncodingKind = string module PositionEncodingKind = - /// Character offsets count UTF-8 code units (e.g. bytes). - [] - let UTF8: PositionEncodingKind = "utf-8" - - /// Character offsets count UTF-16 code units. - /// - /// This is the default and must always be supported - /// by servers - [] - let UTF16: PositionEncodingKind = "utf-16" - - /// Character offsets count UTF-32 code units. - /// - /// Implementation note: these are the same as Unicode codepoints, - /// so this `PositionEncodingKind` may also be used for an - /// encoding-agnostic representation of character offsets. - [] - let UTF32: PositionEncodingKind = "utf-32" + /// Character offsets count UTF-8 code units (e.g. bytes). + [] + let UTF8: PositionEncodingKind = "utf-8" + + /// Character offsets count UTF-16 code units. + /// + /// This is the default and must always be supported + /// by servers + [] + let UTF16: PositionEncodingKind = "utf-16" + + /// Character offsets count UTF-32 code units. + /// + /// Implementation note: these are the same as Unicode codepoints, + /// so this `PositionEncodingKind` may also be used for an + /// encoding-agnostic representation of character offsets. + [] + let UTF32: PositionEncodingKind = "utf-32" /// The file event type type FileChangeType = - /// The file got created. - | Created = 1 - /// The file got changed. - | Changed = 2 - /// The file got deleted. - | Deleted = 3 + /// The file got created. + | Created = 1 + /// The file got changed. + | Changed = 2 + /// The file got deleted. + | Deleted = 3 type WatchKind = - /// Interested in create events. - | Create = 1 - /// Interested in change events - | Change = 2 - /// Interested in delete events - | Delete = 4 + /// Interested in create events. + | Create = 1 + /// Interested in change events + | Change = 2 + /// Interested in delete events + | Delete = 4 /// The diagnostic's severity. type DiagnosticSeverity = - /// Reports an error. - | Error = 1 - /// Reports a warning. - | Warning = 2 - /// Reports an information. - | Information = 3 - /// Reports a hint. - | Hint = 4 + /// Reports an error. + | Error = 1 + /// Reports a warning. + | Warning = 2 + /// Reports an information. + | Information = 3 + /// Reports a hint. + | Hint = 4 /// The diagnostic tags. /// /// @since 3.15.0 type DiagnosticTag = - /// Unused or unnecessary code. - /// - /// Clients are allowed to render diagnostics with this tag faded out instead of having - /// an error squiggle. - | Unnecessary = 1 - /// Deprecated or obsolete code. - /// - /// Clients are allowed to rendered diagnostics with this tag strike through. - | Deprecated = 2 + /// Unused or unnecessary code. + /// + /// Clients are allowed to render diagnostics with this tag faded out instead of having + /// an error squiggle. + | Unnecessary = 1 + /// Deprecated or obsolete code. + /// + /// Clients are allowed to rendered diagnostics with this tag strike through. + | Deprecated = 2 /// How a completion was triggered type CompletionTriggerKind = - /// Completion was triggered by typing an identifier (24x7 code - /// complete), manual invocation (e.g Ctrl+Space) or via API. - | Invoked = 1 - /// Completion was triggered by a trigger character specified by - /// the `triggerCharacters` properties of the `CompletionRegistrationOptions`. - | TriggerCharacter = 2 - /// Completion was re-triggered as current completion list is incomplete - | TriggerForIncompleteCompletions = 3 + /// Completion was triggered by typing an identifier (24x7 code + /// complete), manual invocation (e.g Ctrl+Space) or via API. + | Invoked = 1 + /// Completion was triggered by a trigger character specified by + /// the `triggerCharacters` properties of the `CompletionRegistrationOptions`. + | TriggerCharacter = 2 + /// Completion was re-triggered as current completion list is incomplete + | TriggerForIncompleteCompletions = 3 /// How a signature help was triggered. /// /// @since 3.15.0 type SignatureHelpTriggerKind = - /// Signature help was invoked manually by the user or by a command. - | Invoked = 1 - /// Signature help was triggered by a trigger character. - | TriggerCharacter = 2 - /// Signature help was triggered by the cursor moving or by the document content changing. - | ContentChange = 3 + /// Signature help was invoked manually by the user or by a command. + | Invoked = 1 + /// Signature help was triggered by a trigger character. + | TriggerCharacter = 2 + /// Signature help was triggered by the cursor moving or by the document content changing. + | ContentChange = 3 /// The reason why code actions were requested. /// /// @since 3.17.0 type CodeActionTriggerKind = - /// Code actions were explicitly requested by the user or by an extension. - | Invoked = 1 - /// Code actions were requested automatically. - /// - /// This typically happens when current selection in a file changes, but can - /// also be triggered when file content changes. - | Automatic = 2 + /// Code actions were explicitly requested by the user or by an extension. + | Invoked = 1 + /// Code actions were requested automatically. + /// + /// This typically happens when current selection in a file changes, but can + /// also be triggered when file content changes. + | Automatic = 2 /// A pattern kind describing if a glob pattern matches a file a folder or /// both. /// /// @since 3.16.0 -[)>] +[)>] type FileOperationPatternKind = - /// The pattern matches a file only. - | [] file = 0 - /// The pattern matches a folder only. - | [] folder = 1 + /// The pattern matches a file only. + | [] file = 0 + /// The pattern matches a folder only. + | [] folder = 1 /// A notebook cell kind. /// /// @since 3.17.0 type NotebookCellKind = - /// A markup-cell is formatted source that is used for display. - | Markup = 1 - /// A code-cell is source code. - | Code = 2 + /// A markup-cell is formatted source that is used for display. + | Markup = 1 + /// A code-cell is source code. + | Code = 2 -[)>] +[)>] type ResourceOperationKind = - /// Supports creating new files and folders. - | [] Create = 0 - /// Supports renaming existing files and folders. - | [] Rename = 1 - /// Supports deleting existing files and folders. - | [] Delete = 2 - -[)>] + /// Supports creating new files and folders. + | [] Create = 0 + /// Supports renaming existing files and folders. + | [] Rename = 1 + /// Supports deleting existing files and folders. + | [] Delete = 2 + +[)>] type FailureHandlingKind = - /// Applying the workspace change is simply aborted if one of the changes provided - /// fails. All operations executed before the failing operation stay executed. - | [] Abort = 0 - /// All operations are executed transactional. That means they either all - /// succeed or no changes at all are applied to the workspace. - | [] Transactional = 1 - /// If the workspace edit contains only textual file changes they are executed transactional. - /// If resource changes (create, rename or delete file) are part of the change the failure - /// handling strategy is abort. - | [] TextOnlyTransactional = 2 - /// The client tries to undo the operations already executed. But there is no - /// guarantee that this is succeeding. - | [] Undo = 3 + /// Applying the workspace change is simply aborted if one of the changes provided + /// fails. All operations executed before the failing operation stay executed. + | [] Abort = 0 + /// All operations are executed transactional. That means they either all + /// succeed or no changes at all are applied to the workspace. + | [] Transactional = 1 + /// If the workspace edit contains only textual file changes they are executed transactional. + /// If resource changes (create, rename or delete file) are part of the change the failure + /// handling strategy is abort. + | [] TextOnlyTransactional = 2 + /// The client tries to undo the operations already executed. But there is no + /// guarantee that this is succeeding. + | [] Undo = 3 type PrepareSupportDefaultBehavior = - /// The client's default behavior is to select the identifier - /// according the to language's syntax rule. - | Identifier = 1 + /// The client's default behavior is to select the identifier + /// according the to language's syntax rule. + | Identifier = 1 -[)>] +[)>] type TokenFormat = - | [] Relative = 0 \ No newline at end of file + | [] Relative = 0 \ No newline at end of file diff --git a/src/Types.fs b/src/Types.fs index 47106c1..359839f 100644 --- a/src/Types.fs +++ b/src/Types.fs @@ -1,6 +1,8 @@ namespace Ionide.LanguageServerProtocol.Types open Ionide.LanguageServerProtocol +open System.Text.Json +open System.Text.Json.Serialization /// Types in typescript can have hardcoded values for their fields, this attribute is used to mark @@ -89,4 +91,94 @@ type U4<'T1, 'T2, 'T3, 'T4> = | C1 c -> string c | C2 c -> string c | C3 c -> string 3 - | C4 c -> string 3 \ No newline at end of file + | C4 c -> string 3 + +// --------------------------------------------------------------------------- +// LSPAny — a JsonElement-derived wrapper with deep structural equality +// --------------------------------------------------------------------------- + +/// The LSP any type. +/// Please note that strictly speaking a property with the value `undefined` +/// can't be converted into JSON preserving the property name. However for +/// convenience it is allowed and assumed that all these properties are +/// optional as well. +/// @since 3.17.0 +/// +/// A reference type wrapping `System.Text.Json.JsonElement` with deep structural +/// equality and comparison via `JsonElement.DeepEquals` (kind-then-content, +/// object properties order-insensitive). +[)>] +type LSPAny(value: JsonElement) = + + // ---- private helpers ---------------------------------------------------- + + static member private Hash(je: JsonElement) : int = + match je.ValueKind with + | JsonValueKind.Null -> 0 + | JsonValueKind.True -> 1 + | JsonValueKind.False -> 2 + | JsonValueKind.Number -> + // Raw text preserves distinctions like 1 vs 1.0 + je.GetRawText().GetHashCode() + | JsonValueKind.String -> je.GetString().GetHashCode() + | JsonValueKind.Array -> + je.EnumerateArray() + |> Seq.fold + (fun acc el -> + acc * 31 + + LSPAny.Hash(el) + ) + 17 + | JsonValueKind.Object -> + je.EnumerateObject() + |> Seq.fold + (fun acc p -> + acc + ^^^ (p.Name.GetHashCode() + * 31 + + LSPAny.Hash(p.Value)) + ) + 17 + | _ -> 0 + + // ---- public surface ----------------------------------------------------- + + /// The underlying `JsonElement`. + member _.JsonElement = value + + override _.ToString() = value.GetRawText() + override _.GetHashCode() = LSPAny.Hash(value) + + override x.Equals(obj) = + match obj with + | :? LSPAny as other -> JsonElement.DeepEquals(value, other.JsonElement) + | _ -> false + + interface System.IEquatable with + member x.Equals(other) = JsonElement.DeepEquals(value, other.JsonElement) + +/// STJ JsonConverter for LSPAny. Reads and writes the underlying JsonElement +/// transparently so the wire format is indistinguishable from a bare JsonElement. +and LSPAnyConverter() = + inherit JsonConverter() + + override _.Read(reader, _t, _opts) = + use doc = JsonDocument.ParseValue(&reader) + LSPAny(doc.RootElement.Clone()) + + override _.Write(writer, value, _opts) = value.JsonElement.WriteTo(writer) + +/// Helpers for constructing and deconstructing `LSPAny` values. +[] +module LSPAny = + /// Wrap a `JsonElement` in an `LSPAny`. + let ofJsonElement (je: JsonElement) : LSPAny = LSPAny je + + /// Unwrap the inner `JsonElement` from an `LSPAny`. + let toJsonElement (x: LSPAny) : JsonElement = x.JsonElement + + /// Serialize any value to `LSPAny` using the default STJ rules. + let inline ofValue (value: 'T) : LSPAny = LSPAny(JsonSerializer.SerializeToElement(value)) + + /// Deserialize an `LSPAny` to the requested type using the default STJ rules. + let inline toValue<'T> (x: LSPAny) : 'T = JsonSerializer.Deserialize<'T>(x.JsonElement) \ No newline at end of file diff --git a/tests/Benchmarks.fs b/tests/Benchmarks.fs index 7769572..a6aa1f5 100644 --- a/tests/Benchmarks.fs +++ b/tests/Benchmarks.fs @@ -3,13 +3,14 @@ module Ionide.LanguageServerProtocol.Tests.Benchmarks open Ionide.LanguageServerProtocol.Types open Ionide.LanguageServerProtocol.JsonUtils open Ionide.LanguageServerProtocol.Server -open Newtonsoft.Json.Linq + open BenchmarkDotNet.Attributes open BenchmarkDotNet.Running open BenchmarkDotNet.Configs open System open System.Collections.Concurrent open System.Collections.Generic +open System.Text.Json open BenchmarkDotNet.Order let inline private memorise (f: 'a -> 'b) : 'a -> 'b = @@ -67,6 +68,13 @@ type TypeCheckBenchmarks() = values |> Array.map (fun v -> v.GetType()) + static let numericHashes = + Type.numerics + |> Array.map (fun t -> t.GetHashCode()) + + static let boolHash = typeof.GetHashCode() + static let stringHash = typeof.GetHashCode() + static let isOptionType (ty: Type) = ty.IsGenericType && ty.GetGenericTypeDefinition() = typedefof<_ option> @@ -95,7 +103,7 @@ type TypeCheckBenchmarks() = let hash = ty.GetHashCode() if - Type.numericHashes + numericHashes |> Array.contains hash then count <- count + 1 @@ -117,7 +125,7 @@ type TypeCheckBenchmarks() = let mutable count = 0 for ty in types do - if ty.GetHashCode() = Type.boolHash then + if ty.GetHashCode() = boolHash then count <- count + 1 count @@ -137,7 +145,7 @@ type TypeCheckBenchmarks() = let mutable count = 0 for ty in types do - if ty.GetHashCode() = Type.stringHash then + if ty.GetHashCode() = stringHash then count <- count + 1 count @@ -213,7 +221,7 @@ module Example = type WithExtensionData = { NoExtensionData: string [] - mutable AdditionalData: IDictionary + mutable AdditionalData: IDictionary } module WithExtensionData = @@ -224,7 +232,7 @@ module Example = (rand.NextCount depth) (fun i -> let key = $"Data{depth}Ele{i}" - let value = JToken.FromObject(i * depth) + let value = JsonSerializer.SerializeToElement(i * depth, lspSerializerOptions) (key, value) ) |> Map.ofList @@ -679,7 +687,7 @@ type MultipleTypesBenchmarks() = Tooltip = Some(U2.C2 { Kind = MarkupKind.PlainText; Value = "some tooltip" }) PaddingLeft = Some true PaddingRight = Some false - Data = Some(JToken.FromObject "some data") + Data = Some(LSPAny(JsonSerializer.SerializeToElement("some data", lspSerializerOptions))) } let allLsp: obj[] = [| @@ -707,7 +715,7 @@ type MultipleTypesBenchmarks() = inlayHint |> serialize - let res = json.ToObject(o.GetType(), jsonRpcFormatter.JsonSerializer) + let res = JsonSerializer.Deserialize(json, o.GetType(), lspSerializerOptions) () [] @@ -722,7 +730,7 @@ type MultipleTypesBenchmarks() = example |> serialize - let res = json.ToObject(example.GetType(), jsonRpcFormatter.JsonSerializer) + let res = JsonSerializer.Deserialize(json, example.GetType(), lspSerializerOptions) () [] @@ -741,7 +749,7 @@ type MultipleTypesBenchmarks() = option |> serialize - let _ = json.ToObject(option.GetType(), jsonRpcFormatter.JsonSerializer) + let _ = JsonSerializer.Deserialize(json, option.GetType(), lspSerializerOptions) () member _.SingleCaseUnion_ArgumentsSource() = @@ -762,7 +770,7 @@ type MultipleTypesBenchmarks() = data |> serialize - let _ = json.ToObject(typeof, jsonRpcFormatter.JsonSerializer) + let _ = JsonSerializer.Deserialize(json, typeof, lspSerializerOptions) () member _.ErasedUnion_ArgumentsSource() = @@ -791,7 +799,7 @@ type MultipleTypesBenchmarks() = data |> serialize - let _ = json.ToObject(typeof, jsonRpcFormatter.JsonSerializer) + let _ = JsonSerializer.Deserialize(json, typeof, lspSerializerOptions) () diff --git a/tests/Ionide.LanguageServerProtocol.Tests.fsproj b/tests/Ionide.LanguageServerProtocol.Tests.fsproj index 9b4006f..e3d05fd 100644 --- a/tests/Ionide.LanguageServerProtocol.Tests.fsproj +++ b/tests/Ionide.LanguageServerProtocol.Tests.fsproj @@ -2,7 +2,7 @@ Exe - net8.0;net10.0 + net10.0 false diff --git a/tests/Shotgun.fs b/tests/Shotgun.fs index 952e60a..72d41cb 100644 --- a/tests/Shotgun.fs +++ b/tests/Shotgun.fs @@ -8,9 +8,9 @@ module Ionide.LanguageServerProtocol.Tests.Shotgun open System open System.Reflection +open System.Text.Json open Ionide.LanguageServerProtocol.Types open FsCheck -open Newtonsoft.Json.Linq open Expecto open Ionide.LanguageServerProtocol.Server open Ionide.LanguageServerProtocol.Types @@ -27,10 +27,17 @@ type Gens = <> null ) - static member JToken() : Arbitrary = - // actual value doesn't matter -> handled by user - // and complexer JTokens cannot be directly compared with `=` - JToken.FromObject(123) + static member JsonElement() : Arbitrary = + // FsCheck can't derive a generator for JsonElement. + // Actual value doesn't matter — keep it simple. + JsonSerializer.SerializeToElement(123) + |> Gen.constant + |> Arb.fromGen + + static member LSPAny() : Arbitrary = + // LSPAny now has structural equality, but FsCheck still can't derive a generator. + // Use a constant value; equality is now real so roundtrips compare by value. + LSPAny(JsonSerializer.SerializeToElement(123)) |> Gen.constant |> Arb.fromGen @@ -151,11 +158,12 @@ type private Roundtripper = static member TestThereAndBackAgain(input: 'a) = let output = Roundtripper.ThereAndBackAgain input - // Fails: Dictionary doesn't support structural identity (-> different instances with same content aren't equal) - // Expect.equal output input "Input -> serialize -> deserialize should be Input again" - Utils.convertExtensionDataDictionariesToMap output - Utils.convertExtensionDataDictionariesToMap input - Expect.equal output input "Input -> serialize -> deserialize should be Input again" + // Compare via JSON round-trip to handle types that lack structural equality: + // - `JsonElement` (`LSPAny`) is a struct without structural `=` + // - `Dictionary` (`JsonExtensionData`) compares by reference, not content + let inputJson = (serialize input).GetRawText() + let outputJson = (serialize output).GetRawText() + Expect.equal outputJson inputJson "Input -> serialize -> deserialize should be Input again" static member TestProperty<'a when 'a: equality> name = testPropertyWithConfig fsCheckConfig name (Roundtripper.TestThereAndBackAgain<'a>) diff --git a/tests/Tests.fs b/tests/Tests.fs index 6fa1953..92bc6d0 100644 --- a/tests/Tests.fs +++ b/tests/Tests.fs @@ -5,11 +5,11 @@ open Expecto open Ionide.LanguageServerProtocol.Types open Ionide.LanguageServerProtocol.Server open Ionide.LanguageServerProtocol.Tests -open Newtonsoft.Json.Linq -open Newtonsoft.Json +open System.Text.Json +open System.Text.Json.Nodes +open System.Text.Json.Serialization open Ionide.LanguageServerProtocol.JsonRpc open System.Collections.Generic -open System.Runtime.Serialization type Record1 = { Name: string; Value: int } type Record2 = { Name: string; Position: int } @@ -32,9 +32,9 @@ type InlayHintData = { TextDocument: TextDocumentIdentifier; Range: Range } /// Considering Serialization is used for communicating with LSP client (public API), /// this is not really an issue. type private PrivateRecord = { - [] + [] Data: string - [] + [] Value: int } @@ -60,37 +60,24 @@ type AllOptional = { OptionalName: string option; OptionalValue: int option } type MutableField = { Name: string; mutable Value: int } -type RequiredAttributeFields = { - NoProperty: string - NoPropertyOption: string option - [] - DisallowNull: string - [] - Always: string option - [] - AllowNull: string -} +type RequiredAttributeFields() = + member val NoProperty: string = null with get, set + member val NoPropertyOption: string option = None with get, set + + [] + member val DisallowNull: string = null with get, set + + [] + member val Always: string option = None with get, set + + member val AllowNull: string = null with get, set + +type ExtensionDataField() = + member val Name: string = null with get, set + member val Value: string option = None with get, set -type ExtensionDataField = { - Name: string - Value: string option - /// Note: Must be mutable to allow deserializing to something `null` (uninitialized) [] - mutable AdditionalData: IDictionary -} with - - /// Required because: - /// If no AdditionalData, AdditionalData stays null - /// -> Must be initialized manually - /// But no ctor in Record - /// -> initialize in After Deserialization if necessary - /// - /// Note: it's possible to set in `OnDeserializing` -- which is before Dictionary gets filled. - /// But cannot use `Map` there: Map values cannot be mutated - [] - member x.OnDeserialized(context: StreamingContext) = - if isNull x.AdditionalData then - x.AdditionalData <- Map.empty + member val AdditionalData: Dictionary = Dictionary() with get, set let private serializationTests = testList "(de)serialization" [ @@ -99,42 +86,41 @@ let private serializationTests = let mkLower (str: string) = sprintf "%c%s" (Char.ToLowerInvariant str[0]) (str.Substring(1)) /// Note: changes first letter into lower case - let removeProperty (name: string) (json: JToken) = - let prop = - (json :?> JObject) - .Property( - name - |> mkLower - ) - - prop.Remove() - json - - /// Note: changes first letter into lower case - let addProperty (name: string) (value: 'a) (json: JToken) = - let jObj = json :?> JObject + let removeProperty (name: string) (json: JsonElement) = + let node = System.Text.Json.Nodes.JsonNode.Parse(json.GetRawText()).AsObject() - jObj.Add( - JProperty( - name - |> mkLower, - value - ) + node.Remove( + name + |> mkLower ) + |> ignore - json + JsonSerializer.Deserialize(node.ToJsonString()) - let tryGetProperty (name: string) (json: JToken) = - let jObj = json :?> JObject + /// Note: changes first letter into lower case + let addProperty (name: string) (value: 'a) (json: JsonElement) = + let node = System.Text.Json.Nodes.JsonNode.Parse(json.GetRawText()).AsObject() - jObj.Property( + node.Add( name - |> mkLower + |> mkLower, + System.Text.Json.Nodes.JsonValue.Create(value) ) - |> Option.ofObj - let logJson (json: JToken) = - printfn $"%s{json.ToString()}" + JsonSerializer.Deserialize(node.ToJsonString()) + + let tryGetProperty (name: string) (json: JsonElement) = + match + json.TryGetProperty( + name + |> mkLower + ) + with + | true, prop -> Some prop + | _ -> None + + let logJson (json: JsonElement) = + printfn $"%s{json.GetRawText()}" json let thereAndBackAgain (input: 'a) : 'a = @@ -144,7 +130,10 @@ let private serializationTests = let testThereAndBackAgain input = let output = thereAndBackAgain input - Expect.equal output input "Input -> serialize -> deserialize should be Input again" + // Compare via JSON round-trip to handle JsonElement which lacks structural equality + let inputJson = (serialize input).GetRawText() + let outputJson = (serialize output).GetRawText() + Expect.equal outputJson inputJson "Input -> serialize -> deserialize should be Input again" testList "mutable field" [ // Newtonsoft.Json serializes all public fields @@ -160,10 +149,9 @@ let private serializationTests = let json = o |> serialize - :?> JObject let props = - json.Properties() + json.EnumerateObject() |> Seq.map (fun p -> p.Name) let expected = [ @@ -175,114 +163,103 @@ let private serializationTests = ] testList "ExtensionData" [ + let mkExtensionDataField name value additionalData = + let o = ExtensionDataField() + o.Name <- name + o.Value <- value + let d = Dictionary() + + additionalData + |> Map.iter (fun k v -> d.[k] <- v) + + o.AdditionalData <- d + o + let testThereAndBackAgain (input: ExtensionDataField) = let output = thereAndBackAgain input - // Dictionaries aren't structural comparable - // and additional: `Dictionary` when deserialized, whatever user provided for serializing (probably `Map`) - // -> custom compare `AdditionalData` - let extractAdditionalData o = - let ad = o.AdditionalData - let o = { o with AdditionalData = Map.empty } - (o, ad) + // Dictionary isn't structural comparable -> compare fields separately + Expect.equal output.Name input.Name "Name should match" + Expect.equal output.Value input.Value "Value should match" - let (input, inputAdditionalData) = extractAdditionalData input - let (output, outputAdditionalData) = extractAdditionalData output + let toSorted (d: Dictionary) = + d + |> Seq.map (fun kv -> kv.Key, kv.Value.GetRawText()) + |> Seq.sort + |> Seq.toList - Expect.equal output input "Input -> serialize -> deserialize should be Input again (ignoring AdditionalData)" - - Expect.sequenceEqual outputAdditionalData inputAdditionalData "AdditionalData should match" + Expect.equal (toSorted output.AdditionalData) (toSorted input.AdditionalData) "AdditionalData should match" testCase "can (de)serialize with all fields and additional data" <| fun _ -> - let input = { - ExtensionDataField.Name = "foo" - Value = Some "bar" - AdditionalData = - [ - "alpha", JToken.FromObject("lorem") - "beta", JToken.FromObject("ipsum") - "gamma", JToken.FromObject("dolor") - ] - |> Map.ofList - } + let input = + mkExtensionDataField + "foo" + (Some "bar") + (Map.ofList [ + "alpha", JsonSerializer.SerializeToElement("lorem", lspSerializerOptions) + "beta", JsonSerializer.SerializeToElement("ipsum", lspSerializerOptions) + "gamma", JsonSerializer.SerializeToElement("dolor", lspSerializerOptions) + ]) testThereAndBackAgain input testCase "can (de)serialize with all fields and no additional data" <| fun _ -> - let input = { - ExtensionDataField.Name = "foo" - Value = Some "bar" - AdditionalData = Map.empty - } - + let input = mkExtensionDataField "foo" (Some "bar") Map.empty testThereAndBackAgain input testCase "can (de)serialize when just required fields" <| fun _ -> - let input = { ExtensionDataField.Name = "foo"; Value = None; AdditionalData = Map.empty } + let input = mkExtensionDataField "foo" None Map.empty testThereAndBackAgain input testCase "can (de)serialize with required fields and additional data" <| fun _ -> - let input = { - ExtensionDataField.Name = "foo" - Value = None - AdditionalData = - [ - "alpha", JToken.FromObject("lorem") - "beta", JToken.FromObject("ipsum") - "gamma", JToken.FromObject("dolor") - ] - |> Map.ofList - } + let input = + mkExtensionDataField + "foo" + None + (Map.ofList [ + "alpha", JsonSerializer.SerializeToElement("lorem", lspSerializerOptions) + "beta", JsonSerializer.SerializeToElement("ipsum", lspSerializerOptions) + "gamma", JsonSerializer.SerializeToElement("dolor", lspSerializerOptions) + ]) testThereAndBackAgain input - testCase "fails when not required field" + testCase "uses default when required field is not given" <| fun _ -> - let json = JObject(JProperty("value", "bar"), JProperty("alpha", "lorem"), JProperty("beta", "ipsum")) + // STJ does not throw on missing non-option fields; Name defaults to null + let json = JsonSerializer.Deserialize("""{"value":"bar","alpha":"lorem","beta":"ipsum"}""") - Expect.throws - (fun _ -> - json - |> deserialize - |> ignore - ) - "Should throw when required property is missing" + let output = + json + |> deserialize + + Expect.equal output.Name null "Missing Name should default to null" testCase "serializes items in AdditionalData as properties" <| fun _ -> - let input = { - ExtensionDataField.Name = "foo" - Value = Some "bar" - AdditionalData = - [ - "alpha", JToken.FromObject("lorem") - "beta", JToken.FromObject("ipsum") - "gamma", JToken.FromObject("dolor") - ] - |> Map.ofList - } + let input = + mkExtensionDataField + "foo" + (Some "bar") + (Map.ofList [ + "alpha", JsonSerializer.SerializeToElement("lorem", lspSerializerOptions) + "beta", JsonSerializer.SerializeToElement("ipsum", lspSerializerOptions) + "gamma", JsonSerializer.SerializeToElement("dolor", lspSerializerOptions) + ]) let json = input |> serialize - let expected = - JObject( - JProperty("name", "foo"), - JProperty("value", "bar"), - JProperty("alpha", "lorem"), - JProperty("beta", "ipsum"), - JProperty("gamma", "dolor") - ) - - Expect.equal (json.ToString()) (expected.ToString()) "Items in AdditionalData should be normal properties" + let expected = """{"name":"foo","value":"bar","alpha":"lorem","beta":"ipsum","gamma":"dolor"}""" + Expect.equal (json.GetRawText()) expected "Items in AdditionalData should be normal properties" testCase "AdditionalData is not null when no additional properties" <| fun _ -> - let json = JObject(JProperty("name", "foo")) + let json = JsonSerializer.Deserialize("""{"name":"foo"}""") let output = json @@ -295,14 +272,15 @@ let private serializationTests = testCase "changes lower cases start in F# to lower case in JSON" <| fun _ -> let o = {| Name = "foo"; SomeValue = 42 |} - let json = serialize o :?> JObject - - let name = json.Property("name") - Expect.equal name.Name "name" "name should be lower case start" + let json = serialize o - let someValue = json.Property("someValue") + let props = + json.EnumerateObject() + |> Seq.map (fun p -> p.Name) + |> Seq.toList - Expect.equal someValue.Name "someValue" "someValue should be lowercase start, but keep upper case 2nd word" + Expect.contains props "name" "name should be lower case start" + Expect.contains props "someValue" "someValue should be lowercase start, but keep upper case 2nd word" testCase "keeps capitalization of Map" <| fun _ -> @@ -323,10 +301,10 @@ let private serializationTests = |> Seq.mapi (fun i k -> (k, i)) |> Map.ofSeq - let json = serialize m :?> JObject + let json = serialize m let propNames = - json.Properties() + json.EnumerateObject() |> Seq.map (fun p -> p.Name) |> Seq.toArray |> Array.sort @@ -352,21 +330,20 @@ let private serializationTests = testList "Optional & Required Fields" [ testList "Two Required" [ - testCase "fails when required field is not given" + testCase "uses default when required field is not given" <| fun _ -> + // STJ does not throw on missing non-option fields; it uses the type default let input = { AllRequired.RequiredName = "foo"; RequiredValue = 42 } let json = serialize input |> removeProperty (nameof input.RequiredValue) - Expect.throws - (fun _ -> - json - |> deserialize - |> ignore - ) - "Should fail without all required fields" + let output = + json + |> deserialize + + Expect.equal output.RequiredValue 0 "Missing int field should default to 0" testCase "doesn't fail with additional fields" <| fun _ -> let input = { AllRequired.RequiredName = "foo"; RequiredValue = 42 } @@ -392,21 +369,20 @@ let private serializationTests = json |> deserialize |> ignore - testCase "fails when required field is not given" + testCase "uses default when required field is not given" <| fun _ -> + // STJ does not throw on missing non-option fields; it uses the type default let input = { OneOptional.RequiredName = "foo"; OptionalValue = Some 42 } let json = serialize input |> removeProperty (nameof input.RequiredName) - Expect.throws - (fun _ -> - json - |> deserialize - |> ignore - ) - "Should fail without all required fields" + let output = + json + |> deserialize + + Expect.equal output.RequiredName null "Missing string field should default to null" testCase "doesn't fail with all fields" <| fun _ -> @@ -458,7 +434,7 @@ let private serializationTests = <| fun _ -> let input = { AllOptional.OptionalName = None; OptionalValue = None } let json = serialize input - Expect.isEmpty (json.Children()) "There should be no properties" + Expect.isEmpty (json.EnumerateObject()) "There should be no properties" testCase "doesn't fail when all fields given" <| fun _ -> @@ -497,90 +473,63 @@ let private serializationTests = ] testList "Existing JsonProperty.Required" [ - let o: RequiredAttributeFields = { - NoProperty = "" - NoPropertyOption = None - DisallowNull = "" - Always = None - AllowNull = "" - } - - let l = mkLower - testCase "all according to Required Attribute should not fail" <| fun _ -> let json = - JObject( - JProperty(l (nameof o.NoProperty), "lorem"), - JProperty(l (nameof o.NoPropertyOption), "ipsum"), - JProperty(l (nameof o.DisallowNull), "dolor"), - JProperty(l (nameof o.Always), "sit"), - JProperty(l (nameof o.AllowNull), "amet") + JsonSerializer.Deserialize( + """{"noProperty":"lorem","noPropertyOption":"ipsum","disallowNull":"dolor","always":"sit","allowNull":"amet"}""" ) json |> deserialize |> ignore - testCase "No property fails when not provided" + testCase "No property succeeds when not provided (STJ requires explicit JsonRequired)" <| fun _ -> + // Unlike Newtonsoft's default "required" behavior, STJ only enforces presence for + // [] fields. NoProperty has no [] -> a missing value + // defaults to null instead of failing. let json = - JObject( - JProperty(l (nameof o.NoPropertyOption), "ipsum"), - JProperty(l (nameof o.DisallowNull), "dolor"), - JProperty(l (nameof o.Always), "sit"), - JProperty(l (nameof o.AllowNull), "amet") + JsonSerializer.Deserialize( + """{"noPropertyOption":"ipsum","disallowNull":"dolor","always":"sit","allowNull":"amet"}""" ) - Expect.throws - (fun _ -> - json - |> deserialize - |> ignore - ) - "No Property means required and should fail when not present" + let output = + json + |> deserialize + + Expect.equal output.NoProperty null "Missing non-required field should default to null" testCase "No property on option succeeds when not provided" <| fun _ -> let json = - JObject( - JProperty(l (nameof o.NoProperty), "lorem"), - JProperty(l (nameof o.DisallowNull), "dolor"), - JProperty(l (nameof o.Always), "sit"), - JProperty(l (nameof o.AllowNull), "amet") + JsonSerializer.Deserialize( + """{"noProperty":"lorem","disallowNull":"dolor","always":"sit","allowNull":"amet"}""" ) json |> deserialize |> ignore - testCase "DisallowNull fails when null" + testCase "DisallowNull with null value is accepted by STJ" <| fun _ -> + // STJ [] only enforces presence, not non-null (unlike Newtonsoft Required.DisallowNull) let json = - JObject( - JProperty(l (nameof o.NoProperty), "lorem"), - JProperty(l (nameof o.NoPropertyOption), "ipsum"), - JProperty(l (nameof o.DisallowNull), null), - JProperty(l (nameof o.Always), "sit"), - JProperty(l (nameof o.AllowNull), "amet") + JsonSerializer.Deserialize( + """{"noProperty":"lorem","noPropertyOption":"ipsum","disallowNull":null,"always":"sit","allowNull":"amet"}""" ) - Expect.throws - (fun _ -> - json - |> deserialize - |> ignore - ) - "DisallowNull cannot be null" + let output = + json + |> deserialize + + Expect.equal output.DisallowNull null "STJ JsonRequired allows null values" testCase "Option with Always fails when not present" <| fun _ -> let json = - JObject( - JProperty(l (nameof o.NoProperty), "lorem"), - JProperty(l (nameof o.NoPropertyOption), "ipsum"), - JProperty(l (nameof o.DisallowNull), "dolor"), - JProperty(l (nameof o.AllowNull), "amet") + JsonSerializer.Deserialize( + """{"noProperty":"lorem","noPropertyOption":"ipsum","disallowNull":"dolor","allowNull":"amet"}""" ) Expect.throws @@ -594,12 +543,8 @@ let private serializationTests = testCase "AllowNull doesn't fail when null" <| fun _ -> let json = - JObject( - JProperty(l (nameof o.NoProperty), "lorem"), - JProperty(l (nameof o.NoPropertyOption), "ipsum"), - JProperty(l (nameof o.DisallowNull), "dolor"), - JProperty(l (nameof o.Always), "sit"), - JProperty(l (nameof o.AllowNull), null) + JsonSerializer.Deserialize( + """{"noProperty":"lorem","noPropertyOption":"ipsum","disallowNull":"dolor","always":"sit","allowNull":null}""" ) json @@ -656,10 +601,15 @@ let private serializationTests = <| fun _ -> let input: U2 = U2.C2 { OneOptional.RequiredName = "foo"; OptionalValue = None } - let json = serialize input :?> JObject - Expect.hasLength (json.Properties()) 1 "There should be just one property" - let prop = json.Property("requiredName") - Expect.equal (prop.Value.ToString()) "foo" "Required Property should have correct value" + let json = serialize input + + let props = + json.EnumerateObject() + |> Seq.toList + + Expect.hasLength props 1 "There should be just one property" + let prop = json.GetProperty("requiredName") + Expect.equal (prop.GetString()) "foo" "Required Property should have correct value" testCase "can deserialize with optional missing member" <| fun _ -> @@ -671,17 +621,16 @@ let private serializationTests = let input: U2 = U2.C2 { OneOptional.RequiredName = "foo"; OptionalValue = Some 42 } testThereAndBackAgain input - testCase "fails with missing required value" + testCase "uses default when required value is missing" <| fun _ -> - let json = JToken.Parse """{"optionalValue": 42}""" + // STJ does not throw on missing non-option fields; RequiredName defaults to null + let json = JsonSerializer.Deserialize("""{"optionalValue": 42}""") - Expect.throws - (fun _ -> - json - |> deserialize - |> ignore - ) - "Should fail without required member" + let output = + json + |> deserialize + + Expect.equal output.RequiredName null "Missing RequiredName should default to null" ] @@ -779,18 +728,9 @@ let private serializationTests = let json = textDoc |> serialize - :?> JObject - - let prop = json.Property("version") - let value = prop.Value - Expect.equal (value.Type) (JTokenType.Null) "Version should be null" - - let prop = - json - |> tryGetProperty (nameof textDoc.Version) - |> Flip.Expect.wantSome "Property Version should exist" - Expect.equal prop.Value.Type (JTokenType.Null) "Version should be null" + // STJ omits None options (WhenWritingNull), so version is absent + Expect.isNone (tryGetProperty (nameof textDoc.Version) json) "None Version should not be present in JSON" testCase "can deserialize null Version in OptioanlVersionedTextDocumentIdentifier" <| fun _ -> let textDoc = { OptionalVersionedTextDocumentIdentifier.Uri = "..."; Version = None } @@ -807,12 +747,12 @@ let private serializationTests = Expect.isNone (json |> tryGetProperty (nameof response.Version)) - "Version should exist, but instead as jsonrpc" + "Version should not exist as 'version', but as 'jsonrpc'" Expect.isSome (json |> tryGetProperty "jsonrpc") - "jsonrcp should exist because of Version" + "jsonrpc should exist because of Version" // Id & Error optional -> not in json Expect.isNone (json @@ -823,13 +763,13 @@ let private serializationTests = (json |> tryGetProperty (nameof response.Error)) "None Error shouldn't be in json" - // Result even when null/None + // Result always present (even null/None) because JsonIgnoreCondition.Never let prop = json |> tryGetProperty (nameof response.Result) |> Flip.Expect.wantSome "Result should exist even when null/None" - Expect.equal prop.Value.Type (JTokenType.Null) "Result should be null" + Expect.equal prop.ValueKind JsonValueKind.Null "Result should be null" testCase "can (de)serialize empty response" <| fun _ -> let response: Response = { Version = "123"; Id = None; Error = None; Result = None } @@ -840,7 +780,7 @@ let private serializationTests = Version = "123" Id = None Error = None - Result = Some(JToken.Parse "\"some result\"") + Result = Some(JsonSerializer.Deserialize("\"some result\"")) } testThereAndBackAgain response @@ -851,7 +791,7 @@ let private serializationTests = Version = "123" Id = Some 42 Error = None - Result = Some(JToken.Parse "\"some result\"") + Result = Some(JsonSerializer.Deserialize("\"some result\"")) } testThereAndBackAgain response @@ -860,7 +800,12 @@ let private serializationTests = let response: Response = { Version = "123" Id = Some 42 - Error = Some { Code = 13; Message = "oh no"; Data = Some(JToken.Parse "\"some data\"") } + Error = + Some { + Code = 13 + Message = "oh no" + Data = Some(JsonSerializer.Deserialize("\"some data\"")) + } Result = None } @@ -870,8 +815,13 @@ let private serializationTests = let response: Response = { Version = "123" Id = Some 42 - Error = Some { Code = 13; Message = "oh no"; Data = Some(JToken.Parse "\"some data\"") } - Result = Some(JToken.Parse "\"some result\"") + Error = + Some { + Code = 13 + Message = "oh no" + Data = Some(JsonSerializer.Deserialize("\"some data\"")) + } + Result = Some(JsonSerializer.Deserialize("\"some result\"")) } let output = thereAndBackAgain response @@ -919,11 +869,11 @@ let private serializationTests = Tooltip = Some(U2.C1 "tooltipping") PaddingLeft = Some true PaddingRight = Some false - Data = Some(JToken.FromObject "some data") + Data = Some(LSPAny(JsonSerializer.SerializeToElement("some data", lspSerializerOptions))) } testThereAndBackAgain theInlayHint - testCase "can keep Data with JToken" + testCase "can keep Data with JsonElement" <| fun _ -> // JToken doesn't use structural equality // -> Expecto equal check fails even when same content in complex JToken @@ -940,14 +890,14 @@ let private serializationTests = Tooltip = None PaddingLeft = None PaddingRight = None - Data = Some(JToken.FromObject data) + Data = Some(LSPAny(JsonSerializer.SerializeToElement(data, lspSerializerOptions))) } let output = thereAndBackAgain theInlayHint let outputData = output.Data - |> Option.map (fun t -> t.ToObject()) + |> Option.map (fun t -> JsonSerializer.Deserialize(t.JsonElement, lspSerializerOptions)) Expect.equal outputData (Some data) "Data should not change" testCase "can roundtrip InlayHint with all fields (complex)" @@ -996,7 +946,7 @@ let private serializationTests = Tooltip = Some(U2.C2 { Kind = MarkupKind.PlainText; Value = "some tooltip" }) PaddingLeft = Some true PaddingRight = Some false - Data = Some(JToken.FromObject "some data") + Data = Some(LSPAny(JsonSerializer.SerializeToElement("some data", lspSerializerOptions))) } testThereAndBackAgain theInlayHint diff --git a/tests/Utils.fs b/tests/Utils.fs index 4236c7a..7bb4f9b 100644 --- a/tests/Utils.fs +++ b/tests/Utils.fs @@ -3,9 +3,9 @@ module Ionide.LanguageServerProtocol.Tests.Utils open Ionide.LanguageServerProtocol.Types open System.Reflection -open Newtonsoft.Json open System.Collections.Generic -open Newtonsoft.Json.Linq +open System.Text.Json +open System.Text.Json.Serialization open System open Expecto open System.Collections @@ -75,7 +75,7 @@ let isLspType (additionalRules: (Type -> bool) list) (ty: Type) = && (additionalRules |> List.forall (fun rule -> rule ty)) -/// Replaces contents of properties with `JsonExtensionData`Attribute of type `IDictionary` +/// Replaces contents of properties with `JsonExtensionData`Attribute of type `IDictionary` /// with a `Map` containing same elements. /// `null` field is kept. /// @@ -88,10 +88,10 @@ let isLspType (additionalRules: (Type -> bool) list) (ty: Type) = /// Dictionaries don't use structural identity /// -> `Expecto.equal` fails with two dictionaries -- or objects that contain dictionary /// -/// In Newtonsoft.Json: `JsonExtensionData` required a Dictionary (IDictionary). -/// Unfortunately F# `Map` cannot be used because no default ctor and not mutable. -/// -> Must use something else -- like `Dictionary` (see LSP Type `FormattingOptions`) -/// But now LSP data cannot be compared with `=` or `Expecto.equal`. +/// STJ `JsonExtensionData` requires a mutable `IDictionary` — F# `Map` cannot be used +/// because it has no default ctor and is not mutable. +/// -> Must use `Dictionary` (see LSP Type `FormattingOptions`) +/// But `Dictionary` doesn't use structural equality, so LSP data can't be compared with `=`. /// And the type with `Dictionary` might be nested deep down. /// /// -> Replace all dictionaries with `Map` -> comparison works again @@ -117,7 +117,7 @@ let rec convertExtensionDataDictionariesToMap (o: obj) = | :? float | :? byte | :? uint -> () - | :? JToken -> () + | :? JsonElement -> () | :? IDictionary as dict -> for kv in dict @@ -163,8 +163,8 @@ let rec convertExtensionDataDictionariesToMap (o: obj) = for (prop, value) in propsWithValues do match value with | null -> () - | :? Map -> () - | :? IDictionary as dict -> + | :? Map -> () + | :? IDictionary as dict -> match prop.GetCustomAttribute() with | null -> () | _ when not prop.CanWrite -> @@ -187,7 +187,7 @@ module TestData = type WithExtensionData = { Value: string [] - mutable AdditionalData: IDictionary + mutable AdditionalData: IDictionary } [] @@ -332,9 +332,9 @@ let tests = let dict = [| - "alpha", JToken.FromObject "lorem" - "beta", JToken.FromObject "ipsum" - "gamma", JToken.FromObject "dolor" + "alpha", LSPAny(JsonSerializer.SerializeToElement "lorem") + "beta", LSPAny(JsonSerializer.SerializeToElement "ipsum") + "gamma", LSPAny(JsonSerializer.SerializeToElement "dolor") |] |> Map.ofArray @@ -429,7 +429,7 @@ let tests = 5 (fun i -> let m = - Array.init (i + 3) (fun j -> ($"Dict{i}Element{j}", JToken.FromObject(i + j))) + Array.init (i + 3) (fun j -> ($"Dict{i}Element{j}", LSPAny(JsonSerializer.SerializeToElement(i + j)))) |> Map.ofArray { @@ -458,7 +458,7 @@ let tests = List.init (seed % 4 + 3) - (fun i -> ($"Seed{seed}Element{i}Of{count}", JToken.FromObject(count + i))) + (fun i -> ($"Seed{seed}Element{i}Of{count}", LSPAny(JsonSerializer.SerializeToElement(count + i)))) |> Map.ofList |> mkDict } diff --git a/tools/MetaModelGenerator/Common.fs b/tools/MetaModelGenerator/Common.fs index bce160b..da1e5e6 100644 --- a/tools/MetaModelGenerator/Common.fs +++ b/tools/MetaModelGenerator/Common.fs @@ -5,14 +5,14 @@ module Formatting = let formatConfig = { FormatConfig.Default with - IndentSize = 2 + IndentSize = 4 MaxRecordWidth = 80 MaxValueBindingWidth = 120 MaxFunctionBindingWidth = 120 MaxDotGetExpressionWidth = 120 MaxInfixOperatorExpression = 10 ArrayOrListMultilineFormatter = MultilineFormatterType.NumberOfItems - MultilineBracketStyle = MultilineBracketStyle.Stroustrup + MultilineBracketStyle = MultilineBracketStyle.Aligned MultiLineLambdaClosingNewline = true InsertFinalNewline = false } diff --git a/tools/MetaModelGenerator/GenerateTypes.fs b/tools/MetaModelGenerator/GenerateTypes.fs index ad13d75..aace661 100644 --- a/tools/MetaModelGenerator/GenerateTypes.fs +++ b/tools/MetaModelGenerator/GenerateTypes.fs @@ -27,7 +27,7 @@ module GenerateTypes = |> String.concat "" - let JToken = LongIdent "JToken" + let JsonElement = LongIdent "JsonElement" let createOption (t: WidgetBuilder) = Ast.OptionPostfix t @@ -230,9 +230,7 @@ module GenerateTypes = isOptional && not currentProperty.IsOptional then - createOption (createErasedUnion ts), - Some(Attribute "JsonProperty(NullValueHandling = NullValueHandling.Include)"), - namedAnonRecs + createOption (createErasedUnion ts), None, namedAnonRecs else createErasedUnion ts, None, namedAnonRecs @@ -244,7 +242,7 @@ module GenerateTypes = l.Value.PropertiesSafe |> Array.isEmpty then - JToken, None, [] + JsonElement, None, [] else let ts = l.Value.PropertiesSafe @@ -645,10 +643,13 @@ module GenerateTypes = /// Creates F# Type Aliases or Records based on a TypeAlias let createTypeAlias (alias: MetaModel.TypeAlias) = - let rec getType path (t: MetaModel.Type) = - if alias.Name = "LSPAny" then - JToken, [] - else + // LSPAny is defined as a proper wrapper DU (with structural equality) in Types.fs. + // Do not emit a generated alias for it here. + if alias.Name = "LSPAny" then + AnonymousModule() { () } + else + + let rec getType path (t: MetaModel.Type) = match t with | MetaModel.Type.ReferenceType r -> LongIdent r.Name, [] | MetaModel.Type.BaseType b -> LongIdent(b.Name.ToDotNetType()), [] @@ -687,7 +688,7 @@ module GenerateTypes = l.Value.PropertiesSafe |> Array.isEmpty then - JToken, [] + JsonElement, [] else let ts = l.Value.PropertiesSafe @@ -761,47 +762,47 @@ module GenerateTypes = | _ -> failwithf "todo Property %A" t - let (types: WidgetBuilder, namedAnonRecs) = getType [ alias.Name ] alias.Type - - let (|AliasIsSameAsRecordName|_|) (alias: WidgetBuilder, namedAnonRecs) = - let typeAlias = Gen.mkOak alias + let (types: WidgetBuilder, namedAnonRecs) = getType [ alias.Name ] alias.Type - let nestedRecord = - namedAnonRecs - |> Seq.tryExactlyOne + let (|AliasIsSameAsRecordName|_|) (alias: WidgetBuilder, namedAnonRecs) = + let typeAlias = Gen.mkOak alias - match typeAlias, Option.map Gen.mkOak nestedRecord with - | Type.LongIdent i, Some r when (getIdent i.Content) = getIdent ((r :> ITypeDefn).TypeName.Identifier.Content) -> - nestedRecord - | _ -> None - - let abbrev = - match types, namedAnonRecs with - | AliasIsSameAsRecordName r -> - // If the record being emitted is the same as the type alias, ignore the type alias and just emit the record - AnonymousModule() { - alias.StructuredDocs - |> Option.mapOrDefault r r.xmlDocs - } - | _ -> - AnonymousModule() { - let abbrev = Abbrev(alias.Name, types) - - let abbrev = + let nestedRecord = + namedAnonRecs + |> Seq.tryExactlyOne + + match typeAlias, Option.map Gen.mkOak nestedRecord with + | Type.LongIdent i, Some r when (getIdent i.Content) = getIdent ((r :> ITypeDefn).TypeName.Identifier.Content) -> + nestedRecord + | _ -> None + + let abbrev = + match types, namedAnonRecs with + | AliasIsSameAsRecordName r -> + // If the record being emitted is the same as the type alias, ignore the type alias and just emit the record + AnonymousModule() { alias.StructuredDocs - |> Option.mapOrDefault abbrev abbrev.xmlDocs + |> Option.mapOrDefault r r.xmlDocs + } + | _ -> + AnonymousModule() { + let abbrev = Abbrev(alias.Name, types) - abbrev + let abbrev = + alias.StructuredDocs + |> Option.mapOrDefault abbrev abbrev.xmlDocs - for o in namedAnonRecs do - o - } + abbrev - AnonymousModule() { + for o in namedAnonRecs do + o + } - abbrev + AnonymousModule() { - } + abbrev + + } /// Creates Open or Closed Enums based on an Enumeration @@ -847,7 +848,7 @@ module GenerateTypes = enumeration.StructuredDocs |> Option.mapOrDefault enum enum.xmlDocs - enum.attribute (Attribute("JsonConverter(typeof)")) + enum.attribute (Attribute("JsonConverter(typeof)")) | MetaModel.EnumerationTypeNameValues.Integer | MetaModel.EnumerationTypeNameValues.Uinteger -> // Create enums with number values @@ -894,8 +895,8 @@ See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17 Open("System") Open("System.Runtime.Serialization") Open("System.Diagnostics") - Open("Newtonsoft.Json") - Open("Newtonsoft.Json.Linq") + Open("System.Text.Json") + Open("System.Text.Json.Serialization") // Simple aliases for types that are not in dotnet Abbrev(Widgets.UriString, "string")