diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 3abe23a..800e578 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -2,14 +2,8 @@ "version": 1, "isRoot": true, "tools": { - "paket": { - "version": "6.2.1", - "commands": [ - "paket" - ] - }, "fantomas": { - "version": "6.2.3", + "version": "7.0.1", "commands": [ "fantomas" ] diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 65e2eb3..5b6f989 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: global-json-file: global.json dotnet-version: | 8.x - 6.x + 9.x - name: Run build run: dotnet build -c Release src - name: Run tests @@ -29,7 +29,7 @@ jobs: - name: Run publish run: dotnet pack -o release src - name: Upload NuGet packages - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: - name: packages + name: packages-${{ matrix.os }} path: release/ diff --git a/.vscode/settings.json b/.vscode/settings.json index ebcf8fd..10ff91d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,5 +7,6 @@ "Ionide", "Newtonsoft", "Supertypes" - ] + ], + "editor.formatOnSave": true } \ No newline at end of file diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 0000000..54a4472 --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,42 @@ + + + + + <_BuildProjBaseIntermediateOutputPath>$(MSBuildThisFileDirectory)build/obj/ + <_DotnetToolManifestFile>$(MSBuildThisFileDirectory).config/dotnet-tools.json + <_DotnetToolRestoreOutputFile> + $(_BuildProjBaseIntermediateOutputPath)/dotnet-tool-restore-$(NETCoreSdkVersion)-$(OS) + <_DotnetFantomasOutputFile> + $(BaseIntermediateOutputPath)dotnet-fantomas-msbuild-$(NETCoreSdkVersion)-$(OS) + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/global.json b/global.json index cf2164e..f15a959 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.100", - "rollForward": "major" + "version": "9.0.100", + "rollForward": "latestMinor" } } \ No newline at end of file diff --git a/src/Client.fs b/src/Client.fs index c6e88d3..c828e5c 100644 --- a/src/Client.fs +++ b/src/Client.fs @@ -1,6 +1,7 @@ namespace Ionide.LanguageServerProtocol open Ionide.LanguageServerProtocol.Types +open Ionide.LanguageServerProtocol.JsonRpc module private ClientUtil = /// Return the JSON-RPC "not implemented" error @@ -11,131 +12,6 @@ module private ClientUtil = open ClientUtil -[] -type ILspClient = - /// 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 member WindowShowMessage: ShowMessageParams -> Async - - /// The show message request is sent from a server to a client to ask the client to display - /// a particular message in the user interface. In addition to the show message notification the - /// request allows to pass actions and to wait for an answer from the client. - abstract member WindowShowMessageRequest: ShowMessageRequestParams -> AsyncLspResult - - - /// The log message notification is sent from the server to the client to ask the client to log - ///a particular message. - abstract member WindowLogMessage: LogMessageParams -> Async - - /// The show document request is sent from a server to a client to ask the client to display a particular - /// resource referenced by a URI in the user interface. - abstract member WindowShowDocument: ShowDocumentParams -> AsyncLspResult - - /// 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 - - /// The `client/registerCapability` request is sent from the server to the client to register for a new - /// capability on the client side. Not all clients need to support dynamic capability registration. - /// A client opts in via the dynamicRegistration property on the specific client capabilities. A client - /// can even provide dynamic registration for capability A but not for capability B. - abstract member ClientRegisterCapability: RegistrationParams -> AsyncLspResult - - /// The `client/unregisterCapability` request is sent from the server to the client to unregister a previously - /// registered capability. - abstract member ClientUnregisterCapability: UnregistrationParams -> AsyncLspResult - - - /// Many tools support more than one root folder per workspace. Examples for this are VS Code’s multi-root - /// support, Atom’s project folder support or Sublime’s project support. If a client workspace consists of - /// multiple roots then a server typically needs to know about this. The protocol up to know assumes one root - /// folder which is announce to the server by the rootUri property of the InitializeParams. - /// If the client supports workspace folders and announces them via the corresponding workspaceFolders client - /// capability the InitializeParams contain an additional property workspaceFolders with the configured - /// workspace folders when the server starts. - /// - /// The workspace/workspaceFolders request is sent from the server to the client to fetch the current open - /// list of workspace folders. Returns null in the response if only a single file is open in the tool. - /// Returns an empty array if a workspace is open but no folders are configured. - abstract member WorkspaceWorkspaceFolders: unit -> AsyncLspResult - - /// The workspace/configuration request is sent from the server to the client to fetch configuration - /// settings from the client. - /// - /// 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 WorkspaceApplyEdit: ApplyWorkspaceEditParams -> AsyncLspResult - - /// The workspace/semanticTokens/refresh request is sent from the server to the client. - /// Servers can use it to ask clients to refresh the editors for which this server provides semantic tokens. - /// As a result the client should ask the server to recompute the semantic tokens for these editors. - /// This is useful if a server detects a project wide configuration change which requires a re-calculation - /// of all semantic tokens. Note that the client still has the freedom to delay the re-calculation of - /// the semantic tokens if for example an editor is currently not visible. - abstract member WorkspaceSemanticTokensRefresh: unit -> Async - - - /// The `workspace/inlayHint/refresh` request is sent from the server to the client. - /// Servers can use it to ask clients to refresh the inlay hints currently shown in editors. - /// As a result the client should ask the server to recompute the inlay hints for these editors. - /// This is useful if a server detects a configuration change which requires a re-calculation - /// of all inlay hints. Note that the client still has the freedom to delay the re-calculation of the inlay hints - /// if for example an editor is currently not visible. - abstract member WorkspaceInlayHintRefresh: unit -> Async - - - /// The workspace/codeLens/refresh request is sent from the server to the client. Servers can use it to ask - /// clients to refresh the code lenses currently shown in editors. As a result the client should ask the - /// server to recompute the code lenses for these editors. This is useful if a server detects a - /// configuration change which requires a re-calculation of all code lenses. Note that the client still has - /// the freedom to delay the re-calculation of the code lenses if for example an editor is currently not - /// visible. - abstract member WorkspaceCodeLensRefresh: unit -> Async - - - /// The workspace/inlineValue/refresh request is sent from the server to the client. Servers can use it to - /// ask clients to refresh the inline values currently shown in editors. As a result the client should ask - /// the server to recompute the inline values for these editors. This is useful if a server detects a - /// configuration change which requires a re-calculation of all inline values. Note that the client still - /// has the freedom to delay the re-calculation of the inline values if for example an editor is currently - /// not visible. - abstract member WorkspaceInlineValueRefresh: unit -> Async - - - /// Diagnostics notification are sent from the server to the client to signal results of validation runs. - /// - /// Diagnostics are “owned” by the server so it is the server’s responsibility to clear them if necessary. - /// The following rule is used for VS Code servers that generate diagnostics: - /// - /// * if a language is single file only (for example HTML) then diagnostics are cleared by the server when - /// the file is closed. - /// * if a language has a project system (for example C#) diagnostics are not cleared when a file closes. - /// When a project is opened all diagnostics for all files are recomputed (or read from a cache). - /// - /// When a file changes it is the server’s responsibility to re-compute diagnostics and push them to the - /// client. If the computed set is empty it has to push the empty array to clear former diagnostics. - /// Newly pushed diagnostics always replace previously pushed diagnostics. There is no merging that happens - /// on the client side. - abstract member TextDocumentPublishDiagnostics: PublishDiagnosticsParams -> Async - - /// The workspace/diagnostic/refresh request is sent from the server to the client. Servers can use it to - /// ask clients to refresh all needed document and workspace diagnostics. This is useful if a server detects - /// a project wide configuration change which requires a re-calculation of all diagnostics. - abstract member WorkspaceDiagnosticRefresh: unit -> Async - - /// The window/workDoneProgress/create request is sent from the server to the client to ask the client to create a work done progress. - abstract member WorkDoneProgressCreate: ProgressToken -> AsyncLspResult - - /// The base protocol offers also support to report progress in a generic fashion. - /// This mechanism can be used to report any kind of progress including work done progress - /// (usually used to report progress in the user interface using a progress bar) and - /// partial result progress to support streaming of results. - abstract member Progress: ProgressToken * 'Progress -> Async - [] type LspClient() = @@ -218,9 +94,9 @@ type LspClient() = /// This is useful if a server detects a project wide configuration change which requires a re-calculation /// of all semantic tokens. Note that the client still has the freedom to delay the re-calculation of /// the semantic tokens if for example an editor is currently not visible. - abstract member WorkspaceSemanticTokensRefresh: unit -> Async + abstract member WorkspaceSemanticTokensRefresh: unit -> AsyncLspResult - default __.WorkspaceSemanticTokensRefresh() = ignoreNotification + default __.WorkspaceSemanticTokensRefresh() = notImplemented /// The `workspace/inlayHint/refresh` request is sent from the server to the client. /// Servers can use it to ask clients to refresh the inlay hints currently shown in editors. @@ -228,9 +104,9 @@ type LspClient() = /// This is useful if a server detects a configuration change which requires a re-calculation /// of all inlay hints. Note that the client still has the freedom to delay the re-calculation of the inlay hints /// if for example an editor is currently not visible. - abstract member WorkspaceInlayHintRefresh: unit -> Async + abstract member WorkspaceInlayHintRefresh: unit -> AsyncLspResult - default __.WorkspaceInlayHintRefresh() = ignoreNotification + default __.WorkspaceInlayHintRefresh() = notImplemented /// The workspace/codeLens/refresh request is sent from the server to the client. Servers can use it to ask /// clients to refresh the code lenses currently shown in editors. As a result the client should ask the @@ -238,9 +114,9 @@ type LspClient() = /// configuration change which requires a re-calculation of all code lenses. Note that the client still has /// the freedom to delay the re-calculation of the code lenses if for example an editor is currently not /// visible. - abstract member WorkspaceCodeLensRefresh: unit -> Async + abstract member WorkspaceCodeLensRefresh: unit -> AsyncLspResult - default __.WorkspaceCodeLensRefresh() = ignoreNotification + default __.WorkspaceCodeLensRefresh() = notImplemented /// The workspace/inlineValue/refresh request is sent from the server to the client. Servers can use it to /// ask clients to refresh the inline values currently shown in editors. As a result the client should ask @@ -248,9 +124,9 @@ type LspClient() = /// configuration change which requires a re-calculation of all inline values. Note that the client still /// has the freedom to delay the re-calculation of the inline values if for example an editor is currently /// not visible. - abstract member WorkspaceInlineValueRefresh: unit -> Async + abstract member WorkspaceInlineValueRefresh: unit -> AsyncLspResult - default __.WorkspaceInlineValueRefresh() = ignoreNotification + default __.WorkspaceInlineValueRefresh() = notImplemented /// Diagnostics notification are sent from the server to the client to signal results of validation runs. /// @@ -273,17 +149,23 @@ type LspClient() = /// The workspace/diagnostic/refresh request is sent from the server to the client. Servers can use it to /// ask clients to refresh all needed document and workspace diagnostics. This is useful if a server detects /// a project wide configuration change which requires a re-calculation of all diagnostics. - abstract member WorkspaceDiagnosticRefresh: unit -> Async + abstract member WorkspaceDiagnosticRefresh: unit -> AsyncLspResult + + default __.WorkspaceDiagnosticRefresh() = notImplemented + + abstract member Progress: ProgressParams -> Async - default __.WorkspaceDiagnosticRefresh() = ignoreNotification + default __.Progress(p) = ignoreNotification - abstract member Progress: ProgressToken * 'Progress -> Async + abstract member CancelRequest: CancelParams -> Async + default __.CancelRequest(_) = ignoreNotification - default __.Progress(_, _) = ignoreNotification + abstract member LogTrace: LogTraceParams -> Async + default __.LogTrace(_) = ignoreNotification /// The window/workDoneProgress/create request is sent from the server to the client to ask the client to create a work done progress. - abstract member WorkDoneProgressCreate: ProgressToken -> AsyncLspResult - default __.WorkDoneProgressCreate(_) = notImplemented + abstract member WindowWorkDoneProgressCreate: WorkDoneProgressCreateParams -> AsyncLspResult + default __.WindowWorkDoneProgressCreate(_) = notImplemented interface ILspClient with member this.WindowShowMessage(p: ShowMessageParams) = this.WindowShowMessage(p) @@ -302,5 +184,8 @@ type LspClient() = member this.WorkspaceInlineValueRefresh() = this.WorkspaceInlineValueRefresh() member this.TextDocumentPublishDiagnostics(p: PublishDiagnosticsParams) = this.TextDocumentPublishDiagnostics(p) member this.WorkspaceDiagnosticRefresh() = this.WorkspaceDiagnosticRefresh() - member this.WorkDoneProgressCreate(token: ProgressToken) = this.WorkDoneProgressCreate(token) - member this.Progress(token, data) = this.Progress(token, data) \ No newline at end of file + member this.WindowWorkDoneProgressCreate(p: WorkDoneProgressCreateParams) = this.WindowWorkDoneProgressCreate(p) + member this.Progress(p: ProgressParams) = this.Progress(p) + member this.CancelRequest(p: CancelParams) : Async = this.CancelRequest(p) + member this.LogTrace(p: LogTraceParams) : Async = this.LogTrace(p) + member this.Dispose() : unit = () \ No newline at end of file diff --git a/src/ClientServer.cg.fs b/src/ClientServer.cg.fs new file mode 100644 index 0000000..a899f79 --- /dev/null +++ b/src/ClientServer.cg.fs @@ -0,0 +1,593 @@ +namespace Ionide.LanguageServerProtocol + +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>>> + + /// 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 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 incoming calls for a given `CallHierarchyItem`. + /// + /// @since 3.16.0 + abstract CallHierarchyIncomingCalls: + CallHierarchyIncomingCallsParams -> 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 TextDocumentSemanticTokensFull: SemanticTokensParams -> AsyncLspResult> + + /// @since 3.16.0 + abstract TextDocumentSemanticTokensFullDelta: + SemanticTokensDeltaParams -> 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 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 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>> + + /// 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 + +module Mappings = + type ServerRequestHandling<'server when 'server :> ILspServer> = { Run: 'server -> System.Delegate } + + 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 diff --git a/src/FsLibLog.fs b/src/FsLibLog.fs index a84ffb0..f14de48 100644 --- a/src/FsLibLog.fs +++ b/src/FsLibLog.fs @@ -26,19 +26,21 @@ module Types = type MappedContext = string -> obj -> bool -> IDisposable /// Type representing a Log - type Log = - { LogLevel: LogLevel - Message: MessageThunk - Exception: exn option - Parameters: obj list - AdditionalNamedParameters: ((string * obj * bool) list) } - - static member StartLogLevel(logLevel: LogLevel) = - { LogLevel = logLevel - Message = None - Exception = None - Parameters = List.empty - AdditionalNamedParameters = List.empty } + type Log = { + LogLevel: LogLevel + Message: MessageThunk + Exception: exn option + Parameters: obj list + AdditionalNamedParameters: ((string * obj * bool) list) + } with + + static member StartLogLevel(logLevel: LogLevel) = { + LogLevel = logLevel + Message = None + Exception = None + Parameters = List.empty + AdditionalNamedParameters = List.empty + } /// An interface wrapper for `Logger`. Useful when using depedency injection frameworks. type ILog = @@ -58,7 +60,10 @@ module Types = stack.Pop().Dispose() member __.Push(item: IDisposable) = stack.Push item - member __.Push(items: IDisposable list) = items |> List.iter stack.Push + + member __.Push(items: IDisposable list) = + items + |> List.iter stack.Push static member Create(items: IDisposable list) = let ds = new DisposableStack() @@ -110,7 +115,9 @@ module Types = /// /// **Output Type** /// * `unit` - member logger.fatal(logConfig: Log -> Log) = logger.fatal' logConfig |> ignore + member logger.fatal(logConfig: Log -> Log) = + logger.fatal' logConfig + |> ignore /// **Description** /// @@ -135,7 +142,9 @@ module Types = /// /// **Output Type** /// * `unit` - member logger.error(logConfig: Log -> Log) = logger.error' logConfig |> ignore + member logger.error(logConfig: Log -> Log) = + logger.error' logConfig + |> ignore /// **Description** /// @@ -160,7 +169,9 @@ module Types = /// /// **Output Type** /// * `unit` - member logger.warn(logConfig: Log -> Log) = logger.warn' logConfig |> ignore + member logger.warn(logConfig: Log -> Log) = + logger.warn' logConfig + |> ignore /// **Description** /// @@ -185,7 +196,9 @@ module Types = /// /// **Output Type** /// * `unit` - member logger.info(logConfig: Log -> Log) = logger.info' logConfig |> ignore + member logger.info(logConfig: Log -> Log) = + logger.info' logConfig + |> ignore /// **Description** /// @@ -210,7 +223,9 @@ module Types = /// /// **Output Type** /// * `unit` - member logger.debug(logConfig: Log -> Log) = logger.debug' logConfig |> ignore + member logger.debug(logConfig: Log -> Log) = + logger.debug' logConfig + |> ignore /// **Description** /// @@ -235,7 +250,9 @@ module Types = /// /// **Output Type** /// * `unit` - member logger.trace(logConfig: Log -> Log) = logger.trace' logConfig |> ignore + member logger.trace(logConfig: Log -> Log) = + logger.trace' logConfig + |> ignore /// An interface for retrieving a concrete logger such as Serilog, Nlog, etc. @@ -302,9 +319,16 @@ module Types = /// **Exceptions** /// let addParameters (``params``: obj list) (log: Log) = - let ``params`` = ``params`` |> List.map box - { log with Parameters = log.Parameters @ ``params`` } + let ``params`` = + ``params`` + |> List.map box + { + log with + Parameters = + log.Parameters + @ ``params`` + } /// **Description** @@ -323,9 +347,10 @@ module Types = /// /// **Exceptions** /// - let addContext (key: string) (value: obj) (log: Log) = - { log with - AdditionalNamedParameters = List.append log.AdditionalNamedParameters [ key, (box value), false ] } + let addContext (key: string) (value: obj) (log: Log) = { + log with + AdditionalNamedParameters = List.append log.AdditionalNamedParameters [ key, (box value), false ] + } /// **Description** @@ -346,9 +371,10 @@ module Types = /// /// **Exceptions** /// - let addContextDestructured (key: string) (value: obj) (log: Log) = - { log with - AdditionalNamedParameters = List.append log.AdditionalNamedParameters [ key, (box value), true ] } + let addContextDestructured (key: string) (value: obj) (log: Log) = { + log with + AdditionalNamedParameters = List.append log.AdditionalNamedParameters [ key, (box value), true ] + } /// **Description** @@ -402,7 +428,11 @@ module Providers = open System.Linq.Expressions let getLogManagerType () = Type.GetType("Serilog.Log, Serilog") - let isAvailable () = getLogManagerType () |> isNull |> not + + let isAvailable () = + getLogManagerType () + |> isNull + |> not let getPushProperty () = @@ -414,7 +444,14 @@ module Providers = () let pushPropertyMethod = - ndcContextType.GetMethod("PushProperty", [| typedefof; typedefof; typedefof |]) + ndcContextType.GetMethod( + "PushProperty", + [| + typedefof + typedefof + typedefof + |] + ) let nameParam = Expression.Parameter(typedefof, "name") let valueParam = Expression.Parameter(typedefof, "value") @@ -438,11 +475,27 @@ module Providers = let getForContextMethodCall () = let logManagerType = getLogManagerType () - let method = logManagerType.GetMethod("ForContext", [| typedefof; typedefof; typedefof |]) + + let method = + logManagerType.GetMethod( + "ForContext", + [| + typedefof + typedefof + typedefof + |] + ) + let propertyNameParam = Expression.Parameter(typedefof, "propertyName") let valueParam = Expression.Parameter(typedefof, "value") let destructureObjectsParam = Expression.Parameter(typedefof, "destructureObjects") - let exrs: Expression[] = [| propertyNameParam; valueParam; destructureObjectsParam |] + + let exrs: Expression[] = [| + propertyNameParam + valueParam + destructureObjectsParam + |] + let methodCall = Expression.Call(null, method, exrs) let func = @@ -452,16 +505,20 @@ module Providers = fun name -> func.Invoke("SourceContext", name, false) - type SerilogGateway = - { Write: obj -> obj -> string -> obj[] -> unit - WriteException: obj -> obj -> exn -> string -> obj[] -> unit - IsEnabled: obj -> obj -> bool - TranslateLevel: LogLevel -> obj } + type SerilogGateway = { + Write: obj -> obj -> string -> obj[] -> unit + WriteException: obj -> obj -> exn -> string -> obj[] -> unit + IsEnabled: obj -> obj -> bool + TranslateLevel: LogLevel -> obj + } with static member Create() = let logEventLevelType = Type.GetType("Serilog.Events.LogEventLevel, Serilog") - if (logEventLevelType |> isNull) then + if + (logEventLevelType + |> isNull) + then failwith ("Type Serilog.Events.LogEventLevel was not found.") let debugLevel = Enum.Parse(logEventLevelType, "Debug", false) @@ -483,7 +540,10 @@ module Providers = let loggerType = Type.GetType("Serilog.ILogger, Serilog") - if (loggerType |> isNull) then + if + (loggerType + |> isNull) + then failwith ("Type Serilog.ILogger was not found.") let isEnabledMethodInfo = loggerType.GetMethod("IsEnabled", [| logEventLevelType |]) @@ -497,7 +557,14 @@ module Providers = Expression.Lambda>(isEnabledMethodCall, instanceParam, levelParam).Compile() let writeMethodInfo = - loggerType.GetMethod("Write", [| logEventLevelType; typedefof; typedefof |]) + loggerType.GetMethod( + "Write", + [| + logEventLevelType + typedefof + typedefof + |] + ) let messageParam = Expression.Parameter(typedefof) let propertyValuesParam = Expression.Parameter(typedefof) @@ -517,7 +584,15 @@ module Providers = let write = expression.Compile() let writeExceptionMethodInfo = - loggerType.GetMethod("Write", [| logEventLevelType; typedefof; typedefof; typedefof |]) + loggerType.GetMethod( + "Write", + [| + logEventLevelType + typedefof + typedefof + typedefof + |] + ) let exceptionParam = Expression.Parameter(typedefof) @@ -543,13 +618,15 @@ module Providers = ) .Compile() - { Write = + { + Write = (fun logger level message formattedParmeters -> write.Invoke(logger, level, message, formattedParmeters)) WriteException = fun logger level ex message formattedParmeters -> writeException.Invoke(logger, level, ex, message, formattedParmeters) IsEnabled = fun logger level -> isEnabled.Invoke(logger, level) - TranslateLevel = translateLevel } + TranslateLevel = translateLevel + } type private SerigLogProvider() = let getLoggerByName = getForContextMethodCall () @@ -562,7 +639,11 @@ module Providers = match messageFunc with | None -> serilogGateway.IsEnabled logger translatedValue - | Some _ when serilogGateway.IsEnabled logger translatedValue |> not -> false + | Some _ when + serilogGateway.IsEnabled logger translatedValue + |> not + -> + false | Some m -> match ``exception`` with | Some ex -> serilogGateway.WriteException logger translatedValue ex (m ()) formatParams @@ -571,7 +652,9 @@ module Providers = true interface ILogProvider with - member this.GetLogger(name: string) : Logger = getLoggerByName name |> writeMessage + member this.GetLogger(name: string) : Logger = + getLoggerByName name + |> writeMessage member this.OpenMappedContext (key: string) (value: obj) (destructure: bool) : IDisposable = pushProperty key value destructure @@ -602,7 +685,8 @@ module LogProvider = let private noopDisposable = { new IDisposable with - member __.Dispose() = () } + member __.Dispose() = () + } /// **Description** /// @@ -687,7 +771,8 @@ module LogProvider = { new ILog with member x.Log = logFunc - member x.MappedContext = openMappedContextDestucturable } + member x.MappedContext = openMappedContextDestucturable + } /// **Description** /// @@ -698,7 +783,10 @@ module LogProvider = /// /// **Output Type** /// * `ILog` - let getLoggerByType (``type``: Type) = ``type`` |> string |> getLoggerByName + let getLoggerByType (``type``: Type) = + ``type`` + |> string + |> getLoggerByName /// **Description** /// @@ -735,8 +823,9 @@ module LogProvider = /// /// **Exceptions** /// - let getLoggerByQuotation (quotation: Quotations.Expr) = getModuleType quotation |> getLoggerByType - + let getLoggerByQuotation (quotation: Quotations.Expr) = + getModuleType quotation + |> getLoggerByType /// **Description** diff --git a/src/Ionide.LanguageServerProtocol.fsproj b/src/Ionide.LanguageServerProtocol.fsproj index d615540..61da048 100644 --- a/src/Ionide.LanguageServerProtocol.fsproj +++ b/src/Ionide.LanguageServerProtocol.fsproj @@ -20,10 +20,11 @@ repo. --> - - + + + @@ -41,20 +42,39 @@ - <_MetaModelInputs Include="$(MSBuildThisFileDirectory)../data/$(LSPVersion)/metaModel.json" /> + <_MetaModelInputs + Include="$(MSBuildThisFileDirectory)../data/$(LSPVersion)/metaModel.json" /> + <_GenerationInputs + Include="$(MSBuildThisFileDirectory)../tools/**/*.fs;$(MSBuildThisFileDirectory)../tools/**/*.fsproj" /> + + <_MetaModelOutputs Include="$(MSBuildThisFileDirectory)Types.cg.fs" /> + <_MetaModelClientServerOutputs Include="$(MSBuildThisFileDirectory)ClientServer.cg.fs" /> + + - <_GeneratorProject Include="../tools/MetaModelGenerator/MetaModelGenerator.fsproj" /> + + + + + @@ -70,5 +90,18 @@ + + + <_GenerateCommand2 Include="dotnet;@(_GeneratorApp)" /> + <_GenerateCommand2 Include="clientserver" /> + <_GenerateCommand2 Include="--metamodelpath" /> + <_GenerateCommand2 Include="%(_MetaModelInputs.FullPath)" /> + <_GenerateCommand2 Include="--outputfilepath" /> + <_GenerateCommand2 Include="%(_MetaModelClientServerOutputs.FullPath)" /> + + + + \ No newline at end of file diff --git a/src/JsonRpc.fs b/src/JsonRpc.fs index aa6a467..7e73b88 100644 --- a/src/JsonRpc.fs +++ b/src/JsonRpc.fs @@ -3,11 +3,12 @@ module Ionide.LanguageServerProtocol.JsonRpc open Newtonsoft.Json open Newtonsoft.Json.Linq -type MessageTypeTest = - { [] - Version: string - Id: int option - Method: string option } +type MessageTypeTest = { + [] + Version: string + Id: int option + Method: string option +} [] type MessageType = @@ -23,115 +24,175 @@ let getMessageType messageTest = | { Version = "2.0"; Id = None; Method = Some _ } -> MessageType.Notification | _ -> MessageType.Error -type Request = - { [] - Version: string - Id: int - Method: string - Params: JToken option } - - static member Create(id: int, method': string, rpcParams: JToken option) = - { Version = "2.0"; Id = id; Method = method'; Params = rpcParams } - -type Notification = - { [] - Version: string - Method: string - Params: JToken option } - - static member Create(method': string, rpcParams: JToken option) = - { Version = "2.0"; Method = method'; Params = rpcParams } +type Request = { + [] + Version: string + Id: int + Method: string + Params: JToken option +} with + + static member Create(id: int, method': string, rpcParams: JToken option) = { + Version = "2.0" + Id = id + Method = method' + Params = rpcParams + } + +type Notification = { + [] + Version: string + Method: string + Params: JToken option +} with + + static member Create(method': string, rpcParams: JToken option) = { + Version = "2.0" + Method = method' + Params = rpcParams + } module ErrorCodes = - open System - let parseError = -32700 - let invalidRequest = -32600 - let methodNotFound = -32601 - let invalidParams = -32602 - let internalError = -32603 - - ///This is the start range of JSON-RPC reserved error codes. ///It doesn't denote a real error code. No LSP error codes should ///be defined between the start and end range. For backwards ///compatibility the and the ///are left in the range. let jsonrpcReservedErrorRangeStart = -32099 - - [] - let serverErrorStart = jsonrpcReservedErrorRangeStart - - /// Error code indicating that a server received a notification or - /// request before the server has received the `initialize` request. - let serverNotInitialized = -32002 - ///This is the end range of JSON-RPC reserved error codes. It doesn't denote a real error code. let jsonrpcReservedErrorRangeEnd = -32000 - [] - let serverErrorEnd = jsonrpcReservedErrorRangeEnd - - /// This is the start range of LSP reserved error codes. It doesn't denote a real error code. let lspReservedErrorRangeStart = -32899 - - /// 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 - let 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 - let 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. - let contentModified = -32801 - - /// The client has canceled a request and a server has detected the cancel. - let requestCancelled = -32800 /// This is the end range of LSP reserved error codes. It doesn't denote a real error code. let lspReservedErrorRangeEnd = -32899 -type Error = - { Code: int - Message: string - Data: JToken option } +open Ionide.LanguageServerProtocol.Types + +type Error = { + Code: int + Message: string + Data: JToken option +} with static member Create(code: int, message: string) = { Code = code; Message = message; Data = None } - static member ParseError = Error.Create(ErrorCodes.parseError, "Parse error") - static member InvalidRequest = Error.Create(ErrorCodes.invalidRequest, "Invalid Request") - static member MethodNotFound = Error.Create(ErrorCodes.methodNotFound, "Method not found") - static member InvalidParams = Error.Create(ErrorCodes.invalidParams, "Invalid params") - static member InternalError = Error.Create(ErrorCodes.internalError, "Internal error") - static member InternalErrorMessage message = Error.Create(ErrorCodes.internalError, message) - static member RequestCancelled = Error.Create(ErrorCodes.requestCancelled, "Request cancelled") - static member RequestCancelledMessage message = Error.Create(ErrorCodes.requestCancelled, message) - -type Response = - { [] - Version: string - Id: int option - Error: Error option - [] - Result: JToken option } + + static member ParseError(?message) = + let message = defaultArg message "Parse error" + Error.Create(int ErrorCodes.ParseError, message) + + static member InvalidRequest(?message) = + let message = defaultArg message "Invalid Request" + Error.Create(int ErrorCodes.InvalidRequest, message) + + static member MethodNotFound(?message) = + let message = defaultArg message "Method not found" + Error.Create(int ErrorCodes.MethodNotFound, message) + + static member InvalidParams(?message) = + let message = defaultArg message "Invalid params" + Error.Create(int ErrorCodes.InvalidParams, message) + + static member InternalError(?message: string) = + let message = defaultArg message "Internal error" + Error.Create(int ErrorCodes.InternalError, message) + + static member RequestCancelled(?message) = + let message = defaultArg message "Request cancelled" + Error.Create(int LSPErrorCodes.RequestCancelled, message) + +type Response = { + [] + Version: string + Id: int option + Error: Error option + [] + Result: JToken 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) = - { Version = "2.0"; Id = Some id; Result = result; Error = None } + static member Success(id: int, result: JToken option) = { + Version = "2.0" + Id = Some id + Result = result + Error = None + } + + static member Failure(id: int, error: Error) = { Version = "2.0"; Id = Some id; Result = None; Error = Some error } + + +/// Result type composed of a success value or an error of type JsonRpc.Error +type LspResult<'t> = Result<'t, Error> +/// Async Result type composed of a success value or an error of type JsonRpc.Error +type AsyncLspResult<'t> = Async> + + +module LspResult = + + let success x : LspResult<_> = Result.Ok x + + let invalidParams message : LspResult<_> = Result.Error(Error.InvalidParams message) + + let internalError<'a> (message: string) : LspResult<'a> = + Result.Error(Error.Create(int ErrorCodes.InvalidParams, message)) + + let notImplemented<'a> : LspResult<'a> = Result.Error(Error.MethodNotFound()) - static member Failure(id: int, error: Error) = { Version = "2.0"; Id = Some id; Result = None; Error = Some error } \ No newline at end of file + let requestCancelled<'a> : LspResult<'a> = Result.Error(Error.RequestCancelled()) + +module AsyncLspResult = + + let success x : AsyncLspResult<_> = async.Return(Result.Ok x) + + let invalidParams message : AsyncLspResult<_> = async.Return(LspResult.invalidParams message) + + let internalError message : AsyncLspResult<_> = async.Return(LspResult.internalError message) + + let notImplemented<'a> : AsyncLspResult<'a> = async.Return LspResult.notImplemented + + let requestCancelled<'a> : AsyncLspResult<'a> = async.Return LspResult.requestCancelled + + +module Requests = + open StreamJsonRpc + open System + open System.Threading + open System.Threading.Tasks + + let requestHandling<'param, 'result> (run: 'param -> AsyncLspResult<'result>) : Delegate = + let runAsTask param ct = + // 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 + + return + match lspResult with + | Ok result -> result + | Error error -> + let rpcException = LocalRpcException(error.Message) + rpcException.ErrorCode <- error.Code + + rpcException.ErrorData <- + error.Data + |> Option.defaultValue null + + raise rpcException + } + + Async.StartAsTask(asyncContinuation, cancellationToken = ct) + + Func<'param, CancellationToken, Task<'result>>(runAsTask) :> Delegate + + /// Notifications don't generate a response or error, but to unify things we consider them as always successful. + /// They will still not send any response because their ID is null. + let internal notificationSuccess (response: Async) = + async { + do! response + return Result.Ok() + } \ No newline at end of file diff --git a/src/JsonUtils.fs b/src/JsonUtils.fs index 315c62f..8e1d182 100644 --- a/src/JsonUtils.fs +++ b/src/JsonUtils.fs @@ -63,8 +63,6 @@ type OptionAndCamelCasePropertyNamesContractResolver() as this = 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 @@ -74,7 +72,9 @@ type StrictNumberConverter() = static let defaultSerializer = JsonSerializer() - override _.CanConvert(t) = t |> Type.isNumeric + override _.CanConvert(t) = + t + |> Type.isNumeric override __.ReadJson(reader, t, _, serializer) = match reader.TokenType with @@ -93,7 +93,9 @@ type StrictNumberConverter() = type StrictStringConverter() = inherit JsonConverter() - override _.CanConvert(t) = t |> Type.isString + override _.CanConvert(t) = + t + |> Type.isString override __.ReadJson(reader, t, _, serializer) = match reader.TokenType with @@ -110,7 +112,9 @@ type StrictStringConverter() = type StrictBoolConverter() = inherit JsonConverter() - override _.CanConvert(t) = t |> Type.isBool + override _.CanConvert(t) = + t + |> Type.isBool override __.ReadJson(reader, t, _, serializer) = match reader.TokenType with @@ -132,7 +136,8 @@ type ErasedUnionConverter() = t.GetCustomAttributes(typedefof, false).Length > 0 || // Case - t.BaseType.GetCustomAttributes(typedefof, false).Length > 0)) + t.BaseType.GetCustomAttributes(typedefof, false).Length > 0) + ) override __.CanConvert(t) = canConvert t @@ -150,47 +155,73 @@ type ErasedUnionConverter() = let tryReadPrimitive (json: JToken) (targetType: Type) = if Type.isString targetType then if json.Type = JTokenType.String then - reader.Value |> Some + reader.Value + |> Some else None elif Type.isBool targetType then if json.Type = JTokenType.Boolean then - reader.Value |> Some + reader.Value + |> Some else None elif Type.isNumeric targetType then match json.Type with | JTokenType.Integer - | JTokenType.Float -> json.ToObject(targetType, serializer) |> Some + | 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 + 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 - with _ -> None + | _ -> None + with _ -> + None + let tryReadAllMatchingFields (json: JToken) (targetType: Type) = - try - let fields = json.Children() |> Seq.map (fun f -> f.Name.ToLowerInvariant()) - let props = targetType.GetProperties() |> Seq.map(fun p -> p.Name.ToLowerInvariant()) - if fields |> Seq.forall (fun f -> props |> Seq.contains f) then - json.ToObject(targetType, serializer) |> Some - else - None - with _ -> + try + let fields = + json.Children() + |> Seq.map (fun f -> f.Name.ToLowerInvariant()) + + let props = + targetType.GetProperties() + |> Seq.map (fun p -> p.Name.ToLowerInvariant()) + + if + fields + |> Seq.forall (fun f -> + props + |> Seq.contains f + ) + then + json.ToObject(targetType, serializer) + |> Some + else None + with _ -> + None let union = UnionInfo.get t let json = JToken.ReadFrom reader @@ -202,18 +233,23 @@ type ErasedUnionConverter() = match tryReadValue json ty with | None -> None - | Some value -> case.Create [| value |] |> Some + | 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) + let c = + union.Cases + |> Array.tryPick (tryMakeUnionCase tryReadPrimitive json) |> Option.orElseWith (fun () -> - union.Cases |> Array.tryPick (tryMakeUnionCase tryReadUnionKind json) + union.Cases + |> Array.tryPick (tryMakeUnionCase tryReadUnionKind json) ) |> Option.orElseWith (fun () -> - union.Cases |> Array.tryPick (tryMakeUnionCase tryReadAllMatchingFields json) + union.Cases + |> Array.tryPick (tryMakeUnionCase tryReadAllMatchingFields json) ) match c with @@ -231,7 +267,8 @@ type SingleCaseUnionConverter() = memoriseByHash (fun t -> FSharpType.IsUnion t && allCases t - |> Array.forall (fun c -> c.GetFields().Length = 0)) + |> Array.forall (fun c -> c.GetFields().Length = 0) + ) override _.CanConvert t = canConvert t @@ -249,4 +286,4 @@ type SingleCaseUnionConverter() = 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}'" + | None -> failwith $"Could not create an instance of the type '%s{t.Name}' with the name '%s{caseName}'" \ No newline at end of file diff --git a/src/LanguageServerProtocol.fs b/src/LanguageServerProtocol.fs index 505a8fe..fdfb11e 100644 --- a/src/LanguageServerProtocol.fs +++ b/src/LanguageServerProtocol.fs @@ -15,6 +15,7 @@ module Server = open StreamJsonRpc open StreamJsonRpc.Protocol open JsonRpc + open Mappings let logger = LogProvider.getLoggerByName "LSP Server" @@ -237,9 +238,6 @@ module Server = use jsonRpcHandler = new WebSocketMessageHandler(socket, defaultJsonRpcFormatter ()) startWithSetupCore setupRequestHandlings jsonRpcHandler clientCreator customizeRpc - type ServerRequestHandling<'server when 'server :> Ionide.LanguageServerProtocol.ILspServer> = { - Run: 'server -> Delegate - } let serverRequestHandling<'server, 'param, 'result when 'server :> Ionide.LanguageServerProtocol.ILspServer> (run: 'server -> 'param -> AsyncLspResult<'result>) @@ -247,135 +245,7 @@ module Server = { Run = fun s -> requestHandling (run s) } let defaultRequestHandlings () : Map> = - let requestHandling = serverRequestHandling - - [ - "initialize", requestHandling (fun s p -> s.Initialize(p)) - "initialized", - requestHandling (fun s () -> - s.Initialized() - |> notificationSuccess - ) - "textDocument/hover", requestHandling (fun s p -> s.TextDocumentHover(p)) - "textDocument/didOpen", - requestHandling (fun s p -> - s.TextDocumentDidOpen(p) - |> notificationSuccess - ) - "textDocument/didChange", - requestHandling (fun s p -> - s.TextDocumentDidChange(p) - |> notificationSuccess - ) - "textDocument/completion", requestHandling (fun s p -> s.TextDocumentCompletion(p)) - "completionItem/resolve", requestHandling (fun s p -> s.CompletionItemResolve(p)) - "textDocument/rename", requestHandling (fun s p -> s.TextDocumentRename(p)) - "textDocument/prepareRename", requestHandling (fun s p -> s.TextDocumentPrepareRename(p)) - "textDocument/declaration", requestHandling (fun s p -> s.TextDocumentDeclaration(p)) - "textDocument/definition", requestHandling (fun s p -> s.TextDocumentDefinition(p)) - "textDocument/typeDefinition", requestHandling (fun s p -> s.TextDocumentTypeDefinition(p)) - "textDocument/implementation", requestHandling (fun s p -> s.TextDocumentImplementation(p)) - "textDocument/codeAction", requestHandling (fun s p -> s.TextDocumentCodeAction(p)) - "codeAction/resolve", requestHandling (fun s p -> s.CodeActionResolve(p)) - "textDocument/codeLens", requestHandling (fun s p -> s.TextDocumentCodeLens(p)) - "codeLens/resolve", requestHandling (fun s p -> s.CodeLensResolve(p)) - "textDocument/references", requestHandling (fun s p -> s.TextDocumentReferences(p)) - "textDocument/documentHighlight", requestHandling (fun s p -> s.TextDocumentDocumentHighlight(p)) - "textDocument/documentLink", requestHandling (fun s p -> s.TextDocumentDocumentLink(p)) - "textDocument/signatureHelp", requestHandling (fun s p -> s.TextDocumentSignatureHelp(p)) - "documentLink/resolve", requestHandling (fun s p -> s.DocumentLinkResolve(p)) - "textDocument/documentColor", requestHandling (fun s p -> s.TextDocumentDocumentColor(p)) - "textDocument/colorPresentation", requestHandling (fun s p -> s.TextDocumentColorPresentation(p)) - "textDocument/formatting", requestHandling (fun s p -> s.TextDocumentFormatting(p)) - "textDocument/rangeFormatting", requestHandling (fun s p -> s.TextDocumentRangeFormatting(p)) - "textDocument/onTypeFormatting", requestHandling (fun s p -> s.TextDocumentOnTypeFormatting(p)) - "textDocument/willSave", - requestHandling (fun s p -> - s.TextDocumentWillSave(p) - |> notificationSuccess - ) - "textDocument/willSaveWaitUntil", requestHandling (fun s p -> s.TextDocumentWillSaveWaitUntil(p)) - "textDocument/didSave", - requestHandling (fun s p -> - s.TextDocumentDidSave(p) - |> notificationSuccess - ) - "textDocument/didClose", - requestHandling (fun s p -> - s.TextDocumentDidClose(p) - |> notificationSuccess - ) - "textDocument/documentSymbol", requestHandling (fun s p -> s.TextDocumentDocumentSymbol(p)) - "textDocument/moniker", requestHandling (fun s p -> s.TextDocumentMoniker(p)) - "textDocument/linkedEditingRange", requestHandling (fun s p -> s.TextDocumentLinkedEditingRange(p)) - "textDocument/foldingRange", requestHandling (fun s p -> s.TextDocumentFoldingRange(p)) - "textDocument/selectionRange", requestHandling (fun s p -> s.TextDocumentSelectionRange(p)) - "textDocument/prepareCallHierarchy", requestHandling (fun s p -> s.TextDocumentPrepareCallHierarchy(p)) - "callHierarchy/incomingCalls", requestHandling (fun s p -> s.CallHierarchyIncomingCalls(p)) - "callHierarchy/outgoingCalls", requestHandling (fun s p -> s.CallHierarchyOutgoingCalls(p)) - "textDocument/prepareTypeHierarchy", requestHandling (fun s p -> s.TextDocumentPrepareTypeHierarchy(p)) - "typeHierarchy/supertypes", requestHandling (fun s p -> s.TypeHierarchySupertypes(p)) - "typeHierarchy/subtypes", requestHandling (fun s p -> s.TypeHierarchySubtypes(p)) - "textDocument/semanticTokens/full", requestHandling (fun s p -> s.TextDocumentSemanticTokensFull(p)) - "textDocument/semanticTokens/full/delta", requestHandling (fun s p -> s.TextDocumentSemanticTokensFullDelta(p)) - "textDocument/semanticTokens/range", requestHandling (fun s p -> s.TextDocumentSemanticTokensRange(p)) - "textDocument/inlayHint", requestHandling (fun s p -> s.TextDocumentInlayHint(p)) - "inlayHint/resolve", requestHandling (fun s p -> s.InlayHintResolve(p)) - "textDocument/inlineValue", requestHandling (fun s p -> s.TextDocumentInlineValue(p)) - "textDocument/diagnostic", requestHandling (fun s p -> s.TextDocumentDiagnostic(p)) - "workspace/didChangeWatchedFiles", - requestHandling (fun s p -> - s.WorkspaceDidChangeWatchedFiles(p) - |> notificationSuccess - ) - "workspace/didChangeWorkspaceFolders", - requestHandling (fun s p -> - s.WorkspaceDidChangeWorkspaceFolders(p) - |> notificationSuccess - ) - "workspace/didChangeConfiguration", - requestHandling (fun s p -> - s.WorkspaceDidChangeConfiguration(p) - |> notificationSuccess - ) - "workspace/willCreateFiles", requestHandling (fun s p -> s.WorkspaceWillCreateFiles(p)) - "workspace/didCreateFiles", - requestHandling (fun s p -> - s.WorkspaceDidCreateFiles(p) - |> notificationSuccess - ) - "workspace/willRenameFiles", requestHandling (fun s p -> s.WorkspaceWillRenameFiles(p)) - "workspace/didRenameFiles", - requestHandling (fun s p -> - s.WorkspaceDidRenameFiles(p) - |> notificationSuccess - ) - "workspace/willDeleteFiles", requestHandling (fun s p -> s.WorkspaceWillDeleteFiles(p)) - "workspace/didDeleteFiles", - requestHandling (fun s p -> - s.WorkspaceDidDeleteFiles(p) - |> notificationSuccess - ) - "workspace/symbol", requestHandling (fun s p -> s.WorkspaceSymbol(p)) - "workspaceSymbol/resolve", requestHandling (fun s p -> s.WorkspaceSymbolResolve(p)) - "workspace/executeCommand", requestHandling (fun s p -> s.WorkspaceExecuteCommand(p)) - "window/workDoneProgress/cancel", - requestHandling (fun s p -> - s.WorkDoneProgressCancel(p) - |> notificationSuccess - ) - "workspace/diagnostic", requestHandling (fun s p -> s.WorkspaceDiagnostic(p)) - "shutdown", - requestHandling (fun s () -> - s.Shutdown() - |> notificationSuccess - ) - "exit", - requestHandling (fun s () -> - s.Exit() - |> notificationSuccess - ) - ] + routeMappings () |> Map.ofList let private requestHandlingSetupFunc<'client, 'server @@ -629,13 +499,15 @@ module Client = | Some handling -> try match notification.Params with - | None -> return Result.Error(JsonRpc.Error.InvalidParams) + | None -> return Result.Error(JsonRpc.Error.InvalidParams()) | Some prms -> let! result = handling.Run prms return Result.Ok() with ex -> - return Result.Error(JsonRpc.Error.Create(JsonRpc.ErrorCodes.internalError, ex.ToString())) - | None -> return Result.Error(JsonRpc.Error.MethodNotFound) + return + JsonRpc.Error.InternalError(ex.ToString()) + |> Result.Error + | None -> return Result.Error(JsonRpc.Error.MethodNotFound()) } let messageHandler str = diff --git a/src/OptionConverter.fs b/src/OptionConverter.fs index 796b30c..5d9431a 100644 --- a/src/OptionConverter.fs +++ b/src/OptionConverter.fs @@ -1,4 +1,5 @@ namespace Ionide.LanguageServerProtocol.JsonUtils + open Newtonsoft.Json open Microsoft.FSharp.Reflection open System @@ -6,9 +7,9 @@ open System.Collections.Concurrent open System.Reflection - module internal Converters = open System.Collections.Concurrent + let inline memorise (f: 'a -> 'b) : 'a -> 'b = let d = ConcurrentDictionary<'a, 'b>() fun key -> d.GetOrAdd(key, f) @@ -23,52 +24,66 @@ module internal Converters = | (true, value) -> value | _ -> let value = f key - d.TryAdd(hash, value) |> ignore + + d.TryAdd(hash, value) + |> ignore + value + open Converters -type private CaseInfo = - { Info: UnionCaseInfo - Fields: PropertyInfo[] - GetFieldValues: obj -> obj[] - Create: obj[] -> obj } +type private CaseInfo = { + Info: UnionCaseInfo + Fields: PropertyInfo[] + GetFieldValues: obj -> obj[] + Create: obj[] -> obj +} -type private UnionInfo = - { Cases: CaseInfo[] - GetTag: obj -> int } +type private UnionInfo = { + Cases: CaseInfo[] + GetTag: obj -> int +} with member u.GetCaseOf(value: obj) = let tag = u.GetTag value - u.Cases |> Array.find (fun case -> case.Info.Tag = tag) + + u.Cases + |> Array.find (fun case -> case.Info.Tag = tag) module private UnionInfo = - + let private create (ty: Type) = - assert (ty |> FSharpType.IsUnion) + assert + (ty + |> FSharpType.IsUnion) let cases = FSharpType.GetUnionCases ty - |> Array.map (fun case -> - { Info = case - Fields = case.GetFields() - GetFieldValues = FSharpValue.PreComputeUnionReader case - Create = FSharpValue.PreComputeUnionConstructor case }) + |> Array.map (fun case -> { + Info = case + Fields = case.GetFields() + GetFieldValues = FSharpValue.PreComputeUnionReader case + Create = FSharpValue.PreComputeUnionConstructor case + }) { Cases = cases; GetTag = FSharpValue.PreComputeUnionTagReader ty } let get: Type -> _ = memoriseByHash (create) module Type = - let numerics = - [| typeof - typeof - typeof - typeof - //ENHANCEMENT: other number types - |] - - let numericHashes = numerics |> Array.map (fun t -> t.GetHashCode()) + let numerics = [| + typeof + typeof + typeof + typeof + //ENHANCEMENT: other number types + |] + + let numericHashes = + numerics + |> Array.map (fun t -> t.GetHashCode()) + let stringHash = typeof.GetHashCode() let boolHash = typeof.GetHashCode() @@ -81,7 +96,9 @@ module Type = let inline isNumeric (t: Type) = let hash = t.GetHashCode() - numericHashes |> Array.contains hash + + numericHashes + |> Array.contains hash [] type OptionConverter() = @@ -94,7 +111,8 @@ type OptionConverter() = if innerType.IsValueType then typedefof>.MakeGenericType([| innerType |]) else - innerType) + innerType + ) let canConvert = memoriseByHash (Type.isOption) @@ -107,7 +125,9 @@ type OptionConverter() = else let union = UnionInfo.get (value.GetType()) let case = union.GetCaseOf value - case.GetFieldValues value |> Array.head + + case.GetFieldValues value + |> Array.head serializer.Serialize(writer, value) diff --git a/src/Server.fs b/src/Server.fs index 3ba64aa..f7335ef 100644 --- a/src/Server.fs +++ b/src/Server.fs @@ -1,6 +1,7 @@ namespace Ionide.LanguageServerProtocol open Ionide.LanguageServerProtocol.Types +open Ionide.LanguageServerProtocol.JsonRpc module private ServerUtil = /// Return the JSON-RPC "not implemented" error @@ -11,381 +12,6 @@ module private ServerUtil = open ServerUtil -[] -type ILspServer = - inherit System.IDisposable - - /// The initialize request is sent as the first request from the client to the server. - /// The initialize request may only be sent once. - abstract member Initialize: InitializeParams -> AsyncLspResult - - /// The initialized notification is sent from the client to the server after the client received the result - /// of the initialize request but before the client is sending any other request or notification to the server. - /// The server can use the initialized notification for example to dynamically register capabilities. - /// The initialized notification may only be sent once. - abstract member Initialized: InitializedParams -> Async - - /// The shutdown request is sent from the client to the server. It asks the server to shut down, but to not - /// exit (otherwise the response might not be delivered correctly to the client). There is a separate exit - /// notification that asks the server to exit. - abstract member Shutdown: unit -> Async - - - /// A notification to ask the server to exit its process. - abstract member Exit: unit -> Async - - /// The hover request is sent from the client to the server to request hover information at a given text - /// document position. - abstract member TextDocumentHover: TextDocumentPositionParams -> AsyncLspResult - - - /// 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 for a particular textDocument is one. - abstract member TextDocumentDidOpen: DidOpenTextDocumentParams -> Async - - - /// The document change notification is sent from the client to the server to signal changes to a text document. - abstract member TextDocumentDidChange: DidChangeTextDocumentParams -> Async - - /// The Completion request is sent from the client to the server to compute completion items at a given - /// cursor position. Completion items are presented in the IntelliSense user interface. - /// - /// If computing full completion items is expensive, servers can additionally provide a handler for the - /// completion item resolve request (‘completionItem/resolve’). This request is sent when a completion - /// item is selected in the user interface. A typical use case is for example: the ‘textDocument/completion’ - /// request doesn’t fill in the documentation property for returned completion items since it is expensive - /// to compute. When the item is selected in the user interface then a ‘completionItem/resolve’ request is - /// sent with the selected completion item as a param. The returned completion item should have the - /// documentation property filled in. The request can delay the computation of the detail and documentation - /// properties. However, properties that are needed for the initial sorting and filtering, like sortText, - /// filterText, insertText, and textEdit must be provided in the textDocument/completion request and must - /// not be changed during resolve. - abstract member TextDocumentCompletion: CompletionParams -> AsyncLspResult - - - /// The request is sent from the client to the server to resolve additional information for a given - /// completion item. - abstract member CompletionItemResolve: CompletionItem -> AsyncLspResult - - - /// The rename request is sent from the client to the server to perform a workspace-wide rename of a symbol. - abstract member TextDocumentRename: RenameParams -> AsyncLspResult - - /// The prepare rename request is sent from the client to the server to setup and test the validity of a rename operation at a given location. - /// If None is returned then it is deemed that a ‘textDocument/rename’ request is not valid at the given position. - abstract member TextDocumentPrepareRename: PrepareRenameParams -> AsyncLspResult - - - /// The go to declaration request is sent from the client to the server to resolve the declaration location - /// of a symbol at a given text document position - abstract member TextDocumentDeclaration: TextDocumentPositionParams -> AsyncLspResult - - /// The goto definition request is sent from the client to the server to resolve the definition location of - /// a symbol at a given text document position. - abstract member TextDocumentDefinition: TextDocumentPositionParams -> AsyncLspResult - - - /// The references request is sent from the client to the server to resolve project-wide references for - /// the symbol denoted by the given text document position. - abstract member TextDocumentReferences: ReferenceParams -> AsyncLspResult - - - /// The document highlight request is sent from the client to the server to resolve a document highlights - /// for a given text document position. For programming languages this usually highlights all references - /// to the symbol scoped to this file. - /// - /// However we kept `textDocument/documentHighlight` and `textDocument/references` separate requests since - /// the first one is allowed to be more fuzzy. Symbol matches usually have a DocumentHighlightKind of Read - /// or Write whereas fuzzy or textual matches use Text as the kind. - abstract member TextDocumentDocumentHighlight: - TextDocumentPositionParams -> AsyncLspResult - - - /// The document links request is sent from the client to the server to request the location of links - /// in a document. - abstract member TextDocumentDocumentLink: DocumentLinkParams -> AsyncLspResult - - - /// The goto type definition request is sent from the client to the server to resolve the type definition - /// location of a symbol at a given text document position. - abstract member TextDocumentTypeDefinition: TextDocumentPositionParams -> AsyncLspResult - - - /// The goto implementation request is sent from the client to the server to resolve the implementation - /// location of a symbol at a given text document position. - abstract member TextDocumentImplementation: TextDocumentPositionParams -> AsyncLspResult - - - /// The code action request is sent from the client to the server to compute commands for a given text - /// document and range. These commands are typically code fixes to either fix problems or to - /// beautify/refactor code. The result of a textDocument/codeAction request is an array of Command literals - /// which are typically presented in the user interface. When the command is selected the server should be - /// contacted again (via the workspace/executeCommand) request to execute the command. - abstract member TextDocumentCodeAction: CodeActionParams -> AsyncLspResult - - - /// The code action request is sent from the client to the server to compute commands for a given text - /// document and range. These commands are typically code fixes to either fix problems or to - /// beautify/refactor code. The result of a textDocument/codeAction request is an array of Command literals - /// which are typically presented in the user interface. When the command is selected the server should be - /// contacted again (via the workspace/executeCommand) request to execute the command. - abstract member CodeActionResolve: CodeAction -> AsyncLspResult - - - /// The code lens request is sent from the client to the server to compute code lenses for a given - /// text document. - abstract member TextDocumentCodeLens: CodeLensParams -> AsyncLspResult - - - /// The code lens resolve request is sent from the client to the server to resolve the command for - /// a given code lens item. - abstract member CodeLensResolve: CodeLens -> AsyncLspResult - - - /// The signature help request is sent from the client to the server to request signature information at - /// a given cursor position. - abstract member TextDocumentSignatureHelp: SignatureHelpParams -> AsyncLspResult - - - /// The document link resolve request is sent from the client to the server to resolve the target of - /// a given document link. - abstract member DocumentLinkResolve: DocumentLink -> AsyncLspResult - - - /// The document color request is sent from the client to the server to list all color references - /// found in a given text document. Along with the range, a color value in RGB is returned. - abstract member TextDocumentDocumentColor: DocumentColorParams -> AsyncLspResult - - /// The color presentation request is sent from the client to the server to obtain a list of - /// presentations for a color value at a given location. Clients can use the result to - abstract member TextDocumentColorPresentation: ColorPresentationParams -> AsyncLspResult - - - /// The document formatting request is sent from the client to the server to format a whole document. - abstract member TextDocumentFormatting: DocumentFormattingParams -> AsyncLspResult - - /// The document range formatting request is sent from the client to the server to format a given - /// range in a document. - abstract member TextDocumentRangeFormatting: DocumentRangeFormattingParams -> AsyncLspResult - - - /// The document on type formatting request is sent from the client to the server to format parts - /// of the document during typing. - abstract member TextDocumentOnTypeFormatting: DocumentOnTypeFormattingParams -> AsyncLspResult - - - /// The document symbol request is sent from the client to the server to return a flat list of all symbols - /// found in a given text document. Neither the symbol’s location range nor the symbol’s container name - /// should be used to infer a hierarchy. - abstract member TextDocumentDocumentSymbol: - DocumentSymbolParams -> AsyncLspResult option> - - - /// The textDocument/moniker request is sent from the client to the server to get the symbol monikers for a - /// given text document position. An array of Moniker types is returned as response to indicate possible - /// monikers at the given location. If no monikers can be calculated, an empty array or null should be - /// returned. - abstract member TextDocumentMoniker: TextDocumentPositionParams -> AsyncLspResult - - - /// The linked editing request is sent from the client to the server to return for a given position in a document the - /// range of the symbol at the position and all ranges that have the same content. Optionally a word pattern can be - /// returned to describe valid contents. A rename to one of the ranges can be applied to all other ranges if the new - /// content is valid. If no result-specific word pattern is provided, the word pattern from the client’s language - /// configuration is used. - abstract member TextDocumentLinkedEditingRange: - TextDocumentPositionParams -> AsyncLspResult - - - /// The watched files notification is sent from the client to the server when the client detects changes - /// to files watched by the language client. It is recommended that servers register for these file - /// events using the registration mechanism. In former implementations clients pushed file events without - /// the server actively asking for it. - abstract member WorkspaceDidChangeWatchedFiles: DidChangeWatchedFilesParams -> Async - - - /// The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server to inform - /// the server about workspace folder configuration changes. The notification is sent by default if both - /// *ServerCapabilities/workspace/workspaceFolders* and *ClientCapabilities/workspace/workspaceFolders* are - /// true; or if the server has registered to receive this notification it first. - abstract member WorkspaceDidChangeWorkspaceFolders: DidChangeWorkspaceFoldersParams -> Async - - - /// A notification sent from the client to the server to signal the change of configuration settings. - abstract member WorkspaceDidChangeConfiguration: DidChangeConfigurationParams -> Async - - /// 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 either by a user action or by applying a - /// workspace edit - abstract member WorkspaceWillCreateFiles: CreateFilesParams -> AsyncLspResult - - - /// The did create files notification is sent from the client to the server when files were created - /// from within the client. - abstract member WorkspaceDidCreateFiles: CreateFilesParams -> Async - - - /// 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 either by a user action or by applying a - /// workspace edit. - abstract member WorkspaceWillRenameFiles: RenameFilesParams -> AsyncLspResult - - - /// The did rename files notification is sent from the client to the server when files were renamed from - /// within the client. - abstract member 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 either by a user action or by applying a - /// workspace edit. - abstract member WorkspaceWillDeleteFiles: DeleteFilesParams -> AsyncLspResult - - - /// The did delete files notification is sent from the client to the server when files were deleted from - /// within the client. - abstract member WorkspaceDidDeleteFiles: DeleteFilesParams -> Async - - - /// The workspace symbol request is sent from the client to the server to list project-wide symbols matching - /// the query string. - abstract member WorkspaceSymbol: - WorkspaceSymbolParams -> AsyncLspResult option> - - - /// The request is sent from the client to the server to resolve additional information for a given workspace symbol. - abstract member WorkspaceSymbolResolve: WorkspaceSymbol -> AsyncLspResult - - - /// The `workspace/executeCommand` request is sent from the client to the server to trigger command execution - /// on the server. In most cases the server creates a `WorkspaceEdit` structure and applies the changes to the - /// workspace using the request `workspace/applyEdit` which is sent from the server to the client. - abstract member WorkspaceExecuteCommand: ExecuteCommandParams -> AsyncLspResult - - - /// The document will save notification is sent from the client to the server before the document is - /// actually saved. - abstract member TextDocumentWillSave: WillSaveTextDocumentParams -> Async - - - /// The 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 member TextDocumentWillSaveWaitUntil: WillSaveTextDocumentParams -> AsyncLspResult - - - /// The document save notification is sent from the client to the server when the document was saved - /// in the client. - abstract member TextDocumentDidSave: DidSaveTextDocumentParams -> 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 member TextDocumentDidClose: DidCloseTextDocumentParams -> Async - - - /// The folding range request is sent from the client to the server to return all folding ranges found in a given text document. - abstract member TextDocumentFoldingRange: FoldingRangeParams -> AsyncLspResult - - /// The selection range request is sent from the client to the server to return suggested selection ranges at an array of given positions. - /// A selection range is a range around the cursor position which the user might be interested in selecting. - abstract member TextDocumentSelectionRange: SelectionRangeParams -> AsyncLspResult - - abstract member TextDocumentSemanticTokensFull: SemanticTokensParams -> AsyncLspResult - - abstract member TextDocumentSemanticTokensFullDelta: - SemanticTokensDeltaParams -> AsyncLspResult option> - - abstract member TextDocumentSemanticTokensRange: SemanticTokensRangeParams -> AsyncLspResult - - /// The inlay hints request is sent from the client to the server to compute inlay hints for a given [text document, range] tuple - /// that may be rendered in the editor in place with other text. - abstract member TextDocumentInlayHint: InlayHintParams -> AsyncLspResult - - /// The request is sent from the client to the server to resolve additional information for a given inlay hint. - /// This is usually used to compute the `tooltip`, `location` or `command` properties of a inlay hint’s label part - /// to avoid its unnecessary computation during the `textDocument/inlayHint` request. - /// - /// Consider the clients announces the `label.location` property as a property that can be resolved lazy using the client capability - /// ```typescript - /// textDocument.inlayHint.resolveSupport = { properties: ['label.location'] }; - /// ``` - /// then an inlay hint with a label part without a location needs to be resolved using the `inlayHint/resolve` request before it can be used. - abstract member InlayHintResolve: InlayHint -> AsyncLspResult - - /// The `window/workDoneProgress/cancel` notification is sent from the client to the server to cancel a - /// progress initiated on the server side using the `window/workDoneProgress/create`. The progress need - /// not be marked as cancellable to be cancelled and a client may cancel a progress for any number of - /// reasons: in case of error, reloading a workspace etc. - abstract member WorkDoneProgressCancel: WorkDoneProgressCancelParams -> Async - - /// The inline value request is sent from the client to the server to compute inline values for a given text document - /// that may be rendered in the editor at the end of lines. - abstract member TextDocumentInlineValue: InlineValueParams -> AsyncLspResult - - /// The call hierarchy request is sent from the client to the server to return a call hierarchy for the - /// language element of given text document positions. The call hierarchy requests are executed in two - /// steps: - /// 1. first a call hierarchy item is resolved for the given text document position - /// 2. for a call hierarchy item the incoming or outgoing call hierarchy items are resolved. - abstract member TextDocumentPrepareCallHierarchy: - CallHierarchyPrepareParams -> AsyncLspResult - - /// The request is sent from the client to the server to resolve incoming calls for a given call hierarchy - /// item. The request doesn't define its own client and server capabilities. It is only issued if a server - /// registers for the `textDocument/prepareCallHierarchy` request. - abstract member CallHierarchyIncomingCalls: - CallHierarchyIncomingCallsParams -> AsyncLspResult - - /// The request is sent from the client to the server to resolve outgoing calls for a given call hierarchy - /// item. The request doesn't define its own client and server capabilities. It is only issued if a server - /// registers for the `textDocument/prepareCallHierarchy` request. - abstract member CallHierarchyOutgoingCalls: - CallHierarchyOutgoingCallsParams -> AsyncLspResult - - /// The type hierarchy request is sent from the client to the server to return a type hierarchy for the - /// language element of given text document positions. Will return `null` if the server couldn't infer a - /// valid type from the position. The type hierarchy requests are executed in two steps: - /// 1. first a type hierarchy item is prepared for the given text document position. - /// 2. for a type hierarchy item the supertype or subtype type hierarchy items are resolved. - abstract member TextDocumentPrepareTypeHierarchy: - TypeHierarchyPrepareParams -> AsyncLspResult - - /// The request is sent from the client to the server to resolve the supertype for a given type hierarchy - /// item. Will return `null` is the serve couldn't infer a valid type from `item` in the params. The request - /// doesn't defines its own client and server capabilities. It is only issued if a server registers for the - /// `textDocument/prepareTypeHierarchy` request. - abstract member TypeHierarchySupertypes: TypeHierarchySupertypesParams -> AsyncLspResult - - /// The request is sent from the client to the server to resolve the supertype for a given type hierarchy - /// item. Will return `null` is the serve couldn't infer a valid type from `item` in the params. The request - /// doesn't defines its own client and server capabilities. It is only issued if a server registers for the - /// `textDocument/prepareTypeHierarchy` request. - abstract member TypeHierarchySubtypes: TypeHierarchySubtypesParams -> AsyncLspResult - - /// The text document diagnostic request is sent from the client to the server to ask the server to compute - /// the diagnostics for a given document. As with other pull requests the server is asked to compute the - /// diagnostics for the currently synced version of the document. - abstract member TextDocumentDiagnostic: DocumentDiagnosticParams -> AsyncLspResult - - /// The workspace diagnostic request is sent from the client to the server to ask the server to compute - /// workspace wide diagnostics which previously where pushed from the server to the client. In contrast to - /// the document diagnostic request the workspace request can be long running and is not bound to a specific - /// workspace or document state. If the client supports streaming for the workspace diagnostic pull it is - /// legal to provide a document diagnostic report multiple times for the same document URI. The last one - /// reported will win over previous reports. - abstract member WorkspaceDiagnostic: WorkspaceDiagnosticParams -> AsyncLspResult - [] type LspServer() = abstract member Dispose: unit -> unit @@ -402,14 +28,14 @@ type LspServer() = /// The initialized notification may only be sent once. abstract member Initialized: InitializedParams -> Async - default __.Initialized() = ignoreNotification + default __.Initialized(_) = ignoreNotification /// The shutdown request is sent from the client to the server. It asks the server to shut down, but to not /// exit (otherwise the response might not be delivered correctly to the client). There is a separate exit /// notification that asks the server to exit. - abstract member Shutdown: unit -> Async + abstract member Shutdown: unit -> AsyncLspResult - default __.Shutdown() = ignoreNotification + default __.Shutdown() = notImplemented /// A notification to ask the server to exit its process. abstract member Exit: unit -> Async @@ -417,7 +43,7 @@ type LspServer() = /// The hover request is sent from the client to the server to request hover information at a given text /// document position. - abstract member TextDocumentHover: TextDocumentPositionParams -> AsyncLspResult + abstract member TextDocumentHover: HoverParams -> AsyncLspResult default __.TextDocumentHover(_) = notImplemented @@ -450,7 +76,8 @@ type LspServer() = /// properties. However, properties that are needed for the initial sorting and filtering, like sortText, /// filterText, insertText, and textEdit must be provided in the textDocument/completion request and must /// not be changed during resolve. - abstract member TextDocumentCompletion: CompletionParams -> AsyncLspResult + abstract member TextDocumentCompletion: + CompletionParams -> AsyncLspResult option> default __.TextDocumentCompletion(_) = notImplemented @@ -472,13 +99,15 @@ type LspServer() = /// The go to declaration request is sent from the client to the server to resolve the declaration location /// of a symbol at a given text document position. - abstract member TextDocumentDeclaration: TextDocumentPositionParams -> AsyncLspResult + abstract member TextDocumentDeclaration: + DeclarationParams -> AsyncLspResult>>> default __.TextDocumentDeclaration(_) = notImplemented /// The goto definition request is sent from the client to the server to resolve the definition location of /// a symbol at a given text document position. - abstract member TextDocumentDefinition: TextDocumentPositionParams -> AsyncLspResult + abstract member TextDocumentDefinition: + DefinitionParams -> AsyncLspResult option> default __.TextDocumentDefinition(_) = notImplemented @@ -495,8 +124,7 @@ type LspServer() = /// However we kept `textDocument/documentHighlight` and `textDocument/references` separate requests since /// the first one is allowed to be more fuzzy. Symbol matches usually have a DocumentHighlightKind of Read /// or Write whereas fuzzy or textual matches use Text as the kind. - abstract member TextDocumentDocumentHighlight: - TextDocumentPositionParams -> AsyncLspResult + abstract member TextDocumentDocumentHighlight: DocumentHighlightParams -> AsyncLspResult default __.TextDocumentDocumentHighlight(_) = notImplemented @@ -508,13 +136,15 @@ type LspServer() = /// The goto type definition request is sent from the client to the server to resolve the type definition /// location of a symbol at a given text document position. - abstract member TextDocumentTypeDefinition: TextDocumentPositionParams -> AsyncLspResult + abstract member TextDocumentTypeDefinition: + TypeDefinitionParams -> AsyncLspResult option> default __.TextDocumentTypeDefinition(_) = notImplemented /// The goto implementation request is sent from the client to the server to resolve the implementation /// location of a symbol at a given text document position. - abstract member TextDocumentImplementation: TextDocumentPositionParams -> AsyncLspResult + abstract member TextDocumentImplementation: + ImplementationParams -> AsyncLspResult>>> default __.TextDocumentImplementation(_) = notImplemented @@ -532,7 +162,7 @@ type LspServer() = /// beautify/refactor code. The result of a textDocument/codeAction request is an array of Command literals /// which are typically presented in the user interface. When the command is selected the server should be /// contacted again (via the workspace/executeCommand) request to execute the command. - abstract member CodeActionResolve: CodeAction -> AsyncLspResult + abstract member CodeActionResolve: CodeAction -> AsyncLspResult default __.CodeActionResolve(_) = notImplemented @@ -600,7 +230,7 @@ type LspServer() = /// given text document position. An array of Moniker types is returned as response to indicate possible /// monikers at the given location. If no monikers can be calculated, an empty array or null should be /// returned. - abstract member TextDocumentMoniker: TextDocumentPositionParams -> AsyncLspResult + abstract member TextDocumentMoniker: MonikerParams -> AsyncLspResult default __.TextDocumentMoniker(_) = notImplemented @@ -609,8 +239,7 @@ type LspServer() = /// returned to describe valid contents. A rename to one of the ranges can be applied to all other ranges if the new /// content is valid. If no result-specific word pattern is provided, the word pattern from the client’s language /// configuration is used. - abstract member TextDocumentLinkedEditingRange: - TextDocumentPositionParams -> AsyncLspResult + abstract member TextDocumentLinkedEditingRange: LinkedEditingRangeParams -> AsyncLspResult default __.TextDocumentLinkedEditingRange(_) = notImplemented @@ -688,7 +317,7 @@ type LspServer() = /// The `workspace/executeCommand` request is sent from the client to the server to trigger command execution /// on the server. In most cases the server creates a `WorkspaceEdit` structure and applies the changes to the /// workspace using the request `workspace/applyEdit` which is sent from the server to the client. - abstract member WorkspaceExecuteCommand: ExecuteCommandParams -> AsyncLspResult + abstract member WorkspaceExecuteCommand: ExecuteCommandParams -> AsyncLspResult default __.WorkspaceExecuteCommand(_) = notImplemented @@ -722,12 +351,12 @@ type LspServer() = default __.TextDocumentDidClose(_) = ignoreNotification /// The folding range request is sent from the client to the server to return all folding ranges found in a given text document. - abstract member TextDocumentFoldingRange: FoldingRangeParams -> AsyncLspResult + abstract member TextDocumentFoldingRange: FoldingRangeParams -> AsyncLspResult default __.TextDocumentFoldingRange(_) = notImplemented /// The selection range request is sent from the client to the server to return suggested selection ranges at an array of given positions. /// A selection range is a range around the cursor position which the user might be interested in selecting. - abstract member TextDocumentSelectionRange: SelectionRangeParams -> AsyncLspResult + abstract member TextDocumentSelectionRange: SelectionRangeParams -> AsyncLspResult default __.TextDocumentSelectionRange(_) = notImplemented @@ -765,9 +394,9 @@ type LspServer() = /// progress initiated on the server side using the `window/workDoneProgress/create`. The progress need /// not be marked as cancellable to be cancelled and a client may cancel a progress for any number of /// reasons: in case of error, reloading a workspace etc. - abstract member WorkDoneProgressCancel: WorkDoneProgressCancelParams -> Async + abstract member WindowWorkDoneProgressCancel: WorkDoneProgressCancelParams -> Async - default __.WorkDoneProgressCancel(_) = ignoreNotification + default __.WindowWorkDoneProgressCancel(_) = ignoreNotification /// The inline value request is sent from the client to the server to compute inline values for a given text document /// that may be rendered in the editor at the end of lines. @@ -847,23 +476,23 @@ type LspServer() = interface ILspServer with member this.Dispose() = this.Dispose() member this.Initialize(p: InitializeParams) = this.Initialize(p) - member this.Initialized() = this.Initialized() + member this.Initialized(p: InitializedParams) = this.Initialized(p) member this.Shutdown() = this.Shutdown() member this.Exit() = this.Exit() - member this.TextDocumentHover(p: TextDocumentPositionParams) = this.TextDocumentHover(p) + member this.TextDocumentHover(p: HoverParams) = this.TextDocumentHover(p) member this.TextDocumentDidOpen(p: DidOpenTextDocumentParams) = this.TextDocumentDidOpen(p) member this.TextDocumentDidChange(p: DidChangeTextDocumentParams) = this.TextDocumentDidChange(p) member this.TextDocumentCompletion(p: CompletionParams) = this.TextDocumentCompletion(p) member this.CompletionItemResolve(p: CompletionItem) = this.CompletionItemResolve(p) member this.TextDocumentRename(p: RenameParams) = this.TextDocumentRename(p) member this.TextDocumentPrepareRename(p: PrepareRenameParams) = this.TextDocumentPrepareRename(p) - member this.TextDocumentDeclaration(p: TextDocumentPositionParams) = this.TextDocumentDeclaration(p) - member this.TextDocumentDefinition(p: TextDocumentPositionParams) = this.TextDocumentDefinition(p) + member this.TextDocumentDeclaration(p: DeclarationParams) = this.TextDocumentDeclaration(p) + member this.TextDocumentDefinition(p: DefinitionParams) = this.TextDocumentDefinition(p) member this.TextDocumentReferences(p: ReferenceParams) = this.TextDocumentReferences(p) - member this.TextDocumentDocumentHighlight(p: TextDocumentPositionParams) = this.TextDocumentDocumentHighlight(p) + member this.TextDocumentDocumentHighlight(p: DocumentHighlightParams) = this.TextDocumentDocumentHighlight(p) member this.TextDocumentDocumentLink(p: DocumentLinkParams) = this.TextDocumentDocumentLink(p) - member this.TextDocumentTypeDefinition(p: TextDocumentPositionParams) = this.TextDocumentTypeDefinition(p) - member this.TextDocumentImplementation(p: TextDocumentPositionParams) = this.TextDocumentImplementation(p) + member this.TextDocumentTypeDefinition(p: TypeDefinitionParams) = this.TextDocumentTypeDefinition(p) + member this.TextDocumentImplementation(p: ImplementationParams) = this.TextDocumentImplementation(p) member this.TextDocumentCodeAction(p: CodeActionParams) = this.TextDocumentCodeAction(p) member this.CodeActionResolve(p: CodeAction) = this.CodeActionResolve(p) member this.TextDocumentCodeLens(p: CodeLensParams) = this.TextDocumentCodeLens(p) @@ -876,8 +505,8 @@ type LspServer() = member this.TextDocumentRangeFormatting(p: DocumentRangeFormattingParams) = this.TextDocumentRangeFormatting(p) member this.TextDocumentOnTypeFormatting(p: DocumentOnTypeFormattingParams) = this.TextDocumentOnTypeFormatting(p) member this.TextDocumentDocumentSymbol(p: DocumentSymbolParams) = this.TextDocumentDocumentSymbol(p) - member this.TextDocumentMoniker(p: TextDocumentPositionParams) = this.TextDocumentMoniker(p) - member this.TextDocumentLinkedEditingRange(p: TextDocumentPositionParams) = this.TextDocumentLinkedEditingRange(p) + member this.TextDocumentMoniker(p: MonikerParams) = this.TextDocumentMoniker(p) + member this.TextDocumentLinkedEditingRange(p: LinkedEditingRangeParams) = this.TextDocumentLinkedEditingRange(p) member this.WorkspaceDidChangeWatchedFiles(p: DidChangeWatchedFilesParams) = this.WorkspaceDidChangeWatchedFiles(p) member this.WorkspaceDidChangeWorkspaceFolders(p: DidChangeWorkspaceFoldersParams) = @@ -909,7 +538,7 @@ type LspServer() = member this.TextDocumentSemanticTokensRange(p: SemanticTokensRangeParams) = this.TextDocumentSemanticTokensRange(p) member this.TextDocumentInlayHint(p: InlayHintParams) = this.TextDocumentInlayHint(p) member this.InlayHintResolve(p: InlayHint) = this.InlayHintResolve(p) - member this.WorkDoneProgressCancel(p: WorkDoneProgressCancelParams) = this.WorkDoneProgressCancel(p) + member this.WindowWorkDoneProgressCancel(p: WorkDoneProgressCancelParams) = this.WindowWorkDoneProgressCancel(p) member this.TextDocumentInlineValue(p: InlineValueParams) = this.TextDocumentInlineValue(p) member this.TextDocumentPrepareCallHierarchy(p: CallHierarchyPrepareParams) = @@ -924,4 +553,14 @@ type LspServer() = member this.TypeHierarchySupertypes(p: TypeHierarchySupertypesParams) = this.TypeHierarchySupertypes(p) member this.TypeHierarchySubtypes(p: TypeHierarchySubtypesParams) = this.TypeHierarchySubtypes(p) member this.TextDocumentDiagnostic(p: DocumentDiagnosticParams) = this.TextDocumentDiagnostic(p) - member this.WorkspaceDiagnostic(p: WorkspaceDiagnosticParams) = this.WorkspaceDiagnostic(p) \ No newline at end of file + member this.WorkspaceDiagnostic(p: WorkspaceDiagnosticParams) = this.WorkspaceDiagnostic(p) + member this.CancelRequest(arg1: CancelParams) : Async = ignoreNotification + + member this.NotebookDocumentDidChange(arg1: DidChangeNotebookDocumentParams) : Async = ignoreNotification + + member this.NotebookDocumentDidClose(arg1: DidCloseNotebookDocumentParams) : Async = ignoreNotification + + member this.NotebookDocumentDidOpen(arg1: DidOpenNotebookDocumentParams) : Async = ignoreNotification + member this.NotebookDocumentDidSave(arg1: DidSaveNotebookDocumentParams) : Async = ignoreNotification + member this.Progress(arg1: ProgressParams) : Async = ignoreNotification + member this.SetTrace(arg1: SetTraceParams) : Async = ignoreNotification \ No newline at end of file diff --git a/src/TypeDefaults.fs b/src/TypeDefaults.fs index c3d8050..0c60d0a 100644 --- a/src/TypeDefaults.fs +++ b/src/TypeDefaults.fs @@ -1,4 +1,5 @@ namespace Ionide.LanguageServerProtocol.Types + [] module Extensions = @@ -193,8 +194,8 @@ module Extensions = static member CanUseDocumentChanges(capabilities: ClientCapabilities) = (capabilities.Workspace - |> Option.bind (fun x -> x.WorkspaceEdit) - |> Option.bind (fun x -> x.DocumentChanges)) = Some true + |> Option.bind (fun x -> x.WorkspaceEdit) + |> Option.bind (fun x -> x.DocumentChanges)) = Some true static member Create(edits: TextDocumentEdit[], capabilities: ClientCapabilities) = if WorkspaceEdit.CanUseDocumentChanges(capabilities) then diff --git a/src/Types.cg.fs b/src/Types.cg.fs index 303e8cb..f09ed4d 100644 --- a/src/Types.cg.fs +++ b/src/Types.cg.fs @@ -5,6 +5,7 @@ open System.Runtime.Serialization open System.Diagnostics open Newtonsoft.Json open Newtonsoft.Json.Linq + /// 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 +20,361 @@ type DocumentUri = string type RegExp = string type IWorkDoneProgressOptions = - abstract member WorkDoneProgress: bool option + abstract WorkDoneProgress: bool option type IWorkDoneProgressParams = - /// An optional token that a server can use to report work done progress. - abstract member 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 member 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 member TextDocument: TextDocumentIdentifier - /// The position inside the text document. - abstract member 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 member 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 member Legend: SemanticTokensLegend - /// Server supports providing semantic tokens for a specific range - /// of a document. - abstract member Range: U2 option - /// Server supports providing semantic tokens for a full document. - abstract member 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 member 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 member 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 member InterFileDependencies: bool - /// The server provides support for workspace diagnostics as well. - abstract member 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 member ProcessId: int32 option - /// Information about the client - /// - /// @since 3.15.0 - abstract member 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 member Locale: string option - /// The rootPath of the workspace. Is null - /// if no folder is open. - /// - /// @deprecated in favour of rootUri. - abstract member 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 member RootUri: DocumentUri option - /// The capabilities provided by the client (editor or tool) - abstract member Capabilities: ClientCapabilities - /// User provided initialization options. - abstract member InitializationOptions: LSPAny option - /// The initial trace setting. If omitted trace is disabled ('off'). - abstract member 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 member 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 member 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 member 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 member AllCommitCharacters: string[] option - /// The server provides support to resolve additional - /// information for a completion item. - abstract member ResolveProvider: bool option - /// The server supports the following `CompletionItem` specific - /// capabilities. - /// - /// @since 3.17.0 - abstract member 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 member 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 member 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 member Name: string - /// The kind of this symbol. - abstract member Kind: SymbolKind - /// Tags for this symbol. - /// - /// @since 3.16.0 - abstract member 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 member 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 member 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 member CodeActionKinds: CodeActionKind[] option - /// The server provides support to resolve additional - /// information for a code action. - /// - /// @since 3.16.0 - abstract member 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 member 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 member 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 member 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 member FirstTriggerCharacter: string - /// More trigger characters. - abstract member 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 member 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 member 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 member Kind: string - /// An optional annotation identifier describing the operation. - /// - /// @since 3.16.0 - abstract member 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 member Kind: string - /// An optional result id. If provided it will - /// be sent on the next diagnostic request for the - /// same document. - abstract member ResultId: string option - /// The actual items. - abstract member 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 member Kind: string - /// A result id which will be sent on the next - /// diagnostic request for the same document. - abstract member 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 member 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 member Range: Range - /// The string to be inserted. For delete operations use an - /// empty string. - abstract member 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,813 +390,772 @@ type ITextEdit = /// /// @since 3.17.0 type INotebookDocumentSyncOptions = - /// The notebooks to be synced - abstract member NotebookSelector: NotebookDocumentSyncOptionsNotebookSelector[] - /// Whether save notification should be forwarded to - /// the server. Will only be honored if mode === `notebook`. - abstract member Save: bool option - -type InitializedParams = unit - -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 + /// 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 /// 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 - } - - 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 +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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +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 /// 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[] - } - - 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[] +} 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 /// 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 - } - - 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 +} 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 +} /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// @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 - } - - 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 +} 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 /// @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 - } - - 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 +} 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 /// @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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 @@ -1209,410 +1169,393 @@ 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// @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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} with + + 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 - } - - 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 +} 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 /// 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 - } - - 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 +} with + + 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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. /// @@ -1622,1352 +1565,1293 @@ 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 - } - - 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 +} 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 /// 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[] - } - - 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[] +} 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 /// A workspace diagnostic report. /// /// @since 3.17.0 -type WorkspaceDiagnosticReport = - { Items: WorkspaceDocumentDiagnosticReport[] } +type WorkspaceDiagnosticReport = { Items: WorkspaceDocumentDiagnosticReport[] } /// A partial result for a workspace diagnostic report. /// /// @since 3.17.0 -type WorkspaceDiagnosticReportPartialResult = - { Items: WorkspaceDocumentDiagnosticReport[] } +type WorkspaceDiagnosticReportPartialResult = { Items: WorkspaceDocumentDiagnosticReport[] } /// 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 - } - - 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 +} 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 +} /// 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 } +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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 IHoverOptions + interface IHoverOptions - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// 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 +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 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 - } - - 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 +} 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 /// 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 - } - - 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 +} with + + interface ITextDocumentPositionParams with + /// The text document. + member x.TextDocument = x.TextDocument + /// The position inside the text document. + member x.Position = x.Position -/// 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 - } + 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 - 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 +/// 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 - interface IDefinitionOptions + interface IDefinitionOptions - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + 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 - } - - 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 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 -/// 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 - } + 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 - 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 +/// 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 - interface IReferenceOptions + interface IReferenceOptions - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// 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 +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 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 - } - - 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 +} 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 IDocumentHighlightOptions + interface IDocumentHighlightOptions - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + interface IWorkDoneProgressOptions with + member x.WorkDoneProgress = x.WorkDoneProgress /// 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 +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 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 WorkspaceSymbolLocationC2 = { Uri: DocumentUri } @@ -2976,572 +2860,540 @@ 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 -/// 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 - } - - 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 + 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 - } - - 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 +} with + + 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 - } - - 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 +} 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 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 - } - - 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 +} with + + 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 - } - - 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 +} 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 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 - } - - 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 +} 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 /// 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 - } - - 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 +} with + + 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 - } - - 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 +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 /// 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 - } - - 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 +} with + + 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[] - } +type ExecuteCommandRegistrationOptions = { + WorkDoneProgress: bool option + /// The commands to be executed on the server + Commands: string[] +} with - 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 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 - } - - 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 +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 /// 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. /// @@ -3555,106 +3407,105 @@ type LocationLink = /// } /// ``` [] -type Range = - { - /// The range's start position. - Start: Position - /// The range's end position. - End: Position - } +type Range = { + /// The range's start position. + Start: Position + /// The range's end position. + End: Position +} with - [] - member x.DebuggerDisplay = $"{x.Start.DebuggerDisplay}-{x.End.DebuggerDisplay}" + [] + member x.DebuggerDisplay = $"{x.Start.DebuggerDisplay}-{x.End.DebuggerDisplay}" -type ImplementationOptions = - { WorkDoneProgress: bool option } +type ImplementationOptions = { + WorkDoneProgress: bool option +} with - 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 } +type TypeDefinitionOptions = { + WorkDoneProgress: bool option +} with - 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 - } +type TextDocumentIdentifier = { + /// The text document's uri. + Uri: DocumentUri +} with - 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 } +type DocumentColorOptions = { + WorkDoneProgress: bool option +} with - 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 } +type FoldingRangeOptions = { + WorkDoneProgress: bool option +} with - 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 } +type DeclarationOptions = { + WorkDoneProgress: bool option +} with - 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 @@ -3684,346 +3535,335 @@ 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 - } - - [] - member x.DebuggerDisplay = $"({x.Line},{x.Character})" - -type SelectionRangeOptions = - { WorkDoneProgress: bool option } - - 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 +} with + + [] + member x.DebuggerDisplay = $"({x.Line},{x.Character})" + +type SelectionRangeOptions = { + WorkDoneProgress: bool option +} with + + 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 } +type CallHierarchyOptions = { + WorkDoneProgress: bool option +} with - 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 - } - - 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 +} 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 /// @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 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 } +type LinkedEditingRangeOptions = { + WorkDoneProgress: bool option +} with - interface ILinkedEditingRangeOptions + interface ILinkedEditingRangeOptions - interface IWorkDoneProgressOptions with - member x.WorkDoneProgress = x.WorkDoneProgress + 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 } +type MonikerOptions = { + WorkDoneProgress: bool option +} with - 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 } +type TypeHierarchyOptions = { + WorkDoneProgress: bool option +} with - 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 } +type InlineValueOptions = { + WorkDoneProgress: bool option +} with - 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. @@ -4047,1273 +3887,1226 @@ 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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[] - } - - 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[] +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 - } +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 +} /// 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 - } - - 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 +} with + + 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 - } +type SaveOptions = { + /// The client is supposed to include the content on save. + IncludeText: bool option +} with - 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 - } - - [] - 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 +} with + + [] + 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 - } - - 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 +} 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 /// Hover options. -type HoverOptions = - { WorkDoneProgress: bool option } +type HoverOptions = { + WorkDoneProgress: bool option +} with - 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 - } - - 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 +} 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 /// Server Capabilities for a {@link DefinitionRequest}. -type DefinitionOptions = - { WorkDoneProgress: bool option } +type DefinitionOptions = { + WorkDoneProgress: bool option +} with - 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 } +type ReferenceOptions = { + WorkDoneProgress: bool option +} with - 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 } +type DocumentHighlightOptions = { + WorkDoneProgress: bool option +} with - 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// Code Lens provider options of a {@link CodeLensRequest}. -type CodeLensOptions = - { - WorkDoneProgress: bool option - /// Code lens has a resolve provider as well. - ResolveProvider: bool option - } +type CodeLensOptions = { + WorkDoneProgress: bool option + /// Code lens has a resolve provider as well. + ResolveProvider: bool option +} with - 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 - } +type DocumentLinkOptions = { + WorkDoneProgress: bool option + /// Document links have a resolve provider as well. + ResolveProvider: bool option +} with - 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 } +type DocumentFormattingOptions = { + WorkDoneProgress: bool option +} with - 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 } +type DocumentRangeFormattingOptions = { + WorkDoneProgress: bool option +} with - 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// The server capabilities of a {@link ExecuteCommandRequest}. -type ExecuteCommandOptions = - { - WorkDoneProgress: bool option - /// The commands to be executed on the server - Commands: string[] - } +type ExecuteCommandOptions = { + WorkDoneProgress: bool option + /// The commands to be executed on the server + Commands: string[] +} with - 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 - } - - 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 +} with + + 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 /// A notebook cell. /// @@ -5322,85 +5115,80 @@ 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 } @@ -5417,535 +5205,507 @@ 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 - } - - 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 +} 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 /// 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 - } - - 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 +} 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 +} /// 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. /// @@ -5953,777 +5713,719 @@ 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 @@ -6790,29 +6492,27 @@ 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 @@ -6857,30 +6557,28 @@ 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 @@ -6900,77 +6598,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 @@ -6980,374 +6678,374 @@ 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`. @@ -7356,10 +7054,10 @@ type TraceValues = /// 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. /// @@ -7367,100 +7065,100 @@ 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. @@ -7468,50 +7166,50 @@ type CodeActionTriggerKind = /// @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 + | [] Relative = 0 \ No newline at end of file diff --git a/src/Types.fs b/src/Types.fs index d8c842e..47106c1 100644 --- a/src/Types.fs +++ b/src/Types.fs @@ -5,81 +5,88 @@ open Ionide.LanguageServerProtocol /// Types in typescript can have hardcoded values for their fields, this attribute is used to mark /// the default value for a field in a type and is used when deserializing the type to json -/// but these types might not actually be used as a discriminated union or only partially used +/// but these types might not actually be used as a discriminated union or only partially used /// so we don't generate a dedicated union type because of that -/// +/// /// see https://microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification/#resourceChanges for a dedicated example -type UnionKindAttribute( value: string ) = - inherit System.Attribute() - member x.Value = value +type UnionKindAttribute(value: string) = + inherit System.Attribute() + member x.Value = value /// Represents a Union type where the individual cases are erased when serialized or deserialized /// For instance a union could be defined as: "string | int | bool" and when serialized it would be /// serialized as a only a value based on the actual case type ErasedUnionAttribute() = - inherit System.Attribute() + inherit System.Attribute() +/// Represents a Union type where the individual cases are erased when serialized or deserialized +/// For instance a union could be defined as: "string | int | bool" and when serialized it would be +/// serialized as a only a value based on the actual case [] type U2<'T1, 'T2> = - | C1 of 'T1 - | C2 of 'T2 - override x.ToString() = - match x with - | C1 c -> string c - | C2 c -> string c + /// Represents a single case of a Union type where the individual cases are erased when serialized or deserialized + /// For instance a union could be defined as: "string | int | bool" and when serialized it would be + /// serialized as a only a value based on the actual case + | C1 of 'T1 + /// Represents a single case of a Union type where the individual cases are erased when serialized or deserialized + /// For instance a union could be defined as: "string | int | bool" and when serialized it would be + /// serialized as a only a value based on the actual case + | C2 of 'T2 + + override x.ToString() = + match x with + | C1 c -> string c + | C2 c -> string c +/// Represents a Union type where the individual cases are erased when serialized or deserialized +/// For instance a union could be defined as: "string | int | bool" and when serialized it would be +/// serialized as a only a value based on the actual case [] type U3<'T1, 'T2, 'T3> = - | C1 of 'T1 - | C2 of 'T2 - | C3 of 'T3 - override x.ToString() = - match x with - | C1 c -> string c - | C2 c -> string c - | C3 c -> string c + /// Represents a Union type where the individual cases are erased when serialized or deserialized + /// For instance a union could be defined as: "string | int | bool" and when serialized it would be + /// serialized as a only a value based on the actual case + | C1 of 'T1 + /// Represents a Union type where the individual cases are erased when serialized or deserialized + /// For instance a union could be defined as: "string | int | bool" and when serialized it would be + /// serialized as a only a value based on the actual case + | C2 of 'T2 + /// Represents a Union type where the individual cases are erased when serialized or deserialized + /// For instance a union could be defined as: "string | int | bool" and when serialized it would be + /// serialized as a only a value based on the actual case + | C3 of 'T3 + + override x.ToString() = + match x with + | C1 c -> string c + | C2 c -> string c + | C3 c -> string c +/// Represents a Union type where the individual cases are erased when serialized or deserialized +/// For instance a union could be defined as: "string | int | bool" and when serialized it would be +/// serialized as a only a value based on the actual case [] type U4<'T1, 'T2, 'T3, 'T4> = - | C1 of 'T1 - | C2 of 'T2 - | C3 of 'T3 - | C4 of 'T4 - override x.ToString() = - match x with - | C1 c -> string c - | C2 c -> string c - | C3 c -> string 3 - | C4 c -> string 3 - - -type LspResult<'t> = Result<'t, JsonRpc.Error> -type AsyncLspResult<'t> = Async> - - -module LspResult = - - let success x : LspResult<_> = Result.Ok x - - let invalidParams s : LspResult<_> = Result.Error(JsonRpc.Error.Create(JsonRpc.ErrorCodes.invalidParams, s)) - - let internalError<'a> (s: string) : LspResult<'a> = - Result.Error(JsonRpc.Error.Create(JsonRpc.ErrorCodes.internalError, s)) - - let notImplemented<'a> : LspResult<'a> = Result.Error(JsonRpc.Error.MethodNotFound) - - let requestCancelled<'a> : LspResult<'a> = Result.Error(JsonRpc.Error.RequestCancelled) - -module AsyncLspResult = - - let success x : AsyncLspResult<_> = async.Return(Result.Ok x) - - let invalidParams s : AsyncLspResult<_> = - async.Return(Result.Error(JsonRpc.Error.Create(JsonRpc.ErrorCodes.invalidParams, s))) - - let internalError s : AsyncLspResult<_> = - async.Return(Result.Error(JsonRpc.Error.Create(JsonRpc.ErrorCodes.internalError, s))) - - let notImplemented<'a> : AsyncLspResult<'a> = async.Return(Result.Error(JsonRpc.Error.MethodNotFound)) - - let requestCancelled<'a> : AsyncLspResult<'a> = async.Return(Result.Error(JsonRpc.Error.RequestCancelled)) + /// Represents a Union type where the individual cases are erased when serialized or deserialized + /// For instance a union could be defined as: "string | int | bool" and when serialized it would be + /// serialized as a only a value based on the actual case + | C1 of 'T1 + /// Represents a Union type where the individual cases are erased when serialized or deserialized + /// For instance a union could be defined as: "string | int | bool" and when serialized it would be + /// serialized as a only a value based on the actual case + | C2 of 'T2 + /// Represents a Union type where the individual cases are erased when serialized or deserialized + /// For instance a union could be defined as: "string | int | bool" and when serialized it would be + /// serialized as a only a value based on the actual case + | C3 of 'T3 + /// Represents a Union type where the individual cases are erased when serialized or deserialized + /// For instance a union could be defined as: "string | int | bool" and when serialized it would be + /// serialized as a only a value based on the actual case + | C4 of 'T4 + + override x.ToString() = + match x with + | C1 c -> string c + | C2 c -> string c + | C3 c -> string 3 + | C4 c -> string 3 \ No newline at end of file diff --git a/tests/Benchmarks.fs b/tests/Benchmarks.fs index 76679c9..7769572 100644 --- a/tests/Benchmarks.fs +++ b/tests/Benchmarks.fs @@ -26,40 +26,46 @@ let inline private memoriseByHash (f: 'a -> 'b) : 'a -> 'b = | (true, value) -> value | _ -> let value = f key - d.TryAdd(hash, value) |> ignore + + d.TryAdd(hash, value) + |> ignore + value [] [] [] type TypeCheckBenchmarks() = - static let values: obj array = - [| 1 - 3.14 - true - "foo" - 4uy - Some "foo" - 123456 - "bar" - false - Some true - 987.654321 - 0 - Some 0 - 5u - Some "string" - Some "bar" - Some "baz" - Some "lorem ipsum dolor sit" - 321654 - 2.71828 - "lorem ipsum dolor sit" - Some 42 - Some true - Some 3.14 |] - - static let types = values |> Array.map (fun v -> v.GetType()) + static let values: obj array = [| + 1 + 3.14 + true + "foo" + 4uy + Some "foo" + 123456 + "bar" + false + Some true + 987.654321 + 0 + Some 0 + 5u + Some "string" + Some "bar" + Some "baz" + Some "lorem ipsum dolor sit" + 321654 + 2.71828 + "lorem ipsum dolor sit" + Some 42 + Some true + Some 3.14 + |] + + static let types = + values + |> Array.map (fun v -> v.GetType()) static let isOptionType (ty: Type) = ty.IsGenericType @@ -73,7 +79,10 @@ type TypeCheckBenchmarks() = let mutable count = 0 for ty in types do - if Type.numerics |> Array.exists ((=) ty) then + if + Type.numerics + |> Array.exists ((=) ty) + then count <- count + 1 count @@ -85,7 +94,10 @@ type TypeCheckBenchmarks() = for ty in types do let hash = ty.GetHashCode() - if Type.numericHashes |> Array.contains hash then + if + Type.numericHashes + |> Array.contains hash + then count <- count + 1 count @@ -190,40 +202,56 @@ module Example = type SingleCaseUnionHolder = { SingleCaseUnion: SingleCaseUnion } module SingleCaseUnionHolder = - let gen (rand: Random) (depth: int) = - { SingleCaseUnion = - if rand.NextBool() then - SingleCaseUnion.Ipsum - else - SingleCaseUnion.Ipsum } - - type WithExtensionData = - { NoExtensionData: string - [] - mutable AdditionalData: IDictionary } + let gen (rand: Random) (depth: int) = { + SingleCaseUnion = + if rand.NextBool() then + SingleCaseUnion.Ipsum + else + SingleCaseUnion.Ipsum + } + + type WithExtensionData = { + NoExtensionData: string + [] + mutable AdditionalData: IDictionary + } module WithExtensionData = - let gen (rand: Random) (depth: int) = - { NoExtensionData = $"WithExtensionData {depth}" - AdditionalData = - List.init (rand.NextCount depth) (fun i -> + let gen (rand: Random) (depth: int) = { + NoExtensionData = $"WithExtensionData {depth}" + AdditionalData = + List.init + (rand.NextCount depth) + (fun i -> let key = $"Data{depth}Ele{i}" let value = JToken.FromObject(i * depth) - (key, value)) - |> Map.ofList } - - type RecordWithOption = - { RequiredValue: string - OptionalValue: string option - AnotherOptionalValue: int option - FinalOptionalValue: int option } + (key, value) + ) + |> Map.ofList + } + + type RecordWithOption = { + RequiredValue: string + OptionalValue: string option + AnotherOptionalValue: int option + FinalOptionalValue: int option + } module RecordWithOption = - let gen (rand: Random) (depth: int) = - { RequiredValue = $"RecordWithOption {depth}" - OptionalValue = rand.NextOption $"Hello {depth}" - AnotherOptionalValue = rand.NextOption(42000 + depth) - FinalOptionalValue = rand.NextOption(13000 + depth) } + let gen (rand: Random) (depth: int) = { + RequiredValue = $"RecordWithOption {depth}" + OptionalValue = rand.NextOption $"Hello {depth}" + AnotherOptionalValue = + rand.NextOption( + 42000 + + depth + ) + FinalOptionalValue = + rand.NextOption( + 13000 + + depth + ) + } [] [] @@ -238,9 +266,17 @@ module Example = let gen (rand: Random) (depth: int) = match rand.Next(0, 5) with | 0 -> ErasedUnionData.Alpha $"Erased {depth}" - | 1 -> ErasedUnionData.Beta(42000 + depth) + | 1 -> + ErasedUnionData.Beta( + 42000 + + depth + ) | 2 -> ErasedUnionData.Gamma false - | 3 -> ErasedUnionData.Delta(42000.123 + (float depth)) + | 3 -> + ErasedUnionData.Delta( + 42000.123 + + (float depth) + ) | 4 -> ErasedUnionData.Epsilon(RecordWithOption.gen rand (depth - 1)) | _ -> failwith "unreachable" @@ -249,28 +285,29 @@ module Example = module ErasedUnionDataHolder = let gen (rand: Random) (depth: int) = { ErasedUnion = ErasedUnionData.gen rand depth } - type U2Holder = - { BoolString: U2 - StringInt: U2 - BoolErasedUnionData: U2 } + type U2Holder = { + BoolString: U2 + StringInt: U2 + BoolErasedUnionData: U2 + } module U2Holder = - let gen (rand: Random) (depth: int) = - { BoolString = - if rand.NextBool() then - U2.C1 true - else - U2.C2 $"U2 {depth}" - StringInt = - if rand.NextBool() then - U2.C1 $"U2 {depth}" - else - U2.C2(42000 + depth) - BoolErasedUnionData = - if rand.NextBool() then - U2.C1 true - else - U2.C2(ErasedUnionDataHolder.gen rand (depth - 1)) } + let gen (rand: Random) (depth: int) = { + BoolString = if rand.NextBool() then U2.C1 true else U2.C2 $"U2 {depth}" + StringInt = + if rand.NextBool() then + U2.C1 $"U2 {depth}" + else + U2.C2( + 42000 + + depth + ) + BoolErasedUnionData = + if rand.NextBool() then + U2.C1 true + else + U2.C2(ErasedUnionDataHolder.gen rand (depth - 1)) + } [] type MyEnum = @@ -284,38 +321,56 @@ module Example = let gen (rand: Random) (depth: int) = let n = Enum.GetNames(typeof).Length - { EnumValue = rand.Next(0, n) |> enum<_> - EnumArray = Array.init (rand.NextCount depth) (fun i -> rand.Next(0, n) |> enum<_>) } + { + EnumValue = + rand.Next(0, n) + |> enum<_> + EnumArray = + Array.init + (rand.NextCount depth) + (fun i -> + rand.Next(0, n) + |> enum<_> + ) + } type MapHolder = { MyMap: Map } module MapHolder = - let gen (rand: Random) (depth: int) = - { MyMap = - Array.init (rand.NextCount depth) (fun i -> + let gen (rand: Random) (depth: int) = { + MyMap = + Array.init + (rand.NextCount depth) + (fun i -> let key = $"Key{i}" let value = $"Data{i}@{depth}" - (key, value)) - |> Map.ofArray } - - type BasicData = - { IntData: int - FloatData: float - BoolData: bool - StringData: string - CharData: char - StringOptionData: string option - IntArrayOptionData: int[] option } + (key, value) + ) + |> Map.ofArray + } + + type BasicData = { + IntData: int + FloatData: float + BoolData: bool + StringData: string + CharData: char + StringOptionData: string option + IntArrayOptionData: int[] option + } module BasicData = - let gen (rand: Random) (depth: int) = - { IntData = rand.Next(0, 500) - FloatData = rand.NextDouble() - BoolData = rand.NextBool() - StringData = $"Data {depth}" - CharData = '_' - StringOptionData = rand.NextOption $"Option {depth}" - IntArrayOptionData = Array.init (rand.NextCount depth) id |> rand.NextOption } + let gen (rand: Random) (depth: int) = { + IntData = rand.Next(0, 500) + FloatData = rand.NextDouble() + BoolData = rand.NextBool() + StringData = $"Data {depth}" + CharData = '_' + StringOptionData = rand.NextOption $"Option {depth}" + IntArrayOptionData = + Array.init (rand.NextCount depth) id + |> rand.NextOption + } [] @@ -347,9 +402,12 @@ module Example = | 9 | 10 -> Data.More( - Array.init (rand.NextCount depth) (fun _ -> - let depth = rand.NextDepth depth - gen rand depth) + Array.init + (rand.NextCount depth) + (fun _ -> + let depth = rand.NextDepth depth + gen rand depth + ) ) | _ -> failwith "unreachable" @@ -357,20 +415,24 @@ module Example = // Note: deterministic (-> seed) let rand = Random(seed) - let always = - [| Data.SingleCaseUnion(SingleCaseUnionHolder.gen rand maxDepth) - Data.WithExtensionData(WithExtensionData.gen rand maxDepth) - Data.RecordWithOption(RecordWithOption.gen rand maxDepth) - Data.ErasedUnion(ErasedUnionDataHolder.gen rand maxDepth) - Data.U2(U2Holder.gen rand maxDepth) - Data.Enum(MyEnumHolder.gen rand maxDepth) - Data.Map(MapHolder.gen rand maxDepth) - Data.BasicData(BasicData.gen rand maxDepth) |] + let always = [| + Data.SingleCaseUnion(SingleCaseUnionHolder.gen rand maxDepth) + Data.WithExtensionData(WithExtensionData.gen rand maxDepth) + Data.RecordWithOption(RecordWithOption.gen rand maxDepth) + Data.ErasedUnion(ErasedUnionDataHolder.gen rand maxDepth) + Data.U2(U2Holder.gen rand maxDepth) + Data.Enum(MyEnumHolder.gen rand maxDepth) + Data.Map(MapHolder.gen rand maxDepth) + Data.BasicData(BasicData.gen rand maxDepth) + |] let additional = - Array.init additionalWidth (fun _ -> - let depth = rand.NextDepth maxDepth - Data.gen rand depth) + Array.init + additionalWidth + (fun _ -> + let depth = rand.NextDepth maxDepth + Data.gen rand depth + ) let data = Array.append always additional Data.More data @@ -380,189 +442,250 @@ module Example = [] [] type MultipleTypesBenchmarks() = - let initializeParams: InitializeParams = - { ProcessId = Some 42 - ClientInfo = Some { Name = "foo"; Version = None } - Locale = None - RootPath = Some "/" - RootUri = Some "file://..." - InitializationOptions = None - WorkDoneToken = None - Trace = Some TraceValues.Off - Capabilities = - - { Workspace = - Some - { ApplyEdit = Some true - WorkspaceEdit = - Some - { DocumentChanges = Some true - ResourceOperations = - Some - [| ResourceOperationKind.Create - ResourceOperationKind.Rename - ResourceOperationKind.Delete |] - FailureHandling = Some FailureHandlingKind.Abort - NormalizesLineEndings = None - ChangeAnnotationSupport = Some { GroupsOnLabel = Some false } } - DidChangeConfiguration = None - DidChangeWatchedFiles = None - Symbol = - Some - { DynamicRegistration = Some false - SymbolKind = Some { ValueSet = Some SymbolKindCapabilities.DefaultValueSet } - TagSupport = None - ResolveSupport = None } - SemanticTokens = Some { RefreshSupport = Some true } - InlayHint = Some { RefreshSupport = Some false } - InlineValue = Some { RefreshSupport = Some false } - CodeLens = Some { RefreshSupport = Some true } - ExecuteCommand = None - WorkspaceFolders = None - Configuration = None - FileOperations = None - Diagnostics = None - + let initializeParams: InitializeParams = { + ProcessId = Some 42 + ClientInfo = Some { Name = "foo"; Version = None } + Locale = None + RootPath = Some "/" + RootUri = Some "file://..." + InitializationOptions = None + WorkDoneToken = None + Trace = Some TraceValues.Off + Capabilities = + + { + Workspace = + Some { + ApplyEdit = Some true + WorkspaceEdit = + Some { + DocumentChanges = Some true + ResourceOperations = + Some [| + ResourceOperationKind.Create + ResourceOperationKind.Rename + ResourceOperationKind.Delete + |] + FailureHandling = Some FailureHandlingKind.Abort + NormalizesLineEndings = None + ChangeAnnotationSupport = Some { GroupsOnLabel = Some false } + } + DidChangeConfiguration = None + DidChangeWatchedFiles = None + Symbol = + Some { + DynamicRegistration = Some false + SymbolKind = Some { ValueSet = Some SymbolKindCapabilities.DefaultValueSet } + TagSupport = None + ResolveSupport = None + } + SemanticTokens = Some { RefreshSupport = Some true } + InlayHint = Some { RefreshSupport = Some false } + InlineValue = Some { RefreshSupport = Some false } + CodeLens = Some { RefreshSupport = Some true } + ExecuteCommand = None + WorkspaceFolders = None + Configuration = None + FileOperations = None + Diagnostics = None + + } + NotebookDocument = None + TextDocument = + Some { + Synchronization = + Some { + DynamicRegistration = Some true + WillSave = Some true + WillSaveWaitUntil = Some false + DidSave = Some true + } + PublishDiagnostics = + Some { + RelatedInformation = None + TagSupport = None + VersionSupport = None + CodeDescriptionSupport = None + DataSupport = None + } + Completion = None + Hover = + Some { + DynamicRegistration = Some true + ContentFormat = + Some [| + MarkupKind.PlainText + MarkupKind.Markdown + |] + } + SignatureHelp = + Some { + DynamicRegistration = Some true + SignatureInformation = + Some { + DocumentationFormat = None + ParameterInformation = None + ActiveParameterSupport = None } - NotebookDocument = None - TextDocument = - Some - { Synchronization = - Some - { DynamicRegistration = Some true - WillSave = Some true - WillSaveWaitUntil = Some false - DidSave = Some true } - PublishDiagnostics = - Some - { RelatedInformation = None - TagSupport = None - VersionSupport = None - CodeDescriptionSupport = None - DataSupport = None } - Completion = None - Hover = - Some - { DynamicRegistration = Some true - ContentFormat = Some [| MarkupKind.PlainText; MarkupKind.Markdown |] } - SignatureHelp = - Some - { DynamicRegistration = Some true - SignatureInformation = - Some - { DocumentationFormat = None - ParameterInformation = None - ActiveParameterSupport = None } - ContextSupport = None } - Declaration = Some { DynamicRegistration = Some false; LinkSupport = Some false } - References = Some { DynamicRegistration = Some false } - DocumentHighlight = Some { DynamicRegistration = None } - DocumentSymbol = None - Formatting = Some { DynamicRegistration = Some true } - RangeFormatting = Some { - DynamicRegistration = Some true + ContextSupport = None + } + Declaration = Some { DynamicRegistration = Some false; LinkSupport = Some false } + References = Some { DynamicRegistration = Some false } + DocumentHighlight = Some { DynamicRegistration = None } + DocumentSymbol = None + Formatting = Some { DynamicRegistration = Some true } + RangeFormatting = Some { DynamicRegistration = Some true } + OnTypeFormatting = None + Definition = Some { DynamicRegistration = Some false; LinkSupport = Some false } + TypeDefinition = Some { DynamicRegistration = Some false; LinkSupport = Some false } + Implementation = Some { DynamicRegistration = Some false; LinkSupport = Some false } + CodeAction = + Some { + DynamicRegistration = Some true + CodeActionLiteralSupport = + Some { + CodeActionKind = { + ValueSet = [| + "foo" + "bar" + "baz" + "alpha" + "beta" + "gamma" + "delta" + "x" + "y" + "z" + |] } - OnTypeFormatting = None - Definition = Some { DynamicRegistration = Some false; LinkSupport = Some false } - TypeDefinition = Some { DynamicRegistration = Some false; LinkSupport = Some false } - Implementation = Some { DynamicRegistration = Some false; LinkSupport = Some false } - CodeAction = - Some - { DynamicRegistration = Some true - CodeActionLiteralSupport = - Some - { CodeActionKind = - { ValueSet = [| "foo"; "bar"; "baz"; "alpha"; "beta"; "gamma"; "delta"; "x"; "y"; "z" |] } } - IsPreferredSupport = Some true - DisabledSupport = Some false - DataSupport = None - ResolveSupport = Some { Properties = [| "foo"; "bar"; "baz" |] } - HonorsChangeAnnotations = Some false } - CodeLens = Some { DynamicRegistration = Some true } - DocumentLink = Some { DynamicRegistration = Some true; TooltipSupport = None } - ColorProvider = Some { DynamicRegistration = Some true } - Rename = None - FoldingRange = - Some - { DynamicRegistration = Some false - LineFoldingOnly = Some true - RangeLimit = None - FoldingRangeKind = None - FoldingRange = None } - SelectionRange = Some { DynamicRegistration = None } - LinkedEditingRange = Some { DynamicRegistration = None } - CallHierarchy = Some { DynamicRegistration = None } - SemanticTokens = - Some - { DynamicRegistration = Some false - Requests = { Range = Some (U2.C1 true); Full = Some(U2.C2 { Delta = Some true }) } - TokenTypes = - "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Proin tortor purus platea sit eu id nisi litora libero. Neque vulputate consequat ac amet augue blandit maximus aliquet congue. Pharetra vestibulum posuere ornare faucibus fusce dictumst orci aenean eu facilisis ut volutpat commodo senectus purus himenaeos fames primis convallis nisi." - |> fun s -> s.Split(' ') - TokenModifiers = - "Phasellus fermentum malesuada phasellus netus dictum aenean placerat egestas amet. Ornare taciti semper dolor tristique morbi. Sem leo tincidunt aliquet semper eu lectus scelerisque quis. Sagittis vivamus mollis nisi mollis enim fermentum laoreet." - |> fun s -> s.Split(' ') - Formats = [| TokenFormat.Relative |] - OverlappingTokenSupport = Some false - MultilineTokenSupport = Some true - ServerCancelSupport = None - AugmentsSyntaxTokens = None } - TypeHierarchy = Some { DynamicRegistration = None } - Moniker = Some { DynamicRegistration = None } - InlineValue = Some { DynamicRegistration = None } - InlayHint = - Some - { DynamicRegistration = Some true - ResolveSupport = Some { Properties = [| "Tooltip"; "Position"; "TextEdits" |] } } - Diagnostic = Some { DynamicRegistration = None; RelatedDocumentSupport = None } } - General = None - Experimental = None - Window = None } - WorkspaceFolders = - Some - [| { Uri = "..."; Name = "foo" } - { Uri = "/"; Name = "bar" } - { Uri = "something long stuff and even longer and longer and longer" - Name = "bar" } |] } - - let inlayHint: InlayHint = - { Label = - U2.C2 - [| { InlayHintLabelPart.Value = "1st label" - Tooltip = Some(U2.C1 "1st label tooltip") - Location = Some { Uri = "1st"; Range = mkRange' (1u, 2u) (3u, 4u) } - Command = None } - { Value = "2nd label" - Tooltip = Some(U2.C1 "1st label tooltip") - Location = Some { Uri = "2nd"; Range = mkRange' (5u, 8u) (10u, 9u) } - Command = Some { Title = "2nd command"; Command = "foo"; Arguments = None } } - { InlayHintLabelPart.Value = "3rd label" - Tooltip = - Some( - U2.C2 - { Kind = MarkupKind.Markdown - Value = - """ + } + IsPreferredSupport = Some true + DisabledSupport = Some false + DataSupport = None + ResolveSupport = + Some { + Properties = [| + "foo" + "bar" + "baz" + |] + } + HonorsChangeAnnotations = Some false + } + CodeLens = Some { DynamicRegistration = Some true } + DocumentLink = Some { DynamicRegistration = Some true; TooltipSupport = None } + ColorProvider = Some { DynamicRegistration = Some true } + Rename = None + FoldingRange = + Some { + DynamicRegistration = Some false + LineFoldingOnly = Some true + RangeLimit = None + FoldingRangeKind = None + FoldingRange = None + } + SelectionRange = Some { DynamicRegistration = None } + LinkedEditingRange = Some { DynamicRegistration = None } + CallHierarchy = Some { DynamicRegistration = None } + SemanticTokens = + Some { + DynamicRegistration = Some false + Requests = { Range = Some(U2.C1 true); Full = Some(U2.C2 { Delta = Some true }) } + TokenTypes = + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Proin tortor purus platea sit eu id nisi litora libero. Neque vulputate consequat ac amet augue blandit maximus aliquet congue. Pharetra vestibulum posuere ornare faucibus fusce dictumst orci aenean eu facilisis ut volutpat commodo senectus purus himenaeos fames primis convallis nisi." + |> fun s -> s.Split(' ') + TokenModifiers = + "Phasellus fermentum malesuada phasellus netus dictum aenean placerat egestas amet. Ornare taciti semper dolor tristique morbi. Sem leo tincidunt aliquet semper eu lectus scelerisque quis. Sagittis vivamus mollis nisi mollis enim fermentum laoreet." + |> fun s -> s.Split(' ') + Formats = [| TokenFormat.Relative |] + OverlappingTokenSupport = Some false + MultilineTokenSupport = Some true + ServerCancelSupport = None + AugmentsSyntaxTokens = None + } + TypeHierarchy = Some { DynamicRegistration = None } + Moniker = Some { DynamicRegistration = None } + InlineValue = Some { DynamicRegistration = None } + InlayHint = + Some { + DynamicRegistration = Some true + ResolveSupport = + Some { + Properties = [| + "Tooltip" + "Position" + "TextEdits" + |] + } + } + Diagnostic = Some { DynamicRegistration = None; RelatedDocumentSupport = None } + } + General = None + Experimental = None + Window = None + } + WorkspaceFolders = + Some [| + { Uri = "..."; Name = "foo" } + { Uri = "/"; Name = "bar" } + { + Uri = "something long stuff and even longer and longer and longer" + Name = "bar" + } + |] + } + + let inlayHint: InlayHint = { + Label = + U2.C2 [| + { + InlayHintLabelPart.Value = "1st label" + Tooltip = Some(U2.C1 "1st label tooltip") + Location = Some { Uri = "1st"; Range = mkRange' (1u, 2u) (3u, 4u) } + Command = None + } + { + Value = "2nd label" + Tooltip = Some(U2.C1 "1st label tooltip") + Location = Some { Uri = "2nd"; Range = mkRange' (5u, 8u) (10u, 9u) } + Command = Some { Title = "2nd command"; Command = "foo"; Arguments = None } + } + { + InlayHintLabelPart.Value = "3rd label" + Tooltip = + Some( + U2.C2 { + Kind = MarkupKind.Markdown + Value = + """ # Header Description * List 1 * List 2 - """ } - ) - Location = Some { Uri = "3rd"; Range = mkRange' (1u, 2u) (3u, 4u) } - Command = None } |] - Position = { Line = 5u; Character = 10u } - Kind = Some InlayHintKind.Type - TextEdits = - Some - [| { Range = mkRange' (5u, 10u) (6u, 5u); NewText = "foo bar" } - { Range = mkRange' (5u, 0u) (5u, 2u); NewText = "baz" } |] - Tooltip = Some(U2.C2 { Kind = MarkupKind.PlainText; Value = "some tooltip" }) - PaddingLeft = Some true - PaddingRight = Some false - Data = Some(JToken.FromObject "some data") } - - let allLsp: obj[] = [| initializeParams; inlayHint |] + """ + } + ) + Location = Some { Uri = "3rd"; Range = mkRange' (1u, 2u) (3u, 4u) } + Command = None + } + |] + Position = { Line = 5u; Character = 10u } + Kind = Some InlayHintKind.Type + TextEdits = + Some [| + { Range = mkRange' (5u, 10u) (6u, 5u); NewText = "foo bar" } + { Range = mkRange' (5u, 0u) (5u, 2u); NewText = "baz" } + |] + Tooltip = Some(U2.C2 { Kind = MarkupKind.PlainText; Value = "some tooltip" }) + PaddingLeft = Some true + PaddingRight = Some false + Data = Some(JToken.FromObject "some data") + } + + let allLsp: obj[] = [| + initializeParams + inlayHint + |] /// Some complex data which covers all converters let example = Example.createData (1234, 9, 5) @@ -570,11 +693,20 @@ type MultipleTypesBenchmarks() = let withCounts (counts) data = data - |> Array.collect (fun data -> counts |> Array.map (fun count -> [| box count; box data |])) + |> Array.collect (fun data -> + counts + |> Array.map (fun count -> [| + box count + box data + |]) + ) member _.AllLsp_Roundtrip() = for o in allLsp do - let json = inlayHint |> serialize + let json = + inlayHint + |> serialize + let res = json.ToObject(o.GetType(), jsonRpcFormatter.JsonSerializer) () @@ -586,7 +718,10 @@ type MultipleTypesBenchmarks() = b.AllLsp_Roundtrip() member _.Example_Roundtrip() = - let json = example |> serialize + let json = + example + |> serialize + let res = json.ToObject(example.GetType(), jsonRpcFormatter.JsonSerializer) () @@ -602,44 +737,74 @@ type MultipleTypesBenchmarks() = [] member _.Option_Roundtrips(count: int) = for _ in 1..count do - let json = option |> serialize + let json = + option + |> serialize + let _ = json.ToObject(option.GetType(), jsonRpcFormatter.JsonSerializer) () member _.SingleCaseUnion_ArgumentsSource() = - [| Example.SingleCaseUnion.Ipsum; Example.SingleCaseUnion.Lorem |] - |> withCounts [| 1; 50 |] + [| + Example.SingleCaseUnion.Ipsum + Example.SingleCaseUnion.Lorem + |] + |> withCounts [| + 1 + 50 + |] [] [] member _.SingleCaseUnion_Roundtrips(count: int, data: Example.SingleCaseUnion) = for _ in 1..count do - let json = data |> serialize + let json = + data + |> serialize + let _ = json.ToObject(typeof, jsonRpcFormatter.JsonSerializer) () member _.ErasedUnion_ArgumentsSource() = - [| Example.ErasedUnionData.Alpha "foo" - Example.ErasedUnionData.Beta 42 - Example.ErasedUnionData.Gamma true - Example.ErasedUnionData.Delta 3.14 - Example.ErasedUnionData.Epsilon - { RequiredValue = "foo" - OptionalValue = None - AnotherOptionalValue = None - FinalOptionalValue = None } |] - |> withCounts [| 1; 50 |] + [| + Example.ErasedUnionData.Alpha "foo" + Example.ErasedUnionData.Beta 42 + Example.ErasedUnionData.Gamma true + Example.ErasedUnionData.Delta 3.14 + Example.ErasedUnionData.Epsilon { + RequiredValue = "foo" + OptionalValue = None + AnotherOptionalValue = None + FinalOptionalValue = None + } + |] + |> withCounts [| + 1 + 50 + |] [] [] member _.ErasedUnion_Roundtrips(count: int, data: Example.ErasedUnionData) = for _ in 1..count do - let json = data |> serialize + let json = + data + |> serialize + let _ = json.ToObject(typeof, jsonRpcFormatter.JsonSerializer) () let run (args: string[]) = - let switcher = BenchmarkSwitcher.FromTypes([| typeof; typeof |]) - switcher.Run(args) |> ignore + let switcher = + BenchmarkSwitcher.FromTypes( + [| + typeof + typeof + |] + ) + + switcher.Run(args) + |> ignore + 0 \ No newline at end of file diff --git a/tests/Ionide.LanguageServerProtocol.Tests.fsproj b/tests/Ionide.LanguageServerProtocol.Tests.fsproj index ad46e5f..3d5520d 100644 --- a/tests/Ionide.LanguageServerProtocol.Tests.fsproj +++ b/tests/Ionide.LanguageServerProtocol.Tests.fsproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0;net9.0 false diff --git a/tests/Program.fs b/tests/Program.fs index 61f1750..b171d31 100644 --- a/tests/Program.fs +++ b/tests/Program.fs @@ -6,11 +6,20 @@ open Expecto.Tests let main args = let (|ShouldRunBenchmarks|_|) (args: string[]) = let nArgs = args.Length - let markers = [| "--benchmark"; "--benchmarks"; "-b" |] + + let markers = [| + "--benchmark" + "--benchmarks" + "-b" + |] let args = args - |> Array.filter (fun arg -> markers |> Array.contains arg |> not) + |> Array.filter (fun arg -> + markers + |> Array.contains arg + |> not + ) if args.Length = nArgs then None else Some args diff --git a/tests/Shotgun.fs b/tests/Shotgun.fs index 272976d..952e60a 100644 --- a/tests/Shotgun.fs +++ b/tests/Shotgun.fs @@ -22,15 +22,25 @@ type Gens = Arb.Default.Derive<'T>() else Arb.Default.Derive<'T>() - |> Arb.filter (fun v -> (box v) <> null) + |> Arb.filter (fun v -> + (box v) + <> null + ) static member JToken() : Arbitrary = // actual value doesn't matter -> handled by user // and complexer JTokens cannot be directly compared with `=` - JToken.FromObject(123) |> Gen.constant |> Arb.fromGen + JToken.FromObject(123) + |> Gen.constant + |> Arb.fromGen + + static member String() : Arbitrary = + Arb.Default.String() + |> Arb.filter (fun s -> not (isNull s)) - static member String() : Arbitrary = Arb.Default.String() |> Arb.filter (fun s -> not (isNull s)) - static member Float() : Arbitrary = Arb.Default.NormalFloat() |> Arb.convert float NormalFloat + static member Float() : Arbitrary = + Arb.Default.NormalFloat() + |> Arb.convert float NormalFloat static member Uri() : Arbitrary = // actual value doesn't matter -> always use example uri @@ -39,31 +49,54 @@ type Gens = |> Arb.fromGen static member CreateFile() : Arbitrary = - let create annotationId uri options : CreateFile = { AnnotationId = annotationId; Uri = uri; Options = options ; Kind = "create" } - Gen.map3 create Arb.generate Arb.generate Arb.generate |> Arb.fromGen + let create annotationId uri options : CreateFile = { + AnnotationId = annotationId + Uri = uri + Options = options + Kind = "create" + } + + Gen.map3 create Arb.generate Arb.generate Arb.generate + |> Arb.fromGen static member RenameFile() : Arbitrary = - let create annotationId oldUri newUri options : RenameFile = { AnnotationId = annotationId; OldUri = oldUri; NewUri = newUri; Options = options ; Kind = "rename" } - Gen.map4 create Arb.generate Arb.generate Arb.generate Arb.generate |> Arb.fromGen + let create annotationId oldUri newUri options : RenameFile = { + AnnotationId = annotationId + OldUri = oldUri + NewUri = newUri + Options = options + Kind = "rename" + } + + Gen.map4 create Arb.generate Arb.generate Arb.generate Arb.generate + |> Arb.fromGen static member DeleteFile() : Arbitrary = - let create annotationId uri options : DeleteFile = { AnnotationId = annotationId; Uri = uri; Options = options ; Kind = "delete" } - Gen.map3 create Arb.generate Arb.generate Arb.generate |> Arb.fromGen + let create annotationId uri options : DeleteFile = { + AnnotationId = annotationId + Uri = uri + Options = options + Kind = "delete" + } + + Gen.map3 create Arb.generate Arb.generate Arb.generate + |> Arb.fromGen static member DocumentSymbol() : Arbitrary = // DocumentSymbol is recursive -> Stack overflow when default generation // https://fscheck.github.io/FsCheck/TestData.html#Generating-recursive-data-types let maxDepth = 5 - let create name detail kind range selectionRange children = - { Name = name - Detail = detail - Kind = kind - Tags = None - Deprecated = None - Range = range - SelectionRange = selectionRange - Children = children } + let create name detail kind range selectionRange children = { + Name = name + Detail = detail + Kind = kind + Tags = None + Deprecated = None + Range = range + SelectionRange = selectionRange + Children = children + } let genDocSymbol = Gen.map6 create Arb.generate Arb.generate Arb.generate Arb.generate Arb.generate // Children is still open @@ -71,12 +104,22 @@ type Gens = let size = min size maxDepth if size <= 0 then - genDocSymbol (Gen.oneof [ Gen.constant (None); Gen.constant (Some [||]) ]) + genDocSymbol ( + Gen.oneof [ + Gen.constant (None) + Gen.constant (Some [||]) + ] + ) else - let children = gen (size - 1) |> Gen.arrayOf |> Gen.optionOf + let children = + gen (size - 1) + |> Gen.arrayOf + |> Gen.optionOf + genDocSymbol children - Gen.sized gen |> Arb.fromGen + Gen.sized gen + |> Arb.fromGen static member SelectionRange() : Arbitrary = let maxDepth = 5 @@ -89,15 +132,22 @@ type Gens = if size <= 0 then genSelectionRange (Gen.constant None) else - let parent = gen (size - 1) |> Gen.optionOf + let parent = + gen (size - 1) + |> Gen.optionOf + genSelectionRange parent - Gen.sized gen |> Arb.fromGen + Gen.sized gen + |> Arb.fromGen let private fsCheckConfig = { FsCheckConfig.defaultConfig with arbitrary = [ typeof ] } type private Roundtripper = - static member ThereAndBackAgain(input: 'a) = input |> serialize |> deserialize<'a> + static member ThereAndBackAgain(input: 'a) = + input + |> serialize + |> deserialize<'a> static member TestThereAndBackAgain(input: 'a) = let output = Roundtripper.ThereAndBackAgain input @@ -111,38 +161,50 @@ type private Roundtripper = testPropertyWithConfig fsCheckConfig name (Roundtripper.TestThereAndBackAgain<'a>) let tests = - testList - "shotgun" - [ - // Type Abbreviations get erased - // -> not available as type and don't get pick up below - // -> specify manual - let abbrevTys = - [| nameof DocumentUri, typeof - nameof DocumentSelector, typeof - nameof TextDocumentCodeActionResult, typeof - - |] - - let tys = - let shouldTestType (t: Type) = - Utils.isLspType [ not << Lsp.Is.Generic; not << Lsp.Is.Nested ] t - && t.Name = "ApplyWorkspaceEditParams" - - - let example = typeof - let ass = example.Assembly - - ass.GetTypes() - |> Array.filter shouldTestType - |> Array.map (fun t -> t.Name, t) - |> Array.append abbrevTys - |> Array.sortBy fst - - let propTester = - typeof - .GetMethod(nameof (Roundtripper.TestProperty), BindingFlags.Static ||| BindingFlags.NonPublic) - - for (name, ty) in tys do - let m = propTester.MakeGenericMethod([| ty |]) - m.Invoke(null, [| name |]) |> unbox ] \ No newline at end of file + testList "shotgun" [ + // Type Abbreviations get erased + // -> not available as type and don't get pick up below + // -> specify manual + let abbrevTys = [| + nameof DocumentUri, typeof + nameof DocumentSelector, typeof + nameof TextDocumentCodeActionResult, typeof + + |] + + let tys = + let shouldTestType (t: Type) = + Utils.isLspType + [ + not + << Lsp.Is.Generic + not + << Lsp.Is.Nested + ] + t + && t.Name = "ApplyWorkspaceEditParams" + + + let example = typeof + let ass = example.Assembly + + ass.GetTypes() + |> Array.filter shouldTestType + |> Array.map (fun t -> t.Name, t) + |> Array.append abbrevTys + |> Array.sortBy fst + + let propTester = + typeof + .GetMethod( + nameof (Roundtripper.TestProperty), + BindingFlags.Static + ||| BindingFlags.NonPublic + ) + + for (name, ty) in tys do + let m = propTester.MakeGenericMethod([| ty |]) + + m.Invoke(null, [| name |]) + |> unbox + ] \ No newline at end of file diff --git a/tests/StartWithSetup.fs b/tests/StartWithSetup.fs index 09dae2a..9334223 100644 --- a/tests/StartWithSetup.fs +++ b/tests/StartWithSetup.fs @@ -14,7 +14,9 @@ open StreamJsonRpc.Protocol type TestLspClient(sendServerNotification: ClientNotificationSender, sendServerRequest: ClientRequestSender) = inherit LspClient() -let setupEndpoints (_: LspClient) : Map = [] |> Map.ofList +let setupEndpoints (_: LspClient) : Map = + [] + |> Map.ofList let requestWithContentLength (request: string) = $"Content-Length: {request.Length}\r\n\r\n{request}" @@ -26,80 +28,85 @@ let exitRequest = @"{""jsonrpc"":""2.0"",""method"":""exit"",""id"":1}" type Foo = { bar: string; baz: string } let tests = - testList - "startWithSetup" - [ testAsync "can start up multiple times in same process" { - use inputServerPipe1 = new AnonymousPipeServerStream() - use inputClientPipe1 = new AnonymousPipeClientStream(inputServerPipe1.GetClientHandleAsString()) - use outputServerPipe1 = new AnonymousPipeServerStream() + testList "startWithSetup" [ + testAsync "can start up multiple times in same process" { + use inputServerPipe1 = new AnonymousPipeServerStream() + use inputClientPipe1 = new AnonymousPipeClientStream(inputServerPipe1.GetClientHandleAsString()) + use outputServerPipe1 = new AnonymousPipeServerStream() - use inputWriter1 = new StreamWriter(inputServerPipe1) - inputWriter1.AutoFlush <- true + use inputWriter1 = new StreamWriter(inputServerPipe1) + inputWriter1.AutoFlush <- true - let server1 = - async { - let result = (startWithSetup setupEndpoints inputClientPipe1 outputServerPipe1 TestLspClient defaultRpc) - Expect.equal (int result) 0 "server startup failed" - } + let server1 = + async { + let result = + startWithSetup setupEndpoints inputClientPipe1 outputServerPipe1 (fun x -> new TestLspClient(x)) defaultRpc - let! server1Async = Async.StartChild(server1) + Expect.equal (int result) 0 "server startup failed" + } - use inputServerPipe2 = new AnonymousPipeServerStream() - use inputClientPipe2 = new AnonymousPipeClientStream(inputServerPipe2.GetClientHandleAsString()) - use outputServerPipe2 = new AnonymousPipeServerStream() + let! server1Async = Async.StartChild(server1) - use inputWriter2 = new StreamWriter(inputServerPipe2) - inputWriter2.AutoFlush <- true + use inputServerPipe2 = new AnonymousPipeServerStream() + use inputClientPipe2 = new AnonymousPipeClientStream(inputServerPipe2.GetClientHandleAsString()) + use outputServerPipe2 = new AnonymousPipeServerStream() - let server2 = - async { - let result = (startWithSetup setupEndpoints inputClientPipe2 outputServerPipe2 TestLspClient defaultRpc) - Expect.equal (int result) 0 "server startup failed" - } + use inputWriter2 = new StreamWriter(inputServerPipe2) + inputWriter2.AutoFlush <- true - let! server2Async = Async.StartChild(server2) + let server2 = + async { + let result = + (startWithSetup setupEndpoints inputClientPipe2 outputServerPipe2 (fun x -> new TestLspClient(x)) defaultRpc) - inputWriter1.Write(requestWithContentLength (shutdownRequest)) - inputWriter1.Write(requestWithContentLength (exitRequest)) + Expect.equal (int result) 0 "server startup failed" + } - inputWriter2.Write(requestWithContentLength (shutdownRequest)) - inputWriter2.Write(requestWithContentLength (exitRequest)) + let! server2Async = Async.StartChild(server2) - do! server1Async - do! server2Async - } + inputWriter1.Write(requestWithContentLength (shutdownRequest)) + inputWriter1.Write(requestWithContentLength (exitRequest)) - testCaseAsync "Handle JsonSerializationError gracefully" - <| async { + inputWriter2.Write(requestWithContentLength (shutdownRequest)) + inputWriter2.Write(requestWithContentLength (exitRequest)) - let struct (server, client) = FullDuplexStream.CreatePair() + do! server1Async + do! server2Async + } - use jsonRpcHandler = new HeaderDelimitedMessageHandler(server, defaultJsonRpcFormatter ()) - use serverRpc = defaultRpc jsonRpcHandler + testCaseAsync "Handle JsonSerializationError gracefully" + <| async { - let functions: Map = Map [ "lol", Func(fun (foo: Foo) -> foo) :> Delegate ] + let struct (server, client) = FullDuplexStream.CreatePair() - functions - |> Seq.iter (fun (KeyValue(name, rpcDelegate)) -> - let rpcAttribute = JsonRpcMethodAttribute(name) - rpcAttribute.UseSingleObjectParameterDeserialization <- true - serverRpc.AddLocalRpcMethod(rpcDelegate.GetMethodInfo(), rpcDelegate.Target, rpcAttribute)) + use jsonRpcHandler = new HeaderDelimitedMessageHandler(server, defaultJsonRpcFormatter ()) + use serverRpc = defaultRpc jsonRpcHandler - serverRpc.StartListening() - let create (s: Stream) : JsonRpc = JsonRpc.Attach(s, target = null) - let clientRpc: JsonRpc = create client + let functions: Map = Map [ "lol", Func(fun (foo: Foo) -> foo) :> Delegate ] - try - let! (_: Foo) = - clientRpc.InvokeWithParameterObjectAsync("lol", {| bar = "lol" |}) - |> Async.AwaitTask + functions + |> Seq.iter (fun (KeyValue(name, rpcDelegate)) -> + let rpcAttribute = JsonRpcMethodAttribute(name) + rpcAttribute.UseSingleObjectParameterDeserialization <- true + serverRpc.AddLocalRpcMethod(rpcDelegate.GetMethodInfo(), rpcDelegate.Target, rpcAttribute) + ) - () - with Flatten(:? RemoteInvocationException as ex) -> - Expect.equal - ex.Message - "Required property 'baz' not found in JSON. Path ''." - "Get parse error message and not crash process" + serverRpc.StartListening() + let create (s: Stream) : JsonRpc = JsonRpc.Attach(s, target = null) + let clientRpc: JsonRpc = create client - Expect.equal ex.ErrorCode ((int) JsonRpcErrorCode.ParseError) "Should get parse error code" - } ] \ No newline at end of file + try + let! (_: Foo) = + clientRpc.InvokeWithParameterObjectAsync("lol", {| bar = "lol" |}) + |> Async.AwaitTask + + () + with Flatten(:? RemoteInvocationException as ex) -> + Expect.equal + ex.Message + "Required property 'baz' not found in JSON. Path ''." + "Get parse error message and not crash process" + + Expect.equal ex.ErrorCode ((int) JsonRpcErrorCode.ParseError) "Should get parse error code" + } + ] \ No newline at end of file diff --git a/tests/Tests.fs b/tests/Tests.fs index 0de2115..6fa1953 100644 --- a/tests/Tests.fs +++ b/tests/Tests.fs @@ -31,11 +31,12 @@ 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 } +type private PrivateRecord = { + [] + Data: string + [] + Value: int +} [] type EU2 = EU2 of string * int @@ -59,24 +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 ExtensionDataField = - { - Name: string - Value: string option - /// Note: Must be mutable to allow deserializing to something `null` (uninitialized) - [] - mutable AdditionalData: IDictionary - } +type RequiredAttributeFields = { + NoProperty: string + NoPropertyOption: string option + [] + DisallowNull: string + [] + Always: string option + [] + AllowNull: string +} + +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 @@ -92,789 +93,955 @@ type ExtensionDataField = x.AdditionalData <- Map.empty let private serializationTests = - testList - "(de)serialization" - [ - - /// Decapitalizes first letter - 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 - jObj.Add(JProperty(name |> mkLower, value)) - json - - let tryGetProperty (name: string) (json: JToken) = - let jObj = json :?> JObject - jObj.Property(name |> mkLower) |> Option.ofObj - - let logJson (json: JToken) = - printfn $"%s{json.ToString()}" - json - - let thereAndBackAgain (input: 'a) : 'a = input |> serialize |> deserialize - - let testThereAndBackAgain input = + testList "(de)serialization" [ + + /// Decapitalizes first letter + 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 + + jObj.Add( + JProperty( + name + |> mkLower, + value + ) + ) + + json + + let tryGetProperty (name: string) (json: JToken) = + let jObj = json :?> JObject + + jObj.Property( + name + |> mkLower + ) + |> Option.ofObj + + let logJson (json: JToken) = + printfn $"%s{json.ToString()}" + json + + let thereAndBackAgain (input: 'a) : 'a = + input + |> serialize + |> deserialize + + let testThereAndBackAgain input = + let output = thereAndBackAgain input + Expect.equal output input "Input -> serialize -> deserialize should be Input again" + + testList "mutable field" [ + // Newtonsoft.Json serializes all public fields + // F# emits a public field for mutable data: + // `{ mutable Data: int }` + // -> public property `Data` & public field `Data@` + // -> Data gets serialized twice + // Solution: exclude fields with trailing `@` (-> consider private) + testCase "doesn't serialize backing field" + <| fun _ -> + let o: MutableField = { MutableField.Name = "foo"; Value = 42 } + + let json = + o + |> serialize + :?> JObject + + let props = + json.Properties() + |> Seq.map (fun p -> p.Name) + + let expected = [ + "name" + "value" + ] + + Expect.sequenceEqual props expected "backing field should not get serialized" + ] + + testList "ExtensionData" [ + let testThereAndBackAgain (input: ExtensionDataField) = let output = thereAndBackAgain input - Expect.equal output input "Input -> serialize -> deserialize should be Input again" - - testList - "mutable field" - [ - // Newtonsoft.Json serializes all public fields - // F# emits a public field for mutable data: - // `{ mutable Data: int }` - // -> public property `Data` & public field `Data@` - // -> Data gets serialized twice - // Solution: exclude fields with trailing `@` (-> consider private) - testCase "doesn't serialize backing field" - <| fun _ -> - let o: MutableField = { MutableField.Name = "foo"; Value = 42 } - let json = o |> serialize :?> JObject - let props = json.Properties() |> Seq.map (fun p -> p.Name) - let expected = [ "name"; "value" ] - Expect.sequenceEqual props expected "backing field should not get serialized" ] - - testList - "ExtensionData" - [ 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) - - let (input, inputAdditionalData) = extractAdditionalData input - let (output, outputAdditionalData) = extractAdditionalData output - - Expect.equal - output - input - "Input -> serialize -> deserialize should be Input again (ignoring AdditionalData)" - - Expect.sequenceEqual outputAdditionalData inputAdditionalData "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 } - - 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 } - - testThereAndBackAgain input - - testCase "can (de)serialize when just required fields" - <| fun _ -> - let input = { ExtensionDataField.Name = "foo"; Value = None; AdditionalData = 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 } - - testThereAndBackAgain input - - testCase "fails when not required field" - <| fun _ -> - let json = JObject(JProperty("value", "bar"), JProperty("alpha", "lorem"), JProperty("beta", "ipsum")) - - Expect.throws - (fun _ -> json |> deserialize |> ignore) - "Should throw when required property is missing" - - 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 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" - - testCase "AdditionalData is not null when no additional properties" - <| fun _ -> - let json = JObject(JProperty("name", "foo")) - let output = json |> deserialize - Expect.isNotNull output.AdditionalData "Empty AdditionalData should not be null" ] - - testList - "capitalization" - [ 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 someValue = json.Property("someValue") - - Expect.equal someValue.Name "someValue" "someValue should be lowercase start, but keep upper case 2nd word" - - testCase "keeps capitalization of Map" - <| fun _ -> - let keys = - [| "foo"; "Bar"; "BAZ"; "SomeValue"; "anotherValue"; "l"; "P" |] - |> Array.sort - - let m = keys |> Seq.mapi (fun i k -> (k, i)) |> Map.ofSeq - let json = serialize m :?> JObject - - let propNames = - json.Properties() - |> Seq.map (fun p -> p.Name) - |> Seq.toArray - |> Array.sort - - Expect.equal propNames keys "Property names from Map should be unchanged" - testCase "can deserialize Map back" - <| fun _ -> - let m = - [| "foo"; "Bar"; "BAZ"; "SomeValue"; "anotherValue"; "l"; "P" |] - |> Seq.mapi (fun i k -> (k, i)) - |> Map.ofSeq - - testThereAndBackAgain m ] - - testList - "Optional & Required Fields" - [ testList - "Two Required" - [ testCase "fails when required field is not given" - <| fun _ -> - 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" - testCase "doesn't fail with additional fields" - <| fun _ -> - let input = { AllRequired.RequiredName = "foo"; RequiredValue = 42 } - let json = serialize input |> addProperty "myProp" "hello world" - - json |> deserialize |> ignore ] - - testList - "One Required, One Optional" - [ testCase "doesn't fail when optional field not given" - <| fun _ -> - let input = { OneOptional.RequiredName = "foo"; OptionalValue = Some 42 } - - let json = - serialize input - |> removeProperty (nameof input.OptionalValue) - - json |> deserialize |> ignore - testCase "fails when required field is not given" - <| fun _ -> - 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" - - testCase "doesn't fail with all fields" - <| fun _ -> - let input = { OneOptional.RequiredName = "foo"; OptionalValue = Some 42 } - let json = serialize input - json |> deserialize |> ignore - testCase "doesn't fail with additional properties" - <| fun _ -> - let input = { OneOptional.RequiredName = "foo"; OptionalValue = Some 42 } - - let json = - serialize input - |> addProperty "foo" "bar" - |> addProperty "baz" 42 - - json |> deserialize |> ignore ] - - testList - "Two Optional" - [ testCase "doesn't fail when one optional field not given" - <| fun _ -> - let input = { AllOptional.OptionalName = Some "foo"; OptionalValue = Some 42 } - - let json = - serialize input - |> removeProperty (nameof input.OptionalValue) - - json |> deserialize |> ignore - testCase "doesn't fail when all optional fields not given" - <| fun _ -> - let input = { AllOptional.OptionalName = Some "foo"; OptionalValue = Some 42 } - - let json = - serialize input - |> removeProperty (nameof input.OptionalName) - |> removeProperty (nameof input.OptionalValue) - - json |> deserialize |> ignore - testCase "doesn't emit optional missing fields" - <| fun _ -> - let input = { AllOptional.OptionalName = None; OptionalValue = None } - let json = serialize input - Expect.isEmpty (json.Children()) "There should be no properties" - - testCase "doesn't fail when all fields given" - <| fun _ -> - let input = { AllOptional.OptionalName = Some "foo"; OptionalValue = Some 42 } - let json = serialize input - json |> deserialize |> ignore - testCase "doesn't fail when additional properties" - <| fun _ -> - let input = { AllOptional.OptionalName = Some "foo"; OptionalValue = Some 42 } - - let json = - serialize input - |> addProperty "foo" "bar" - |> addProperty "baz" 42 - - json |> deserialize |> ignore - testCase "doesn't fail when no field but additional properties" - <| fun _ -> - let input = { AllOptional.OptionalName = Some "foo"; OptionalValue = Some 42 } - - let json = - serialize input - |> removeProperty (nameof input.OptionalName) - |> removeProperty (nameof input.OptionalValue) - |> addProperty "foo" "bar" - |> addProperty "baz" 42 - - json |> deserialize |> ignore ] - - 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") - ) - - json |> deserialize |> ignore - - testCase "No property fails when not provided" - <| fun _ -> - 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") - ) - - Expect.throws - (fun _ -> json |> deserialize |> ignore) - "No Property means required and should fail when not present" - - 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") - ) - - json |> deserialize |> ignore - - testCase "DisallowNull fails when null" - <| fun _ -> - 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") - ) - - Expect.throws - (fun _ -> json |> deserialize |> ignore) - "DisallowNull cannot be null" - - 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") - ) - - Expect.throws - (fun _ -> json |> deserialize |> ignore) - "Always is required despite Option" - - 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) - ) - - json |> deserialize |> ignore ] ] - - testList - "U2" - [ testCase "can (de)serialize U2.First" - <| fun _ -> - let input: U2 = U2.C1 42 - testThereAndBackAgain input - testCase "can (de)serialize U2.Second" - <| fun _ -> - let input: U2 = U2.C2 "foo" - testThereAndBackAgain input - testCase "deserialize to first type match" - <| fun _ -> - // Cannot distinguish between same type -> pick first - let input: U2 = U2.C2 42 - let output = thereAndBackAgain input - Expect.notEqual output input "First matching type gets matched" - testCase "deserialize Second int to first float" - <| fun _ -> - // Cannot distinguish between float and int - let input: U2 = U2.C2 42 - let output = thereAndBackAgain input - Expect.notEqual output input "First matching type gets matched" - - testCase "can (de)serialize Record1 in U2" - <| fun _ -> - let input: U2 = U2.C1 { Record1.Name = "foo"; Value = 42 } - testThereAndBackAgain input - - testCase "can (de)serialize Record1 in U2" - <| fun _ -> - let input: U2 = U2.C2 { Record1.Name = "foo"; Value = 42 } - testThereAndBackAgain input - - testCase "can (de)serialize Record1 in U2" - <| fun _ -> - let input: U2 = U2.C1 { Record1.Name = "foo"; Value = 42 } - testThereAndBackAgain input - - testCase "can deserialize to correct record" - <| fun _ -> - // Note: only possible because Records aren't compatible with each other. - // If Record2.Position optional -> gets deserialized to `Record2` because first match - let input: U2 = U2.C2 { Record1.Name = "foo"; Value = 42 } - testThereAndBackAgain input - testList - "optional" - [ testCase "doesn't emit optional missing member" - <| 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" - - testCase "can deserialize with optional missing member" - <| fun _ -> - let input: U2 = - U2.C2 { OneOptional.RequiredName = "foo"; OptionalValue = None } - - testThereAndBackAgain input - testCase "can deserialize with optional existing member" - <| fun _ -> - let input: U2 = - U2.C2 { OneOptional.RequiredName = "foo"; OptionalValue = Some 42 } - - testThereAndBackAgain input - testCase "fails with missing required value" - <| fun _ -> - let json = JToken.Parse """{"optionalValue": 42}""" - - Expect.throws - (fun _ -> json |> deserialize |> ignore) - "Should fail without required member" - - ] - - testList - "string vs int" - [ testCase "can deserialize int to U2" - <| fun _ -> - let input: U2 = U2.C1 42 - testThereAndBackAgain input - testCase "can deserialize string to U2" - <| fun _ -> - let input: U2 = U2.C2 "foo" - testThereAndBackAgain input - testCase "can deserialize 42 string to U2" - <| fun _ -> - let input: U2 = U2.C2 "42" - testThereAndBackAgain input - - testCase "can deserialize int to U2" - <| fun _ -> - let input: U2 = U2.C2 42 - testThereAndBackAgain input - testCase "can deserialize string to U2" - <| fun _ -> - let input: U2 = U2.C1 "foo" - testThereAndBackAgain input - testCase "can deserialize 42 string to U2" - <| fun _ -> - let input: U2 = U2.C1 "42" - testThereAndBackAgain input ] - testList - "string vs bool" - [ testCase "can deserialize bool to U2" - <| fun _ -> - let input: U2 = U2.C1 true - testThereAndBackAgain input - testCase "can deserialize string to U2" - <| fun _ -> - let input: U2 = U2.C2 "foo" - testThereAndBackAgain input - testCase "can deserialize true string to U2" - <| fun _ -> - let input: U2 = U2.C2 "true" - testThereAndBackAgain input - - testCase "can deserialize bool true to U2" - <| fun _ -> - let input: U2 = U2.C2 true - testThereAndBackAgain input - testCase "can deserialize bool false to U2" - <| fun _ -> - let input: U2 = U2.C2 false - testThereAndBackAgain input - testCase "can deserialize string to U2" - <| fun _ -> - let input: U2 = U2.C1 "foo" - testThereAndBackAgain input - testCase "can deserialize true string to U2" - <| fun _ -> - let input: U2 = U2.C1 "true" - testThereAndBackAgain input ] ] - - testList - "ErasedUnionConverter" - [ - // most tests in `U2` - testCase "cannot serialize case with more than one field" - <| fun _ -> - let input = EU2("foo", 42) - - Expect.throws - (fun _ -> - serialize input - |> fun t -> printfn "%A" (t.ToString()) - |> ignore) - "ErasedUnion with multiple fields should not serializable" - testCase "can (de)serialize struct union" - <| fun _ -> - let input = StructEU.Second "foo" - testThereAndBackAgain input ] - - testList - "SingleCaseUnionConverter" - [ testCase "can (de)serialize union with all zero field cases" - <| fun _ -> - let input = NoFields.Second - testThereAndBackAgain input ] - - testList - "JsonProperty" - [ testCase "keep null when serializing OptionalVersionedTextDocumentIdentifier" - <| fun _ -> - let textDoc = { OptionalVersionedTextDocumentIdentifier.Uri = "..."; Version = None } - 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 = + // 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) + + let (input, inputAdditionalData) = extractAdditionalData input + let (output, outputAdditionalData) = extractAdditionalData output + + Expect.equal output input "Input -> serialize -> deserialize should be Input again (ignoring AdditionalData)" + + Expect.sequenceEqual outputAdditionalData inputAdditionalData "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 + } + + 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 + } + + testThereAndBackAgain input + + testCase "can (de)serialize when just required fields" + <| fun _ -> + let input = { ExtensionDataField.Name = "foo"; Value = None; AdditionalData = 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 + } + + testThereAndBackAgain input + + testCase "fails when not required field" + <| fun _ -> + let json = JObject(JProperty("value", "bar"), JProperty("alpha", "lorem"), JProperty("beta", "ipsum")) + + Expect.throws + (fun _ -> + json + |> deserialize + |> ignore + ) + "Should throw when required property is missing" + + 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 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" + + testCase "AdditionalData is not null when no additional properties" + <| fun _ -> + let json = JObject(JProperty("name", "foo")) + + let output = + json + |> deserialize + + Expect.isNotNull output.AdditionalData "Empty AdditionalData should not be null" + ] + + testList "capitalization" [ + 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 someValue = json.Property("someValue") + + Expect.equal someValue.Name "someValue" "someValue should be lowercase start, but keep upper case 2nd word" + + testCase "keeps capitalization of Map" + <| fun _ -> + let keys = + [| + "foo" + "Bar" + "BAZ" + "SomeValue" + "anotherValue" + "l" + "P" + |] + |> Array.sort + + let m = + keys + |> Seq.mapi (fun i k -> (k, i)) + |> Map.ofSeq + + let json = serialize m :?> JObject + + let propNames = + json.Properties() + |> Seq.map (fun p -> p.Name) + |> Seq.toArray + |> Array.sort + + Expect.equal propNames keys "Property names from Map should be unchanged" + testCase "can deserialize Map back" + <| fun _ -> + let m = + [| + "foo" + "Bar" + "BAZ" + "SomeValue" + "anotherValue" + "l" + "P" + |] + |> Seq.mapi (fun i k -> (k, i)) + |> Map.ofSeq + + testThereAndBackAgain m + ] + + testList "Optional & Required Fields" [ + testList "Two Required" [ + testCase "fails when required field is not given" + <| fun _ -> + 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" + testCase "doesn't fail with additional fields" + <| fun _ -> + let input = { AllRequired.RequiredName = "foo"; RequiredValue = 42 } + + let json = + serialize input + |> addProperty "myProp" "hello world" + + json + |> deserialize + |> ignore + ] + + testList "One Required, One Optional" [ + testCase "doesn't fail when optional field not given" + <| fun _ -> + let input = { OneOptional.RequiredName = "foo"; OptionalValue = Some 42 } + + let json = + serialize input + |> removeProperty (nameof input.OptionalValue) + + json + |> deserialize + |> ignore + testCase "fails when required field is not given" + <| fun _ -> + let input = { OneOptional.RequiredName = "foo"; OptionalValue = Some 42 } + + let json = + serialize input + |> removeProperty (nameof input.RequiredName) + + Expect.throws + (fun _ -> json - |> tryGetProperty (nameof textDoc.Version) - |> Flip.Expect.wantSome "Property Version should exist" - - Expect.equal prop.Value.Type (JTokenType.Null) "Version should be null" - testCase "can deserialize null Version in OptioanlVersionedTextDocumentIdentifier" - <| fun _ -> - let textDoc = { OptionalVersionedTextDocumentIdentifier.Uri = "..."; Version = None } - testThereAndBackAgain textDoc - - testCase "serialize to name specified in JsonProperty in Response" - <| fun _ -> - let response: Response = { Version = "123"; Id = None; Error = None; Result = None } - let json = response |> serialize - // Version -> jsonrpc - Expect.isNone - (json |> tryGetProperty (nameof response.Version)) - "Version should exist, but instead as jsonrpc" - - Expect.isSome (json |> tryGetProperty "jsonrpc") "jsonrcp should exist because of Version" - // Id & Error optional -> not in json - Expect.isNone (json |> tryGetProperty (nameof response.Id)) "None Id shouldn't be in json" - Expect.isNone (json |> tryGetProperty (nameof response.Error)) "None Error shouldn't be in json" - // Result even when null/None - let prop = + |> deserialize + |> ignore + ) + "Should fail without all required fields" + + testCase "doesn't fail with all fields" + <| fun _ -> + let input = { OneOptional.RequiredName = "foo"; OptionalValue = Some 42 } + let json = serialize input + + json + |> deserialize + |> ignore + testCase "doesn't fail with additional properties" + <| fun _ -> + let input = { OneOptional.RequiredName = "foo"; OptionalValue = Some 42 } + + let json = + serialize input + |> addProperty "foo" "bar" + |> addProperty "baz" 42 + + json + |> deserialize + |> ignore + ] + + testList "Two Optional" [ + testCase "doesn't fail when one optional field not given" + <| fun _ -> + let input = { AllOptional.OptionalName = Some "foo"; OptionalValue = Some 42 } + + let json = + serialize input + |> removeProperty (nameof input.OptionalValue) + + json + |> deserialize + |> ignore + testCase "doesn't fail when all optional fields not given" + <| fun _ -> + let input = { AllOptional.OptionalName = Some "foo"; OptionalValue = Some 42 } + + let json = + serialize input + |> removeProperty (nameof input.OptionalName) + |> removeProperty (nameof input.OptionalValue) + + json + |> deserialize + |> ignore + testCase "doesn't emit optional missing fields" + <| fun _ -> + let input = { AllOptional.OptionalName = None; OptionalValue = None } + let json = serialize input + Expect.isEmpty (json.Children()) "There should be no properties" + + testCase "doesn't fail when all fields given" + <| fun _ -> + let input = { AllOptional.OptionalName = Some "foo"; OptionalValue = Some 42 } + let json = serialize input + + json + |> deserialize + |> ignore + testCase "doesn't fail when additional properties" + <| fun _ -> + let input = { AllOptional.OptionalName = Some "foo"; OptionalValue = Some 42 } + + let json = + serialize input + |> addProperty "foo" "bar" + |> addProperty "baz" 42 + + json + |> deserialize + |> ignore + testCase "doesn't fail when no field but additional properties" + <| fun _ -> + let input = { AllOptional.OptionalName = Some "foo"; OptionalValue = Some 42 } + + let json = + serialize input + |> removeProperty (nameof input.OptionalName) + |> removeProperty (nameof input.OptionalValue) + |> addProperty "foo" "bar" + |> addProperty "baz" 42 + + json + |> deserialize + |> ignore + ] + + 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") + ) + + json + |> deserialize + |> ignore + + testCase "No property fails when not provided" + <| fun _ -> + 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") + ) + + Expect.throws + (fun _ -> 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" - testCase "can (de)serialize empty response" - <| fun _ -> - let response: Response = { Version = "123"; Id = None; Error = None; Result = None } - testThereAndBackAgain response - testCase "can (de)serialize Response.Result" - <| fun _ -> - let response: Response = - { Version = "123" - Id = None - Error = None - Result = Some(JToken.Parse "\"some result\"") } - - testThereAndBackAgain response - testCase "can (de)serialize Result when Error is None" - <| fun _ -> - // Note: It's either `Error` or `Result`, but not both together - let response: Response = - { Version = "123" - Id = Some 42 - Error = None - Result = Some(JToken.Parse "\"some result\"") } - - testThereAndBackAgain response - testCase "can (de)serialize Error when error is Some" - <| fun _ -> - let response: Response = - { Version = "123" - Id = Some 42 - Error = Some { Code = 13; Message = "oh no"; Data = Some(JToken.Parse "\"some data\"") } - Result = None } - - testThereAndBackAgain response - testCase "doesn't serialize Result when Error is Some" - <| fun _ -> - 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\"") } - - let output = thereAndBackAgain response - Expect.isSome output.Error "Error should be serialized" - Expect.isNone output.Result "Result should not be serialized when Error is Some" ] - - testList - (nameof InlayHint) - [ - // Life of InlayHint: - // * output of `textDocument/inlayHint` (`InlayHint[]`) - // * input of `inlayHint/resolve` - // * output of `inlayHint/resolve` - // -> must be serializable as well as deserializable - testCase "can (de)serialize minimal InlayHint" - <| fun _ -> - let theInlayHint: InlayHint = - { Label = U2.C1 "test" - Position = { Line = 0u; Character = 0u } - Kind = None - TextEdits = None - Tooltip = None - PaddingLeft = None - PaddingRight = None - Data = None } - - testThereAndBackAgain theInlayHint - testCase "can roundtrip InlayHint with all fields (simple)" - <| fun _ -> - let theInlayHint: InlayHint = - { Label = U2.C1 "test" - Position = { Line = 5u; Character = 10u } - Kind = Some InlayHintKind.Parameter - TextEdits = - Some - [| { Range = { Start = { Line = 5u; Character = 10u }; End = { Line = 6u; Character = 5u } } - NewText = "foo bar" } - { Range = { Start = { Line = 4u; Character = 0u }; End = { Line = 5u; Character = 2u } } - NewText = "baz" } |] - Tooltip = Some(U2.C1 "tooltipping") - PaddingLeft = Some true - PaddingRight = Some false - Data = Some(JToken.FromObject "some data") } - - testThereAndBackAgain theInlayHint - testCase "can keep Data with JToken" - <| fun _ -> - // JToken doesn't use structural equality - // -> Expecto equal check fails even when same content in complex JToken - let data = - { InlayHintData.TextDocument = { Uri = "..." } - Range = { Start = { Line = 5u; Character = 7u }; End = { Line = 5u; Character = 10u } } } - - let theInlayHint: InlayHint = - { Label = U2.C1 "test" - Position = { Line = 0u; Character = 0u } - Kind = None - TextEdits = None - Tooltip = None - PaddingLeft = None - PaddingRight = None - Data = Some(JToken.FromObject data) } - - let output = thereAndBackAgain theInlayHint - - let outputData = - output.Data - |> Option.map (fun t -> t.ToObject()) - - Expect.equal outputData (Some data) "Data should not change" - testCase "can roundtrip InlayHint with all fields (complex)" - <| fun _ -> - let theInlayHint: InlayHint = - { Label = - U2.C2 - [| { InlayHintLabelPart.Value = "1st label" - Tooltip = Some(U2.C1 "1st label tooltip") - Location = Some { Uri = "1st"; Range = mkRange' (1u, 2u) (3u, 4u) } - Command = None } - { Value = "2nd label" - Tooltip = Some(U2.C1 "1st label tooltip") - Location = Some { Uri = "2nd"; Range = mkRange' (5u, 8u) (10u, 9u) } - Command = Some { Title = "2nd command"; Command = "foo"; Arguments = None } } - { InlayHintLabelPart.Value = "3rd label" - Tooltip = - Some( - U2.C2 - { Kind = MarkupKind.Markdown - Value = - """ + |> deserialize + |> ignore + ) + "No Property means required and should fail when not present" + + 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") + ) + + json + |> deserialize + |> ignore + + testCase "DisallowNull fails when null" + <| fun _ -> + 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") + ) + + Expect.throws + (fun _ -> + json + |> deserialize + |> ignore + ) + "DisallowNull cannot be null" + + 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") + ) + + Expect.throws + (fun _ -> + json + |> deserialize + |> ignore + ) + "Always is required despite Option" + + 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) + ) + + json + |> deserialize + |> ignore + ] + ] + + testList "U2" [ + testCase "can (de)serialize U2.First" + <| fun _ -> + let input: U2 = U2.C1 42 + testThereAndBackAgain input + testCase "can (de)serialize U2.Second" + <| fun _ -> + let input: U2 = U2.C2 "foo" + testThereAndBackAgain input + testCase "deserialize to first type match" + <| fun _ -> + // Cannot distinguish between same type -> pick first + let input: U2 = U2.C2 42 + let output = thereAndBackAgain input + Expect.notEqual output input "First matching type gets matched" + testCase "deserialize Second int to first float" + <| fun _ -> + // Cannot distinguish between float and int + let input: U2 = U2.C2 42 + let output = thereAndBackAgain input + Expect.notEqual output input "First matching type gets matched" + + testCase "can (de)serialize Record1 in U2" + <| fun _ -> + let input: U2 = U2.C1 { Record1.Name = "foo"; Value = 42 } + testThereAndBackAgain input + + testCase "can (de)serialize Record1 in U2" + <| fun _ -> + let input: U2 = U2.C2 { Record1.Name = "foo"; Value = 42 } + testThereAndBackAgain input + + testCase "can (de)serialize Record1 in U2" + <| fun _ -> + let input: U2 = U2.C1 { Record1.Name = "foo"; Value = 42 } + testThereAndBackAgain input + + testCase "can deserialize to correct record" + <| fun _ -> + // Note: only possible because Records aren't compatible with each other. + // If Record2.Position optional -> gets deserialized to `Record2` because first match + let input: U2 = U2.C2 { Record1.Name = "foo"; Value = 42 } + testThereAndBackAgain input + testList "optional" [ + testCase "doesn't emit optional missing member" + <| 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" + + testCase "can deserialize with optional missing member" + <| fun _ -> + let input: U2 = U2.C2 { OneOptional.RequiredName = "foo"; OptionalValue = None } + + testThereAndBackAgain input + testCase "can deserialize with optional existing member" + <| fun _ -> + let input: U2 = U2.C2 { OneOptional.RequiredName = "foo"; OptionalValue = Some 42 } + + testThereAndBackAgain input + testCase "fails with missing required value" + <| fun _ -> + let json = JToken.Parse """{"optionalValue": 42}""" + + Expect.throws + (fun _ -> + json + |> deserialize + |> ignore + ) + "Should fail without required member" + + ] + + testList "string vs int" [ + testCase "can deserialize int to U2" + <| fun _ -> + let input: U2 = U2.C1 42 + testThereAndBackAgain input + testCase "can deserialize string to U2" + <| fun _ -> + let input: U2 = U2.C2 "foo" + testThereAndBackAgain input + testCase "can deserialize 42 string to U2" + <| fun _ -> + let input: U2 = U2.C2 "42" + testThereAndBackAgain input + + testCase "can deserialize int to U2" + <| fun _ -> + let input: U2 = U2.C2 42 + testThereAndBackAgain input + testCase "can deserialize string to U2" + <| fun _ -> + let input: U2 = U2.C1 "foo" + testThereAndBackAgain input + testCase "can deserialize 42 string to U2" + <| fun _ -> + let input: U2 = U2.C1 "42" + testThereAndBackAgain input + ] + testList "string vs bool" [ + testCase "can deserialize bool to U2" + <| fun _ -> + let input: U2 = U2.C1 true + testThereAndBackAgain input + testCase "can deserialize string to U2" + <| fun _ -> + let input: U2 = U2.C2 "foo" + testThereAndBackAgain input + testCase "can deserialize true string to U2" + <| fun _ -> + let input: U2 = U2.C2 "true" + testThereAndBackAgain input + + testCase "can deserialize bool true to U2" + <| fun _ -> + let input: U2 = U2.C2 true + testThereAndBackAgain input + testCase "can deserialize bool false to U2" + <| fun _ -> + let input: U2 = U2.C2 false + testThereAndBackAgain input + testCase "can deserialize string to U2" + <| fun _ -> + let input: U2 = U2.C1 "foo" + testThereAndBackAgain input + testCase "can deserialize true string to U2" + <| fun _ -> + let input: U2 = U2.C1 "true" + testThereAndBackAgain input + ] + ] + + testList "ErasedUnionConverter" [ + // most tests in `U2` + testCase "cannot serialize case with more than one field" + <| fun _ -> + let input = EU2("foo", 42) + + Expect.throws + (fun _ -> + serialize input + |> fun t -> printfn "%A" (t.ToString()) + |> ignore + ) + "ErasedUnion with multiple fields should not serializable" + testCase "can (de)serialize struct union" + <| fun _ -> + let input = StructEU.Second "foo" + testThereAndBackAgain input + ] + + testList "SingleCaseUnionConverter" [ + testCase "can (de)serialize union with all zero field cases" + <| fun _ -> + let input = NoFields.Second + testThereAndBackAgain input + ] + + testList "JsonProperty" [ + testCase "keep null when serializing OptionalVersionedTextDocumentIdentifier" + <| fun _ -> + let textDoc = { OptionalVersionedTextDocumentIdentifier.Uri = "..."; Version = None } + + 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" + testCase "can deserialize null Version in OptioanlVersionedTextDocumentIdentifier" + <| fun _ -> + let textDoc = { OptionalVersionedTextDocumentIdentifier.Uri = "..."; Version = None } + testThereAndBackAgain textDoc + + testCase "serialize to name specified in JsonProperty in Response" + <| fun _ -> + let response: Response = { Version = "123"; Id = None; Error = None; Result = None } + + let json = + response + |> serialize + // Version -> jsonrpc + Expect.isNone + (json + |> tryGetProperty (nameof response.Version)) + "Version should exist, but instead as jsonrpc" + + Expect.isSome + (json + |> tryGetProperty "jsonrpc") + "jsonrcp should exist because of Version" + // Id & Error optional -> not in json + Expect.isNone + (json + |> tryGetProperty (nameof response.Id)) + "None Id shouldn't be in json" + + Expect.isNone + (json + |> tryGetProperty (nameof response.Error)) + "None Error shouldn't be in json" + // Result even when null/None + 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" + testCase "can (de)serialize empty response" + <| fun _ -> + let response: Response = { Version = "123"; Id = None; Error = None; Result = None } + testThereAndBackAgain response + testCase "can (de)serialize Response.Result" + <| fun _ -> + let response: Response = { + Version = "123" + Id = None + Error = None + Result = Some(JToken.Parse "\"some result\"") + } + + testThereAndBackAgain response + testCase "can (de)serialize Result when Error is None" + <| fun _ -> + // Note: It's either `Error` or `Result`, but not both together + let response: Response = { + Version = "123" + Id = Some 42 + Error = None + Result = Some(JToken.Parse "\"some result\"") + } + + testThereAndBackAgain response + testCase "can (de)serialize Error when error is Some" + <| fun _ -> + let response: Response = { + Version = "123" + Id = Some 42 + Error = Some { Code = 13; Message = "oh no"; Data = Some(JToken.Parse "\"some data\"") } + Result = None + } + + testThereAndBackAgain response + testCase "doesn't serialize Result when Error is Some" + <| fun _ -> + 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\"") + } + + let output = thereAndBackAgain response + Expect.isSome output.Error "Error should be serialized" + Expect.isNone output.Result "Result should not be serialized when Error is Some" + ] + + testList (nameof InlayHint) [ + // Life of InlayHint: + // * output of `textDocument/inlayHint` (`InlayHint[]`) + // * input of `inlayHint/resolve` + // * output of `inlayHint/resolve` + // -> must be serializable as well as deserializable + testCase "can (de)serialize minimal InlayHint" + <| fun _ -> + let theInlayHint: InlayHint = { + Label = U2.C1 "test" + Position = { Line = 0u; Character = 0u } + Kind = None + TextEdits = None + Tooltip = None + PaddingLeft = None + PaddingRight = None + Data = None + } + + testThereAndBackAgain theInlayHint + testCase "can roundtrip InlayHint with all fields (simple)" + <| fun _ -> + let theInlayHint: InlayHint = { + Label = U2.C1 "test" + Position = { Line = 5u; Character = 10u } + Kind = Some InlayHintKind.Parameter + TextEdits = + Some [| + { + Range = { Start = { Line = 5u; Character = 10u }; End = { Line = 6u; Character = 5u } } + NewText = "foo bar" + } + { + Range = { Start = { Line = 4u; Character = 0u }; End = { Line = 5u; Character = 2u } } + NewText = "baz" + } + |] + Tooltip = Some(U2.C1 "tooltipping") + PaddingLeft = Some true + PaddingRight = Some false + Data = Some(JToken.FromObject "some data") + } + + testThereAndBackAgain theInlayHint + testCase "can keep Data with JToken" + <| fun _ -> + // JToken doesn't use structural equality + // -> Expecto equal check fails even when same content in complex JToken + let data = { + InlayHintData.TextDocument = { Uri = "..." } + Range = { Start = { Line = 5u; Character = 7u }; End = { Line = 5u; Character = 10u } } + } + + let theInlayHint: InlayHint = { + Label = U2.C1 "test" + Position = { Line = 0u; Character = 0u } + Kind = None + TextEdits = None + Tooltip = None + PaddingLeft = None + PaddingRight = None + Data = Some(JToken.FromObject data) + } + + let output = thereAndBackAgain theInlayHint + + let outputData = + output.Data + |> Option.map (fun t -> t.ToObject()) + + Expect.equal outputData (Some data) "Data should not change" + testCase "can roundtrip InlayHint with all fields (complex)" + <| fun _ -> + let theInlayHint: InlayHint = { + Label = + U2.C2 [| + { + InlayHintLabelPart.Value = "1st label" + Tooltip = Some(U2.C1 "1st label tooltip") + Location = Some { Uri = "1st"; Range = mkRange' (1u, 2u) (3u, 4u) } + Command = None + } + { + Value = "2nd label" + Tooltip = Some(U2.C1 "1st label tooltip") + Location = Some { Uri = "2nd"; Range = mkRange' (5u, 8u) (10u, 9u) } + Command = Some { Title = "2nd command"; Command = "foo"; Arguments = None } + } + { + InlayHintLabelPart.Value = "3rd label" + Tooltip = + Some( + U2.C2 { + Kind = MarkupKind.Markdown + Value = + """ # Header Description * List 1 * List 2 - """ } - ) - Location = Some { Uri = "3rd"; Range = mkRange' (1u, 2u) (3u, 4u) } - Command = None } |] - Position = { Line = 5u; Character = 10u } - Kind = Some InlayHintKind.Type - TextEdits = - Some - [| { Range = mkRange' (5u, 10u) (6u, 5u); NewText = "foo bar" } - { Range = mkRange' (5u, 0u) (5u, 2u); NewText = "baz" } |] - Tooltip = Some(U2.C2 { Kind = MarkupKind.PlainText; Value = "some tooltip" }) - PaddingLeft = Some true - PaddingRight = Some false - Data = Some(JToken.FromObject "some data") } - - testThereAndBackAgain theInlayHint ] - - testList - (nameof InlineValue) - [ - // Life of InlineValue: - // * output of `textDocument/inlineValue` (`InlineValue[]`) - // -> must be serializable as well as deserializable - testCase "can roundtrip InlineValue with all fields (simple)" - <| fun _ -> - let theInlineValue: InlineValue = - { InlineValueText.Range = { Start = { Line = 5u; Character = 7u }; End = { Line = 5u; Character = 10u } } - Text = "test" } - |> U3.C1 - - testThereAndBackAgain theInlineValue ] - - testList - (nameof TypeHierarchyItem) - [ testCase "can roundtrip HierarchyItem with all fields (simple)" - <| fun _ -> - let item: TypeHierarchyItem = - { Name = "test" - Kind = SymbolKind.Function - Tags = None - Detail = None - Uri = "..." - Range = mkRange' (1u, 2u) (3u, 4u) - SelectionRange = mkRange' (1u, 2u) (1u, 4u) - Data = None } - - testThereAndBackAgain item ] - - Shotgun.tests - StartWithSetup.tests ] + """ + } + ) + Location = Some { Uri = "3rd"; Range = mkRange' (1u, 2u) (3u, 4u) } + Command = None + } + |] + Position = { Line = 5u; Character = 10u } + Kind = Some InlayHintKind.Type + TextEdits = + Some [| + { Range = mkRange' (5u, 10u) (6u, 5u); NewText = "foo bar" } + { Range = mkRange' (5u, 0u) (5u, 2u); NewText = "baz" } + |] + Tooltip = Some(U2.C2 { Kind = MarkupKind.PlainText; Value = "some tooltip" }) + PaddingLeft = Some true + PaddingRight = Some false + Data = Some(JToken.FromObject "some data") + } + + testThereAndBackAgain theInlayHint + ] + + testList (nameof InlineValue) [ + // Life of InlineValue: + // * output of `textDocument/inlineValue` (`InlineValue[]`) + // -> must be serializable as well as deserializable + testCase "can roundtrip InlineValue with all fields (simple)" + <| fun _ -> + let theInlineValue: InlineValue = + { + InlineValueText.Range = { Start = { Line = 5u; Character = 7u }; End = { Line = 5u; Character = 10u } } + Text = "test" + } + |> U3.C1 + + testThereAndBackAgain theInlineValue + ] + + testList (nameof TypeHierarchyItem) [ + testCase "can roundtrip HierarchyItem with all fields (simple)" + <| fun _ -> + let item: TypeHierarchyItem = { + Name = "test" + Kind = SymbolKind.Function + Tags = None + Detail = None + Uri = "..." + Range = mkRange' (1u, 2u) (3u, 4u) + SelectionRange = mkRange' (1u, 2u) (1u, 4u) + Data = None + } + + testThereAndBackAgain item + ] + + Shotgun.tests + StartWithSetup.tests + ] [] -let tests = testList "LSP" [ serializationTests; Utils.tests ] \ No newline at end of file +let tests = + testList "LSP" [ + serializationTests + Utils.tests + ] \ No newline at end of file diff --git a/tests/Utils.fs b/tests/Utils.fs index 5ca1feb..4236c7a 100644 --- a/tests/Utils.fs +++ b/tests/Utils.fs @@ -32,7 +32,9 @@ module Lsp = /// Note: don't confuse with `ty.IsNested`: /// Modules are static classes and everything inside them is nested inside module /// -> `IsNested` always true for types inside module - let Nested (ty: Type) = ty.DeclaringType <> example.DeclaringType + let Nested (ty: Type) = + ty.DeclaringType + <> example.DeclaringType /// Generics like `U2<_,_>` or `U2` /// @@ -50,7 +52,9 @@ module Lsp = /// Abstract & Sealed /// /// Note: Always excludes -> this rule does nothing - let Static (ty: Type) = ty.IsAbstract && ty.IsSealed + let Static (ty: Type) = + ty.IsAbstract + && ty.IsSealed /// Lsp Type: inside `Ionide.LanguageServerProtocol.Types` /// @@ -59,14 +63,17 @@ let isLspType (additionalRules: (Type -> bool) list) (ty: Type) = ty.FullName.StartsWith Lsp.path && not ( // private or internal - (ty.IsNestedPrivate || ty.IsNestedAssembly) + (ty.IsNestedPrivate + || ty.IsNestedAssembly) || ty.IsInterface || // static -> modules - (ty.IsAbstract && ty.IsSealed) + (ty.IsAbstract + && ty.IsSealed) || ty.BaseType = typeof ) - && (additionalRules |> List.forall (fun rule -> rule ty)) + && (additionalRules + |> List.forall (fun rule -> rule ty)) /// Replaces contents of properties with `JsonExtensionData`Attribute of type `IDictionary` /// with a `Map` containing same elements. @@ -93,7 +100,14 @@ let rec convertExtensionDataDictionariesToMap (o: obj) = actual.IsGenericType && actual.GetGenericTypeDefinition() = expected - let (|IsGenericType|_|) expected actual = if actual |> isGenericTypeOf expected then Some() else None + let (|IsGenericType|_|) expected actual = + if + actual + |> isGenericTypeOf expected + then + Some() + else + None match o with | null -> () @@ -105,33 +119,46 @@ let rec convertExtensionDataDictionariesToMap (o: obj) = | :? uint -> () | :? JToken -> () | :? IDictionary as dict -> - for kv in dict |> Seq.cast do + for kv in + dict + |> Seq.cast do convertExtensionDataDictionariesToMap kv.Value | :? IEnumerable as ls -> for v in ls do convertExtensionDataDictionariesToMap v | :? ITuple as t -> - for i in 0 .. (t.Length - 1) do + for i in + 0 .. (t.Length + - 1) do convertExtensionDataDictionariesToMap (t[i]) | _ when let ty = o.GetType() isLspType [] ty - || ty |> isGenericTypeOf typedefof<_ option> + || ty + |> isGenericTypeOf typedefof<_ option> || ty.FullName.StartsWith "Ionide.LanguageServerProtocol.Tests.Utils+TestData+" -> let ty = o.GetType() - let props = ty.GetProperties(BindingFlags.Instance ||| BindingFlags.Public) + + let props = + ty.GetProperties( + BindingFlags.Instance + ||| BindingFlags.Public + ) let propsWithValues = props |> Seq.choose (fun prop -> try let v = prop.GetValue o - (prop, v) |> Some + + (prop, v) + |> Some with ex -> failwithf "Couldn't get value of %s in %A: %s" prop.Name ty ex.Message - None) + None + ) for (prop, value) in propsWithValues do match value with @@ -146,17 +173,22 @@ let rec convertExtensionDataDictionariesToMap (o: obj) = // but not done here (for serializing in record: must be mutable set after in `OnDeserialized` to prevent null) () | _ -> - let v = dict |> Seq.map (fun kv -> kv.Key, kv.Value) |> Map.ofSeq + let v = + dict + |> Seq.map (fun kv -> kv.Key, kv.Value) + |> Map.ofSeq + prop.SetValue(o, v) | _ -> convertExtensionDataDictionariesToMap value | _ -> () module TestData = - type WithExtensionData = - { Value: string - [] - mutable AdditionalData: IDictionary } + type WithExtensionData = { + Value: string + [] + mutable AdditionalData: IDictionary + } [] type MyUnion = @@ -173,212 +205,300 @@ module TestData = | Text of string * MyContainer let tests = - testList - "test utils" - [ testList - (nameof isLspType) - [ testCase "string isn't lsp type" - <| fun _ -> - let isLsp = typeof |> isLspType [] - Expect.isFalse isLsp "string isn't lsp" - testCase "DocumentLink is lsp type" - <| fun _ -> - let isLsp = - typeof - |> isLspType [] - - Expect.isTrue isLsp "DocumentLink is lsp" - testCase "DocumentLink is direct, non-generic lsp type" - <| fun _ -> - let isLsp = - typeof - |> isLspType [ not << Lsp.Is.Nested; not << Lsp.Is.Generic ] - - Expect.isTrue isLsp "DocumentLink is lsp" - - testCase "U2 is lsp type" - <| fun _ -> - let isLsp = typeof> |> isLspType [] - Expect.isTrue isLsp "U2 is lsp" - testCase "U2 is not non-generic lsp type" - <| fun _ -> - let isLsp = - typeof> - |> isLspType [ not << Lsp.Is.Generic ] - - Expect.isFalse isLsp "U2 is generic lsp" - testCase "U2 is non-generic-type-def lsp type" - <| fun _ -> - let isLsp = - typeof> - |> isLspType [ not << Lsp.Is.GenericTypeDef ] - - Expect.isTrue isLsp "U2 is not generic type def lsp" - testCase "U2<_,_> is not non-generic lsp type" - <| fun _ -> - let isLsp = typedefof> |> isLspType [ not << Lsp.Is.Generic ] - Expect.isFalse isLsp "U2 is generic lsp" - testCase "U2<_,_> is not non-generic-type-def lsp type" - <| fun _ -> - let isLsp = - typedefof> - |> isLspType [ not << Lsp.Is.GenericTypeDef ] - - Expect.isFalse isLsp "U2 is generic type def lsp" - testCase "U2<_,_> is not non-abstract lsp type" - <| fun _ -> - let isLsp = typedefof> |> isLspType [ not << Lsp.Is.Abstract ] - Expect.isFalse isLsp "U2 is abstract lsp" - - testCase "MarkedString.String is lsp" - <| fun _ -> - let o = U2.C1 "foo" - let isLsp = o.GetType() |> isLspType [] - Expect.isTrue isLsp "MarkedString.String is lsp" - testCase "MarkedString.String isn't direct lsp" - <| fun _ -> - let o = U2.C1 "foo" - let isLsp = o.GetType() |> isLspType [ not << Lsp.Is.Nested ] - Expect.isFalse isLsp "MarkedString.String is not direct lsp" - - testCase "Client isn't lsp" - <| fun _ -> - let isLsp = - typeof - |> isLspType [] - - Expect.isFalse isLsp "Client isn't lsp" ] - - testList - (nameof convertExtensionDataDictionariesToMap) - [ let testConvert preActual expectedAfterwards = - Expect.notEqual preActual expectedAfterwards "Dictionary and Map shouldn't be equal" - - convertExtensionDataDictionariesToMap preActual - Expect.equal preActual expectedAfterwards "Converter Map should be comparable" - - let dict = - [| "alpha", JToken.FromObject "lorem" - "beta", JToken.FromObject "ipsum" - "gamma", JToken.FromObject "dolor" |] - |> Map.ofArray - - let createWithExtensionData () : TestData.WithExtensionData = - { Value = "foo"; AdditionalData = dict |> Dictionary } - - testCase "can convert direct dictionary field" - <| fun _ -> - let actual = createWithExtensionData () - let expected = { actual with AdditionalData = dict } - testConvert actual expected - - testCase "can convert inside union in case with single value" - <| fun _ -> - let extData = createWithExtensionData () - let actual = TestData.MyUnion.Case2 extData - let expected = TestData.MyUnion.Case2 { extData with AdditionalData = dict } - testConvert actual expected - - testCase "can convert inside union in case with multiple values" - <| fun _ -> - let extData = createWithExtensionData () - let actual = TestData.MyUnion.Case3("foo", extData, 42) - let expected = TestData.MyUnion.Case3("foo", { extData with AdditionalData = dict }, 42) - testConvert actual expected - - testCase "can convert in U2" - <| fun _ -> - let extData = createWithExtensionData () - let actual: U2 = U2.C2 extData - let expected: U2 = U2.C2 { extData with AdditionalData = dict } - testConvert actual expected - - testCase "can convert in tuple" - <| fun _ -> - let extData = createWithExtensionData () - let actual = ("foo", extData, 42) - let expected = ("foo", { extData with AdditionalData = dict }, 42) - testConvert actual expected - - testCase "can convert in array" - <| fun _ -> - let extData = createWithExtensionData () - let actual: obj[] = [| "foo"; extData; 42 |] - let expected: obj[] = [| "foo"; { extData with AdditionalData = dict }; 42 |] - testConvert actual expected - - testCase "can convert in list" - <| fun _ -> - let extData = createWithExtensionData () - let actual: obj list = [ "foo"; extData; 42 ] - let expected: obj list = [ "foo"; { extData with AdditionalData = dict }; 42 ] - testConvert actual expected - - testCase "can convert option" - <| fun _ -> - let extData = createWithExtensionData () - let actual = Some extData - let expected = Some { extData with AdditionalData = dict } - testConvert actual expected - - testCase "replaces all dictionaries" - <| fun _ -> - let extDataMap = - Array.init 5 (fun i -> - let m = - Array.init (i + 3) (fun j -> ($"Dict{i}Element{j}", JToken.FromObject(i + j))) - |> Map.ofArray - - { TestData.WithExtensionData.Value = $"Hello {i}" - TestData.WithExtensionData.AdditionalData = m }) - - let extDataDict = - extDataMap - |> Array.map (fun extData -> { extData with AdditionalData = Dictionary extData.AdditionalData }) - - let actual = TestData.MyContainer.Data(extDataDict, TestData.MyContainer.Fin) - let expected = TestData.MyContainer.Data(extDataMap, TestData.MyContainer.Fin) - testConvert actual expected - - testCase "can replace deeply nested" - <| fun _ -> - let createExtensionData mkDict seed : TestData.WithExtensionData = - { Value = $"Seed {seed}" - AdditionalData = - let count = seed % 4 + 3 - - List.init (seed % 4 + 3) (fun i -> ($"Seed{seed}Element{i}Of{count}", JToken.FromObject(count + i))) - |> Map.ofList - |> mkDict } - - /// builds always same object for same depth - let rec buildObject mkDict (depth: int) = - match depth % 4 with - | _ when depth <= 0 -> TestData.MyContainer.Fin - | 0 -> - [| 1 .. (max 3 (depth / 2)) |] - |> Array.map (fun i -> buildObject mkDict (depth - 1 - (i % 2))) - |> TestData.MyContainer.Big - | 1 -> - let o = buildObject mkDict (depth - 1) - let d = createExtensionData mkDict depth - TestData.MyContainer.Datum(d, o) - | 2 -> - let o = buildObject mkDict (depth - 1) - - let ds = - [| 1 .. max 3 (depth / 2) |] - |> Array.map (fun i -> createExtensionData mkDict (depth * i)) - - TestData.MyContainer.Data(ds, o) - | 3 -> - let o = buildObject mkDict (depth - 1) - let d = $"Depth={depth}" - TestData.MyContainer.Text(d, o) - - | _ -> failwith "unreachable" - - let depth = 7 - let expected = buildObject id depth - let actual = buildObject Dictionary depth - testConvert actual expected ] ] \ No newline at end of file + testList "test utils" [ + testList (nameof isLspType) [ + testCase "string isn't lsp type" + <| fun _ -> + let isLsp = + typeof + |> isLspType [] + + Expect.isFalse isLsp "string isn't lsp" + testCase "DocumentLink is lsp type" + <| fun _ -> + let isLsp = + typeof + |> isLspType [] + + Expect.isTrue isLsp "DocumentLink is lsp" + testCase "DocumentLink is direct, non-generic lsp type" + <| fun _ -> + let isLsp = + typeof + |> isLspType [ + not + << Lsp.Is.Nested + not + << Lsp.Is.Generic + ] + + Expect.isTrue isLsp "DocumentLink is lsp" + + testCase "U2 is lsp type" + <| fun _ -> + let isLsp = + typeof> + |> isLspType [] + + Expect.isTrue isLsp "U2 is lsp" + testCase "U2 is not non-generic lsp type" + <| fun _ -> + let isLsp = + typeof> + |> isLspType [ + not + << Lsp.Is.Generic + ] + + Expect.isFalse isLsp "U2 is generic lsp" + testCase "U2 is non-generic-type-def lsp type" + <| fun _ -> + let isLsp = + typeof> + |> isLspType [ + not + << Lsp.Is.GenericTypeDef + ] + + Expect.isTrue isLsp "U2 is not generic type def lsp" + testCase "U2<_,_> is not non-generic lsp type" + <| fun _ -> + let isLsp = + typedefof> + |> isLspType [ + not + << Lsp.Is.Generic + ] + + Expect.isFalse isLsp "U2 is generic lsp" + testCase "U2<_,_> is not non-generic-type-def lsp type" + <| fun _ -> + let isLsp = + typedefof> + |> isLspType [ + not + << Lsp.Is.GenericTypeDef + ] + + Expect.isFalse isLsp "U2 is generic type def lsp" + testCase "U2<_,_> is not non-abstract lsp type" + <| fun _ -> + let isLsp = + typedefof> + |> isLspType [ + not + << Lsp.Is.Abstract + ] + + Expect.isFalse isLsp "U2 is abstract lsp" + + testCase "MarkedString.String is lsp" + <| fun _ -> + let o = U2.C1 "foo" + + let isLsp = + o.GetType() + |> isLspType [] + + Expect.isTrue isLsp "MarkedString.String is lsp" + testCase "MarkedString.String isn't direct lsp" + <| fun _ -> + let o = U2.C1 "foo" + + let isLsp = + o.GetType() + |> isLspType [ + not + << Lsp.Is.Nested + ] + + Expect.isFalse isLsp "MarkedString.String is not direct lsp" + + testCase "Client isn't lsp" + <| fun _ -> + let isLsp = + typeof + |> isLspType [] + + Expect.isFalse isLsp "Client isn't lsp" + ] + + testList (nameof convertExtensionDataDictionariesToMap) [ + let testConvert preActual expectedAfterwards = + Expect.notEqual preActual expectedAfterwards "Dictionary and Map shouldn't be equal" + + convertExtensionDataDictionariesToMap preActual + Expect.equal preActual expectedAfterwards "Converter Map should be comparable" + + let dict = + [| + "alpha", JToken.FromObject "lorem" + "beta", JToken.FromObject "ipsum" + "gamma", JToken.FromObject "dolor" + |] + |> Map.ofArray + + let createWithExtensionData () : TestData.WithExtensionData = { + Value = "foo" + AdditionalData = + dict + |> Dictionary + } + + testCase "can convert direct dictionary field" + <| fun _ -> + let actual = createWithExtensionData () + let expected = { actual with AdditionalData = dict } + testConvert actual expected + + testCase "can convert inside union in case with single value" + <| fun _ -> + let extData = createWithExtensionData () + let actual = TestData.MyUnion.Case2 extData + let expected = TestData.MyUnion.Case2 { extData with AdditionalData = dict } + testConvert actual expected + + testCase "can convert inside union in case with multiple values" + <| fun _ -> + let extData = createWithExtensionData () + let actual = TestData.MyUnion.Case3("foo", extData, 42) + let expected = TestData.MyUnion.Case3("foo", { extData with AdditionalData = dict }, 42) + testConvert actual expected + + testCase "can convert in U2" + <| fun _ -> + let extData = createWithExtensionData () + let actual: U2 = U2.C2 extData + let expected: U2 = U2.C2 { extData with AdditionalData = dict } + testConvert actual expected + + testCase "can convert in tuple" + <| fun _ -> + let extData = createWithExtensionData () + let actual = ("foo", extData, 42) + let expected = ("foo", { extData with AdditionalData = dict }, 42) + testConvert actual expected + + testCase "can convert in array" + <| fun _ -> + let extData = createWithExtensionData () + + let actual: obj[] = [| + "foo" + extData + 42 + |] + + let expected: obj[] = [| + "foo" + { extData with AdditionalData = dict } + 42 + |] + + testConvert actual expected + + testCase "can convert in list" + <| fun _ -> + let extData = createWithExtensionData () + + let actual: obj list = [ + "foo" + extData + 42 + ] + + let expected: obj list = [ + "foo" + { extData with AdditionalData = dict } + 42 + ] + + testConvert actual expected + + testCase "can convert option" + <| fun _ -> + let extData = createWithExtensionData () + let actual = Some extData + let expected = Some { extData with AdditionalData = dict } + testConvert actual expected + + testCase "replaces all dictionaries" + <| fun _ -> + let extDataMap = + Array.init + 5 + (fun i -> + let m = + Array.init (i + 3) (fun j -> ($"Dict{i}Element{j}", JToken.FromObject(i + j))) + |> Map.ofArray + + { + TestData.WithExtensionData.Value = $"Hello {i}" + TestData.WithExtensionData.AdditionalData = m + } + ) + + let extDataDict = + extDataMap + |> Array.map (fun extData -> { extData with AdditionalData = Dictionary extData.AdditionalData }) + + let actual = TestData.MyContainer.Data(extDataDict, TestData.MyContainer.Fin) + let expected = TestData.MyContainer.Data(extDataMap, TestData.MyContainer.Fin) + testConvert actual expected + + testCase "can replace deeply nested" + <| fun _ -> + let createExtensionData mkDict seed : TestData.WithExtensionData = { + Value = $"Seed {seed}" + AdditionalData = + let count = + seed % 4 + + 3 + + List.init + (seed % 4 + + 3) + (fun i -> ($"Seed{seed}Element{i}Of{count}", JToken.FromObject(count + i))) + |> Map.ofList + |> mkDict + } + + /// builds always same object for same depth + let rec buildObject mkDict (depth: int) = + match depth % 4 with + | _ when depth <= 0 -> TestData.MyContainer.Fin + | 0 -> + [| 1 .. (max 3 (depth / 2)) |] + |> Array.map (fun i -> + buildObject + mkDict + (depth + - 1 + - (i % 2)) + ) + |> TestData.MyContainer.Big + | 1 -> + let o = buildObject mkDict (depth - 1) + let d = createExtensionData mkDict depth + TestData.MyContainer.Datum(d, o) + | 2 -> + let o = buildObject mkDict (depth - 1) + + let ds = + [| 1 .. max 3 (depth / 2) |] + |> Array.map (fun i -> createExtensionData mkDict (depth * i)) + + TestData.MyContainer.Data(ds, o) + | 3 -> + let o = buildObject mkDict (depth - 1) + let d = $"Depth={depth}" + TestData.MyContainer.Text(d, o) + + | _ -> failwith "unreachable" + + let depth = 7 + let expected = buildObject id depth + let actual = buildObject Dictionary depth + testConvert actual expected + ] + ] \ No newline at end of file diff --git a/tools/MetaModelGenerator/Common.fs b/tools/MetaModelGenerator/Common.fs new file mode 100644 index 0000000..4b24a57 --- /dev/null +++ b/tools/MetaModelGenerator/Common.fs @@ -0,0 +1,62 @@ +namespace MetaModelGenerator + + +module FileWriters = + open System.IO + + let writeIfChanged outputPath text = + async { + let writeToFile (path: string) (contents: string) = File.WriteAllTextAsync(path, contents) + + let! existingFile = + async { + if File.Exists(outputPath) then + let! file = + File.ReadAllTextAsync(outputPath) + |> Async.AwaitTask + + return Some file + else + return None + } + + printfn "Writing to %s" outputPath + + match existingFile with + | Some existingFile when existingFile = text -> printfn "No changes" + | _ -> + do! + text + |> writeToFile outputPath + |> Async.AwaitTask + } + + +module Widgets = + [] + let UriString = "URI" + + [] + let DocumentUriString = "DocumentUri" + + [] + let RegExpString = "RegExp" + + +[] +module TypeAnonBuilders = + open Fabulous.AST + open Fantomas.Core.SyntaxOak + + let pipe (right: WidgetBuilder) (left: WidgetBuilder) = Ast.InfixAppExpr(left, "|>", right) + + + type Ast with + + static member LspUri() = Ast.LongIdent Widgets.DocumentUriString + static member DocumentUri() = Ast.LongIdent Widgets.DocumentUriString + static member LspRegExp() = Ast.LongIdent Widgets.DocumentUriString + + static member AsyncPrefix(t: WidgetBuilder) = Ast.AppPrefix(Ast.LongIdent "Async", [ t ]) + + static member AsyncLspResultPrefix(t: WidgetBuilder) = Ast.AppPrefix(Ast.LongIdent "AsyncLspResult", [ t ]) \ No newline at end of file diff --git a/tools/MetaModelGenerator/GenerateClientServer.fs b/tools/MetaModelGenerator/GenerateClientServer.fs index b6a6af6..3f43b99 100644 --- a/tools/MetaModelGenerator/GenerateClientServer.fs +++ b/tools/MetaModelGenerator/GenerateClientServer.fs @@ -1,7 +1,319 @@ namespace MetaModelGenerator module GenerateClientServer = + open System + open Fantomas.Core.SyntaxOak + open Fabulous.AST + open type Fabulous.AST.Ast + open Fantomas.Core - let generate () = - () \ No newline at end of file + let generateClientServer (parsedMetaModel: MetaModel.MetaModel) outputPath = + async { + printfn "Generating generateClientServer" + + + let requests = + parsedMetaModel.Requests + |> Array.filter Proposed.checkProposed + |> Array.groupBy (fun x -> x.MessageDirection) + |> Map + + let notifications = + parsedMetaModel.Notifications + |> Array.filter Proposed.checkProposed + |> Array.groupBy (fun x -> x.MessageDirection) + |> Map + + + let serverRequests = [ + yield! + requests + |> Map.tryFind MetaModel.MessageDirection.ClientToServer + |> Option.defaultValue [||] + yield! + requests + |> Map.tryFind MetaModel.MessageDirection.Both + |> Option.defaultValue [||] + ] + + let serverNotifications = [ + yield! + notifications + |> Map.tryFind MetaModel.MessageDirection.ClientToServer + |> Option.defaultValue [||] + yield! + notifications + |> Map.tryFind MetaModel.MessageDirection.Both + |> Option.defaultValue [||] + ] + + + let clientRequests = [ + yield! + requests + |> Map.tryFind MetaModel.MessageDirection.ServerToClient + |> Option.defaultValue [||] + yield! + requests + |> Map.tryFind MetaModel.MessageDirection.Both + |> Option.defaultValue [||] + ] + + let clientNotifications = [ + yield! + notifications + |> Map.tryFind MetaModel.MessageDirection.ServerToClient + |> Option.defaultValue [||] + yield! + notifications + |> Map.tryFind MetaModel.MessageDirection.Both + |> Option.defaultValue [||] + ] + + let normalizeMethod (s: string) = + let parts = + s.Split( + "/", + StringSplitOptions.RemoveEmptyEntries + ||| StringSplitOptions.TrimEntries + ) + + parts + |> Array.filter (fun x -> x <> "$") + |> Array.map (fun x -> + (string x.[0]).ToUpper() + + x.[1..] + ) + |> String.concat "" + + let oak = + Ast.Oak() { + Namespace "Ionide.LanguageServerProtocol" { + Open "Ionide.LanguageServerProtocol.Types" + Open "Ionide.LanguageServerProtocol.JsonRpc" + + let generateInterface + name + (notifications: list) + (requests: list) + = + + + TypeDefn name { + + Inherit "System.IDisposable" + + let notificationComment = SingleLine "Notifications" + + let mutable writtenNotificationComment = false + + for n in notifications do + let methodName = normalizeMethod n.Method + + let parameters = [ + match n.Params with + | None -> yield Unit() + | Some ps -> + for p in ps do + match p with + | MetaModel.Type.ReferenceType r -> yield LongIdent r.Name + | _ -> () + ] + + let returnType = AsyncPrefix(Unit()) + + + let wb = AbstractMember(methodName, parameters, returnType) + + let wb = + n.StructuredDocs + |> Option.mapOrDefault wb wb.xmlDocs + + let wb = + if not writtenNotificationComment then + writtenNotificationComment <- true + wb.triviaBefore notificationComment + else + wb + + wb + + let requestComment = SingleLine "Requests" + + let mutable writtenRequestComment = false + + + for r in requests do + let methodName = normalizeMethod r.Method + + let parameters = [ + match r.Params with + | None -> yield Unit() + | Some ps -> + for p in ps do + match p with + | MetaModel.Type.ReferenceType r -> yield (LongIdent r.Name) + | _ -> () + ] + + let returnType = + let rec returnType (ty: MetaModel.Type) = + match ty with + | MetaModel.Type.ReferenceType r -> LongIdent r.Name + | MetaModel.Type.BaseType b -> + match b.Name with + | MetaModel.BaseTypes.Null -> Unit() + | MetaModel.BaseTypes.Boolean -> Boolean() + | MetaModel.BaseTypes.Integer -> Int() + | MetaModel.BaseTypes.Uinteger -> UInt32() + | MetaModel.BaseTypes.Decimal -> Float() + | MetaModel.BaseTypes.String -> String() + | MetaModel.BaseTypes.DocumentUri -> DocumentUri() + | MetaModel.BaseTypes.Uri -> LspUri() + | MetaModel.BaseTypes.RegExp -> LspRegExp() + | MetaModel.Type.OrType o -> + // TS types can have optional properties (myKey?: string) + // and unions with null (string | null) + // we need to handle both cases + let isOptional, items = + if Array.exists MetaModel.isNullableType o.Items then + true, + o.Items + |> Array.filter (fun x -> not (MetaModel.isNullableType x)) + else + false, o.Items + + let types = + items + |> Array.map returnType + |> Array.toList + + let retType = + if types.Length > 1 then + let duType = $"U{types.Length}" + AppPrefix(duType, types) + else + types.[0] + + if isOptional then OptionPrefix retType else retType + | MetaModel.Type.ArrayType a -> ArrayPrefix(returnType a.Element) + | _ -> LongIdent "Unsupported Type" + + AsyncLspResultPrefix(returnType r.Result) + + let wb = AbstractMember(methodName, parameters, returnType) + + let wb = + r.StructuredDocs + |> Option.mapOrDefault wb wb.xmlDocs + + let wb = + if not writtenRequestComment then + writtenRequestComment <- true + wb.triviaBefore (requestComment) + else + wb + + wb + } + + generateInterface "ILspServer" serverNotifications serverRequests + generateInterface "ILspClient" clientNotifications clientRequests + + let generateServerRequestHandlingRecord = + let serverTypeArg = "'server" + + Record "ServerRequestHandling" { Field("Run", Funs([ serverTypeArg ], "System.Delegate")) } + |> _.typeParams(PostfixList(TyparDecl(serverTypeArg), SubtypeOf(serverTypeArg, LongIdent("ILspServer")))) + + let generateRoutes = + + let body = + let generateRoute requestParams (method: string) configureValue = + let callWith = + if Array.isEmpty requestParams then + ParenExpr "" + else + ParenExpr "request" + + TupleExpr [ + + ConstantExpr(String method) + + AppWithLambdaExpr( + ConstantExpr "serverRequestHandling", + [ + ConstantPat "server" + ConstantPat "request" + ], + AppLongIdentAndSingleParenArgExpr( + [ + "server" + normalizeMethod method + ], + callWith + ) + |> configureValue + ) + ] + + let generateRouteHandler = + LetOrUseExpr( + Function( + "serverRequestHandling", + NamedPat "run", + RecordExpr [ + RecordFieldExpr( + "Run", + LambdaExpr( + [ ParameterPat "server" ], + AppLongIdentAndSingleParenArgExpr([ "run" ], ConstantExpr "server") + |> pipe (ConstantExpr "JsonRpc.Requests.requestHandling") + ) + ) + ] + ) + ) + + CompExprBodyExpr [ + generateRouteHandler + OtherExpr( + ListExpr [ + for serverRequest in serverRequests do + generateRoute serverRequest.ParamsSafe serverRequest.Method id + + for serverNotification in serverNotifications do + generateRoute + serverNotification.ParamsSafe + serverNotification.Method + (pipe (ConstantExpr "Requests.notificationSuccess")) + + + ] + ) + ] + + + Function("routeMappings", [ UnitPat() ], body) + + Module "Mappings" { + + + generateServerRequestHandlingRecord + generateRoutes + + } + + } + } + + + let! formattedText = + oak + |> Gen.mkOak + |> CodeFormatter.FormatOakAsync + + do! FileWriters.writeIfChanged outputPath formattedText + + } \ No newline at end of file diff --git a/tools/MetaModelGenerator/GenerateTypes.fs b/tools/MetaModelGenerator/GenerateTypes.fs index 564b465..01a4be1 100644 --- a/tools/MetaModelGenerator/GenerateTypes.fs +++ b/tools/MetaModelGenerator/GenerateTypes.fs @@ -1,5 +1,6 @@ namespace MetaModelGenerator + module GenerateTypes = open System.Runtime.CompilerServices @@ -13,10 +14,7 @@ module GenerateTypes = open type Fabulous.AST.Ast - open System.IO - open Newtonsoft.Json open Fantomas.FCS.Syntax - open Fabulous.AST.StackAllocatedCollections open Newtonsoft.Json.Linq let getIdent (x: IdentifierOrDot list) = @@ -28,21 +26,6 @@ module GenerateTypes = ) |> String.concat "" - type ModuleOrNamespaceExtensions = - /// Allows Anonymous Module components to be yielded directly into a Module - /// Useful since there's no common holder of declarations or generic WidgetBuilder than can be used - /// when yielding different types of declarations - [] - static member inline Yield(_: CollectionBuilder<'parent, ModuleDecl>, x: WidgetBuilder) = - let node = Gen.mkOak x - - let ws = - node.Declarations - |> List.map (fun x -> Ast.EscapeHatch(x).Compile()) - |> List.toArray - |> MutStackArray1.fromArray - - { Widgets = ws } let JToken = LongIdent(nameof JToken) @@ -57,15 +40,10 @@ module GenerateTypes = else types.[0] - let isNullableType (t: MetaModel.Type) = - match t with - | MetaModel.Type.BaseType { Name = MetaModel.BaseTypes.Null } -> true - | _ -> false - module DebuggerDisplay = let range_debuggerDisplay (r: WidgetBuilder) = r.attribute(Attribute("DebuggerDisplay(\"{DebuggerDisplay}\")")).members () { - Property("x.DebuggerDisplay", "$\"{x.Start.DebuggerDisplay}-{x.End.DebuggerDisplay}\"") + Member("x.DebuggerDisplay", "$\"{x.Start.DebuggerDisplay}-{x.End.DebuggerDisplay}\"") .attributes ( [ Attribute("DebuggerBrowsable(DebuggerBrowsableState.Never)") @@ -76,7 +54,7 @@ module GenerateTypes = let position_debuggerDisplay (r: WidgetBuilder) = r.attribute(Attribute("DebuggerDisplay(\"{DebuggerDisplay}\")")).members () { - Property("x.DebuggerDisplay", "$\"({x.Line},{x.Character})\"") + Member("x.DebuggerDisplay", "$\"({x.Line},{x.Character})\"") .attributes ( [ Attribute("DebuggerBrowsable(DebuggerBrowsableState.Never)") @@ -87,7 +65,7 @@ module GenerateTypes = let diagnostic_debuggerDisplay (r: WidgetBuilder) = r.attribute(Attribute("DebuggerDisplay(\"{DebuggerDisplay}\")")).members () { - Property( + Member( "x.DebuggerDisplay", "$\"[{defaultArg x.Severity DiagnosticSeverity.Error}] ({x.Range.DebuggerDisplay}) {x.Message} ({Option.map string x.Code |> Option.defaultValue String.Empty})\"" ) @@ -222,10 +200,10 @@ module GenerateTypes = // and unions with null (string | null) // we need to handle both cases let isOptional, items = - if Array.exists isNullableType o.Items then + if Array.exists MetaModel.isNullableType o.Items then true, o.Items - |> Array.filter (fun x -> not (isNullableType x)) + |> Array.filter (fun x -> not (MetaModel.isNullableType x)) else false, o.Items @@ -440,7 +418,7 @@ module GenerateTypes = interfaceStructures |> Array.map (fun s -> let widget = - Interface($"I{s.Name}") { + TypeDefn($"I{s.Name}") { let properties = s.PropertiesSafe for p in properties do @@ -453,7 +431,7 @@ module GenerateTypes = p.Type p - let ap = AbstractProperty(fi.Name, fi.TypeInfo) + let ap = AbstractMember(fi.Name, fi.TypeInfo) yield fi.StructuredDocs @@ -577,10 +555,10 @@ module GenerateTypes = |> Option.map (fun s -> let interfaceName = Ast.LongIdent($"I{s.Name}") - InterfaceMember(interfaceName) { + InterfaceWith(interfaceName) { for p in s.PropertiesSafe do let name = Constant($"x.{p.NameAsPascalCase}") - let outp = Property(ConstantPat(name), ConstantExpr(name)) + let outp = Member(ConstantPat(name), ConstantExpr(name)) p.StructuredDocs |> Option.mapOrDefault outp outp.xmlDocs @@ -838,7 +816,7 @@ module GenerateTypes = enumeration.StructuredDocs |> Option.mapOrDefault ab ab.xmlDocs - NestedModule(enumeration.Name) { + Module(enumeration.Name) { for v in enumeration.ValuesSafe do let name = PrettyNaming.NormalizeIdentifierBackticks v.Name let l = Value(ConstantPat(Constant(name)), ConstantExpr(String(v.Value))).attribute (Attribute "Literal") @@ -889,7 +867,7 @@ module GenerateTypes = /// The main entry point to generating types from a metaModel.json file - let generateType (parsedMetaModel : MetaModel.MetaModel) outputPath = + let generateType (parsedMetaModel: MetaModel.MetaModel) outputPath = async { let documentUriDocs = """ @@ -918,19 +896,19 @@ See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17 Open("Newtonsoft.Json.Linq") // Simple aliases for types that are not in dotnet - Abbrev("URI", "string") + Abbrev(Widgets.UriString, "string") .xmlDocs ( documentUriDocs |> StructuredDocs.parse ) - Abbrev("DocumentUri", "string") + Abbrev(Widgets.DocumentUriString, "string") .xmlDocs ( documentUriDocs |> StructuredDocs.parse ) - Abbrev("RegExp", "string") + Abbrev(Widgets.RegExpString, "string") .xmlDocs ( regexpDocs |> StructuredDocs.parse @@ -951,7 +929,7 @@ See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17 for s in structures do if isUnitStructure s then - Abbrev(s.Name, "unit") + Abbrev(s.Name, "obj") else createStructure s knownInterfaces parsedMetaModel |> List.map (fun r -> @@ -984,16 +962,10 @@ See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17 } - printfn "Writing to %s" outputPath - let writeToFile path contents = File.WriteAllTextAsync(path, contents) - let! formattedText = oak |> Gen.mkOak |> CodeFormatter.FormatOakAsync - do! - formattedText - |> writeToFile outputPath - |> Async.AwaitTask + do! FileWriters.writeIfChanged outputPath formattedText } \ No newline at end of file diff --git a/tools/MetaModelGenerator/MetaModel.fs b/tools/MetaModelGenerator/MetaModel.fs index 9ed8934..f8b5d59 100644 --- a/tools/MetaModelGenerator/MetaModel.fs +++ b/tools/MetaModelGenerator/MetaModel.fs @@ -86,6 +86,10 @@ module rec MetaModel = x.Params |> Option.Array.toArray + member x.StructuredDocs = + x.Documentation + |> Option.map StructuredDocs.parse + /// Represents a LSP notification type Notification = { @@ -114,6 +118,10 @@ module rec MetaModel = x.Params |> Option.Array.toArray + member x.StructuredDocs = + x.Documentation + |> Option.map StructuredDocs.parse + [] type BaseTypes = | Uri @@ -423,13 +431,8 @@ module rec MetaModel = failwith "Should never be writing this structure, it comes from Microsoft LSP Spec" override _.ReadJson - ( - reader: JsonReader, - objectType: System.Type, - existingValue: Type, - hasExistingValue, - serializer: JsonSerializer - ) = + (reader: JsonReader, objectType: System.Type, existingValue: Type, hasExistingValue, serializer: JsonSerializer) + = let jobj = JObject.Load(reader) let kind = jobj.["kind"].Value() @@ -476,4 +479,9 @@ module rec MetaModel = settings.Converters.Add(Converters.TypeConverter() :> JsonConverter) settings.Converters.Add(Converters.MapKeyTypeConverter() :> JsonConverter) settings.Converters.Add(JsonUtils.OptionConverter() :> JsonConverter) - settings \ No newline at end of file + settings + + let isNullableType (t: MetaModel.Type) = + match t with + | MetaModel.Type.BaseType { Name = MetaModel.BaseTypes.Null } -> true + | _ -> false \ No newline at end of file diff --git a/tools/MetaModelGenerator/MetaModelGenerator.fsproj b/tools/MetaModelGenerator/MetaModelGenerator.fsproj index 83faa13..d7b3d24 100644 --- a/tools/MetaModelGenerator/MetaModelGenerator.fsproj +++ b/tools/MetaModelGenerator/MetaModelGenerator.fsproj @@ -1,17 +1,18 @@ Exe - net8.0 + net9.0 - + + diff --git a/tools/MetaModelGenerator/Program.fs b/tools/MetaModelGenerator/Program.fs index 9654a99..4299ef7 100644 --- a/tools/MetaModelGenerator/Program.fs +++ b/tools/MetaModelGenerator/Program.fs @@ -7,32 +7,39 @@ module Main = open System.IO type TypeArgs = - | MetaModelPath of string - | OutputFilePath of string + | MetaModelPath of string + | OutputFilePath of string + interface IArgParserTemplate with - member this.Usage: string = - match this with - | MetaModelPath _ -> "The path to metaModel.json. See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#metaModel" - | OutputFilePath _ -> "The path to the output file. Should end with .fs" - + member this.Usage: string = + match this with + | MetaModelPath _ -> + "The path to metaModel.json. See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#metaModel" + | OutputFilePath _ -> "The path to the output file. Should end with .fs" + type ClientServerArgs = - | MetaModelPath of string - | OutputFilePath of string + | MetaModelPath of string + | OutputFilePath of string + interface IArgParserTemplate with - member this.Usage: string = - match this with - | MetaModelPath _ -> "The path to metaModel.json. See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#metaModel" - | OutputFilePath _ -> "The path to the output file. Should end with .fs" - + member this.Usage: string = + match this with + | MetaModelPath _ -> + "The path to metaModel.json. See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#metaModel" + | OutputFilePath _ -> "The path to the output file. Should end with .fs" + type CommandArgs = - | [] Types of ParseResults - // | [] ClientServer of ParseResults + | [] Types of ParseResults + | [] ClientServer of ParseResults + interface IArgParserTemplate with member this.Usage = match this with | Types _ -> "Generates Types from metaModel.json." - // | ClientServer _ -> "Generates Client/Server" - let readMetaModel metamodelPath = async { + | ClientServer _ -> "Generates Client/Server" + + let readMetaModel metamodelPath = + async { printfn "Reading in %s" metamodelPath @@ -46,56 +53,46 @@ module Main = JsonConvert.DeserializeObject(metaModel, MetaModel.metaModelSerializerSettings) return parsedMetaModel - } + } [] let main argv = - - let errorHandler = ProcessExiter(colorizer = function ErrorCode.HelpText -> None | _ -> Some ConsoleColor.Red) + + let errorHandler = + ProcessExiter( + colorizer = + function + | ErrorCode.HelpText -> None + | _ -> Some ConsoleColor.Red + ) + let parser = ArgumentParser.Create(programName = "MetaModelGenerator", errorHandler = errorHandler) let results = parser.ParseCommandLine argv + match results.GetSubCommand() with | Types r -> let metaModelPath = r.GetResult <@ TypeArgs.MetaModelPath @> let OutputFilePath = r.GetResult <@ TypeArgs.OutputFilePath @> - let metaModel = readMetaModel metaModelPath |> Async.RunSynchronously - GenerateTypes.generateType metaModel OutputFilePath |> Async.RunSynchronously - - // | ClientServer r -> - - // let metaModelPath = r.GetResult <@ ClientServerArgs.MetaModelPath @> - // let OutputFilePath = r.GetResult <@ ClientServerArgs.OutputFilePath @> - // let metaModel = readMetaModel metaModelPath |> Async.RunSynchronously - - // let requests = - // metaModel.Requests - // |> Array.groupBy(fun x ->x.MessageDirection) - // |> Map - // let notifications = - // metaModel.Notifications - // |> Array.groupBy(fun x -> x.MessageDirection) - // |> Map - - // printfn "Server: " - // printfn " Requests: " - // for request in requests.[MetaModel.MessageDirection.ClientToServer] do - // printfn " - %s %A " request.Method request.ParamsSafe - // printfn " Notifications: " - // for request in notifications.[MetaModel.MessageDirection.ClientToServer] |> Array.append notifications.[MetaModel.MessageDirection.Both] do - // printfn " - %s %A" request.Method request.ParamsSafe - // () - // printfn "" - - - // printfn "Client: " - // printfn " Requests: " - // for request in requests.[MetaModel.MessageDirection.ServerToClient] do - // printfn " - %s %A " request.Method request.ParamsSafe - // printfn " Notifications: " - // for request in notifications.[MetaModel.MessageDirection.ServerToClient] |> Array.append notifications.[MetaModel.MessageDirection.Both] do - // printfn " - %s %A" request.Method request.ParamsSafe - // () + + let metaModel = + readMetaModel metaModelPath + |> Async.RunSynchronously + + GenerateTypes.generateType metaModel OutputFilePath + |> Async.RunSynchronously + + | ClientServer r -> + + let metaModelPath = r.GetResult <@ ClientServerArgs.MetaModelPath @> + let OutputFilePath = r.GetResult <@ ClientServerArgs.OutputFilePath @> + + let metaModel = + readMetaModel metaModelPath + |> Async.RunSynchronously + + GenerateClientServer.generateClientServer metaModel OutputFilePath + |> Async.RunSynchronously 0 \ No newline at end of file