diff options
Diffstat (limited to 'graphics/asymptote/LspCpp/include/LibLsp/lsp')
106 files changed, 4374 insertions, 4376 deletions
diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/AbsolutePath.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/AbsolutePath.h index ef1ee43860..4f9aae0851 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/AbsolutePath.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/AbsolutePath.h @@ -4,21 +4,21 @@ #include <string> struct AbsolutePath { - static AbsolutePath BuildDoNotUse(const std::string& path); + static AbsolutePath BuildDoNotUse(const std::string& path); - // Try not to use this. - AbsolutePath(); + // Try not to use this. + AbsolutePath(); - // Provide implicit conversions to std::string for the time being. - AbsolutePath(const std::string& path, bool validate = true); - operator std::string() const; + // Provide implicit conversions to std::string for the time being. + AbsolutePath(const std::string& path, bool validate = true); + operator std::string() const; - bool operator==(const AbsolutePath& rhs) const; - bool operator!=(const AbsolutePath& rhs) const; - bool operator<(const AbsolutePath& rhs) const; - bool operator>(const AbsolutePath& rhs) const; - std::string path; - bool qualify = true; + bool operator==(const AbsolutePath& rhs) const; + bool operator!=(const AbsolutePath& rhs) const; + bool operator<(const AbsolutePath& rhs) const; + bool operator>(const AbsolutePath& rhs) const; + std::string path; + bool qualify = true; }; diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/ClientPreferences.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/ClientPreferences.h index 7adf557f83..29ab82b1c6 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/ClientPreferences.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/ClientPreferences.h @@ -9,298 +9,298 @@ class ClientPreferences { public: - std::shared_ptr<lsWorkspaceClientCapabilites> workspace; - lsTextDocumentClientCapabilities textDocument ; - - ClientPreferences(const lsClientCapabilities& capabilities) - { - v3supported = capabilities.textDocument.has_value(); - if (v3supported) - textDocument = capabilities.textDocument.value(); - if(capabilities.workspace) - { - workspace = std::make_shared<lsWorkspaceClientCapabilites>(capabilities.workspace.value()); - } - } - - bool v3supported=false; - - bool isSignatureHelpSupported() { - - return v3supported && (textDocument.signatureHelp); - } - bool isWorkspaceDidChangeConfigurationSupported() const - { - return workspace && isDynamicRegistrationSupported(workspace->didChangeConfiguration); - } - bool isWorkspaceFoldersSupported() { - return workspace != nullptr && isTrue(workspace->workspaceFolders); - } - - bool isCompletionDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.completion); - } - - bool isCompletionSnippetsSupported() { - //@formatter:off - if(!v3supported || !textDocument.completion) - { - return false; - } - const auto& completion = textDocument.completion.value(); - if(completion.completionItem) - { - return isTrue(completion.completionItem.value().snippetSupport); - } - return false; - } - - bool isV3Supported() { - return v3supported; - } - - bool isFormattingDynamicRegistrationSupported() { - return v3supported && isDynamicRegistrationSupported(textDocument.formatting); - } - - bool isRangeFormattingDynamicRegistrationSupported() { - return v3supported && isDynamicRegistrationSupported(textDocument.rangeFormatting); - } - - bool isOnTypeFormattingDynamicRegistrationSupported() { - return v3supported && isDynamicRegistrationSupported(textDocument.onTypeFormatting); - } - - bool isCodeLensDynamicRegistrationSupported() { - return v3supported && isDynamicRegistrationSupported(textDocument.codeLens); - } - - bool isSignatureHelpDynamicRegistrationSupported() { - return v3supported && isDynamicRegistrationSupported(textDocument.signatureHelp); - } - template<typename T> - static bool isDynamicRegistrationSupported(boost::optional<T>& capability) - { - if(capability) - return (capability.value().dynamicRegistration.value()); - return false; - } - - bool isTrue(const boost::optional<bool>& value) - { - return value.get_value_or(false); - } - - bool isRenameDynamicRegistrationSupported() { - return v3supported && isDynamicRegistrationSupported(textDocument.rename); - } - - bool isExecuteCommandDynamicRegistrationSupported() { - return v3supported && workspace != nullptr && isDynamicRegistrationSupported(workspace->executeCommand); - } - - bool isWorkspaceSymbolDynamicRegistered() { - return v3supported && workspace != nullptr && isDynamicRegistrationSupported(workspace->symbol); - } - - bool isWorkspaceChangeWatchedFilesDynamicRegistered() { - return v3supported && workspace != nullptr && isDynamicRegistrationSupported(workspace->didChangeWatchedFiles); - } - - bool isDocumentSymbolDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.documentSymbol); - } - - bool isCodeActionDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.codeAction); - } - - bool isDefinitionDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.definition); - } - - bool isTypeDefinitionDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.typeDefinition); - } - - bool isHoverDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.hover); - } - - bool isReferencesDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.references); - } - - bool isDocumentHighlightDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.documentHighlight); - } - - bool isFoldgingRangeDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.foldingRange); - } - - bool isImplementationDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.implementation); - } - - bool isSelectionRangeDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.selectionRange); - } - - bool isWillSaveRegistered() { - return v3supported && isTrue(textDocument.synchronization.willSave); - } - - bool isWillSaveWaitUntilRegistered() { - return v3supported && isTrue(textDocument.synchronization.willSaveWaitUntil); - } - - bool isWorkspaceApplyEditSupported() { - return workspace != nullptr && isTrue(workspace->applyEdit); - } - - bool isSupportsCompletionDocumentationMarkdown() { - - if (!v3supported || !textDocument.completion) - { - return false; - } - const auto& completion = textDocument.completion.value(); - if (completion.completionItem) - { - auto& documentationFormat = completion.completionItem.value().documentationFormat; - if(documentationFormat) - { - auto& data = documentationFormat.value(); - for(auto& it : data) - { - if(it == "markdown") - { - return true; - } - } - } - } - return false; - - } - - - bool isWorkspaceEditResourceChangesSupported() { - if(!workspace) return false; - - if(workspace->workspaceEdit) - { - return isTrue(workspace->workspaceEdit.value().resourceChanges); - } - return false; - } - static bool contains(const std::vector<std::string>& v, const std::string& target) - { - for(auto& it : v) - { - if(it == target) return true; - } - return false; - } - bool isResourceOperationSupported() const - { - if (!workspace) return false; - if (!workspace->workspaceEdit) - { - return false; - } - auto& it = (workspace->workspaceEdit.value()); - if(!it.resourceOperations) return false; - const auto& resourceOperations = it.resourceOperations.value(); - return contains(resourceOperations, "create") && contains(resourceOperations, "rename") && contains(resourceOperations, "delete"); - - } - - /** - * {@code true} if the client has explicitly set the - * {@code textDocument.documentSymbol.hierarchicalDocumentSymbolSupport} to - * {@code true} when initializing the LS. Otherwise, {@code false}. - */ - bool isHierarchicalDocumentSymbolSupported() { - if(!v3supported || !textDocument.documentSymbol) return false; - return isTrue(textDocument.documentSymbol.value().hierarchicalDocumentSymbolSupport); - - } - - bool isSemanticHighlightingSupported() { - //@formatter:off - if (!v3supported || !textDocument.semanticHighlightingCapabilities) return false; - return isTrue(textDocument.semanticHighlightingCapabilities.value().semanticHighlighting); - //@formatter:on - } - - /** - * {@code true} if the client has explicitly set the - * {@code textDocument.codeAction.codeActionLiteralSupport.codeActionKind.valueSet} - * value. Otherwise, {@code false}. - */ - bool isSupportedCodeActionKind(const std::string& kind) { - if (!v3supported || !textDocument.codeAction) return false; - //@formatter:off - const auto& codeAction = textDocument.codeAction.value(); - if(codeAction.codeActionLiteralSupport) - { - const auto& codeActionKind = codeAction.codeActionLiteralSupport.value().codeActionKind; - if(codeActionKind) - { - const auto& valueSet = codeActionKind.value().valueSet; - if(valueSet) - { - for(auto& k : valueSet.value()) - { - if(lsp::StartsWith(kind,k)) - { - return true; - } - } - } - } - } - return false; - - //@formatter:on - } - - /** - * {@code true} if the client has explicitly set the - * {@code textDocument.publishDiagnostics.tagSupport} to - * {@code true} when initializing the LS. Otherwise, {@code false}. - */ - bool isDiagnosticTagSupported() { - if (!v3supported || !textDocument.publishDiagnostics) return false; - const auto& publishDiagnostics = textDocument.publishDiagnostics.value(); - if(publishDiagnostics.tagSupport) - { - isTagSupported(publishDiagnostics.tagSupport); - } - return false; - } - - bool isTagSupported(const boost::optional < std::pair<boost::optional<bool>, - boost::optional<DiagnosticsTagSupport> > >& tagSupport) { - if(tagSupport) - { - auto &v = tagSupport.value(); - if (v.first) - { - return v.first.value(); - } - if (v.second) { - return !v.second.value().valueSet.empty(); - } - } - return false; - } - - bool isCallHierarchyDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.callHierarchy); - } + std::shared_ptr<lsWorkspaceClientCapabilites> workspace; + lsTextDocumentClientCapabilities textDocument ; + + ClientPreferences(const lsClientCapabilities& capabilities) + { + v3supported = capabilities.textDocument.has_value(); + if (v3supported) + textDocument = capabilities.textDocument.value(); + if(capabilities.workspace) + { + workspace = std::make_shared<lsWorkspaceClientCapabilites>(capabilities.workspace.value()); + } + } + + bool v3supported=false; + + bool isSignatureHelpSupported() { + + return v3supported && (textDocument.signatureHelp); + } + bool isWorkspaceDidChangeConfigurationSupported() const + { + return workspace && isDynamicRegistrationSupported(workspace->didChangeConfiguration); + } + bool isWorkspaceFoldersSupported() { + return workspace != nullptr && isTrue(workspace->workspaceFolders); + } + + bool isCompletionDynamicRegistered() { + return v3supported && isDynamicRegistrationSupported(textDocument.completion); + } + + bool isCompletionSnippetsSupported() { + //@formatter:off + if(!v3supported || !textDocument.completion) + { + return false; + } + const auto& completion = textDocument.completion.value(); + if(completion.completionItem) + { + return isTrue(completion.completionItem.value().snippetSupport); + } + return false; + } + + bool isV3Supported() { + return v3supported; + } + + bool isFormattingDynamicRegistrationSupported() { + return v3supported && isDynamicRegistrationSupported(textDocument.formatting); + } + + bool isRangeFormattingDynamicRegistrationSupported() { + return v3supported && isDynamicRegistrationSupported(textDocument.rangeFormatting); + } + + bool isOnTypeFormattingDynamicRegistrationSupported() { + return v3supported && isDynamicRegistrationSupported(textDocument.onTypeFormatting); + } + + bool isCodeLensDynamicRegistrationSupported() { + return v3supported && isDynamicRegistrationSupported(textDocument.codeLens); + } + + bool isSignatureHelpDynamicRegistrationSupported() { + return v3supported && isDynamicRegistrationSupported(textDocument.signatureHelp); + } + template<typename T> + static bool isDynamicRegistrationSupported(boost::optional<T>& capability) + { + if(capability) + return (capability.value().dynamicRegistration.value()); + return false; + } + + bool isTrue(const boost::optional<bool>& value) + { + return value.get_value_or(false); + } + + bool isRenameDynamicRegistrationSupported() { + return v3supported && isDynamicRegistrationSupported(textDocument.rename); + } + + bool isExecuteCommandDynamicRegistrationSupported() { + return v3supported && workspace != nullptr && isDynamicRegistrationSupported(workspace->executeCommand); + } + + bool isWorkspaceSymbolDynamicRegistered() { + return v3supported && workspace != nullptr && isDynamicRegistrationSupported(workspace->symbol); + } + + bool isWorkspaceChangeWatchedFilesDynamicRegistered() { + return v3supported && workspace != nullptr && isDynamicRegistrationSupported(workspace->didChangeWatchedFiles); + } + + bool isDocumentSymbolDynamicRegistered() { + return v3supported && isDynamicRegistrationSupported(textDocument.documentSymbol); + } + + bool isCodeActionDynamicRegistered() { + return v3supported && isDynamicRegistrationSupported(textDocument.codeAction); + } + + bool isDefinitionDynamicRegistered() { + return v3supported && isDynamicRegistrationSupported(textDocument.definition); + } + + bool isTypeDefinitionDynamicRegistered() { + return v3supported && isDynamicRegistrationSupported(textDocument.typeDefinition); + } + + bool isHoverDynamicRegistered() { + return v3supported && isDynamicRegistrationSupported(textDocument.hover); + } + + bool isReferencesDynamicRegistered() { + return v3supported && isDynamicRegistrationSupported(textDocument.references); + } + + bool isDocumentHighlightDynamicRegistered() { + return v3supported && isDynamicRegistrationSupported(textDocument.documentHighlight); + } + + bool isFoldgingRangeDynamicRegistered() { + return v3supported && isDynamicRegistrationSupported(textDocument.foldingRange); + } + + bool isImplementationDynamicRegistered() { + return v3supported && isDynamicRegistrationSupported(textDocument.implementation); + } + + bool isSelectionRangeDynamicRegistered() { + return v3supported && isDynamicRegistrationSupported(textDocument.selectionRange); + } + + bool isWillSaveRegistered() { + return v3supported && isTrue(textDocument.synchronization.willSave); + } + + bool isWillSaveWaitUntilRegistered() { + return v3supported && isTrue(textDocument.synchronization.willSaveWaitUntil); + } + + bool isWorkspaceApplyEditSupported() { + return workspace != nullptr && isTrue(workspace->applyEdit); + } + + bool isSupportsCompletionDocumentationMarkdown() { + + if (!v3supported || !textDocument.completion) + { + return false; + } + const auto& completion = textDocument.completion.value(); + if (completion.completionItem) + { + auto& documentationFormat = completion.completionItem.value().documentationFormat; + if(documentationFormat) + { + auto& data = documentationFormat.value(); + for(auto& it : data) + { + if(it == "markdown") + { + return true; + } + } + } + } + return false; + + } + + + bool isWorkspaceEditResourceChangesSupported() { + if(!workspace) return false; + + if(workspace->workspaceEdit) + { + return isTrue(workspace->workspaceEdit.value().resourceChanges); + } + return false; + } + static bool contains(const std::vector<std::string>& v, const std::string& target) + { + for(auto& it : v) + { + if(it == target) return true; + } + return false; + } + bool isResourceOperationSupported() const + { + if (!workspace) return false; + if (!workspace->workspaceEdit) + { + return false; + } + auto& it = (workspace->workspaceEdit.value()); + if(!it.resourceOperations) return false; + const auto& resourceOperations = it.resourceOperations.value(); + return contains(resourceOperations, "create") && contains(resourceOperations, "rename") && contains(resourceOperations, "delete"); + + } + + /** + * {@code true} if the client has explicitly set the + * {@code textDocument.documentSymbol.hierarchicalDocumentSymbolSupport} to + * {@code true} when initializing the LS. Otherwise, {@code false}. + */ + bool isHierarchicalDocumentSymbolSupported() { + if(!v3supported || !textDocument.documentSymbol) return false; + return isTrue(textDocument.documentSymbol.value().hierarchicalDocumentSymbolSupport); + + } + + bool isSemanticHighlightingSupported() { + //@formatter:off + if (!v3supported || !textDocument.semanticHighlightingCapabilities) return false; + return isTrue(textDocument.semanticHighlightingCapabilities.value().semanticHighlighting); + //@formatter:on + } + + /** + * {@code true} if the client has explicitly set the + * {@code textDocument.codeAction.codeActionLiteralSupport.codeActionKind.valueSet} + * value. Otherwise, {@code false}. + */ + bool isSupportedCodeActionKind(const std::string& kind) { + if (!v3supported || !textDocument.codeAction) return false; + //@formatter:off + const auto& codeAction = textDocument.codeAction.value(); + if(codeAction.codeActionLiteralSupport) + { + const auto& codeActionKind = codeAction.codeActionLiteralSupport.value().codeActionKind; + if(codeActionKind) + { + const auto& valueSet = codeActionKind.value().valueSet; + if(valueSet) + { + for(auto& k : valueSet.value()) + { + if(lsp::StartsWith(kind,k)) + { + return true; + } + } + } + } + } + return false; + + //@formatter:on + } + + /** + * {@code true} if the client has explicitly set the + * {@code textDocument.publishDiagnostics.tagSupport} to + * {@code true} when initializing the LS. Otherwise, {@code false}. + */ + bool isDiagnosticTagSupported() { + if (!v3supported || !textDocument.publishDiagnostics) return false; + const auto& publishDiagnostics = textDocument.publishDiagnostics.value(); + if(publishDiagnostics.tagSupport) + { + isTagSupported(publishDiagnostics.tagSupport); + } + return false; + } + + bool isTagSupported(const boost::optional < std::pair<boost::optional<bool>, + boost::optional<DiagnosticsTagSupport> > >& tagSupport) { + if(tagSupport) + { + auto &v = tagSupport.value(); + if (v.first) + { + return v.first.value(); + } + if (v.second) { + return !v.second.value().valueSet.empty(); + } + } + return false; + } + + bool isCallHierarchyDynamicRegistered() { + return v3supported && isDynamicRegistrationSupported(textDocument.callHierarchy); + } }; diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/CodeActionParams.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/CodeActionParams.h index a1e3f1dcc1..1704dd33c6 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/CodeActionParams.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/CodeActionParams.h @@ -7,98 +7,98 @@ #include "LibLsp/lsp/lsCodeAction.h" namespace JDT { - namespace CodeActionKind { - - - /** - * Base kind for quickfix actions: 'quickfix' - */ - extern const char* QuickFix; - - /** - * Base kind for refactoring actions: 'refactor' - */ - extern const char* Refactor; - - /** - * Base kind for refactoring extraction actions: 'refactor.extract' - * - * Example extract actions: - * - * - Extract method - Extract function - Extract variable - Extract interface - * from class - ... - */ - extern const char* RefactorExtract; - - /** - * Base kind for refactoring inline actions: 'refactor.inline' - * - * Example inline actions: - * - * - Inline function - Inline variable - Inline constant - ... - */ - extern const char* RefactorInline; - - /** - * 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 - ... - */ - extern const char* RefactorRewrite; - - /** - * Base kind for source actions: `source` - * - * Source code actions apply to the entire file. - */ - extern const char* Source ; - - /** - * Base kind for an organize imports source action: `source.organizeImports` - */ - extern const char* SourceOrganizeImports; - - extern const char* COMMAND_ID_APPLY_EDIT; - }; + namespace CodeActionKind { + + + /** + * Base kind for quickfix actions: 'quickfix' + */ + extern const char* QuickFix; + + /** + * Base kind for refactoring actions: 'refactor' + */ + extern const char* Refactor; + + /** + * Base kind for refactoring extraction actions: 'refactor.extract' + * + * Example extract actions: + * + * - Extract method - Extract function - Extract variable - Extract interface + * from class - ... + */ + extern const char* RefactorExtract; + + /** + * Base kind for refactoring inline actions: 'refactor.inline' + * + * Example inline actions: + * + * - Inline function - Inline variable - Inline constant - ... + */ + extern const char* RefactorInline; + + /** + * 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 - ... + */ + extern const char* RefactorRewrite; + + /** + * Base kind for source actions: `source` + * + * Source code actions apply to the entire file. + */ + extern const char* Source ; + + /** + * Base kind for an organize imports source action: `source.organizeImports` + */ + extern const char* SourceOrganizeImports; + + extern const char* COMMAND_ID_APPLY_EDIT; + }; } struct lsCodeActionContext { - // An array of diagnostics. - std::vector<lsDiagnostic> diagnostics; - /** - * 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. - * - * See {@link CodeActionKind} for allowed values. - */ - boost::optional<std::vector<std::string>> only; - - MAKE_SWAP_METHOD(lsCodeActionContext, - diagnostics, only); + // An array of diagnostics. + std::vector<lsDiagnostic> diagnostics; + /** + * 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. + * + * See {@link CodeActionKind} for allowed values. + */ + boost::optional<std::vector<std::string>> only; + + MAKE_SWAP_METHOD(lsCodeActionContext, + diagnostics, only); }; MAKE_REFLECT_STRUCT(lsCodeActionContext, - diagnostics, only); + diagnostics, only); // Params for the CodeActionRequest struct lsCodeActionParams { - // The document in which the command was invoked. - lsTextDocumentIdentifier textDocument; - // The range for which the command was invoked. - lsRange range; - // Context carrying additional information. - lsCodeActionContext context; - - MAKE_SWAP_METHOD(lsCodeActionParams, - textDocument, - range, - context); + // The document in which the command was invoked. + lsTextDocumentIdentifier textDocument; + // The range for which the command was invoked. + lsRange range; + // Context carrying additional information. + lsCodeActionContext context; + + MAKE_SWAP_METHOD(lsCodeActionParams, + textDocument, + range, + context); }; MAKE_REFLECT_STRUCT(lsCodeActionParams, textDocument, diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/Directory.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/Directory.h index 93f2c0807d..77b6cbb3e7 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/Directory.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/Directory.h @@ -4,10 +4,10 @@ struct AbsolutePath; struct Directory { - explicit Directory(const AbsolutePath& path); + explicit Directory(const AbsolutePath& path); - bool operator==(const Directory& rhs) const; - bool operator!=(const Directory& rhs) const; + bool operator==(const Directory& rhs) const; + bool operator!=(const Directory& rhs) const; - std::string path; + std::string path; }; diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/ExecuteCommandParams.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/ExecuteCommandParams.h index c06eed4b1c..5ad4e07d8d 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/ExecuteCommandParams.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/ExecuteCommandParams.h @@ -2,19 +2,19 @@ #include "lsAny.h" struct ExecuteCommandParams { - /** - * The identifier of the actual command handler. - */ + /** + * The identifier of the actual command handler. + */ - std::string command; + std::string command; - /** - * Arguments that the command should be invoked with. - * The arguments are typically specified when a command is returned from the server to the client. - * Example requests that return a command are textDocument/codeAction or textDocument/codeLens. - */ - boost::optional<std::vector<lsp::Any>> arguments; - - MAKE_SWAP_METHOD(ExecuteCommandParams, command, arguments); + /** + * Arguments that the command should be invoked with. + * The arguments are typically specified when a command is returned from the server to the client. + * Example requests that return a command are textDocument/codeAction or textDocument/codeLens. + */ + boost::optional<std::vector<lsp::Any>> arguments; + + MAKE_SWAP_METHOD(ExecuteCommandParams, command, arguments); }; MAKE_REFLECT_STRUCT(ExecuteCommandParams,command,arguments) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/IProgressMonitor.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/IProgressMonitor.h index bf1337e44f..369ebb2a6d 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/IProgressMonitor.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/IProgressMonitor.h @@ -2,7 +2,7 @@ #include <string> -namespace lsp { +namespace lsp { /** * The <code>IProgressMonitor</code> interface is implemented * by objects that monitor the progress of an activity; the methods @@ -36,110 +36,108 @@ namespace lsp { * Clients may implement this interface. * </p> */ - class IProgressMonitor { - public: - virtual ~IProgressMonitor() - { - } - - /** Constant indicating an unknown amount of work. - */ - - const static int UNKNOWN = -1; - - /** - * Notifies that the main task is beginning. This must only be called once - * on a given progress monitor instance. - * - * @param name the name (or description) of the main task - * @param totalWork the total number of work units into which - * the main task is been subdivided. If the value is <code>UNKNOWN</code> - * the implemenation is free to indicate progress in a way which - * doesn't require the total number of work units in advance. - */ - virtual void beginTask(void* , int totalWork) - { - - }; - /** - * Notifies that the work is done; that is, either the main task is completed - * or the user canceled it. This method may be called more than once - * (implementations should be prepared to handle this case). - */ - - virtual void endTask(void*, int totalWork) - { - - } - - virtual void done(void*) = 0; - - /** - * Internal method to handle scaling correctly. This method - * must not be called by a client. Clients should - * always use the method </code>worked(int)</code>. - */ - virtual void internalWorked(double work) - { - - } - /** - * Returns whether cancelation of current operation has been requested. - * Long-running operations should poll to see if cancelation - * has been requested. - * - * @return <code>true</code> if cancellation has been requested, - * and <code>false</code> otherwise - * @see #setCanceled - */ - virtual bool isCanceled() = 0; - /** - * Sets the cancel state to the given value. - * - * @param value <code>true</code> indicates that cancelation has - * been requested (but not necessarily acknowledged); - * <code>false</code> clears this flag - * - * @see #isCanceled - */ - virtual void setCanceled(bool value) = 0; - /** - * Sets the task name to the given value. This method is used to - * restore the task label after a nested operation was executed. - * Normally there is no need for clients to call this method. - * - * @param name the name (or description) of the main task - * @see #beginTask(java.lang.const wstring&, int) - */ - virtual void setTaskName(void*) - { - - }; - /** - * Notifies that a subtask of the main task is beginning. - * Subtasks are optional; the main task might not have subtasks. - * - * @param name the name (or description) of the subtask - */ - virtual void subTask(void* ) - { - - } - /** - * Notifies that a given number of work unit of the main task - * has been completed. Note that this amount represents an - * installment, as opposed to a cumulative amount of work done - * to date. - * - * @param work the number of work units just completed - */ - virtual void worked(int work) - { - - }; - - virtual void catch_exception(void*) = 0; - }; + class IProgressMonitor { + public: + virtual ~IProgressMonitor() + { + } + + /** Constant indicating an unknown amount of work. + */ + + const static int UNKNOWN = -1; + + /** + * Notifies that the main task is beginning. This must only be called once + * on a given progress monitor instance. + * + * @param name the name (or description) of the main task + * @param totalWork the total number of work units into which + * the main task is been subdivided. If the value is <code>UNKNOWN</code> + * the implemenation is free to indicate progress in a way which + * doesn't require the total number of work units in advance. + */ + virtual void beginTask(void* , int totalWork) + { + + }; + /** + * Notifies that the work is done; that is, either the main task is completed + * or the user canceled it. This method may be called more than once + * (implementations should be prepared to handle this case). + */ + + virtual void endTask(void*, int totalWork) + { + + } + + virtual void done(void*) = 0; + + /** + * Internal method to handle scaling correctly. This method + * must not be called by a client. Clients should + * always use the method <code>worked(int)</code>. + */ + virtual void internalWorked(double work) + { + + } + /** + * Returns whether cancelation of current operation has been requested. + * Long-running operations should poll to see if cancelation + * has been requested. + * + * @return <code>true</code> if cancellation has been requested, + * and <code>false</code> otherwise + * @see #setCanceled + */ + virtual bool isCanceled() = 0; + /** + * Sets the cancel state to the given value. + * + * @param value <code>true</code> indicates that cancelation has + * been requested (but not necessarily acknowledged); + * <code>false</code> clears this flag + * + * @see #isCanceled + */ + virtual void setCanceled(bool value) = 0; + /** + * Sets the task name to the given value. This method is used to + * restore the task label after a nested operation was executed. + * Normally there is no need for clients to call this method. + * + * @param name the name (or description) of the main task + * @see #beginTask(java.lang.const wstring&, int) + */ + virtual void setTaskName(void*) + { + + }; + /** + * Notifies that a subtask of the main task is beginning. + * Subtasks are optional; the main task might not have subtasks. + * + * @param name the name (or description) of the subtask + */ + virtual void subTask(void* ) + { + + } + /** + * Notifies that a given number of work unit of the main task + * has been completed. Note that this amount represents an + * installment, as opposed to a cumulative amount of work done + * to date. + * + * @param work the number of work units just completed + */ + virtual void worked(int work) + { + + }; + + virtual void catch_exception(void*) = 0; + }; } - - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/Markup/Markup.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/Markup/Markup.h index 92d773db0c..1618939c69 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/Markup/Markup.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/Markup/Markup.h @@ -1,5 +1,5 @@ #pragma once -#include <cctype> +#include <cctype> #include <clocale> #include <cstddef> #include <memory> @@ -11,7 +11,7 @@ namespace lsp { - + /// Holds text and knows how to lay it out. Multiple blocks can be grouped to /// form a document. Blocks include their own trailing newlines, std::string_ref /// should trim them if need be. diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/Markup/string_ref.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/Markup/string_ref.h index 220817a1a2..bac8fbbaf5 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/Markup/string_ref.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/Markup/string_ref.h @@ -12,877 +12,877 @@ namespace std { - /** - * An extension of STL's string providing additional functionality that is often availiable in - * higher-level languages such as Python. - */ - class string_ref : public string - { - public: - - //static unsigned GetAutoSenseRadix(string_ref& Str) { - // if (Str.empty()) - // return 10; - - // if (Str.start_with("0x") || Str.start_with("0X")) { - // Str = Str.substr(2); - // return 16; - // } - - // if (Str.start_with("0b") || Str.start_with("0B")) { - // Str = Str.substr(2); - // return 2; - // } - - // if (Str.start_with("0o")) { - // Str = Str.substr(2); - // return 8; - // } - - // if (Str[0] == '0' && Str.size() > 1 && std::isdigit(Str[1])) { - // Str = Str.substr(1); - // return 8; - // } - - // return 10; - //} - - //static bool consumeUnsignedInteger(string_ref& Str, unsigned Radix, - // unsigned long long& Result) { - // // Autosense radix if not specified. - // if (Radix == 0) - // Radix = GetAutoSenseRadix(Str); - - // // Empty strings (after the radix autosense) are invalid. - // if (Str.empty()) return true; - - // // Parse all the bytes of the string given this radix. Watch for overflow. - // string_ref Str2 = Str; - // Result = 0; - // while (!Str2.empty()) { - // unsigned CharVal; - // if (Str2[0] >= '0' && Str2[0] <= '9') - // CharVal = Str2[0] - '0'; - // else if (Str2[0] >= 'a' && Str2[0] <= 'z') - // CharVal = Str2[0] - 'a' + 10; - // else if (Str2[0] >= 'A' && Str2[0] <= 'Z') - // CharVal = Str2[0] - 'A' + 10; - // else - // break; - - // // If the parsed value is larger than the integer radix, we cannot - // // consume any more characters. - // if (CharVal >= Radix) - // break; - - // // Add in this character. - // unsigned long long PrevResult = Result; - // Result = Result * Radix + CharVal; - - // // Check for overflow by shifting back and seeing if bits were lost. - // if (Result / Radix < PrevResult) - // return true; - - // Str2 = Str2.substr(1); - // } - - // // We consider the operation a failure if no characters were consumed - // // successfully. - // if (Str.size() == Str2.size()) - // return true; - - // Str = Str2; - // return false; - //} - - //static bool consumeSignedInteger(string_ref& Str, unsigned Radix, - // long long& Result) { - // unsigned long long ULLVal; - - // // Handle positive strings first. - // if (Str.empty() || Str.front() != '-') { - // if (consumeUnsignedInteger(Str, Radix, ULLVal) || - // // Check for value so large it overflows a signed value. - // (long long)ULLVal < 0) - // return true; - // Result = ULLVal; - // return false; - // } - - // // Get the positive part of the value. - // string_ref Str2 = Str.drop_front(1); - // if (consumeUnsignedInteger(Str2, Radix, ULLVal) || - // // Reject values so large they'd overflow as negative signed, but allow - // // "-0". This negates the unsigned so that the negative isn't undefined - // // on signed overflow. - // (long long)-ULLVal > 0) - // return true; - - // Str = Str2; - // Result = -ULLVal; - // return false; - //} - - ///// GetAsUnsignedInteger - Workhorse method that converts a integer character - ///// sequence of radix up to 36 to an unsigned long long value. - //static bool getAsUnsignedInteger(string_ref Str, unsigned Radix, - // unsigned long long& Result) { - // if (consumeUnsignedInteger(Str, Radix, Result)) - // return true; - - // // For getAsUnsignedInteger, we require the whole string to be consumed or - // // else we consider it a failure. - // return !Str.empty(); - //} - - //static bool getAsSignedInteger(string_ref Str, unsigned Radix, - // long long& Result) { - // if (consumeSignedInteger(Str, Radix, Result)) - // return true; - - // // For getAsSignedInteger, we require the whole string to be consumed or else - // // we consider it a failure. - // return !Str.empty(); - //} - - - ///// Parse the current string as an integer of the specified radix. If - ///// \p Radix is specified as zero, this does radix autosensing using - ///// extended C rules: 0 is octal, 0x is hex, 0b is binary. - ///// - ///// If the string is invalid or if only a subset of the string is valid, - ///// this returns true to signify the error. The string is considered - ///// erroneous if empty or if it overflows T. - //template <typename T> - //std::enable_if_t<std::numeric_limits<T>::is_signed, bool> - // getAsInteger(unsigned Radix, T& Result) const { - // long long LLVal; - // if (getAsSignedInteger(*this, Radix, LLVal) || - // static_cast<T>(LLVal) != LLVal) - // return true; - // Result = LLVal; - // return false; - //} - - //template <typename T> - //std::enable_if_t<!std::numeric_limits<T>::is_signed, bool> - // getAsInteger(unsigned Radix, T& Result) const { - // unsigned long long ULLVal; - // // The additional cast to unsigned long long is required to avoid the - // // Visual C++ warning C4805: '!=' : unsafe mix of type 'bool' and type - // // 'unsigned __int64' when instantiating getAsInteger with T = bool. - // if (getAsUnsignedInteger(*this, Radix, ULLVal) || - // static_cast<unsigned long long>(static_cast<T>(ULLVal)) != ULLVal) - // return true; - // Result = ULLVal; - // return false; - //} - - - - /**` - * Default constructor - * - * Constructs an empty string_ref ("") - */ - string_ref() : string() { } - - /** - * Duplicate the STL string copy constructor - * - * @param[in] s The string to copy - * @param[in] pos The starting position in the string to copy from - * @param[in] n The number of characters to copy - */ - string_ref(const string &s, size_type pos = 0, size_type n = npos) : string(s, pos, npos) { } - - /** - * Construct an string_ref from a null-terminated character array - * - * @param[in] s The character array to copy into the new string - */ - string_ref(const value_type *s) : string(s) { } - - /** - * Construct an string_ref from a character array and a length - * - * @param[in] s The character array to copy into the new string - * @param[in] n The number of characters to copy - */ - string_ref(const value_type *s, size_type n) : string(s, n) { } - - /** - * Create an string_ref with @p n copies of @p c - * - * @param[in] n The number of copies - * @param[in] c The character to copy @p n times - */ - string_ref(size_type n, value_type c) : string(n, c) { } - - /** - * Create a string from a range - * - * @param[in] first The first element to copy in - * @param[in] last The last element to copy in - */ - template <class InputIterator> - string_ref(InputIterator first, InputIterator last) : string(first, last) { } - - /** - * The destructor - */ - ~string_ref() { } - - /** - * Split a string by whitespace - * - * @return A vector of strings, each of which is a substring of the string - */ - vector<string_ref> split(size_type limit = npos) const - { - vector<string_ref> v; - - const_iterator - i = begin(), - last = i; - for (; i != end(); i++) - { - if (*i == ' ' || *i == '\n' || *i == '\t' || *i == '\r') - { - if (i + 1 != end() && (i[1] == ' ' || i[1] == '\n' || i[1] == '\t' || i[1] == '\r')) - continue; - v.push_back(string_ref(last, i)); - last = i + 1; - if (v.size() >= limit - 1) - { - v.push_back(string_ref(last, end())); - return v; - } - } - } - - if (last != i) - v.push_back(string_ref(last, i)); - - return v; - } - - /** - * Split a string by a character - * - * Returns a vector of ext_strings, each of which is a substring of the string formed by splitting - * it on boundaries formed by the character @p separator. If @p limit is set, the returned vector - * will contain a maximum of @p limit elements with the last element containing the rest of - * the string. - * - * If @p separator is not found in the string, a single element will be returned in the vector - * containing the entire string. - * - * The separators are removed from the output - * - * @param[in] separator The character separator to split the string on - * @param[in] limit The maximum number of output elements - * @return A vector of strings, each of which is a substring of the string - * - * @section split_ex Example - * @code - * std::string_ref s("This|is|a|test."); - * std::vector<std::string_ref> v = s.split('|'); - * std::copy(v.begin(), v.end(), std::ostream_iterator<std::string_ref>(std::cout, "\n")); - * - * This - * is - * a - * test. - * @endcode - */ - vector<string_ref> split(value_type separator, size_type limit = npos) const - { - vector<string_ref> v; - - const_iterator - i = begin(), - last = i; - for (; i != end(); i++) - { - if (*i == separator) - { - v.push_back(string_ref(last, i)); - last = i + 1; - if (v.size() >= limit - 1) - { - v.push_back(string_ref(last, end())); - return v; - } - } - } - - if (last != i) - v.push_back(string_ref(last, i)); - - return v; - } - - /** - * Split a string by another string - * - * Returns a vector of ext_strings, each of which is a substring of the string formed by - * splitting it on boundaries formed by the string @p separator. If @p limit is set, the - * returned vector will contain a maximum of @p limit elements with the last element - * containing the rest of the string. - * - * If @p separator is not found in the string, a single element will be returned in the - * vector containing the entire string. - * - * The separators are removed from the output - * - * @param[in] separator The string separator to split the string on - * @param[in] limit The maximum number of output elements - * @return A vector of strings, each of which is a substring of the string - * - * @ref split_ex - */ - vector<string_ref> split(const string &separator, size_type limit = npos) const - { - vector<string_ref> v; - - const_iterator - i = begin(), - last = i; - for (; i != end(); i++) - { - if (string(i, i + separator.length()) == separator) - { - v.push_back(string_ref(last, i)); - last = i + separator.length(); - - if (v.size() >= limit - 1) - { - v.push_back(string_ref(last, end())); - return v; - } - } - } - - if (last != i) - v.push_back(string_ref(last, i)); - - return v; - } - - /** - * Convert a string into an integer - * - * Convert the initial portion of a string into a signed integer. Once a non-numeric - * character is reached, the remainder of @p string is ignored and the integer that was - * read returned. - * - * @param s The string to convert - * @return The integer converted from @p string - */ - static long int integer(const string &s) - { - long int retval = 0; - bool neg = false; - - for (const_iterator i = s.begin(); i != s.end(); i++) - { - if (i == s.begin()) - { - if (*i == '-') - { - neg = true; - continue; - } - else if (*i == '+') - continue; - } - if (*i >= '0' && *i <= '9') - { - retval *= 10; - retval += *i - '0'; - } - else - break; - } - - if (neg) - retval *= -1; - - return retval; - } - - /** - * Convert the string to an integer - * - * Convert the initial portion of the string into a signed integer. Once a non-numeric - * character is reached, the remainder of the string is ignored and the integer that had - * been read thus far is returned. - * - * @return The integer converted from the string - */ - long int integer() const - { - return integer(*this); - } - - /** - * Split a string into chunks of size @p chunklen. Returns a vector of strings. - * - * Splits a string into chunks of the given size. The final chunk may not fill its - * entire allocated number of characters. - * - * @param[in] chunklen The number of characters per chunk - * @return A vector of strings, each of length <= chunklen - * - * @section chunk_split-ex Example - * @code - * std::string_ref s("abcdefghijk"); - * std::vector<std::string_ref> v = s.chunk_split(3); - * std::copy(v.begin(), v.end(), ostream_iterator<std::string_ref>(cout, " ")); - * - * abc def ghi jk - * @endcode - */ - vector<string_ref> chunk_split(size_type chunklen) const - { - vector<string_ref> retval; - retval.reserve(size() / chunklen + 1); - - size_type count = 0; - const_iterator - i = begin(), - last = i; - for (; i != end(); i++, count++) - { - if (count == chunklen) - { - count = 0; - retval.push_back(string_ref(last, i)); - last = i; - } - } - - if (last != i) - retval.push_back(string_ref(last, i)); - - return retval; - } - - /** - * Join a sequence of strings by some glue to create a new string - * - * Glue is not added to the end of the string. - * - * @pre [first, last) is a valid range - * @pre InputIterator is a model of STL's Input Iterator - * @pre InputIterator must point to a string type (std::string, std::string_ref, char *) - * - * @param[in] glue The glue to join strings with - * @param[in] first The beginning of the range to join - * @param[in] last The end of the range to join - * @return A string constructed of each element of the range connected together with @p glue - * - * @section join_ex Example - * @code - * std::vector<std::string_ref> v; - * v.push_back("This"); - * v.push_back("is"); - * v.push_back("a"); - * v.push_back("test."); - * std::cout << std::string_ref::join("|", v.begin(), v.end()) << std::endl; - * - * This|is|a|test. - * @endcode - */ - template <class InputIterator> - static string_ref join(const string &glue, InputIterator first, InputIterator last) - { - string_ref retval; - - for (; first != last; ++first) - { - retval.append(*first); - retval.append(glue); - } - retval.erase(retval.length() - glue.length()); - - return retval; - } - - /** - * Join a sequence of strings by some glue to create a new string - * - * @copydoc join - * @ref join_ex - */ - template <class InputIterator> - static string_ref join(value_type glue, InputIterator first, InputIterator last) - { - string_ref retval; - - for (; first != last; ++first) - { - retval.append(*first); - retval.append(1, glue); - } - retval.erase(retval.length() - 1); - - return retval; - } - - /** - * Search for any instances of @p needle and replace them with @p s - * - * @param[in] needle The string to replace - * @param[in] s The replacement string - * @return *this - * @post All instances of @p needle in the string are replaced with @p s - * - * @section replace-ex Example - * @code - * std::string_ref s("This is a test."); - * s.replace("is", "ere"); - * std::cout << s << std::endl; - * - * There ere a test. - * @endcode - */ - string_ref &replace(const string &needle, const string &s) - { - size_type - lastpos = 0, - thispos; - - while ((thispos = find(needle, lastpos)) != npos) - { - string::replace(thispos, needle.length(), s); - lastpos = thispos + 1; - } - return *this; - } - string_ref &replace_first(const string &needle, const string &s) - { - size_type - lastpos = 0, - thispos; - - if ((thispos = find(needle, lastpos)) != npos) - { - string::replace(thispos, needle.length(), s); - lastpos = thispos + 1; - } - return *this; - } - /** - * Search of any instances of @p needle and replace them with @p c - * - * @param[in] needle The character to replace - * @param[in] c The replacement character - * @return *this - * @post All instances of @p needle in the string are replaced with @p c - * - * @ref replace-ex - */ - string_ref &replace(value_type needle, value_type c) - { - for (iterator i = begin(); i != end(); i++) - if (*i == needle) - *i = c; - - return *this; - } - - /** - * Repeat a string @p n times - * - * @param[in] n The number of times to repeat the string - * @return string_ref containing @p n copies of the string - * - * @section repeat-ex Example - * @code - * std::string_ref s("123"); - * s = s * 3; - * std::cout << s << std::endl; - * - * 123123123 - * @endcode - */ - string_ref operator*(size_type n) - { - string_ref retval; - for (size_type i = 0; i < n; i++) - retval.append(*this); - - return retval; - } - - /** - * Convert the string to lowercase - * - * @return *this - * @post The string is converted to lowercase - */ - string_ref &tolower() - { - for (iterator i = begin(); i != end(); i++) - if (*i >= 'A' && *i <= 'Z') - *i = (*i) + ('a' - 'A'); - return *this; - } - - /** - * Convert the string to uppercase - * - * @return *this - * @post The string is converted to uppercase - */ - string_ref &toupper() - { - for (iterator i = begin(); i != end(); i++) - if (*i >= 'a' && *i <= 'z') - *i = (*i) - ('a' - 'A'); - return *this; - } - - /** - * Count the occurances of @p str in the string. - * - * @return The count of substrings @p str in the string - */ - size_type count(const string &str) const - { - size_type - count = 0, - last = 0, - cur = 0; - - while ((cur = find(str, last + 1)) != npos) - { - count++; - last = cur; - } - - return count; - } - - /** - * Determine if the string is alphanumeric - * - * @return true if the string contains only characters between a-z, A-Z and 0-9 and - * contains at least one character, else false - */ - bool is_alnum() const - { - if (length() == 0) - return false; - - for (const_iterator i = begin(); i != end(); i++) - { - if (*i < 'A' || *i > 'Z') - if (*i < '0' || *i > '9') - if (*i < 'a' || *i > 'z') - return false; - } - - return true; - } - - /** - * Determine if the string is alphabetic only - * - * @return true of the string contains only characters between a-z and A-Z and contains at - * least one character, else false - */ - bool is_alpha() const - { - if (length() == 0) - return false; - - for (const_iterator i = begin(); i != end(); i++) - if (*i < 'A' || (*i > 'Z' && (*i < 'a' || *i > 'z'))) - return false; - - return true; - } - - /** - * Determine if the string is numeric only - * - * @return true if the string contains only characters between 0-9 and contains at least - * one character, else false - */ - bool is_numeric() const - { - if (length() == 0) - return false; - - for (const_iterator i = begin(); i != end(); i++) - if (*i < '0' || *i > '9') - return false; - - return true; - } - - /** - * Determine if a string is all lower case - * - * @return true if there is at least one character, and all characters are lowercase - * letters, else false - */ - bool is_lower() const - { - if (length() == 0) - return false; - - for (const_iterator i = begin(); i != end(); i++) - if (*i < 'a' || *i < 'z') - return false; - - return true; - } - - /** - * Determine if a string is all upper case - * - * @return true if there is at least one character, and all characters are uppercase - * letters, else false - */ - bool is_upper() const - { - if (length() == 0) - return false; - - for (const_iterator i = begin(); i != end(); i++) - if (*i < 'A' || *i > 'Z') - return false; - - return true; - } - - /** - * Swap the case of a string - * - * @post Converts all uppercase to lowercase, and all lowercase to uppercase in the string - * @return *this - */ - string_ref &swapcase() - { - for (iterator i = begin(); i != end(); i++) - if (*i >= 'A' && *i <= 'Z') - *i += ('a' - 'A'); - else if (*i >= 'a' && *i <= 'z') - *i -= ('a' - 'A'); - - return *this; - } - - /******************************************************************************* - Function: std::string_ref::start_with - Access: public - Qualifier: const - Parameter: const string & str - Returns: bool - - Purpose: is the string start with str - *******************************************************************************/ - bool start_with(const string& str) const - { - return ( this->find(str) == 0 ); - } - - /// Return a string_ref equal to 'this' but with only the last \p N - /// elements remaining. If \p N is greater than the length of the - /// string, the entire string is returned. - - string_ref take_back(size_t N = 1) const { - if (N >= size()) - return *this; - return drop_front(size() - N); - } - /// Return a string_ref equal to 'this' but with the first \p N elements - /// dropped. - - string_ref drop_front(size_t N = 1) const { - //assert(size() >= N && "Dropping more elements than exist"); - return substr(N); - } - - - - /// Return a string_ref equal to 'this' but with the last \p N elements - /// dropped. - - string_ref drop_back(size_t N = 1) const { - - return substr(0, size() - N); - } - - /// Return a string_ref equal to 'this', but with all characters satisfying - /// the given predicate dropped from the beginning of the string. - - string_ref drop_while(std::function<bool(char)> F) const { - return substr(std::find_if_not(begin(),end(),F)-begin()); - } - - /// Return a string_ref equal to 'this', but with all characters not - /// satisfying the given predicate dropped from the beginning of the string. - - string_ref drop_until(std::function<bool(char)> F) const { - return substr(std::find_if(begin(), end(), F) - begin()); - } - - /// Returns true if this string_ref has the given prefix and removes that - /// prefix. - bool consume_front(string_ref Prefix) { - if (!start_with(Prefix)) - return false; - - *this = drop_front(Prefix.size()); - return true; - } - - /// Returns true if this string_ref has the given suffix and removes that - /// suffix. - bool consume_back(string_ref Suffix) { - if (!end_with(Suffix)) - return false; - - *this = drop_back(Suffix.size()); - return true; - } - - /******************************************************************************* - Function: std::string_ref::end_with - Access: public - Qualifier: const - Parameter: const string & str - Returns: bool - - Purpose: is the string end with str - *******************************************************************************/ - bool end_with(const string& str) const - { - if (str.length() > this->length()) - { - return false; - } - size_type off = this->length() - str.length(); - return ( find(str, off) == off); - } - - /******************************************************************************* - Function: hl_lib::string_ref::format - Access: public - Qualifier: - Parameter: const char * format_string - Parameter: ... - Returns: string_ref& - - Purpose: format the string - *******************************************************************************/ - string_ref& format(const char* format_string, ...) - { + /** + * An extension of STL's string providing additional functionality that is often availiable in + * higher-level languages such as Python. + */ + class string_ref : public string + { + public: + + //static unsigned GetAutoSenseRadix(string_ref& Str) { + // if (Str.empty()) + // return 10; + + // if (Str.start_with("0x") || Str.start_with("0X")) { + // Str = Str.substr(2); + // return 16; + // } + + // if (Str.start_with("0b") || Str.start_with("0B")) { + // Str = Str.substr(2); + // return 2; + // } + + // if (Str.start_with("0o")) { + // Str = Str.substr(2); + // return 8; + // } + + // if (Str[0] == '0' && Str.size() > 1 && std::isdigit(Str[1])) { + // Str = Str.substr(1); + // return 8; + // } + + // return 10; + //} + + //static bool consumeUnsignedInteger(string_ref& Str, unsigned Radix, + // unsigned long long& Result) { + // // Autosense radix if not specified. + // if (Radix == 0) + // Radix = GetAutoSenseRadix(Str); + + // // Empty strings (after the radix autosense) are invalid. + // if (Str.empty()) return true; + + // // Parse all the bytes of the string given this radix. Watch for overflow. + // string_ref Str2 = Str; + // Result = 0; + // while (!Str2.empty()) { + // unsigned CharVal; + // if (Str2[0] >= '0' && Str2[0] <= '9') + // CharVal = Str2[0] - '0'; + // else if (Str2[0] >= 'a' && Str2[0] <= 'z') + // CharVal = Str2[0] - 'a' + 10; + // else if (Str2[0] >= 'A' && Str2[0] <= 'Z') + // CharVal = Str2[0] - 'A' + 10; + // else + // break; + + // // If the parsed value is larger than the integer radix, we cannot + // // consume any more characters. + // if (CharVal >= Radix) + // break; + + // // Add in this character. + // unsigned long long PrevResult = Result; + // Result = Result * Radix + CharVal; + + // // Check for overflow by shifting back and seeing if bits were lost. + // if (Result / Radix < PrevResult) + // return true; + + // Str2 = Str2.substr(1); + // } + + // // We consider the operation a failure if no characters were consumed + // // successfully. + // if (Str.size() == Str2.size()) + // return true; + + // Str = Str2; + // return false; + //} + + //static bool consumeSignedInteger(string_ref& Str, unsigned Radix, + // long long& Result) { + // unsigned long long ULLVal; + + // // Handle positive strings first. + // if (Str.empty() || Str.front() != '-') { + // if (consumeUnsignedInteger(Str, Radix, ULLVal) || + // // Check for value so large it overflows a signed value. + // (long long)ULLVal < 0) + // return true; + // Result = ULLVal; + // return false; + // } + + // // Get the positive part of the value. + // string_ref Str2 = Str.drop_front(1); + // if (consumeUnsignedInteger(Str2, Radix, ULLVal) || + // // Reject values so large they'd overflow as negative signed, but allow + // // "-0". This negates the unsigned so that the negative isn't undefined + // // on signed overflow. + // (long long)-ULLVal > 0) + // return true; + + // Str = Str2; + // Result = -ULLVal; + // return false; + //} + + ///// GetAsUnsignedInteger - Workhorse method that converts a integer character + ///// sequence of radix up to 36 to an unsigned long long value. + //static bool getAsUnsignedInteger(string_ref Str, unsigned Radix, + // unsigned long long& Result) { + // if (consumeUnsignedInteger(Str, Radix, Result)) + // return true; + + // // For getAsUnsignedInteger, we require the whole string to be consumed or + // // else we consider it a failure. + // return !Str.empty(); + //} + + //static bool getAsSignedInteger(string_ref Str, unsigned Radix, + // long long& Result) { + // if (consumeSignedInteger(Str, Radix, Result)) + // return true; + + // // For getAsSignedInteger, we require the whole string to be consumed or else + // // we consider it a failure. + // return !Str.empty(); + //} + + + ///// Parse the current string as an integer of the specified radix. If + ///// \p Radix is specified as zero, this does radix autosensing using + ///// extended C rules: 0 is octal, 0x is hex, 0b is binary. + ///// + ///// If the string is invalid or if only a subset of the string is valid, + ///// this returns true to signify the error. The string is considered + ///// erroneous if empty or if it overflows T. + //template <typename T> + //std::enable_if_t<std::numeric_limits<T>::is_signed, bool> + // getAsInteger(unsigned Radix, T& Result) const { + // long long LLVal; + // if (getAsSignedInteger(*this, Radix, LLVal) || + // static_cast<T>(LLVal) != LLVal) + // return true; + // Result = LLVal; + // return false; + //} + + //template <typename T> + //std::enable_if_t<!std::numeric_limits<T>::is_signed, bool> + // getAsInteger(unsigned Radix, T& Result) const { + // unsigned long long ULLVal; + // // The additional cast to unsigned long long is required to avoid the + // // Visual C++ warning C4805: '!=' : unsafe mix of type 'bool' and type + // // 'unsigned __int64' when instantiating getAsInteger with T = bool. + // if (getAsUnsignedInteger(*this, Radix, ULLVal) || + // static_cast<unsigned long long>(static_cast<T>(ULLVal)) != ULLVal) + // return true; + // Result = ULLVal; + // return false; + //} + + + + /**` + * Default constructor + * + * Constructs an empty string_ref ("") + */ + string_ref() : string() { } + + /** + * Duplicate the STL string copy constructor + * + * @param[in] s The string to copy + * @param[in] pos The starting position in the string to copy from + * @param[in] n The number of characters to copy + */ + string_ref(const string &s, size_type pos = 0, size_type n = npos) : string(s, pos, npos) { } + + /** + * Construct an string_ref from a null-terminated character array + * + * @param[in] s The character array to copy into the new string + */ + string_ref(const value_type *s) : string(s) { } + + /** + * Construct an string_ref from a character array and a length + * + * @param[in] s The character array to copy into the new string + * @param[in] n The number of characters to copy + */ + string_ref(const value_type *s, size_type n) : string(s, n) { } + + /** + * Create an string_ref with @p n copies of @p c + * + * @param[in] n The number of copies + * @param[in] c The character to copy @p n times + */ + string_ref(size_type n, value_type c) : string(n, c) { } + + /** + * Create a string from a range + * + * @param[in] first The first element to copy in + * @param[in] last The last element to copy in + */ + template <class InputIterator> + string_ref(InputIterator first, InputIterator last) : string(first, last) { } + + /** + * The destructor + */ + ~string_ref() { } + + /** + * Split a string by whitespace + * + * @return A vector of strings, each of which is a substring of the string + */ + vector<string_ref> split(size_type limit = npos) const + { + vector<string_ref> v; + + const_iterator + i = begin(), + last = i; + for (; i != end(); i++) + { + if (*i == ' ' || *i == '\n' || *i == '\t' || *i == '\r') + { + if (i + 1 != end() && (i[1] == ' ' || i[1] == '\n' || i[1] == '\t' || i[1] == '\r')) + continue; + v.push_back(string_ref(last, i)); + last = i + 1; + if (v.size() >= limit - 1) + { + v.push_back(string_ref(last, end())); + return v; + } + } + } + + if (last != i) + v.push_back(string_ref(last, i)); + + return v; + } + + /** + * Split a string by a character + * + * Returns a vector of ext_strings, each of which is a substring of the string formed by splitting + * it on boundaries formed by the character @p separator. If @p limit is set, the returned vector + * will contain a maximum of @p limit elements with the last element containing the rest of + * the string. + * + * If @p separator is not found in the string, a single element will be returned in the vector + * containing the entire string. + * + * The separators are removed from the output + * + * @param[in] separator The character separator to split the string on + * @param[in] limit The maximum number of output elements + * @return A vector of strings, each of which is a substring of the string + * + * @section split_ex Example + * @code + * std::string_ref s("This|is|a|test."); + * std::vector<std::string_ref> v = s.split('|'); + * std::copy(v.begin(), v.end(), std::ostream_iterator<std::string_ref>(std::cout, "\n")); + * + * This + * is + * a + * test. + * @endcode + */ + vector<string_ref> split(value_type separator, size_type limit = npos) const + { + vector<string_ref> v; + + const_iterator + i = begin(), + last = i; + for (; i != end(); i++) + { + if (*i == separator) + { + v.push_back(string_ref(last, i)); + last = i + 1; + if (v.size() >= limit - 1) + { + v.push_back(string_ref(last, end())); + return v; + } + } + } + + if (last != i) + v.push_back(string_ref(last, i)); + + return v; + } + + /** + * Split a string by another string + * + * Returns a vector of ext_strings, each of which is a substring of the string formed by + * splitting it on boundaries formed by the string @p separator. If @p limit is set, the + * returned vector will contain a maximum of @p limit elements with the last element + * containing the rest of the string. + * + * If @p separator is not found in the string, a single element will be returned in the + * vector containing the entire string. + * + * The separators are removed from the output + * + * @param[in] separator The string separator to split the string on + * @param[in] limit The maximum number of output elements + * @return A vector of strings, each of which is a substring of the string + * + * @ref split_ex + */ + vector<string_ref> split(const string &separator, size_type limit = npos) const + { + vector<string_ref> v; + + const_iterator + i = begin(), + last = i; + for (; i != end(); i++) + { + if (string(i, i + separator.length()) == separator) + { + v.push_back(string_ref(last, i)); + last = i + separator.length(); + + if (v.size() >= limit - 1) + { + v.push_back(string_ref(last, end())); + return v; + } + } + } + + if (last != i) + v.push_back(string_ref(last, i)); + + return v; + } + + /** + * Convert a string into an integer + * + * Convert the initial portion of a string into a signed integer. Once a non-numeric + * character is reached, the remainder of @p string is ignored and the integer that was + * read returned. + * + * @param s The string to convert + * @return The integer converted from @p string + */ + static long int integer(const string &s) + { + long int retval = 0; + bool neg = false; + + for (const_iterator i = s.begin(); i != s.end(); i++) + { + if (i == s.begin()) + { + if (*i == '-') + { + neg = true; + continue; + } + else if (*i == '+') + continue; + } + if (*i >= '0' && *i <= '9') + { + retval *= 10; + retval += *i - '0'; + } + else + break; + } + + if (neg) + retval *= -1; + + return retval; + } + + /** + * Convert the string to an integer + * + * Convert the initial portion of the string into a signed integer. Once a non-numeric + * character is reached, the remainder of the string is ignored and the integer that had + * been read thus far is returned. + * + * @return The integer converted from the string + */ + long int integer() const + { + return integer(*this); + } + + /** + * Split a string into chunks of size @p chunklen. Returns a vector of strings. + * + * Splits a string into chunks of the given size. The final chunk may not fill its + * entire allocated number of characters. + * + * @param[in] chunklen The number of characters per chunk + * @return A vector of strings, each of length <= chunklen + * + * @section chunk_split-ex Example + * @code + * std::string_ref s("abcdefghijk"); + * std::vector<std::string_ref> v = s.chunk_split(3); + * std::copy(v.begin(), v.end(), ostream_iterator<std::string_ref>(cout, " ")); + * + * abc def ghi jk + * @endcode + */ + vector<string_ref> chunk_split(size_type chunklen) const + { + vector<string_ref> retval; + retval.reserve(size() / chunklen + 1); + + size_type count = 0; + const_iterator + i = begin(), + last = i; + for (; i != end(); i++, count++) + { + if (count == chunklen) + { + count = 0; + retval.push_back(string_ref(last, i)); + last = i; + } + } + + if (last != i) + retval.push_back(string_ref(last, i)); + + return retval; + } + + /** + * Join a sequence of strings by some glue to create a new string + * + * Glue is not added to the end of the string. + * + * @pre [first, last) is a valid range + * @pre InputIterator is a model of STL's Input Iterator + * @pre InputIterator must point to a string type (std::string, std::string_ref, char *) + * + * @param[in] glue The glue to join strings with + * @param[in] first The beginning of the range to join + * @param[in] last The end of the range to join + * @return A string constructed of each element of the range connected together with @p glue + * + * @section join_ex Example + * @code + * std::vector<std::string_ref> v; + * v.push_back("This"); + * v.push_back("is"); + * v.push_back("a"); + * v.push_back("test."); + * std::cout << std::string_ref::join("|", v.begin(), v.end()) << std::endl; + * + * This|is|a|test. + * @endcode + */ + template <class InputIterator> + static string_ref join(const string &glue, InputIterator first, InputIterator last) + { + string_ref retval; + + for (; first != last; ++first) + { + retval.append(*first); + retval.append(glue); + } + retval.erase(retval.length() - glue.length()); + + return retval; + } + + /** + * Join a sequence of strings by some glue to create a new string + * + * @copydoc join + * @ref join_ex + */ + template <class InputIterator> + static string_ref join(value_type glue, InputIterator first, InputIterator last) + { + string_ref retval; + + for (; first != last; ++first) + { + retval.append(*first); + retval.append(1, glue); + } + retval.erase(retval.length() - 1); + + return retval; + } + + /** + * Search for any instances of @p needle and replace them with @p s + * + * @param[in] needle The string to replace + * @param[in] s The replacement string + * @return *this + * @post All instances of @p needle in the string are replaced with @p s + * + * @section replace-ex Example + * @code + * std::string_ref s("This is a test."); + * s.replace("is", "ere"); + * std::cout << s << std::endl; + * + * There ere a test. + * @endcode + */ + string_ref &replace(const string &needle, const string &s) + { + size_type + lastpos = 0, + thispos; + + while ((thispos = find(needle, lastpos)) != npos) + { + string::replace(thispos, needle.length(), s); + lastpos = thispos + 1; + } + return *this; + } + string_ref &replace_first(const string &needle, const string &s) + { + size_type + lastpos = 0, + thispos; + + if ((thispos = find(needle, lastpos)) != npos) + { + string::replace(thispos, needle.length(), s); + lastpos = thispos + 1; + } + return *this; + } + /** + * Search of any instances of @p needle and replace them with @p c + * + * @param[in] needle The character to replace + * @param[in] c The replacement character + * @return *this + * @post All instances of @p needle in the string are replaced with @p c + * + * @ref replace-ex + */ + string_ref &replace(value_type needle, value_type c) + { + for (iterator i = begin(); i != end(); i++) + if (*i == needle) + *i = c; + + return *this; + } + + /** + * Repeat a string @p n times + * + * @param[in] n The number of times to repeat the string + * @return string_ref containing @p n copies of the string + * + * @section repeat-ex Example + * @code + * std::string_ref s("123"); + * s = s * 3; + * std::cout << s << std::endl; + * + * 123123123 + * @endcode + */ + string_ref operator*(size_type n) + { + string_ref retval; + for (size_type i = 0; i < n; i++) + retval.append(*this); + + return retval; + } + + /** + * Convert the string to lowercase + * + * @return *this + * @post The string is converted to lowercase + */ + string_ref &tolower() + { + for (iterator i = begin(); i != end(); i++) + if (*i >= 'A' && *i <= 'Z') + *i = (*i) + ('a' - 'A'); + return *this; + } + + /** + * Convert the string to uppercase + * + * @return *this + * @post The string is converted to uppercase + */ + string_ref &toupper() + { + for (iterator i = begin(); i != end(); i++) + if (*i >= 'a' && *i <= 'z') + *i = (*i) - ('a' - 'A'); + return *this; + } + + /** + * Count the occurances of @p str in the string. + * + * @return The count of substrings @p str in the string + */ + size_type count(const string &str) const + { + size_type + count = 0, + last = 0, + cur = 0; + + while ((cur = find(str, last + 1)) != npos) + { + count++; + last = cur; + } + + return count; + } + + /** + * Determine if the string is alphanumeric + * + * @return true if the string contains only characters between a-z, A-Z and 0-9 and + * contains at least one character, else false + */ + bool is_alnum() const + { + if (length() == 0) + return false; + + for (const_iterator i = begin(); i != end(); i++) + { + if (*i < 'A' || *i > 'Z') + if (*i < '0' || *i > '9') + if (*i < 'a' || *i > 'z') + return false; + } + + return true; + } + + /** + * Determine if the string is alphabetic only + * + * @return true of the string contains only characters between a-z and A-Z and contains at + * least one character, else false + */ + bool is_alpha() const + { + if (length() == 0) + return false; + + for (const_iterator i = begin(); i != end(); i++) + if (*i < 'A' || (*i > 'Z' && (*i < 'a' || *i > 'z'))) + return false; + + return true; + } + + /** + * Determine if the string is numeric only + * + * @return true if the string contains only characters between 0-9 and contains at least + * one character, else false + */ + bool is_numeric() const + { + if (length() == 0) + return false; + + for (const_iterator i = begin(); i != end(); i++) + if (*i < '0' || *i > '9') + return false; + + return true; + } + + /** + * Determine if a string is all lower case + * + * @return true if there is at least one character, and all characters are lowercase + * letters, else false + */ + bool is_lower() const + { + if (length() == 0) + return false; + + for (const_iterator i = begin(); i != end(); i++) + if (*i < 'a' || *i < 'z') + return false; + + return true; + } + + /** + * Determine if a string is all upper case + * + * @return true if there is at least one character, and all characters are uppercase + * letters, else false + */ + bool is_upper() const + { + if (length() == 0) + return false; + + for (const_iterator i = begin(); i != end(); i++) + if (*i < 'A' || *i > 'Z') + return false; + + return true; + } + + /** + * Swap the case of a string + * + * @post Converts all uppercase to lowercase, and all lowercase to uppercase in the string + * @return *this + */ + string_ref &swapcase() + { + for (iterator i = begin(); i != end(); i++) + if (*i >= 'A' && *i <= 'Z') + *i += ('a' - 'A'); + else if (*i >= 'a' && *i <= 'z') + *i -= ('a' - 'A'); + + return *this; + } + + /******************************************************************************* + Function: std::string_ref::start_with + Access: public + Qualifier: const + Parameter: const string & str + Returns: bool + + Purpose: is the string start with str + *******************************************************************************/ + bool start_with(const string& str) const + { + return ( this->find(str) == 0 ); + } + + /// Return a string_ref equal to 'this' but with only the last \p N + /// elements remaining. If \p N is greater than the length of the + /// string, the entire string is returned. + + string_ref take_back(size_t N = 1) const { + if (N >= size()) + return *this; + return drop_front(size() - N); + } + /// Return a string_ref equal to 'this' but with the first \p N elements + /// dropped. + + string_ref drop_front(size_t N = 1) const { + //assert(size() >= N && "Dropping more elements than exist"); + return substr(N); + } + + + + /// Return a string_ref equal to 'this' but with the last \p N elements + /// dropped. + + string_ref drop_back(size_t N = 1) const { + + return substr(0, size() - N); + } + + /// Return a string_ref equal to 'this', but with all characters satisfying + /// the given predicate dropped from the beginning of the string. + + string_ref drop_while(std::function<bool(char)> F) const { + return substr(std::find_if_not(begin(),end(),F)-begin()); + } + + /// Return a string_ref equal to 'this', but with all characters not + /// satisfying the given predicate dropped from the beginning of the string. + + string_ref drop_until(std::function<bool(char)> F) const { + return substr(std::find_if(begin(), end(), F) - begin()); + } + + /// Returns true if this string_ref has the given prefix and removes that + /// prefix. + bool consume_front(string_ref Prefix) { + if (!start_with(Prefix)) + return false; + + *this = drop_front(Prefix.size()); + return true; + } + + /// Returns true if this string_ref has the given suffix and removes that + /// suffix. + bool consume_back(string_ref Suffix) { + if (!end_with(Suffix)) + return false; + + *this = drop_back(Suffix.size()); + return true; + } + + /******************************************************************************* + Function: std::string_ref::end_with + Access: public + Qualifier: const + Parameter: const string & str + Returns: bool + + Purpose: is the string end with str + *******************************************************************************/ + bool end_with(const string& str) const + { + if (str.length() > this->length()) + { + return false; + } + size_type off = this->length() - str.length(); + return ( find(str, off) == off); + } + + /******************************************************************************* + Function: hl_lib::string_ref::format + Access: public + Qualifier: + Parameter: const char * format_string + Parameter: ... + Returns: string_ref& + + Purpose: format the string + *******************************************************************************/ + string_ref& format(const char* format_string, ...) + { if (format_string == 0) { return *this; @@ -912,150 +912,150 @@ namespace std #endif va_end( argList ); return *this; - } - - /******************************************************************************* - Function: hl_lib::string_ref::trim_left - Access: public - Qualifier: - Parameter: value_type ch - Returns: string_ref& - - Purpose: delete all char which is ch at the left of the string - *******************************************************************************/ - string_ref& trim_left(value_type ch = ' ') - { - size_type off = this->find_first_not_of(ch); - if (off != string::npos) - { - this->erase(0, off); - } - return *this; - } - - /******************************************************************************* - Function: hl_lib::string_ref::trim_right - Access: public - Qualifier: - Parameter: value_type ch - Returns: string_ref& - - Purpose: delete all char which is ch at the right of the string - *******************************************************************************/ - string_ref& trim_right(value_type ch = ' ') - { - size_type off = this->find_last_not_of(ch); - if (off == string::npos) - { - off = 0; - } - else - { - off++; - } - this->erase(off, length() - off); - return *this; - } - - /******************************************************************************* - Function: hl_lib::string_ref::trim - Access: public - Qualifier: - Parameter: value_type ch - Returns: string_ref& - - Purpose: delete all char which is ch at the left and right of the string - *******************************************************************************/ - string_ref& trim(value_type ch = ' ') - { - trim_left(ch); - trim_right(ch); - return *this; - } - - /******************************************************************************* - Function: hl_lib::string_ref::float_num - Access: public static - Qualifier: - Parameter: const string & str - Returns: double - - Purpose: parse str to a float number - *******************************************************************************/ - static double float_num(const string& str) - { - return atof(str.c_str()); - } - - /******************************************************************************* - Function: hl_lib::string_ref::float_num - Access: public static - Qualifier: - Returns: double - - Purpose: parse this to a float number - *******************************************************************************/ - double float_num() const - { - return float_num(*this); - } - - /******************************************************************************* - Function: hl_lib::string_ref::compare_nocase - Access: public - Qualifier: const - Parameter: const string & str - Returns: int - - Purpose: compare string no case - *******************************************************************************/ - int compare_nocase(const string& str) const - { + } + + /******************************************************************************* + Function: hl_lib::string_ref::trim_left + Access: public + Qualifier: + Parameter: value_type ch + Returns: string_ref& + + Purpose: delete all char which is ch at the left of the string + *******************************************************************************/ + string_ref& trim_left(value_type ch = ' ') + { + size_type off = this->find_first_not_of(ch); + if (off != string::npos) + { + this->erase(0, off); + } + return *this; + } + + /******************************************************************************* + Function: hl_lib::string_ref::trim_right + Access: public + Qualifier: + Parameter: value_type ch + Returns: string_ref& + + Purpose: delete all char which is ch at the right of the string + *******************************************************************************/ + string_ref& trim_right(value_type ch = ' ') + { + size_type off = this->find_last_not_of(ch); + if (off == string::npos) + { + off = 0; + } + else + { + off++; + } + this->erase(off, length() - off); + return *this; + } + + /******************************************************************************* + Function: hl_lib::string_ref::trim + Access: public + Qualifier: + Parameter: value_type ch + Returns: string_ref& + + Purpose: delete all char which is ch at the left and right of the string + *******************************************************************************/ + string_ref& trim(value_type ch = ' ') + { + trim_left(ch); + trim_right(ch); + return *this; + } + + /******************************************************************************* + Function: hl_lib::string_ref::float_num + Access: public static + Qualifier: + Parameter: const string & str + Returns: double + + Purpose: parse str to a float number + *******************************************************************************/ + static double float_num(const string& str) + { + return atof(str.c_str()); + } + + /******************************************************************************* + Function: hl_lib::string_ref::float_num + Access: public static + Qualifier: + Returns: double + + Purpose: parse this to a float number + *******************************************************************************/ + double float_num() const + { + return float_num(*this); + } + + /******************************************************************************* + Function: hl_lib::string_ref::compare_nocase + Access: public + Qualifier: const + Parameter: const string & str + Returns: int + + Purpose: compare string no case + *******************************************************************************/ + int compare_nocase(const string& str) const + { #ifdef _WIN32 - return _stricmp(this->c_str(), str.c_str()); + return _stricmp(this->c_str(), str.c_str()); #else - return strcasecmp(this->c_str(), str.c_str()); + return strcasecmp(this->c_str(), str.c_str()); #endif - } - - /******************************************************************************* - Function: hl_lib::string_ref::compare_nocase - Access: public - Qualifier: const - Parameter: size_type index - Parameter: size_type length - Parameter: const string & str - Returns: int - - Purpose: compare substring no case - *******************************************************************************/ - int compare_nocase( size_type index, size_type length, const string &str ) const - { - string_ref temp = this->substr(index, length); - return temp.compare_nocase(str); - } - - /******************************************************************************* - Function: hl_lib::string_ref::compare_nocase - Access: public - Qualifier: const - Parameter: size_type index - Parameter: size_type length - Parameter: const string & str - Parameter: size_type index2 - Parameter: size_type length2 - Returns: int - - Purpose: compare two substring no case - *******************************************************************************/ - int compare_nocase( size_type index, size_type length, const string &str, size_type index2, size_type length2) const - { - string_ref temp1 = this->substr(index, length); - string_ref temp2 = str.substr(index2, length2); - return temp1.compare_nocase(temp2); - } - - }; + } + + /******************************************************************************* + Function: hl_lib::string_ref::compare_nocase + Access: public + Qualifier: const + Parameter: size_type index + Parameter: size_type length + Parameter: const string & str + Returns: int + + Purpose: compare substring no case + *******************************************************************************/ + int compare_nocase( size_type index, size_type length, const string &str ) const + { + string_ref temp = this->substr(index, length); + return temp.compare_nocase(str); + } + + /******************************************************************************* + Function: hl_lib::string_ref::compare_nocase + Access: public + Qualifier: const + Parameter: size_type index + Parameter: size_type length + Parameter: const string & str + Parameter: size_type index2 + Parameter: size_type length2 + Returns: int + + Purpose: compare two substring no case + *******************************************************************************/ + int compare_nocase( size_type index, size_type length, const string &str, size_type index2, size_type length2) const + { + string_ref temp1 = this->substr(index, length); + string_ref temp2 = str.substr(index2, length2); + return temp1.compare_nocase(temp2); + } + + }; } diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/ParentProcessWatcher.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/ParentProcessWatcher.h index fa84e4109a..6d082d2d2a 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/ParentProcessWatcher.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/ParentProcessWatcher.h @@ -6,12 +6,12 @@ class ParentProcessWatcher { public: - struct ParentProcessWatcherData; + struct ParentProcessWatcherData; - ParentProcessWatcher(lsp::Log& log, int pid, const std::function<void()>&& callback, uint32_t poll_delay_secs = 10); + ParentProcessWatcher(lsp::Log& log, int pid, const std::function<void()>&& callback, uint32_t poll_delay_secs = 10); - ~ParentProcessWatcher(); + ~ParentProcessWatcher(); - std::shared_ptr<ParentProcessWatcherData> d_ptr; + std::shared_ptr<ParentProcessWatcherData> d_ptr; }; diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/ProcessIoService.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/ProcessIoService.h index 1389a1d5b7..5edecef0b2 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/ProcessIoService.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/ProcessIoService.h @@ -4,45 +4,45 @@ namespace lsp { - class ProcessIoService - { - public: - using IOService = boost::asio::io_service; - using Work = boost::asio::io_service::work; - using WorkPtr = std::unique_ptr<Work>; + class ProcessIoService + { + public: + using IOService = boost::asio::io_service; + using Work = boost::asio::io_service::work; + using WorkPtr = std::unique_ptr<Work>; - ProcessIoService() { + ProcessIoService() { - work_ = std::unique_ptr<Work>(new Work(ioService_)); - auto temp_thread_ = new std::thread([this] - { - ioService_.run(); - }); - thread_ = std::unique_ptr<std::thread>(temp_thread_); - } + work_ = std::unique_ptr<Work>(new Work(ioService_)); + auto temp_thread_ = new std::thread([this] + { + ioService_.run(); + }); + thread_ = std::unique_ptr<std::thread>(temp_thread_); + } - ProcessIoService(const ProcessIoService&) = delete; - ProcessIoService& operator=(const ProcessIoService&) = delete; + ProcessIoService(const ProcessIoService&) = delete; + ProcessIoService& operator=(const ProcessIoService&) = delete; - boost::asio::io_service& getIOService() - { - return ioService_; - } + boost::asio::io_service& getIOService() + { + return ioService_; + } - void stop() - { + void stop() + { - work_.reset(); + work_.reset(); - thread_->join(); + thread_->join(); - } + } - private: - IOService ioService_; - WorkPtr work_; - std::unique_ptr<std::thread> thread_; + private: + IOService ioService_; + WorkPtr work_; + std::unique_ptr<std::thread> thread_; - }; + }; } diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/ProtocolJsonHandler.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/ProtocolJsonHandler.h index b563f810d2..f6097fe172 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/ProtocolJsonHandler.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/ProtocolJsonHandler.h @@ -2,10 +2,10 @@ #include "LibLsp/JsonRpc/MessageJsonHandler.h" namespace lsp { - class ProtocolJsonHandler : public MessageJsonHandler - { - public: - ProtocolJsonHandler(); - }; + class ProtocolJsonHandler : public MessageJsonHandler + { + public: + ProtocolJsonHandler(); + }; } diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/ResourceOperation.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/ResourceOperation.h index caf2ea5d5f..ea60205900 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/ResourceOperation.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/ResourceOperation.h @@ -6,116 +6,116 @@ #include "LibLsp/lsp/lsAny.h" #include "LibLsp/lsp/lsTextEdit.h" struct ResourceOperation { - std::string kind; - virtual ~ResourceOperation() = default; - - MAKE_SWAP_METHOD(ResourceOperation, kind); + std::string kind; + virtual ~ResourceOperation() = default; + + MAKE_SWAP_METHOD(ResourceOperation, kind); }; MAKE_REFLECT_STRUCT(ResourceOperation, kind); extern void Reflect(Writer& visitor, ResourceOperation* value); struct CreateFileOptions{ - /** - * Overwrite existing file. Overwrite wins over `ignoreIfExists` - */ - boost::optional<bool> overwrite = false; - - /** - * Ignore if exists. - */ - boost::optional< bool> ignoreIfExists =false; - - MAKE_SWAP_METHOD(CreateFileOptions, overwrite, ignoreIfExists) + /** + * Overwrite existing file. Overwrite wins over `ignoreIfExists` + */ + boost::optional<bool> overwrite = false; + + /** + * Ignore if exists. + */ + boost::optional< bool> ignoreIfExists =false; + + MAKE_SWAP_METHOD(CreateFileOptions, overwrite, ignoreIfExists) }; MAKE_REFLECT_STRUCT(CreateFileOptions, overwrite, ignoreIfExists) struct lsCreateFile :public ResourceOperation { - /** - * The resource to create. - */ - lsCreateFile(); - lsDocumentUri uri; - - /** - * Additional options - */ - boost::optional<CreateFileOptions> options; - - - /** - * An optional annotation identifer describing the operation. - * - * @since 3.16.0 - */ - boost::optional<lsChangeAnnotationIdentifier> annotationId; - - MAKE_SWAP_METHOD(lsCreateFile, kind, uri, options, annotationId) + /** + * The resource to create. + */ + lsCreateFile(); + lsDocumentUri uri; + + /** + * Additional options + */ + boost::optional<CreateFileOptions> options; + + + /** + * An optional annotation identifer describing the operation. + * + * @since 3.16.0 + */ + boost::optional<lsChangeAnnotationIdentifier> annotationId; + + MAKE_SWAP_METHOD(lsCreateFile, kind, uri, options, annotationId) }; MAKE_REFLECT_STRUCT(lsCreateFile, kind, uri,options, annotationId) struct DeleteFileOptions { - /** - * Delete the content recursively if a folder is denoted. - */ - boost::optional<bool> recursive = false; + /** + * Delete the content recursively if a folder is denoted. + */ + boost::optional<bool> recursive = false; - /** - * Ignore the operation if the file doesn't exist. - */ - boost::optional<bool> ignoreIfNotExists = false; + /** + * Ignore the operation if the file doesn't exist. + */ + boost::optional<bool> ignoreIfNotExists = false; - MAKE_SWAP_METHOD(DeleteFileOptions, recursive, ignoreIfNotExists); + MAKE_SWAP_METHOD(DeleteFileOptions, recursive, ignoreIfNotExists); }; MAKE_REFLECT_STRUCT(DeleteFileOptions, recursive, ignoreIfNotExists) struct lsDeleteFile :public ResourceOperation { - /** - * The file to delete. - */ - lsDeleteFile(); - lsDocumentUri uri; - - /** - * Delete options. - */ - boost::optional<DeleteFileOptions> options; - - MAKE_SWAP_METHOD(lsDeleteFile, kind, uri, options); + /** + * The file to delete. + */ + lsDeleteFile(); + lsDocumentUri uri; + + /** + * Delete options. + */ + boost::optional<DeleteFileOptions> options; + + MAKE_SWAP_METHOD(lsDeleteFile, kind, uri, options); }; MAKE_REFLECT_STRUCT(lsDeleteFile, kind, uri,options); typedef CreateFileOptions RenameFileOptions; struct lsRenameFile :public ResourceOperation { - /** - * The old (existing) location. - */ - lsRenameFile(); - lsDocumentUri oldUri; - - /** - * The new location. - */ - - lsDocumentUri newUri; - - /** - * Rename options. - */ - boost::optional<RenameFileOptions> options; - - /** - * An optional annotation identifer describing the operation. - * - * @since 3.16.0 - */ - boost::optional<lsChangeAnnotationIdentifier> annotationId; - - MAKE_SWAP_METHOD(lsRenameFile, kind, oldUri, newUri, options, annotationId) + /** + * The old (existing) location. + */ + lsRenameFile(); + lsDocumentUri oldUri; + + /** + * The new location. + */ + + lsDocumentUri newUri; + + /** + * Rename options. + */ + boost::optional<RenameFileOptions> options; + + /** + * An optional annotation identifer describing the operation. + * + * @since 3.16.0 + */ + boost::optional<lsChangeAnnotationIdentifier> annotationId; + + MAKE_SWAP_METHOD(lsRenameFile, kind, oldUri, newUri, options, annotationId) }; MAKE_REFLECT_STRUCT(lsRenameFile, kind, oldUri, newUri, options, annotationId); -extern ResourceOperation* GetResourceOperation(lsp::Any& lspAny);
\ No newline at end of file +extern ResourceOperation* GetResourceOperation(lsp::Any& lspAny); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/SimpleTimer.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/SimpleTimer.h index 0a2707979d..3178d25d69 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/SimpleTimer.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/SimpleTimer.h @@ -9,7 +9,7 @@ class SimpleTimer { public: SimpleTimer(unsigned int duration,const std::function<void()>& _call_back) - :is_running_(true), call_back(_call_back), _deadline_timer(_ios, Duration(duration)) + :is_running_(true), call_back(_call_back), _deadline_timer(_ios, Duration(duration)) { _deadline_timer.async_wait([&](const boost::system::error_code& e) { diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/client/registerCapability.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/client/registerCapability.h index fa5d111403..60484db56a 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/client/registerCapability.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/client/registerCapability.h @@ -7,20 +7,20 @@ */ struct Registration { - static Registration Create(const std::string& method); - /** - * The id used to register the request. The id can be used to deregister - * the request again. - */ - std::string id; - - /** - * The method / capability to register for. - */ - - std::string method; - - MAKE_SWAP_METHOD(Registration, id, method); + static Registration Create(const std::string& method); + /** + * The id used to register the request. The id can be used to deregister + * the request again. + */ + std::string id; + + /** + * The method / capability to register for. + */ + + std::string method; + + MAKE_SWAP_METHOD(Registration, id, method); }; @@ -35,8 +35,8 @@ MAKE_REFLECT_STRUCT(Registration, id, method); */ struct RegistrationParams { - std::vector<Registration> registrations; - MAKE_SWAP_METHOD(RegistrationParams, registrations); + std::vector<Registration> registrations; + MAKE_SWAP_METHOD(RegistrationParams, registrations); }; /** * The client/registerCapability request is sent from the server to the client @@ -46,4 +46,4 @@ struct RegistrationParams */ MAKE_REFLECT_STRUCT(RegistrationParams, registrations); -DEFINE_REQUEST_RESPONSE_TYPE(Req_ClientRegisterCapability, RegistrationParams,JsonNull, "client/registerCapability");
\ No newline at end of file +DEFINE_REQUEST_RESPONSE_TYPE(Req_ClientRegisterCapability, RegistrationParams,JsonNull, "client/registerCapability"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/client/unregisterCapability.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/client/unregisterCapability.h index aa51d7efee..33bf9d1db6 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/client/unregisterCapability.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/client/unregisterCapability.h @@ -10,20 +10,20 @@ */ struct Unregistration { - /** - * The id used to unregister the request or notification. Usually an id - * provided during the register request. - */ + /** + * The id used to unregister the request or notification. Usually an id + * provided during the register request. + */ - std::string id; + std::string id; - /** - * The method / capability to unregister for. - */ + /** + * The method / capability to unregister for. + */ - std::string method; - - MAKE_SWAP_METHOD(Unregistration, id, method); + std::string method; + + MAKE_SWAP_METHOD(Unregistration, id, method); }; MAKE_REFLECT_STRUCT(Unregistration, id, method); /** @@ -32,10 +32,10 @@ MAKE_REFLECT_STRUCT(Unregistration, id, method); */ struct UnregistrationParams { - std::vector<Unregistration> unregisterations; - MAKE_SWAP_METHOD(UnregistrationParams, unregisterations); + std::vector<Unregistration> unregisterations; + MAKE_SWAP_METHOD(UnregistrationParams, unregisterations); }; MAKE_REFLECT_STRUCT(UnregistrationParams, unregisterations); -DEFINE_REQUEST_RESPONSE_TYPE(Req_ClientUnregisterCapability, UnregistrationParams,JsonNull, "client/unregisterCapability");
\ No newline at end of file +DEFINE_REQUEST_RESPONSE_TYPE(Req_ClientUnregisterCapability, UnregistrationParams,JsonNull, "client/unregisterCapability"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/OverridableMethod.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/OverridableMethod.h index cfb17fdf34..dd0ada60cc 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/OverridableMethod.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/OverridableMethod.h @@ -4,31 +4,31 @@ #include <string> struct OverridableMethod { - std::string bindingKey; - std::string name; - std::vector<std::string> parameters; - bool unimplemented = false; - std::string declaringClass; - std::string declaringClassType; + std::string bindingKey; + std::string name; + std::vector<std::string> parameters; + bool unimplemented = false; + std::string declaringClass; + std::string declaringClassType; - void swap(OverridableMethod& arg) noexcept - { - bindingKey.swap(arg.bindingKey); - name.swap(arg.name); - parameters.swap(arg.parameters); - declaringClass.swap(arg.declaringClass); - declaringClassType.swap(arg.declaringClassType); - std::swap(unimplemented, arg.unimplemented); - } + void swap(OverridableMethod& arg) noexcept + { + bindingKey.swap(arg.bindingKey); + name.swap(arg.name); + parameters.swap(arg.parameters); + declaringClass.swap(arg.declaringClass); + declaringClassType.swap(arg.declaringClassType); + std::swap(unimplemented, arg.unimplemented); + } }; MAKE_REFLECT_STRUCT(OverridableMethod, bindingKey, name, parameters, unimplemented, declaringClass, declaringClassType); struct OverridableMethodsResponse { - std::string type; - std::vector<OverridableMethod> methods; + std::string type; + std::vector<OverridableMethod> methods; - MAKE_SWAP_METHOD(OverridableMethodsResponse, type, methods) + MAKE_SWAP_METHOD(OverridableMethodsResponse, type, methods) }; MAKE_REFLECT_STRUCT(OverridableMethodsResponse, type, methods) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/WorkspaceSymbolParams.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/WorkspaceSymbolParams.h index c7faa94d6c..c8ddbe3c01 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/WorkspaceSymbolParams.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/WorkspaceSymbolParams.h @@ -6,8 +6,8 @@ struct WorkspaceSymbolParams { - std::string query; - MAKE_SWAP_METHOD(WorkspaceSymbolParams, query); + std::string query; + MAKE_SWAP_METHOD(WorkspaceSymbolParams, query); }; MAKE_REFLECT_STRUCT(WorkspaceSymbolParams, query); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/addOverridableMethods.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/addOverridableMethods.h index 5da14a452a..527b3b1827 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/addOverridableMethods.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/addOverridableMethods.h @@ -6,10 +6,10 @@ #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" struct AddOverridableMethodParams { - lsCodeActionParams context; - std::vector<OverridableMethod> overridableMethods; + lsCodeActionParams context; + std::vector<OverridableMethod> overridableMethods; - MAKE_SWAP_METHOD(AddOverridableMethodParams, context, overridableMethods); + MAKE_SWAP_METHOD(AddOverridableMethodParams, context, overridableMethods); }; MAKE_REFLECT_STRUCT(AddOverridableMethodParams, context, overridableMethods); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/buildWorkspace.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/buildWorkspace.h index a2c2c062cc..4809e360bb 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/buildWorkspace.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/buildWorkspace.h @@ -10,8 +10,8 @@ enum class BuildWorkspaceStatus : uint8_t{ - FAILED, SUCCEED, WITH_ERROR, CANCELLED, + FAILED, SUCCEED, WITH_ERROR, CANCELLED, }; MAKE_REFLECT_TYPE_PROXY(BuildWorkspaceStatus) -DEFINE_REQUEST_RESPONSE_TYPE(java_buildWorkspace, bool, BuildWorkspaceStatus, "java/buildWorkspace");
\ No newline at end of file +DEFINE_REQUEST_RESPONSE_TYPE(java_buildWorkspace, bool, BuildWorkspaceStatus, "java/buildWorkspace"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkConstructorsStatus.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkConstructorsStatus.h index 261a0cc551..acb1e4caa6 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkConstructorsStatus.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkConstructorsStatus.h @@ -6,19 +6,19 @@ #include "checkHashCodeEqualsStatus.h" struct LspMethodBinding { - std::string bindingKey; - std::string name; - std::vector< std::string> parameters; + std::string bindingKey; + std::string name; + std::vector< std::string> parameters; - MAKE_SWAP_METHOD(LspMethodBinding, bindingKey, name, parameters); + MAKE_SWAP_METHOD(LspMethodBinding, bindingKey, name, parameters); }; MAKE_REFLECT_STRUCT(LspMethodBinding, bindingKey, name, parameters); struct CheckConstructorsResponse { - std::vector<LspMethodBinding> constructors; - std::vector<LspVariableBinding> fields; - MAKE_SWAP_METHOD(CheckConstructorsResponse, constructors, fields) + std::vector<LspMethodBinding> constructors; + std::vector<LspVariableBinding> fields; + MAKE_SWAP_METHOD(CheckConstructorsResponse, constructors, fields) }; MAKE_REFLECT_STRUCT(CheckConstructorsResponse, constructors,fields) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkDelegateMethodsStatus.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkDelegateMethodsStatus.h index 729639eafa..68a7ed6606 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkDelegateMethodsStatus.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkDelegateMethodsStatus.h @@ -8,22 +8,22 @@ #include "checkConstructorsStatus.h" struct LspDelegateField { - LspVariableBinding field; - std::vector<LspMethodBinding> delegateMethods; + LspVariableBinding field; + std::vector<LspMethodBinding> delegateMethods; - MAKE_SWAP_METHOD(LspDelegateField, field, delegateMethods); + MAKE_SWAP_METHOD(LspDelegateField, field, delegateMethods); }; MAKE_REFLECT_STRUCT(LspDelegateField, field, delegateMethods); struct CheckDelegateMethodsResponse { - std::vector<LspDelegateField> delegateFields; + std::vector<LspDelegateField> delegateFields; - MAKE_SWAP_METHOD(CheckDelegateMethodsResponse, delegateFields) + MAKE_SWAP_METHOD(CheckDelegateMethodsResponse, delegateFields) }; MAKE_REFLECT_STRUCT(CheckDelegateMethodsResponse, delegateFields) DEFINE_REQUEST_RESPONSE_TYPE(java_checkDelegateMethodsStatus, - lsCodeActionParams, CheckDelegateMethodsResponse, "java/checkDelegateMethodsStatus"); + lsCodeActionParams, CheckDelegateMethodsResponse, "java/checkDelegateMethodsStatus"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkHashCodeEqualsStatus.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkHashCodeEqualsStatus.h index 1d9652dd44..88731c29b5 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkHashCodeEqualsStatus.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkHashCodeEqualsStatus.h @@ -8,29 +8,29 @@ #include "LibLsp/lsp/CodeActionParams.h" struct LspVariableBinding { - std::string bindingKey; - std::string name; - std::string type; - bool isField; - void swap(LspVariableBinding& arg) noexcept - { - bindingKey.swap(arg.bindingKey); - name.swap(arg.name); - type.swap(arg.type); - std::swap(isField, arg.isField); - } + std::string bindingKey; + std::string name; + std::string type; + bool isField; + void swap(LspVariableBinding& arg) noexcept + { + bindingKey.swap(arg.bindingKey); + name.swap(arg.name); + type.swap(arg.type); + std::swap(isField, arg.isField); + } }; MAKE_REFLECT_STRUCT(LspVariableBinding, bindingKey, name, type, isField) struct CheckHashCodeEqualsResponse { - std::string type; - std::vector<LspVariableBinding> fields; - std::vector<std::string> existingMethods; - MAKE_SWAP_METHOD(CheckHashCodeEqualsResponse, type, fields, type, existingMethods) + std::string type; + std::vector<LspVariableBinding> fields; + std::vector<std::string> existingMethods; + MAKE_SWAP_METHOD(CheckHashCodeEqualsResponse, type, fields, type, existingMethods) }; MAKE_REFLECT_STRUCT(CheckHashCodeEqualsResponse, type, fields, type, existingMethods) DEFINE_REQUEST_RESPONSE_TYPE(java_checkHashCodeEqualsStatus, - lsCodeActionParams, CheckHashCodeEqualsResponse, "java/checkHashCodeEqualsStatus") + lsCodeActionParams, CheckHashCodeEqualsResponse, "java/checkHashCodeEqualsStatus") diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkToStringStatus.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkToStringStatus.h index 24580d94c0..cadb5ba7dd 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkToStringStatus.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkToStringStatus.h @@ -6,19 +6,19 @@ #include "LibLsp/lsp/CodeActionParams.h" #include "checkHashCodeEqualsStatus.h" struct CheckToStringResponse { - std::string type; - std::vector<LspVariableBinding> fields; - bool exists; - void swap(CheckToStringResponse& arg) noexcept - { - type.swap(arg.type); - fields.swap(arg.fields); - std::swap(exists, arg.exists); - } + std::string type; + std::vector<LspVariableBinding> fields; + bool exists; + void swap(CheckToStringResponse& arg) noexcept + { + type.swap(arg.type); + fields.swap(arg.fields); + std::swap(exists, arg.exists); + } }; MAKE_REFLECT_STRUCT(CheckToStringResponse,type,fields,exists) DEFINE_REQUEST_RESPONSE_TYPE(java_checkToStringStatus, - lsCodeActionParams, CheckToStringResponse ,"java/checkToStringStatus") + lsCodeActionParams, CheckToStringResponse ,"java/checkToStringStatus") diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/codeActionResult.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/codeActionResult.h index 02024e3d93..c0195908d0 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/codeActionResult.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/codeActionResult.h @@ -9,14 +9,14 @@ namespace SourceAssistProcessor { - /*std::set<std::string> UNSUPPORTED_RESOURCES = { "module-info.java", "package-info.java" - };*/ + /*std::set<std::string> UNSUPPORTED_RESOURCES = { "module-info.java", "package-info.java" + };*/ -// static const char* COMMAND_ID_ACTION_OVERRIDEMETHODSPROMPT = "java.action.overrideMethodsPrompt"; -// static const char* COMMAND_ID_ACTION_HASHCODEEQUALSPROMPT = "java.action.hashCodeEqualsPrompt"; -// static const char* COMMAND_ID_ACTION_ORGANIZEIMPORTS = "java.action.organizeImports"; -// static const char* COMMAND_ID_ACTION_GENERATETOSTRINGPROMPT = "java.action.generateToStringPrompt"; -// static const char* COMMAND_ID_ACTION_GENERATEACCESSORSPROMPT = "java.action.generateAccessorsPrompt"; -// static const char* COMMAND_ID_ACTION_GENERATECONSTRUCTORSPROMPT = "java.action.generateConstructorsPrompt"; -// static const char* COMMAND_ID_ACTION_GENERATEDELEGATEMETHODSPROMPT = "java.action.generateDelegateMethodsPrompt"; +// static const char* COMMAND_ID_ACTION_OVERRIDEMETHODSPROMPT = "java.action.overrideMethodsPrompt"; +// static const char* COMMAND_ID_ACTION_HASHCODEEQUALSPROMPT = "java.action.hashCodeEqualsPrompt"; +// static const char* COMMAND_ID_ACTION_ORGANIZEIMPORTS = "java.action.organizeImports"; +// static const char* COMMAND_ID_ACTION_GENERATETOSTRINGPROMPT = "java.action.generateToStringPrompt"; +// static const char* COMMAND_ID_ACTION_GENERATEACCESSORSPROMPT = "java.action.generateAccessorsPrompt"; +// static const char* COMMAND_ID_ACTION_GENERATECONSTRUCTORSPROMPT = "java.action.generateConstructorsPrompt"; +// static const char* COMMAND_ID_ACTION_GENERATEDELEGATEMETHODSPROMPT = "java.action.generateDelegateMethodsPrompt"; }; diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/executeCommand.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/executeCommand.h index 92d4a3627b..19479adfaf 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/executeCommand.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/executeCommand.h @@ -6,20 +6,20 @@ #include "LibLsp/lsp/ExecuteCommandParams.h" namespace buildpath { -// static const char* EDIT_ORGNIZEIMPORTS = "java.edit.organizeImports"; -// static const char* RESOLVE_SOURCE_ATTACHMENT = "java.project.resolveSourceAttachment"; +// static const char* EDIT_ORGNIZEIMPORTS = "java.edit.organizeImports"; +// static const char* RESOLVE_SOURCE_ATTACHMENT = "java.project.resolveSourceAttachment"; -// static const char* UPDATE_SOURCE_ATTACHMENT = "java.project.updateSourceAttachment"; +// static const char* UPDATE_SOURCE_ATTACHMENT = "java.project.updateSourceAttachment"; -// static const char* ADD_TO_SOURCEPATH = "java.project.addToSourcePath"; +// static const char* ADD_TO_SOURCEPATH = "java.project.addToSourcePath"; -// static const char* REMOVE_FROM_SOURCEPATH = "java.project.removeFromSourcePath"; +// static const char* REMOVE_FROM_SOURCEPATH = "java.project.removeFromSourcePath"; -// static const char* LIST_SOURCEPATHS = "java.project.listSourcePaths"; - struct Result { - bool status; - std::string message; - }; +// static const char* LIST_SOURCEPATHS = "java.project.listSourcePaths"; + struct Result { + bool status; + std::string message; + }; diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/findLinks.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/findLinks.h index d184c675d8..fd470b17c8 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/findLinks.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/findLinks.h @@ -8,11 +8,11 @@ #include "LibLsp/lsp/lsTextDocumentPositionParams.h" struct FindLinksParams { - // Supported link types: superImplementation - std::string type; - lsTextDocumentPositionParams position; - - MAKE_SWAP_METHOD(FindLinksParams, type, position) + // Supported link types: superImplementation + std::string type; + lsTextDocumentPositionParams position; + + MAKE_SWAP_METHOD(FindLinksParams, type, position) }; MAKE_REFLECT_STRUCT(FindLinksParams,type,position) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateAccessors.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateAccessors.h index 200d840e94..82013096c7 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateAccessors.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateAccessors.h @@ -8,11 +8,11 @@ struct GenerateAccessorsParams { - lsCodeActionParams context; - std::vector<AccessorField> accessors; + lsCodeActionParams context; + std::vector<AccessorField> accessors; - MAKE_SWAP_METHOD(GenerateAccessorsParams, context, accessors) + MAKE_SWAP_METHOD(GenerateAccessorsParams, context, accessors) }; MAKE_REFLECT_STRUCT(GenerateAccessorsParams, context, accessors) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateConstructors.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateConstructors.h index 77c49a66a2..157fefed79 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateConstructors.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateConstructors.h @@ -8,10 +8,10 @@ struct GenerateConstructorsParams { - lsCodeActionParams context; - std::vector<LspMethodBinding> constructors; - std::vector< LspVariableBinding >fields; - MAKE_SWAP_METHOD(GenerateConstructorsParams, context, fields) + lsCodeActionParams context; + std::vector<LspMethodBinding> constructors; + std::vector< LspVariableBinding >fields; + MAKE_SWAP_METHOD(GenerateConstructorsParams, context, fields) }; MAKE_REFLECT_STRUCT(GenerateConstructorsParams, context, fields) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateDelegateMethods.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateDelegateMethods.h index 8958ae4d7e..c6b4729378 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateDelegateMethods.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateDelegateMethods.h @@ -7,17 +7,17 @@ #include "checkConstructorsStatus.h" struct LspDelegateEntry { - LspVariableBinding field; - LspMethodBinding delegateMethod; - MAKE_SWAP_METHOD(LspDelegateEntry, field, delegateMethod); + LspVariableBinding field; + LspMethodBinding delegateMethod; + MAKE_SWAP_METHOD(LspDelegateEntry, field, delegateMethod); }; MAKE_REFLECT_STRUCT(LspDelegateEntry, field, delegateMethod); struct GenerateDelegateMethodsParams { - lsCodeActionParams context; - std::vector<LspDelegateEntry> delegateEntries; - MAKE_SWAP_METHOD(GenerateDelegateMethodsParams, context, delegateEntries) + lsCodeActionParams context; + std::vector<LspDelegateEntry> delegateEntries; + MAKE_SWAP_METHOD(GenerateDelegateMethodsParams, context, delegateEntries) }; MAKE_REFLECT_STRUCT(GenerateDelegateMethodsParams, context, delegateEntries) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateHashCodeEquals.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateHashCodeEquals.h index 937c358733..0881d305b1 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateHashCodeEquals.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateHashCodeEquals.h @@ -8,15 +8,15 @@ #include "checkHashCodeEqualsStatus.h" struct GenerateHashCodeEqualsParams { - lsCodeActionParams context; - std::vector<LspVariableBinding> fields; - bool regenerate= false; - void swap(GenerateHashCodeEqualsParams& arg) noexcept - { - context.swap(arg.context); - fields.swap(arg.fields); - std::swap(regenerate, arg.regenerate); - } + lsCodeActionParams context; + std::vector<LspVariableBinding> fields; + bool regenerate= false; + void swap(GenerateHashCodeEqualsParams& arg) noexcept + { + context.swap(arg.context); + fields.swap(arg.fields); + std::swap(regenerate, arg.regenerate); + } }; MAKE_REFLECT_STRUCT(GenerateHashCodeEqualsParams, context, fields, regenerate); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateToString.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateToString.h index 1f8ccc73b8..5e5324a59b 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateToString.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateToString.h @@ -7,11 +7,11 @@ struct GenerateToStringParams { - lsCodeActionParams context; - std::vector< LspVariableBinding >fields; - - MAKE_SWAP_METHOD(GenerateToStringParams, context, fields) - + lsCodeActionParams context; + std::vector< LspVariableBinding >fields; + + MAKE_SWAP_METHOD(GenerateToStringParams, context, fields) + }; MAKE_REFLECT_STRUCT(GenerateToStringParams, context, fields) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/getMoveDestinations.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/getMoveDestinations.h index bcbf6f8c2b..56f09a0a53 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/getMoveDestinations.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/getMoveDestinations.h @@ -8,54 +8,54 @@ struct MoveKindInfo { - static std::string moveResource() - { - return "moveResource"; - } - static std::string moveInstanceMethod() - { - return "moveInstanceMethod"; - } - static std::string moveStaticMember() - { - return "moveStaticMember"; - } + static std::string moveResource() + { + return "moveResource"; + } + static std::string moveInstanceMethod() + { + return "moveInstanceMethod"; + } + static std::string moveStaticMember() + { + return "moveStaticMember"; + } }; struct MoveParams { - /** - * The supported move kind: moveResource, moveInstanceMethod, moveStaticMember, - * moveTypeToNewFile. - */ - std::string moveKind; - /** - * The selected resource uris when the move operation is triggered. - */ - std::vector<std::string> sourceUris; - /** - * The code action params when the move operation is triggered. - */ - boost::optional<lsCodeActionParams> params; - /** - * The possible destination: a folder/package, class, instanceDeclaration. - */ - lsp::Any destination; - bool updateReferences; - void swap(MoveParams& arg) noexcept - { - moveKind.swap(arg.moveKind); - sourceUris.swap(arg.sourceUris); - params.swap(arg.params); - destination.swap(arg.destination); - std::swap(updateReferences, arg.updateReferences); - } + /** + * The supported move kind: moveResource, moveInstanceMethod, moveStaticMember, + * moveTypeToNewFile. + */ + std::string moveKind; + /** + * The selected resource uris when the move operation is triggered. + */ + std::vector<std::string> sourceUris; + /** + * The code action params when the move operation is triggered. + */ + boost::optional<lsCodeActionParams> params; + /** + * The possible destination: a folder/package, class, instanceDeclaration. + */ + lsp::Any destination; + bool updateReferences; + void swap(MoveParams& arg) noexcept + { + moveKind.swap(arg.moveKind); + sourceUris.swap(arg.sourceUris); + params.swap(arg.params); + destination.swap(arg.destination); + std::swap(updateReferences, arg.updateReferences); + } }; MAKE_REFLECT_STRUCT(MoveParams, moveKind, sourceUris, params, destination, updateReferences); struct MoveDestinationsResponse { - std::string errorMessage; - std::vector<lsp::Any > destinations; - MAKE_SWAP_METHOD(MoveDestinationsResponse, errorMessage, destinations); + std::string errorMessage; + std::vector<lsp::Any > destinations; + MAKE_SWAP_METHOD(MoveDestinationsResponse, errorMessage, destinations); }; MAKE_REFLECT_STRUCT(MoveDestinationsResponse, errorMessage, destinations); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/getRefactorEdit.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/getRefactorEdit.h index e46327075a..131612dc2e 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/getRefactorEdit.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/getRefactorEdit.h @@ -15,40 +15,40 @@ namespace RefactorProposalUtility { - extern const char* APPLY_REFACTORING_COMMAND_ID; - extern const char* EXTRACT_VARIABLE_ALL_OCCURRENCE_COMMAND; - extern const char* EXTRACT_VARIABLE_COMMAND; - extern const char* EXTRACT_CONSTANT_COMMAND; - extern const char* EXTRACT_METHOD_COMMAND; - extern const char* EXTRACT_FIELD_COMMAND; - extern const char* CONVERT_VARIABLE_TO_FIELD_COMMAND; - extern const char* MOVE_FILE_COMMAND; - extern const char* MOVE_INSTANCE_METHOD_COMMAND; - extern const char* MOVE_STATIC_MEMBER_COMMAND; - extern const char* MOVE_TYPE_COMMAND; + extern const char* APPLY_REFACTORING_COMMAND_ID; + extern const char* EXTRACT_VARIABLE_ALL_OCCURRENCE_COMMAND; + extern const char* EXTRACT_VARIABLE_COMMAND; + extern const char* EXTRACT_CONSTANT_COMMAND; + extern const char* EXTRACT_METHOD_COMMAND; + extern const char* EXTRACT_FIELD_COMMAND; + extern const char* CONVERT_VARIABLE_TO_FIELD_COMMAND; + extern const char* MOVE_FILE_COMMAND; + extern const char* MOVE_INSTANCE_METHOD_COMMAND; + extern const char* MOVE_STATIC_MEMBER_COMMAND; + extern const char* MOVE_TYPE_COMMAND; }; struct RenamePosition { - lsDocumentUri uri; - int offset = 0; - int length = 0; - void swap(RenamePosition& arg) noexcept - { - uri.swap(arg.uri); - std::swap(offset, arg.offset); - std::swap(length, arg.length); - } + lsDocumentUri uri; + int offset = 0; + int length = 0; + void swap(RenamePosition& arg) noexcept + { + uri.swap(arg.uri); + std::swap(offset, arg.offset); + std::swap(length, arg.length); + } }; MAKE_REFLECT_STRUCT(RenamePosition, uri, offset, length); struct GetRefactorEditParams { - std::string command; - std::vector<lsp::Any> commandArguments; - lsCodeActionParams context; - boost::optional<lsFormattingOptions> options; - MAKE_SWAP_METHOD(GetRefactorEditParams, command, context, options); + std::string command; + std::vector<lsp::Any> commandArguments; + lsCodeActionParams context; + boost::optional<lsFormattingOptions> options; + MAKE_SWAP_METHOD(GetRefactorEditParams, command, context, options); }; MAKE_REFLECT_STRUCT(GetRefactorEditParams, command, context, options); @@ -56,20 +56,20 @@ MAKE_REFLECT_STRUCT(GetRefactorEditParams, command, context, options); struct RefactorWorkspaceEdit { - /** - * The workspace edit this code action performs. - */ - lsWorkspaceEdit edit; - /** - * A command this code action executes. If a code action provides a edit and a - * command, first the edit is executed and then the command. - */ - - boost::optional<std::string> errorMessage; - - boost::optional < lsCommandWithAny > command; - - MAKE_SWAP_METHOD(RefactorWorkspaceEdit, edit, command, errorMessage) + /** + * The workspace edit this code action performs. + */ + lsWorkspaceEdit edit; + /** + * A command this code action executes. If a code action provides a edit and a + * command, first the edit is executed and then the command. + */ + + boost::optional<std::string> errorMessage; + + boost::optional < lsCommandWithAny > command; + + MAKE_SWAP_METHOD(RefactorWorkspaceEdit, edit, command, errorMessage) }; MAKE_REFLECT_STRUCT(RefactorWorkspaceEdit,edit,command,errorMessage) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/resolveUnimplementedAccessors.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/resolveUnimplementedAccessors.h index ba77041474..f8bd8a4f7a 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/resolveUnimplementedAccessors.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/resolveUnimplementedAccessors.h @@ -7,16 +7,16 @@ struct AccessorField { - std::string fieldName; - bool isStatic =false; - bool generateGetter = false; - bool generateSetter = false; - void swap(AccessorField& arg) noexcept{ - fieldName.swap(arg.fieldName); - std::swap(isStatic, arg.isStatic); - std::swap(generateGetter, arg.generateGetter); - std::swap(generateSetter, arg.generateSetter); - } + std::string fieldName; + bool isStatic =false; + bool generateGetter = false; + bool generateSetter = false; + void swap(AccessorField& arg) noexcept{ + fieldName.swap(arg.fieldName); + std::swap(isStatic, arg.isStatic); + std::swap(generateGetter, arg.generateGetter); + std::swap(generateSetter, arg.generateSetter); + } }; MAKE_REFLECT_STRUCT(AccessorField, fieldName,isStatic,generateGetter,generateSetter) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/searchSymbols.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/searchSymbols.h index ac8a2419f6..18a2f9999e 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/searchSymbols.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/searchSymbols.h @@ -13,10 +13,10 @@ struct SearchSymbolParams :public WorkspaceSymbolParams { - boost::optional<std::string> projectName; - boost::optional< bool >sourceOnly; - boost::optional< int> maxResults; - MAKE_SWAP_METHOD(SearchSymbolParams, query, projectName, sourceOnly, maxResults); + boost::optional<std::string> projectName; + boost::optional< bool >sourceOnly; + boost::optional< int> maxResults; + MAKE_SWAP_METHOD(SearchSymbolParams, query, projectName, sourceOnly, maxResults); }; MAKE_REFLECT_STRUCT(SearchSymbolParams, query, projectName, sourceOnly, maxResults); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/sonarlint/protocol.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/sonarlint/protocol.h index d81c3eaa63..0823469ba9 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/sonarlint/protocol.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/sonarlint/protocol.h @@ -9,46 +9,46 @@ struct LintRule { - std::string key; - std::string name; + std::string key; + std::string name; - std::string Display() const - { - return name + " (" + key + ")"; - } - bool activeByDefault = true; - boost::optional<std::string> severity; - boost::optional<std::string> type; - int icon_index = -1; - MAKE_SWAP_METHOD(LintRule, key, name, activeByDefault, severity, type); + std::string Display() const + { + return name + " (" + key + ")"; + } + bool activeByDefault = true; + boost::optional<std::string> severity; + boost::optional<std::string> type; + int icon_index = -1; + MAKE_SWAP_METHOD(LintRule, key, name, activeByDefault, severity, type); }; MAKE_REFLECT_STRUCT(LintRule, key, name, activeByDefault, severity, type); struct RuleParameter { - std::string name; - boost::optional<std::string> description; - boost::optional<std::string> defaultValue; + std::string name; + boost::optional<std::string> description; + boost::optional<std::string> defaultValue; }; MAKE_REFLECT_STRUCT(RuleParameter, name, description, defaultValue); struct ShowRuleDescriptionParams { - boost::optional<std::string> key; + boost::optional<std::string> key; - boost::optional<std::string> name; + boost::optional<std::string> name; - boost::optional<std::string> htmlDescription; + boost::optional<std::string> htmlDescription; - boost::optional<std::string> type; + boost::optional<std::string> type; - boost::optional<std::string> severity; + boost::optional<std::string> severity; - boost::optional< std::vector<RuleParameter> > parameters; - MAKE_SWAP_METHOD(ShowRuleDescriptionParams, key, name, htmlDescription, type, severity, parameters) + boost::optional< std::vector<RuleParameter> > parameters; + MAKE_SWAP_METHOD(ShowRuleDescriptionParams, key, name, htmlDescription, type, severity, parameters) }; @@ -56,96 +56,96 @@ MAKE_REFLECT_STRUCT(ShowRuleDescriptionParams, key, name, htmlDescription, type, struct GetJavaConfigResponse { - std::string projectRoot; - std::string sourceLevel; - std::vector<std::string> classpath; - bool isTest; - std::string vmLocation; - MAKE_SWAP_METHOD(GetJavaConfigResponse, projectRoot, sourceLevel, classpath, isTest, vmLocation); + std::string projectRoot; + std::string sourceLevel; + std::vector<std::string> classpath; + bool isTest; + std::string vmLocation; + MAKE_SWAP_METHOD(GetJavaConfigResponse, projectRoot, sourceLevel, classpath, isTest, vmLocation); }; MAKE_REFLECT_STRUCT(GetJavaConfigResponse, projectRoot, sourceLevel, classpath, isTest, vmLocation); struct SetTraceNotificationParams { - lsInitializeParams::lsTrace value; + lsInitializeParams::lsTrace value; }; MAKE_REFLECT_STRUCT(SetTraceNotificationParams, value); struct ServerConnectionSettings { - std::string SONARCLOUD_URL = "https://sonarcloud.io"; - std::vector<std::string>SONARCLOUD_ALIAS = { "https://sonarqube.com", - "https://www.sonarqube.com", - "https://www.sonarcloud.io", - "https://sonarcloud.io" }; + std::string SONARCLOUD_URL = "https://sonarcloud.io"; + std::vector<std::string>SONARCLOUD_ALIAS = { "https://sonarqube.com", + "https://www.sonarqube.com", + "https://www.sonarcloud.io", + "https://sonarcloud.io" }; - std::string connectionId; - std::string serverUrl; - std::string token; - boost::optional<std::string> organizationKey; - MAKE_SWAP_METHOD(ServerConnectionSettings, connectionId, serverUrl, token, organizationKey) + std::string connectionId; + std::string serverUrl; + std::string token; + boost::optional<std::string> organizationKey; + MAKE_SWAP_METHOD(ServerConnectionSettings, connectionId, serverUrl, token, organizationKey) }; MAKE_REFLECT_STRUCT(ServerConnectionSettings, connectionId, serverUrl, token, organizationKey) struct RuleSetting { - bool IsOn(); - std::string level = "on"; - RuleSetting(bool activate); - RuleSetting() = default; - void toggle(); - void on() - { - level = "on"; - } - void off() - { - level = "off"; - } - void turn(bool activate) - { - if (activate) - { - on(); - } - else - { - off(); - } - } - boost::optional< std::map<std::string, std::string > > parameters; + bool IsOn(); + std::string level = "on"; + RuleSetting(bool activate); + RuleSetting() = default; + void toggle(); + void on() + { + level = "on"; + } + void off() + { + level = "off"; + } + void turn(bool activate) + { + if (activate) + { + on(); + } + else + { + off(); + } + } + boost::optional< std::map<std::string, std::string > > parameters; }; MAKE_REFLECT_STRUCT(RuleSetting, level, parameters) struct ConsoleParams { - boost::optional < bool >showAnalyzerLogs; - boost::optional < bool >showVerboseLogs; - MAKE_SWAP_METHOD(ConsoleParams, showAnalyzerLogs, showVerboseLogs) + boost::optional < bool >showAnalyzerLogs; + boost::optional < bool >showVerboseLogs; + MAKE_SWAP_METHOD(ConsoleParams, showAnalyzerLogs, showVerboseLogs) }; MAKE_REFLECT_STRUCT(ConsoleParams, showAnalyzerLogs, showVerboseLogs) struct SonarLintWorkspaceSettings { - boost::optional < bool > disableTelemetry; - boost::optional < std::map<std::string, ServerConnectionSettings> >connectedMode; - boost::optional<std::map<std::string, RuleSetting>> rules; - boost::optional<ConsoleParams> output; + boost::optional < bool > disableTelemetry; + boost::optional < std::map<std::string, ServerConnectionSettings> >connectedMode; + boost::optional<std::map<std::string, RuleSetting>> rules; + boost::optional<ConsoleParams> output; - boost::optional<std::string > pathToNodeExecutable; + boost::optional<std::string > pathToNodeExecutable; - boost::optional< std::map<std::string, std::string > > getConfigurationParameters(const std::string& ruleKey); + boost::optional< std::map<std::string, std::string > > getConfigurationParameters(const std::string& ruleKey); }; MAKE_REFLECT_STRUCT(SonarLintWorkspaceSettings, disableTelemetry, connectedMode, - rules, output, pathToNodeExecutable) + rules, output, pathToNodeExecutable) - DEFINE_REQUEST_RESPONSE_TYPE(slls_listAllRules, JsonNull, lsp::Any, "sonarlint/listAllRules"); + DEFINE_REQUEST_RESPONSE_TYPE(slls_listAllRules, JsonNull, lsp::Any, "sonarlint/listAllRules"); @@ -173,4 +173,4 @@ DEFINE_REQUEST_RESPONSE_TYPE(slls_showRuleDescription, ShowRuleDescriptionParams DEFINE_REQUEST_RESPONSE_TYPE(slls_getJavaConfig, lsDocumentUri, GetJavaConfigResponse, "sonarlint/getJavaConfig"); -DEFINE_NOTIFICATION_TYPE(slls_setTraceNotification, SetTraceNotificationParams, "$/setTraceNotification")
\ No newline at end of file +DEFINE_NOTIFICATION_TYPE(slls_setTraceNotification, SetTraceNotificationParams, "$/setTraceNotification") diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/InitializeParams.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/InitializeParams.h index f10080ea21..c07cc8149d 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/InitializeParams.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/InitializeParams.h @@ -6,10 +6,10 @@ #include "LibLsp/lsp/workspace/workspaceFolders.h" struct ClientInfo { - std::string name; - boost::optional<std::string> version; - - MAKE_SWAP_METHOD(ClientInfo,name,version); + std::string name; + boost::optional<std::string> version; + + MAKE_SWAP_METHOD(ClientInfo,name,version); }; MAKE_REFLECT_STRUCT(ClientInfo,name,version); @@ -19,7 +19,7 @@ struct lsInitializeParams { // If the parent process is not alive then the server should exit (see exit // notification) its process. boost::optional<int> processId; - + /** * Information about the client * @@ -37,7 +37,7 @@ struct lsInitializeParams { * @since 3.16.0 */ boost::optional<std::string> locale; - + // The rootPath of the workspace. Is null // if no folder is open. // @@ -64,13 +64,13 @@ struct lsInitializeParams { boost::optional< std::string >clientName; - + enum class lsTrace { // NOTE: serialized as a string, one of 'off' | 'messages' | 'verbose'; Off, // off Messages, // messages Verbose // verbose - + }; // The initial trace setting. If omitted trace is disabled ('off'). @@ -117,9 +117,9 @@ struct lsInitializeError { bool retry; void swap(lsInitializeError& arg) noexcept { - auto tem = retry; - retry = arg.retry; - arg.retry = tem; + auto tem = retry; + retry = arg.retry; + arg.retry = tem; } }; MAKE_REFLECT_STRUCT(lsInitializeError, retry); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/initialize.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/initialize.h index eb8810939a..2198b158bf 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/initialize.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/initialize.h @@ -15,7 +15,7 @@ */ struct InitializeResult { lsServerCapabilities capabilities; - MAKE_SWAP_METHOD(InitializeResult, capabilities); + MAKE_SWAP_METHOD(InitializeResult, capabilities); }; MAKE_REFLECT_STRUCT(InitializeResult, capabilities); @@ -26,7 +26,7 @@ MAKE_REFLECT_STRUCT(InitializeResult, capabilities); * the server. * * If the server receives request or notification before the initialize request it should act as follows: - * - for a request the respond should be errored with code: -32001. The message can be picked by the server. + * - for a request the respond should be errored with code: -32001. The message can be picked by the server. * - notifications should be dropped, except for the exit notification. This will allow the exit a server without an initialize request. * * Until the server has responded to the initialize request with an InitializeResult diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsClientCapabilities.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsClientCapabilities.h index fcf6634e13..29129565e4 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsClientCapabilities.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsClientCapabilities.h @@ -10,17 +10,17 @@ * @since 3.16.0 */ struct MarkdownClientCapabilities { - /** - * The name of the parser. - */ - std::string parser; - - /** - * The version of the parser. - */ - boost::optional<std::string> version; - MAKE_SWAP_METHOD(MarkdownClientCapabilities, parser, version) - + /** + * The name of the parser. + */ + std::string parser; + + /** + * The version of the parser. + */ + boost::optional<std::string> version; + MAKE_SWAP_METHOD(MarkdownClientCapabilities, parser, version) + }; MAKE_REFLECT_STRUCT(MarkdownClientCapabilities, parser, version) @@ -32,7 +32,7 @@ struct lsClientCapabilities { boost::optional<lsTextDocumentClientCapabilities> textDocument; /** - * Window specific client capabilities. + * Window specific client capabilities. */ boost::optional<lsp::Any> window; /** diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsServerCapabilities.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsServerCapabilities.h index 66af2ced6b..d62d3e4dfd 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsServerCapabilities.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsServerCapabilities.h @@ -16,77 +16,77 @@ extern void Reflect(Reader&, std::pair<boost::optional<lsTextDocumentSyncKind>, // Code Action options. // struct CodeActionOptions : WorkDoneProgressOptions { - // - // 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. - // - typedef std::string CodeActionKind; - std::vector<CodeActionKind> codeActionKinds; - - MAKE_SWAP_METHOD(CodeActionOptions, workDoneProgress, codeActionKinds); + // + // 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. + // + typedef std::string CodeActionKind; + std::vector<CodeActionKind> codeActionKinds; + + MAKE_SWAP_METHOD(CodeActionOptions, workDoneProgress, codeActionKinds); }; MAKE_REFLECT_STRUCT(CodeActionOptions, workDoneProgress, codeActionKinds) struct CodeLensOptions : WorkDoneProgressOptions { - // - // Code lens has a resolve provider as well. - // - boost::optional<bool> resolveProvider ; - MAKE_SWAP_METHOD(CodeLensOptions, workDoneProgress, resolveProvider); + // + // Code lens has a resolve provider as well. + // + boost::optional<bool> resolveProvider ; + MAKE_SWAP_METHOD(CodeLensOptions, workDoneProgress, resolveProvider); }; MAKE_REFLECT_STRUCT(CodeLensOptions, workDoneProgress, resolveProvider) // Format document on type options struct lsDocumentOnTypeFormattingOptions :WorkDoneProgressOptions { - // A character on which formatting should be triggered, like `}`. - std::string firstTriggerCharacter; - - // More trigger characters. - std::vector<std::string> moreTriggerCharacter; - MAKE_SWAP_METHOD(lsDocumentOnTypeFormattingOptions, workDoneProgress, - firstTriggerCharacter, - moreTriggerCharacter); + // A character on which formatting should be triggered, like `}`. + std::string firstTriggerCharacter; + + // More trigger characters. + std::vector<std::string> moreTriggerCharacter; + MAKE_SWAP_METHOD(lsDocumentOnTypeFormattingOptions, workDoneProgress, + firstTriggerCharacter, + moreTriggerCharacter); }; MAKE_REFLECT_STRUCT(lsDocumentOnTypeFormattingOptions, workDoneProgress, - firstTriggerCharacter, - moreTriggerCharacter); + firstTriggerCharacter, + moreTriggerCharacter); struct RenameOptions : WorkDoneProgressOptions { - // - // Renames should be checked and tested before being executed. - // - boost::optional<bool> prepareProvider; - MAKE_SWAP_METHOD(RenameOptions, workDoneProgress, prepareProvider); + // + // Renames should be checked and tested before being executed. + // + boost::optional<bool> prepareProvider; + MAKE_SWAP_METHOD(RenameOptions, workDoneProgress, prepareProvider); }; MAKE_REFLECT_STRUCT(RenameOptions,workDoneProgress,prepareProvider) struct DocumentFilter{ - // - // A language id, like `typescript`. - // - boost::optional<std::string> language; - // - // A Uri [scheme](#Uri.scheme), like `file` or `untitled`. - // - boost::optional<std::string>scheme; - // - // A glob pattern, like `*.{ts,js}`. - // - // 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`) - // - boost::optional<std::string>pattern; - MAKE_SWAP_METHOD(DocumentFilter, language, scheme, pattern) + // + // A language id, like `typescript`. + // + boost::optional<std::string> language; + // + // A Uri [scheme](#Uri.scheme), like `file` or `untitled`. + // + boost::optional<std::string>scheme; + // + // A glob pattern, like `*.{ts,js}`. + // + // 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`) + // + boost::optional<std::string>pattern; + MAKE_SWAP_METHOD(DocumentFilter, language, scheme, pattern) }; MAKE_REFLECT_STRUCT(DocumentFilter, language, scheme, pattern) @@ -95,17 +95,17 @@ using DocumentSelector = std::vector<DocumentFilter>; // Document link options struct lsDocumentLinkOptions :WorkDoneProgressOptions { - // Document links have a resolve provider as well. - boost::optional<bool> resolveProvider; - MAKE_SWAP_METHOD(lsDocumentLinkOptions, workDoneProgress, resolveProvider); + // Document links have a resolve provider as well. + boost::optional<bool> resolveProvider; + MAKE_SWAP_METHOD(lsDocumentLinkOptions, workDoneProgress, resolveProvider); }; MAKE_REFLECT_STRUCT(lsDocumentLinkOptions, workDoneProgress,resolveProvider); // Execute command options. struct lsExecuteCommandOptions : WorkDoneProgressOptions { - // The commands to be executed on the server - std::vector<std::string> commands; - MAKE_SWAP_METHOD(lsExecuteCommandOptions, workDoneProgress, commands); + // The commands to be executed on the server + std::vector<std::string> commands; + MAKE_SWAP_METHOD(lsExecuteCommandOptions, workDoneProgress, commands); }; MAKE_REFLECT_STRUCT(lsExecuteCommandOptions, workDoneProgress, commands); @@ -116,9 +116,9 @@ struct 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. // - boost::optional<DocumentSelector> documentSelector; + boost::optional<DocumentSelector> documentSelector; - MAKE_SWAP_METHOD(TextDocumentRegistrationOptions, documentSelector); + MAKE_SWAP_METHOD(TextDocumentRegistrationOptions, documentSelector); }; MAKE_REFLECT_STRUCT(TextDocumentRegistrationOptions, documentSelector); @@ -127,12 +127,12 @@ MAKE_REFLECT_STRUCT(TextDocumentRegistrationOptions, documentSelector); // struct StaticRegistrationOptions :public TextDocumentRegistrationOptions { - // - // The id used to register the request. The id can be used to deregister - // the request again. See also Registration#id. - // - boost::optional<std::string> id; - MAKE_SWAP_METHOD(StaticRegistrationOptions, documentSelector, id) + // + // The id used to register the request. The id can be used to deregister + // the request again. See also Registration#id. + // + boost::optional<std::string> id; + MAKE_SWAP_METHOD(StaticRegistrationOptions, documentSelector, id) }; MAKE_REFLECT_STRUCT(StaticRegistrationOptions, documentSelector,id) @@ -143,22 +143,22 @@ MAKE_REFLECT_STRUCT(StaticRegistrationOptions, documentSelector,id) // struct WorkspaceFoldersOptions { - // - // The server has support for workspace folders - // - boost::optional<bool> supported; - - // - // 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. - // - boost::optional<std::pair< boost::optional<std::string>, boost::optional<bool> > > changeNotifications; - MAKE_SWAP_METHOD(WorkspaceFoldersOptions, supported, changeNotifications); + // + // The server has support for workspace folders + // + boost::optional<bool> supported; + + // + // 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. + // + boost::optional<std::pair< boost::optional<std::string>, boost::optional<bool> > > changeNotifications; + MAKE_SWAP_METHOD(WorkspaceFoldersOptions, supported, changeNotifications); }; MAKE_REFLECT_STRUCT(WorkspaceFoldersOptions, supported, changeNotifications); @@ -170,8 +170,8 @@ MAKE_REFLECT_STRUCT(WorkspaceFoldersOptions, supported, changeNotifications); // enum lsFileOperationPatternKind { - file, - folder + file, + folder }; MAKE_REFLECT_TYPE_PROXY(lsFileOperationPatternKind) @@ -182,11 +182,11 @@ MAKE_REFLECT_TYPE_PROXY(lsFileOperationPatternKind) // struct lsFileOperationPatternOptions { - // - // The pattern should be matched ignoring casing. - // - boost::optional<bool> ignoreCase; - MAKE_SWAP_METHOD(lsFileOperationPatternOptions, ignoreCase) + // + // The pattern should be matched ignoring casing. + // + boost::optional<bool> ignoreCase; + MAKE_SWAP_METHOD(lsFileOperationPatternOptions, ignoreCase) }; MAKE_REFLECT_STRUCT(lsFileOperationPatternOptions, ignoreCase) // @@ -196,33 +196,33 @@ MAKE_REFLECT_STRUCT(lsFileOperationPatternOptions, ignoreCase) // @since 3.16.0 // struct lsFileOperationPattern { - // - // 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`) - // - std::string glob; - - // - // Whether to match files or folders with this pattern. - // - // Matches both if undefined. - // - boost::optional<lsFileOperationPatternKind> matches; - - // - // Additional options used during matching. - // - boost::optional<lsFileOperationPatternOptions> options ; - MAKE_SWAP_METHOD(lsFileOperationPattern, glob, matches, options) + // + // 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`) + // + std::string glob; + + // + // Whether to match files or folders with this pattern. + // + // Matches both if undefined. + // + boost::optional<lsFileOperationPatternKind> matches; + + // + // Additional options used during matching. + // + boost::optional<lsFileOperationPatternOptions> options ; + MAKE_SWAP_METHOD(lsFileOperationPattern, glob, matches, options) }; MAKE_REFLECT_STRUCT(lsFileOperationPattern, glob, matches, options) // @@ -233,16 +233,16 @@ MAKE_REFLECT_STRUCT(lsFileOperationPattern, glob, matches, options) // struct lsFileOperationFilter { - // - // A Uri like `file` or `untitled`. - // - boost::optional<std::string> scheme; + // + // A Uri like `file` or `untitled`. + // + boost::optional<std::string> scheme; - // - // The actual file operation pattern. - // - boost::optional<lsFileOperationPattern> pattern; - MAKE_SWAP_METHOD(lsFileOperationFilter, scheme, pattern) + // + // The actual file operation pattern. + // + boost::optional<lsFileOperationPattern> pattern; + MAKE_SWAP_METHOD(lsFileOperationFilter, scheme, pattern) }; MAKE_REFLECT_STRUCT(lsFileOperationFilter, scheme, pattern) // @@ -251,69 +251,69 @@ MAKE_REFLECT_STRUCT(lsFileOperationFilter, scheme, pattern) // @since 3.16.0 // struct lsFileOperationRegistrationOptions { - // - // The actual filters. - // - boost::optional<std::vector<lsFileOperationFilter>> filters; - MAKE_SWAP_METHOD(lsFileOperationRegistrationOptions, filters) + // + // The actual filters. + // + boost::optional<std::vector<lsFileOperationFilter>> filters; + MAKE_SWAP_METHOD(lsFileOperationRegistrationOptions, filters) }; MAKE_REFLECT_STRUCT(lsFileOperationRegistrationOptions, filters) struct WorkspaceServerCapabilities { - // - // The server supports workspace folder. - // - // Since 3.6.0 - // - WorkspaceFoldersOptions workspaceFolders; - - - // - // The server is interested in file notifications/requests. - // - // @since 3.16.0 - // - struct lsFileOperations - { - // - // The server is interested in receiving didCreateFiles - // notifications. - // - boost::optional<lsFileOperationRegistrationOptions> didCreate; - - // - // The server is interested in receiving willCreateFiles requests. - // - boost::optional<lsFileOperationRegistrationOptions> willCreate; - - // - // The server is interested in receiving didRenameFiles - // notifications. - // - boost::optional<lsFileOperationRegistrationOptions> didRename; - - // - // The server is interested in receiving willRenameFiles requests. - // - boost::optional<lsFileOperationRegistrationOptions> willRename; - - // - // The server is interested in receiving didDeleteFiles file - // notifications. - // - boost::optional<lsFileOperationRegistrationOptions> didDelete; - - // - // The server is interested in receiving willDeleteFiles file - // requests. - // - boost::optional<lsFileOperationRegistrationOptions> willDelete; - MAKE_SWAP_METHOD(lsFileOperations, didCreate, willCreate, didRename, willRename, didDelete, willDelete) - }; - boost::optional<lsFileOperations>fileOperations; - - - MAKE_SWAP_METHOD(WorkspaceServerCapabilities, workspaceFolders, fileOperations) + // + // The server supports workspace folder. + // + // Since 3.6.0 + // + WorkspaceFoldersOptions workspaceFolders; + + + // + // The server is interested in file notifications/requests. + // + // @since 3.16.0 + // + struct lsFileOperations + { + // + // The server is interested in receiving didCreateFiles + // notifications. + // + boost::optional<lsFileOperationRegistrationOptions> didCreate; + + // + // The server is interested in receiving willCreateFiles requests. + // + boost::optional<lsFileOperationRegistrationOptions> willCreate; + + // + // The server is interested in receiving didRenameFiles + // notifications. + // + boost::optional<lsFileOperationRegistrationOptions> didRename; + + // + // The server is interested in receiving willRenameFiles requests. + // + boost::optional<lsFileOperationRegistrationOptions> willRename; + + // + // The server is interested in receiving didDeleteFiles file + // notifications. + // + boost::optional<lsFileOperationRegistrationOptions> didDelete; + + // + // The server is interested in receiving willDeleteFiles file + // requests. + // + boost::optional<lsFileOperationRegistrationOptions> willDelete; + MAKE_SWAP_METHOD(lsFileOperations, didCreate, willCreate, didRename, willRename, didDelete, willDelete) + }; + boost::optional<lsFileOperations>fileOperations; + + + MAKE_SWAP_METHOD(WorkspaceServerCapabilities, workspaceFolders, fileOperations) }; MAKE_REFLECT_STRUCT(WorkspaceServerCapabilities, workspaceFolders, fileOperations) MAKE_REFLECT_STRUCT(WorkspaceServerCapabilities::lsFileOperations, didCreate, willCreate, didRename, willRename, didDelete, willDelete) @@ -328,77 +328,77 @@ MAKE_REFLECT_STRUCT(WorkspaceServerCapabilities::lsFileOperations, didCreate, wi // struct SemanticHighlightingServerCapabilities { - // - // A "lookup table" of semantic highlighting <a href="https://manual.macromates.com/en/language_grammars">TextMate scopes</a> - // supported by the language server. If not defined or empty, then the server does not support the semantic highlighting - // feature. Otherwise, clients should reuse this "lookup table" when receiving semantic highlighting notifications from - // the server. - // - std::vector< std::vector<std::string> > scopes; - MAKE_SWAP_METHOD(SemanticHighlightingServerCapabilities, scopes) + // + // A "lookup table" of semantic highlighting <a href="https://manual.macromates.com/en/language_grammars">TextMate scopes</a> + // supported by the language server. If not defined or empty, then the server does not support the semantic highlighting + // feature. Otherwise, clients should reuse this "lookup table" when receiving semantic highlighting notifications from + // the server. + // + std::vector< std::vector<std::string> > scopes; + MAKE_SWAP_METHOD(SemanticHighlightingServerCapabilities, scopes) }; MAKE_REFLECT_STRUCT(SemanticHighlightingServerCapabilities, scopes) struct SemanticTokensServerFull { - // - // The server supports deltas for full documents. - // - bool delta =false; - MAKE_SWAP_METHOD(SemanticTokensServerFull, delta) + // + // The server supports deltas for full documents. + // + bool delta =false; + MAKE_SWAP_METHOD(SemanticTokensServerFull, delta) }; MAKE_REFLECT_STRUCT(SemanticTokensServerFull, delta) struct SemanticTokensWithRegistrationOptions { - SemanticTokensLegend legend; - - // - // Server supports providing semantic tokens for a specific range - // of a document. - // - boost::optional< std::pair< boost::optional<bool>, boost::optional<lsp::Any> > > range; - - // - // Server supports providing semantic tokens for a full document. - // - boost::optional< std::pair< boost::optional<bool>, - boost::optional<SemanticTokensServerFull> > > full; - - // - // 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. - // - boost::optional < std::vector<DocumentFilter> > documentSelector; - // - // The id used to register the request. The id can be used to deregister - // the request again. See also Registration#id. - // - boost::optional<std::string> id; - MAKE_SWAP_METHOD(SemanticTokensWithRegistrationOptions, legend, range, full, documentSelector, id) + SemanticTokensLegend legend; + + // + // Server supports providing semantic tokens for a specific range + // of a document. + // + boost::optional< std::pair< boost::optional<bool>, boost::optional<lsp::Any> > > range; + + // + // Server supports providing semantic tokens for a full document. + // + boost::optional< std::pair< boost::optional<bool>, + boost::optional<SemanticTokensServerFull> > > full; + + // + // 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. + // + boost::optional < std::vector<DocumentFilter> > documentSelector; + // + // The id used to register the request. The id can be used to deregister + // the request again. See also Registration#id. + // + boost::optional<std::string> id; + MAKE_SWAP_METHOD(SemanticTokensWithRegistrationOptions, legend, range, full, documentSelector, id) }; MAKE_REFLECT_STRUCT(SemanticTokensWithRegistrationOptions, legend, range, full, documentSelector ,id) using DocumentColorOptions = WorkDoneProgressOptions; using FoldingRangeOptions = WorkDoneProgressOptions; struct lsServerCapabilities { - // Defines how text documents are synced. Is either a detailed structure - // defining each notification or for backwards compatibility the + // Defines how text documents are synced. Is either a detailed structure + // defining each notification or for backwards compatibility the - // TextDocumentSyncKind number. - boost::optional< std::pair<boost::optional<lsTextDocumentSyncKind>, - boost::optional<lsTextDocumentSyncOptions> >> textDocumentSync; + // TextDocumentSyncKind number. + boost::optional< std::pair<boost::optional<lsTextDocumentSyncKind>, + boost::optional<lsTextDocumentSyncOptions> >> textDocumentSync; - // The server provides hover support. - boost::optional<bool> hoverProvider; + // The server provides hover support. + boost::optional<bool> hoverProvider; - // The server provides completion support. - boost::optional < lsCompletionOptions > completionProvider; + // The server provides completion support. + boost::optional < lsCompletionOptions > completionProvider; - // The server provides signature help support. - boost::optional < lsSignatureHelpOptions > signatureHelpProvider; + // The server provides signature help support. + boost::optional < lsSignatureHelpOptions > signatureHelpProvider; - // The server provides goto definition support. - boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > definitionProvider; + // The server provides goto definition support. + boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > definitionProvider; // @@ -406,184 +406,184 @@ struct lsServerCapabilities { // // Since 3.6.0 // - boost::optional< std::pair< boost::optional<bool>, boost::optional<StaticRegistrationOptions> > > typeDefinitionProvider ; + boost::optional< std::pair< boost::optional<bool>, boost::optional<StaticRegistrationOptions> > > typeDefinitionProvider ; - // The server provides implementation support. - boost::optional< std::pair< boost::optional<bool>, boost::optional<StaticRegistrationOptions> > > implementationProvider ; + // The server provides implementation support. + boost::optional< std::pair< boost::optional<bool>, boost::optional<StaticRegistrationOptions> > > implementationProvider ; - // The server provides find references support. - boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > referencesProvider ; + // The server provides find references support. + boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > referencesProvider ; - // The server provides document highlight support. - boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > documentHighlightProvider ; + // The server provides document highlight support. + boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > documentHighlightProvider ; - // The server provides document symbol support. - boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > documentSymbolProvider ; + // The server provides document symbol support. + boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > documentSymbolProvider ; - // The server provides workspace symbol support. - boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > workspaceSymbolProvider ; + // The server provides workspace symbol support. + boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > workspaceSymbolProvider ; - // The server provides code actions. - boost::optional< std::pair< boost::optional<bool>, boost::optional<CodeActionOptions> > > codeActionProvider ; + // The server provides code actions. + boost::optional< std::pair< boost::optional<bool>, boost::optional<CodeActionOptions> > > codeActionProvider ; - // The server provides code lens. - boost::optional<CodeLensOptions> codeLensProvider; + // The server provides code lens. + boost::optional<CodeLensOptions> codeLensProvider; - // The server provides document formatting. - boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > documentFormattingProvider ; + // The server provides document formatting. + boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > documentFormattingProvider ; - // The server provides document range formatting. - boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > documentRangeFormattingProvider ; + // The server provides document range formatting. + boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > documentRangeFormattingProvider ; - // The server provides document formatting on typing. - boost::optional<lsDocumentOnTypeFormattingOptions> documentOnTypeFormattingProvider; + // The server provides document formatting on typing. + boost::optional<lsDocumentOnTypeFormattingOptions> documentOnTypeFormattingProvider; - // The server provides rename support. - boost::optional< std::pair< boost::optional<bool>, boost::optional<RenameOptions> > > renameProvider; + // The server provides rename support. + boost::optional< std::pair< boost::optional<bool>, boost::optional<RenameOptions> > > renameProvider; - // The server provides document link support. - boost::optional<lsDocumentLinkOptions > documentLinkProvider; + // The server provides document link support. + boost::optional<lsDocumentLinkOptions > documentLinkProvider; - - // - // The server provides color provider support. - // - // @since 3.6.0 - // - boost::optional< std::pair< boost::optional<bool>, boost::optional<DocumentColorOptions> > > colorProvider; - - - // - // The server provides folding provider support. - // - // @since 3.10.0 - // - boost::optional < std::pair< boost::optional<bool>, boost::optional<FoldingRangeOptions> > > foldingRangeProvider; - - // The server provides execute command support. - boost::optional < lsExecuteCommandOptions >executeCommandProvider; - - - // - // Workspace specific server capabilities - // - boost::optional< WorkspaceServerCapabilities > workspace; - - // - // Semantic highlighting server capabilities. - // - - boost::optional< SemanticHighlightingServerCapabilities >semanticHighlighting; - - // - // Server capability for calculating super- and subtype hierarchies. - // The LS supports the type hierarchy language feature, if this capability is set to {@code true}. - // - // <p> - // <b>Note:</b> the <a href= - // "https://github.com/Microsoft/vscode-languageserver-node/pull/426">{@code textDocument/typeHierarchy} - // language feature</a> is not yet part of the official LSP specification. - // - - boost::optional< std::pair< boost::optional<bool>, - boost::optional<StaticRegistrationOptions> > > typeHierarchyProvider; - - // - // The server provides Call Hierarchy support. - // - - boost::optional< std::pair< boost::optional<bool>, - boost::optional<StaticRegistrationOptions> > > callHierarchyProvider; - - // - // The server provides selection range support. - // - // Since 3.15.0 - // - boost::optional< std::pair< boost::optional<bool>, - boost::optional<StaticRegistrationOptions> > > selectionRangeProvider; - - // - // The server provides linked editing range support. - // - // Since 3.16.0 - // - boost::optional< std::pair< boost::optional<bool>, - boost::optional<StaticRegistrationOptions> > > linkedEditingRangeProvider; - - - // - // The server provides semantic tokens support. - // - // Since 3.16.0 - // - boost::optional < SemanticTokensWithRegistrationOptions> semanticTokensProvider; - - // - // Whether server provides moniker support. - // - // Since 3.16.0 - // - boost::optional< std::pair< boost::optional<bool>, - boost::optional<StaticRegistrationOptions> > > monikerProvider; - - boost::optional<lsp::Any> experimental; - - - MAKE_SWAP_METHOD(lsServerCapabilities, - textDocumentSync, - hoverProvider, - completionProvider, - signatureHelpProvider, - definitionProvider, - typeDefinitionProvider, - implementationProvider, - referencesProvider, - documentHighlightProvider, - documentSymbolProvider, - workspaceSymbolProvider, - codeActionProvider, - codeLensProvider, - documentFormattingProvider, - documentRangeFormattingProvider, - documentOnTypeFormattingProvider, - renameProvider, - documentLinkProvider, - executeCommandProvider, - workspace, - semanticHighlighting, - typeHierarchyProvider, - callHierarchyProvider, - selectionRangeProvider, - experimental, colorProvider, foldingRangeProvider, - linkedEditingRangeProvider, monikerProvider, semanticTokensProvider) + + // + // The server provides color provider support. + // + // @since 3.6.0 + // + boost::optional< std::pair< boost::optional<bool>, boost::optional<DocumentColorOptions> > > colorProvider; + + + // + // The server provides folding provider support. + // + // @since 3.10.0 + // + boost::optional < std::pair< boost::optional<bool>, boost::optional<FoldingRangeOptions> > > foldingRangeProvider; + + // The server provides execute command support. + boost::optional < lsExecuteCommandOptions >executeCommandProvider; + + + // + // Workspace specific server capabilities + // + boost::optional< WorkspaceServerCapabilities > workspace; + + // + // Semantic highlighting server capabilities. + // + + boost::optional< SemanticHighlightingServerCapabilities >semanticHighlighting; + + // + // Server capability for calculating super- and subtype hierarchies. + // The LS supports the type hierarchy language feature, if this capability is set to {@code true}. + // + // <p> + // <b>Note:</b> the <a href= + // "https://github.com/Microsoft/vscode-languageserver-node/pull/426">{@code textDocument/typeHierarchy} + // language feature</a> is not yet part of the official LSP specification. + // + + boost::optional< std::pair< boost::optional<bool>, + boost::optional<StaticRegistrationOptions> > > typeHierarchyProvider; + + // + // The server provides Call Hierarchy support. + // + + boost::optional< std::pair< boost::optional<bool>, + boost::optional<StaticRegistrationOptions> > > callHierarchyProvider; + + // + // The server provides selection range support. + // + // Since 3.15.0 + // + boost::optional< std::pair< boost::optional<bool>, + boost::optional<StaticRegistrationOptions> > > selectionRangeProvider; + + // + // The server provides linked editing range support. + // + // Since 3.16.0 + // + boost::optional< std::pair< boost::optional<bool>, + boost::optional<StaticRegistrationOptions> > > linkedEditingRangeProvider; + + + // + // The server provides semantic tokens support. + // + // Since 3.16.0 + // + boost::optional < SemanticTokensWithRegistrationOptions> semanticTokensProvider; + + // + // Whether server provides moniker support. + // + // Since 3.16.0 + // + boost::optional< std::pair< boost::optional<bool>, + boost::optional<StaticRegistrationOptions> > > monikerProvider; + + boost::optional<lsp::Any> experimental; + + + MAKE_SWAP_METHOD(lsServerCapabilities, + textDocumentSync, + hoverProvider, + completionProvider, + signatureHelpProvider, + definitionProvider, + typeDefinitionProvider, + implementationProvider, + referencesProvider, + documentHighlightProvider, + documentSymbolProvider, + workspaceSymbolProvider, + codeActionProvider, + codeLensProvider, + documentFormattingProvider, + documentRangeFormattingProvider, + documentOnTypeFormattingProvider, + renameProvider, + documentLinkProvider, + executeCommandProvider, + workspace, + semanticHighlighting, + typeHierarchyProvider, + callHierarchyProvider, + selectionRangeProvider, + experimental, colorProvider, foldingRangeProvider, + linkedEditingRangeProvider, monikerProvider, semanticTokensProvider) }; MAKE_REFLECT_STRUCT(lsServerCapabilities, - textDocumentSync, - hoverProvider, - completionProvider, - signatureHelpProvider, - definitionProvider, - typeDefinitionProvider, - implementationProvider, - referencesProvider, - documentHighlightProvider, - documentSymbolProvider, - workspaceSymbolProvider, - codeActionProvider, - codeLensProvider, - documentFormattingProvider, - documentRangeFormattingProvider, - documentOnTypeFormattingProvider, - renameProvider, - documentLinkProvider, - executeCommandProvider, - workspace, - semanticHighlighting, - typeHierarchyProvider, - callHierarchyProvider, - selectionRangeProvider, - experimental, colorProvider, foldingRangeProvider, - linkedEditingRangeProvider, monikerProvider, semanticTokensProvider) + textDocumentSync, + hoverProvider, + completionProvider, + signatureHelpProvider, + definitionProvider, + typeDefinitionProvider, + implementationProvider, + referencesProvider, + documentHighlightProvider, + documentSymbolProvider, + workspaceSymbolProvider, + codeActionProvider, + codeLensProvider, + documentFormattingProvider, + documentRangeFormattingProvider, + documentOnTypeFormattingProvider, + renameProvider, + documentLinkProvider, + executeCommandProvider, + workspace, + semanticHighlighting, + typeHierarchyProvider, + callHierarchyProvider, + selectionRangeProvider, + experimental, colorProvider, foldingRangeProvider, + linkedEditingRangeProvider, monikerProvider, semanticTokensProvider) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsTextDocumentClientCapabilities.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsTextDocumentClientCapabilities.h index 569f203c7a..4e66bcb7ae 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsTextDocumentClientCapabilities.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsTextDocumentClientCapabilities.h @@ -14,8 +14,8 @@ struct WorkDoneProgressOptions { - boost::optional<bool>workDoneProgress; - MAKE_SWAP_METHOD(WorkDoneProgressOptions, workDoneProgress); + boost::optional<bool>workDoneProgress; + MAKE_SWAP_METHOD(WorkDoneProgressOptions, workDoneProgress); }; MAKE_REFLECT_STRUCT(WorkDoneProgressOptions, workDoneProgress); @@ -58,9 +58,9 @@ struct lsSaveOptions { bool includeText = false; void swap(lsSaveOptions& arg)noexcept { - auto temp = includeText; - includeText = arg.includeText; - arg.includeText = temp; + auto temp = includeText; + includeText = arg.includeText; + arg.includeText = temp; } }; MAKE_REFLECT_STRUCT(lsSaveOptions, includeText); @@ -114,11 +114,11 @@ struct lsTextDocumentSyncOptions { boost::optional<lsSaveOptions> save; MAKE_SWAP_METHOD(lsTextDocumentSyncOptions, - openClose, - change, - willSave, - willSaveWaitUntil, - save); + openClose, + change, + willSave, + willSaveWaitUntil, + save); }; MAKE_REFLECT_STRUCT(lsTextDocumentSyncOptions, openClose, @@ -128,402 +128,402 @@ MAKE_REFLECT_STRUCT(lsTextDocumentSyncOptions, save); struct SynchronizationCapabilities { - // Whether text document synchronization supports dynamic registration. - boost::optional<bool> dynamicRegistration; + // Whether text document synchronization supports dynamic registration. + boost::optional<bool> dynamicRegistration; - // The client supports sending will save notifications. - boost::optional<bool> willSave; + // The client supports sending will save notifications. + boost::optional<bool> willSave; - // 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. - boost::optional<bool> willSaveWaitUntil; + // 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. + boost::optional<bool> willSaveWaitUntil; - // The client supports did save notifications. - boost::optional<bool> didSave; + // The client supports did save notifications. + boost::optional<bool> didSave; - MAKE_SWAP_METHOD(SynchronizationCapabilities, - dynamicRegistration, - willSave, - willSaveWaitUntil, - didSave); + MAKE_SWAP_METHOD(SynchronizationCapabilities, + dynamicRegistration, + willSave, + willSaveWaitUntil, + didSave); }; MAKE_REFLECT_STRUCT(SynchronizationCapabilities, - dynamicRegistration, - willSave, - willSaveWaitUntil, - didSave); + dynamicRegistration, + willSave, + willSaveWaitUntil, + didSave); struct CompletionItemKindCapabilities { - boost::optional<std::vector<lsCompletionItemKind> >valueSet; - MAKE_SWAP_METHOD(CompletionItemKindCapabilities, valueSet); + boost::optional<std::vector<lsCompletionItemKind> >valueSet; + MAKE_SWAP_METHOD(CompletionItemKindCapabilities, valueSet); }; MAKE_REFLECT_STRUCT(CompletionItemKindCapabilities, valueSet); struct CompletionItemCapabilities { - // 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. - boost::optional<bool> snippetSupport; + // 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. + boost::optional<bool> snippetSupport; // Client supports commit characters on a completion item. - boost::optional<bool> commitCharactersSupport; + boost::optional<bool> commitCharactersSupport; // Client supports the following content formats for the documentation // property. The order describes the preferred format of the client. - boost::optional< std::vector<std::string> > documentationFormat; + boost::optional< std::vector<std::string> > documentationFormat; // Client supports the deprecated property on a completion item. - boost::optional<bool> deprecatedSupport; + boost::optional<bool> deprecatedSupport; - // - // Client supports the preselect property on a completion item. - // - boost::optional<bool> preselectSupport; + // + // Client supports the preselect property on a completion item. + // + boost::optional<bool> preselectSupport; - MAKE_SWAP_METHOD(CompletionItemCapabilities, - snippetSupport, - commitCharactersSupport, - documentationFormat, - deprecatedSupport, preselectSupport); + MAKE_SWAP_METHOD(CompletionItemCapabilities, + snippetSupport, + commitCharactersSupport, + documentationFormat, + deprecatedSupport, preselectSupport); }; MAKE_REFLECT_STRUCT(CompletionItemCapabilities, - snippetSupport, - commitCharactersSupport, - documentationFormat, - deprecatedSupport, preselectSupport); + snippetSupport, + commitCharactersSupport, + documentationFormat, + deprecatedSupport, preselectSupport); // // Capabilities specific to the `textDocument/completion` // struct CompletionCapabilities { - // Whether completion supports dynamic registration. - boost::optional<bool> dynamicRegistration; + // Whether completion supports dynamic registration. + boost::optional<bool> dynamicRegistration; - // The client supports the following `CompletionItem` specific - // capabilities. - boost::optional<CompletionItemCapabilities> completionItem; + // The client supports the following `CompletionItem` specific + // capabilities. + boost::optional<CompletionItemCapabilities> completionItem; - // - // The client supports the following `CompletionItemKind` specific - // capabilities. - // - boost::optional<CompletionItemKindCapabilities> completionItemKind; + // + // The client supports the following `CompletionItemKind` specific + // capabilities. + // + boost::optional<CompletionItemKindCapabilities> completionItemKind; - // - // The client supports sending additional context information for a - // `textDocument/completion` request. - // - boost::optional<bool> contextSupport; + // + // The client supports sending additional context information for a + // `textDocument/completion` request. + // + boost::optional<bool> contextSupport; - MAKE_SWAP_METHOD(CompletionCapabilities, - dynamicRegistration, - completionItem, completionItemKind); + MAKE_SWAP_METHOD(CompletionCapabilities, + dynamicRegistration, + completionItem, completionItemKind); }; MAKE_REFLECT_STRUCT(CompletionCapabilities, - dynamicRegistration, - completionItem , completionItemKind); + dynamicRegistration, + completionItem , completionItemKind); struct HoverCapabilities:public DynamicRegistrationCapabilities { - // + // // Client supports the following content formats for the content // property. The order describes the preferred format of the client. // // See {@link MarkupKind} for allowed values. // - boost::optional<std::vector<std::string>> contentFormat; + boost::optional<std::vector<std::string>> contentFormat; - MAKE_SWAP_METHOD(HoverCapabilities, dynamicRegistration, contentFormat); + MAKE_SWAP_METHOD(HoverCapabilities, dynamicRegistration, contentFormat); }; MAKE_REFLECT_STRUCT(HoverCapabilities, dynamicRegistration, contentFormat); // // Client capabilities specific to parameter information. // -struct ParameterInformationCapabilities { - // - // The client supports processing label offsets instead of a - // simple label string. - // - // Since 3.14.0 - // - boost::optional<bool> labelOffsetSupport; - - MAKE_SWAP_METHOD(ParameterInformationCapabilities, labelOffsetSupport); +struct ParameterInformationCapabilities { + // + // The client supports processing label offsets instead of a + // simple label string. + // + // Since 3.14.0 + // + boost::optional<bool> labelOffsetSupport; + + MAKE_SWAP_METHOD(ParameterInformationCapabilities, labelOffsetSupport); }; MAKE_REFLECT_STRUCT(ParameterInformationCapabilities, labelOffsetSupport) struct SignatureInformationCapabilities { - // - // Client supports the following content formats for the documentation - // property. The order describes the preferred format of the client. - // - // See {@link MarkupKind} for allowed values. - // - std::vector<std::string> documentationFormat; - - // - // Client capabilities specific to parameter information. - // - ParameterInformationCapabilities parameterInformation; - - MAKE_SWAP_METHOD(SignatureInformationCapabilities, documentationFormat, parameterInformation) + // + // Client supports the following content formats for the documentation + // property. The order describes the preferred format of the client. + // + // See {@link MarkupKind} for allowed values. + // + std::vector<std::string> documentationFormat; + + // + // Client capabilities specific to parameter information. + // + ParameterInformationCapabilities parameterInformation; + + MAKE_SWAP_METHOD(SignatureInformationCapabilities, documentationFormat, parameterInformation) }; MAKE_REFLECT_STRUCT(SignatureInformationCapabilities,documentationFormat, parameterInformation) struct SignatureHelpCapabilities :public DynamicRegistrationCapabilities { - // - // The client supports the following `SignatureInformation` - // specific properties. - // - boost::optional< SignatureInformationCapabilities > signatureInformation; + // + // The client supports the following `SignatureInformation` + // specific properties. + // + boost::optional< SignatureInformationCapabilities > signatureInformation; - MAKE_SWAP_METHOD(SignatureHelpCapabilities, dynamicRegistration, signatureInformation) + MAKE_SWAP_METHOD(SignatureHelpCapabilities, dynamicRegistration, signatureInformation) }; MAKE_REFLECT_STRUCT(SignatureHelpCapabilities, dynamicRegistration, signatureInformation) struct DocumentSymbolCapabilities :public DynamicRegistrationCapabilities { - // - // Specific capabilities for the `SymbolKind`. - // - boost::optional<SymbolKindCapabilities> symbolKind; + // + // Specific capabilities for the `SymbolKind`. + // + boost::optional<SymbolKindCapabilities> symbolKind; - // - // The client support hierarchical document symbols. - // - boost::optional<bool> hierarchicalDocumentSymbolSupport; + // + // The client support hierarchical document symbols. + // + boost::optional<bool> hierarchicalDocumentSymbolSupport; - MAKE_SWAP_METHOD(DocumentSymbolCapabilities, dynamicRegistration, symbolKind, hierarchicalDocumentSymbolSupport) + MAKE_SWAP_METHOD(DocumentSymbolCapabilities, dynamicRegistration, symbolKind, hierarchicalDocumentSymbolSupport) }; MAKE_REFLECT_STRUCT(DocumentSymbolCapabilities, dynamicRegistration, symbolKind, hierarchicalDocumentSymbolSupport) struct DeclarationCapabilities:public DynamicRegistrationCapabilities{ - // - // The client supports additional metadata in the form of declaration links. - // - boost::optional<bool>linkSupport; + // + // The client supports additional metadata in the form of declaration links. + // + boost::optional<bool>linkSupport; - MAKE_SWAP_METHOD(DeclarationCapabilities, dynamicRegistration, linkSupport); + MAKE_SWAP_METHOD(DeclarationCapabilities, dynamicRegistration, linkSupport); }; MAKE_REFLECT_STRUCT(DeclarationCapabilities, dynamicRegistration, linkSupport) struct CodeActionKindCapabilities { - // - // 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. - // - // See {@link CodeActionKind} for allowed values. - // - boost::optional< std::vector< std::string> >valueSet; - - MAKE_SWAP_METHOD(CodeActionKindCapabilities, valueSet) + // + // 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. + // + // See {@link CodeActionKind} for allowed values. + // + boost::optional< std::vector< std::string> >valueSet; + + MAKE_SWAP_METHOD(CodeActionKindCapabilities, valueSet) }; MAKE_REFLECT_STRUCT(CodeActionKindCapabilities,valueSet) struct CodeActionLiteralSupportCapabilities { - boost::optional<CodeActionKindCapabilities> codeActionKind; + boost::optional<CodeActionKindCapabilities> codeActionKind; - MAKE_SWAP_METHOD(CodeActionLiteralSupportCapabilities, codeActionKind) + MAKE_SWAP_METHOD(CodeActionLiteralSupportCapabilities, codeActionKind) }; MAKE_REFLECT_STRUCT(CodeActionLiteralSupportCapabilities, codeActionKind) struct CodeActionCapabilities:public DynamicRegistrationCapabilities{ - // + // // The client support code action literals as a valid // response of the `textDocument/codeAction` request. // - boost::optional<CodeActionLiteralSupportCapabilities> codeActionLiteralSupport; + boost::optional<CodeActionLiteralSupportCapabilities> codeActionLiteralSupport; - MAKE_SWAP_METHOD(CodeActionCapabilities, dynamicRegistration, codeActionLiteralSupport) + MAKE_SWAP_METHOD(CodeActionCapabilities, dynamicRegistration, codeActionLiteralSupport) }; MAKE_REFLECT_STRUCT(CodeActionCapabilities,dynamicRegistration,codeActionLiteralSupport) struct RenameCapabilities :public DynamicRegistrationCapabilities { - // + // // The client support code action literals as a valid // response of the `textDocument/codeAction` request. // - boost::optional<bool> prepareSupport; + boost::optional<bool> prepareSupport; - MAKE_SWAP_METHOD(RenameCapabilities, dynamicRegistration, prepareSupport) + MAKE_SWAP_METHOD(RenameCapabilities, dynamicRegistration, prepareSupport) }; MAKE_REFLECT_STRUCT(RenameCapabilities, dynamicRegistration, prepareSupport) struct DiagnosticsTagSupport { - /** - * The tags supported by the client. - */ - std::vector<DiagnosticTag> valueSet; - MAKE_SWAP_METHOD(DiagnosticsTagSupport, valueSet) + /** + * The tags supported by the client. + */ + std::vector<DiagnosticTag> valueSet; + MAKE_SWAP_METHOD(DiagnosticsTagSupport, valueSet) }; MAKE_REFLECT_STRUCT(DiagnosticsTagSupport, valueSet) struct PublishDiagnosticsClientCapabilities :public DynamicRegistrationCapabilities { - /** + /** * The client support code action literals as a valid * response of the `textDocument/codeAction` request. */ - boost::optional<bool> relatedInformation; - - /** - * Client supports the tag property to provide meta data about a diagnostic. - * Clients supporting tags have to handle unknown tags gracefully. - * - * This property had been added and implemented as boolean before it was - * added to the specification as {@link DiagnosticsTagSupport}. In order to - * keep this implementation compatible with intermediate clients (including - * vscode-language-client < 6.0.0) we add an either type here. - * - * Since 3.15 - */ - boost::optional < std::pair<boost::optional<bool>, boost::optional<DiagnosticsTagSupport> > > tagSupport; - - /** - * Whether the client interprets the version property of the - * `textDocument/publishDiagnostics` notification's parameter. - * - * Since 3.15.0 - */ - boost::optional<bool> versionSupport; - - /** + boost::optional<bool> relatedInformation; + + /** + * Client supports the tag property to provide meta data about a diagnostic. + * Clients supporting tags have to handle unknown tags gracefully. + * + * This property had been added and implemented as boolean before it was + * added to the specification as {@link DiagnosticsTagSupport}. In order to + * keep this implementation compatible with intermediate clients (including + * vscode-language-client < 6.0.0) we add an either type here. + * + * Since 3.15 + */ + boost::optional < std::pair<boost::optional<bool>, boost::optional<DiagnosticsTagSupport> > > tagSupport; + + /** + * Whether the client interprets the version property of the + * `textDocument/publishDiagnostics` notification's parameter. + * + * Since 3.15.0 + */ + boost::optional<bool> versionSupport; + + /** * Client supports a codeDescription property * * @since 3.16.0 */ - boost::optional<bool> codeDescriptionSupport ; + boost::optional<bool> codeDescriptionSupport ; - /** - * Whether code action supports the `data` property which is - * preserved between a `textDocument/publishDiagnostics` and - * `textDocument/codeAction` request. - * - * @since 3.16.0 - */ - boost::optional<bool> dataSupport ; + /** + * Whether code action supports the `data` property which is + * preserved between a `textDocument/publishDiagnostics` and + * `textDocument/codeAction` request. + * + * @since 3.16.0 + */ + boost::optional<bool> dataSupport ; - MAKE_SWAP_METHOD(PublishDiagnosticsClientCapabilities, dynamicRegistration, relatedInformation, tagSupport,versionSupport,codeDescriptionSupport,dataSupport) + MAKE_SWAP_METHOD(PublishDiagnosticsClientCapabilities, dynamicRegistration, relatedInformation, tagSupport,versionSupport,codeDescriptionSupport,dataSupport) }; MAKE_REFLECT_STRUCT(PublishDiagnosticsClientCapabilities, dynamicRegistration, relatedInformation, tagSupport, versionSupport, codeDescriptionSupport, dataSupport) struct FoldingRangeCapabilities :public DynamicRegistrationCapabilities { - // - // 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. - // - boost::optional<int> rangeLimit; - - // - // 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. - // - boost::optional<bool> lineFoldingOnly; - MAKE_SWAP_METHOD(FoldingRangeCapabilities, dynamicRegistration, rangeLimit, lineFoldingOnly) + // + // 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. + // + boost::optional<int> rangeLimit; + + // + // 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. + // + boost::optional<bool> lineFoldingOnly; + MAKE_SWAP_METHOD(FoldingRangeCapabilities, dynamicRegistration, rangeLimit, lineFoldingOnly) }; MAKE_REFLECT_STRUCT(FoldingRangeCapabilities, dynamicRegistration, rangeLimit,lineFoldingOnly) struct SemanticHighlightingCapabilities :public DynamicRegistrationCapabilities { - // + // // The client support code action literals as a valid // response of the `textDocument/codeAction` request. // - boost::optional<bool> semanticHighlighting; + boost::optional<bool> semanticHighlighting; - MAKE_SWAP_METHOD(SemanticHighlightingCapabilities, dynamicRegistration, semanticHighlighting) + MAKE_SWAP_METHOD(SemanticHighlightingCapabilities, dynamicRegistration, semanticHighlighting) }; MAKE_REFLECT_STRUCT(SemanticHighlightingCapabilities, dynamicRegistration, semanticHighlighting) struct SemanticTokensClientCapabilitiesRequestsFull { - // - // The client will send the `textDocument/semanticTokens/full/delta` request if - // the server provides a corresponding handler. - // - bool delta = false; - MAKE_SWAP_METHOD(SemanticTokensClientCapabilitiesRequestsFull, delta) + // + // The client will send the `textDocument/semanticTokens/full/delta` request if + // the server provides a corresponding handler. + // + bool delta = false; + MAKE_SWAP_METHOD(SemanticTokensClientCapabilitiesRequestsFull, delta) }; MAKE_REFLECT_STRUCT(SemanticTokensClientCapabilitiesRequestsFull, delta) struct SemanticTokensClientCapabilities : public DynamicRegistrationCapabilities { - //export TokenFormat = 'relative'; - struct lsRequests - { - // - // The client will send the `textDocument/semanticTokens/range` request - // if the server provides a corresponding handler. - // - boost::optional<std::pair< boost::optional<bool>, - boost::optional<SemanticTokensClientCapabilitiesRequestsFull>>> range; - // - // The client will send the `textDocument/semanticTokens/full` request - // if the server provides a corresponding handler. - // - boost::optional<std::pair< boost::optional<bool>, boost::optional<lsp::Any>>> full; - MAKE_SWAP_METHOD(lsRequests, range, full) - }; - - lsRequests requests; - // - // The token types that the client supports. - // - std::vector<std::string> tokenTypes; - - // - // The token modifiers that the client supports. - // - std::vector<std::string> tokenModifiers; - // - // The formats the clients supports. - // - std::vector<std::string> formats; - // - // Whether the client supports tokens that can overlap each other. - // - boost::optional < bool >overlappingTokenSupport; - - // - // Whether the client supports tokens that can span multiple lines. - // - boost::optional < bool > multilineTokenSupport; - - MAKE_SWAP_METHOD(SemanticTokensClientCapabilities, dynamicRegistration,requests, tokenTypes, tokenModifiers, - formats, overlappingTokenSupport, multilineTokenSupport) + //export TokenFormat = 'relative'; + struct lsRequests + { + // + // The client will send the `textDocument/semanticTokens/range` request + // if the server provides a corresponding handler. + // + boost::optional<std::pair< boost::optional<bool>, + boost::optional<SemanticTokensClientCapabilitiesRequestsFull>>> range; + // + // The client will send the `textDocument/semanticTokens/full` request + // if the server provides a corresponding handler. + // + boost::optional<std::pair< boost::optional<bool>, boost::optional<lsp::Any>>> full; + MAKE_SWAP_METHOD(lsRequests, range, full) + }; + + lsRequests requests; + // + // The token types that the client supports. + // + std::vector<std::string> tokenTypes; + + // + // The token modifiers that the client supports. + // + std::vector<std::string> tokenModifiers; + // + // The formats the clients supports. + // + std::vector<std::string> formats; + // + // Whether the client supports tokens that can overlap each other. + // + boost::optional < bool >overlappingTokenSupport; + + // + // Whether the client supports tokens that can span multiple lines. + // + boost::optional < bool > multilineTokenSupport; + + MAKE_SWAP_METHOD(SemanticTokensClientCapabilities, dynamicRegistration,requests, tokenTypes, tokenModifiers, + formats, overlappingTokenSupport, multilineTokenSupport) }; MAKE_REFLECT_STRUCT(SemanticTokensClientCapabilities::lsRequests, range,full) MAKE_REFLECT_STRUCT(SemanticTokensClientCapabilities, dynamicRegistration, requests, tokenTypes, tokenModifiers, - formats, overlappingTokenSupport, multilineTokenSupport) + formats, overlappingTokenSupport, multilineTokenSupport) // Text document specific client capabilities. struct lsTextDocumentClientCapabilities { - SynchronizationCapabilities synchronization; + SynchronizationCapabilities synchronization; // Capabilities specific to the `textDocument/completion` @@ -641,10 +641,10 @@ struct lsTextDocumentClientCapabilities { boost::optional< DynamicRegistrationCapabilities > selectionRange; // - // Capabilities specific to the `textDocument/linkedEditingRange` request. - // - // @since 3.16.0 - // + // Capabilities specific to the `textDocument/linkedEditingRange` request. + // + // @since 3.16.0 + // boost::optional< DynamicRegistrationCapabilities > linkedEditingRange; // @@ -669,45 +669,45 @@ struct lsTextDocumentClientCapabilities { boost::optional< DynamicRegistrationCapabilities > moniker; MAKE_SWAP_METHOD(lsTextDocumentClientCapabilities, - synchronization, - completion, - hover, - signatureHelp, - implementation, - references, - documentHighlight, - documentSymbol, - formatting, - rangeFormatting, - onTypeFormatting, - declaration, - definition, typeDefinition, implementation, - codeAction, - codeLens, - documentLink, colorProvider, - rename, publishDiagnostics, foldingRange, - semanticHighlightingCapabilities, typeHierarchyCapabilities, - callHierarchy, selectionRange , linkedEditingRange, semanticTokens, moniker) + synchronization, + completion, + hover, + signatureHelp, + implementation, + references, + documentHighlight, + documentSymbol, + formatting, + rangeFormatting, + onTypeFormatting, + declaration, + definition, typeDefinition, implementation, + codeAction, + codeLens, + documentLink, colorProvider, + rename, publishDiagnostics, foldingRange, + semanticHighlightingCapabilities, typeHierarchyCapabilities, + callHierarchy, selectionRange , linkedEditingRange, semanticTokens, moniker) }; MAKE_REFLECT_STRUCT(lsTextDocumentClientCapabilities, - synchronization, - completion, - hover, - signatureHelp, - implementation, - references, - documentHighlight, - documentSymbol, - formatting, - rangeFormatting, - onTypeFormatting, - declaration, - definition, typeDefinition, implementation, - codeAction, - codeLens, - documentLink, colorProvider, - rename, publishDiagnostics, foldingRange, - semanticHighlightingCapabilities, typeHierarchyCapabilities, - callHierarchy, selectionRange, linkedEditingRange, semanticTokens, moniker) + synchronization, + completion, + hover, + signatureHelp, + implementation, + references, + documentHighlight, + documentSymbol, + formatting, + rangeFormatting, + onTypeFormatting, + declaration, + definition, typeDefinition, implementation, + codeAction, + codeLens, + documentLink, colorProvider, + rename, publishDiagnostics, foldingRange, + semanticHighlightingCapabilities, typeHierarchyCapabilities, + callHierarchy, selectionRange, linkedEditingRange, semanticTokens, moniker) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsWorkspaceClientCapabilites.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsWorkspaceClientCapabilites.h index dd37a1af2f..ee672aa111 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsWorkspaceClientCapabilites.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsWorkspaceClientCapabilites.h @@ -21,90 +21,90 @@ struct lschangeAnnotationSupport { - /** - * 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. - */ - boost::optional<bool> groupsOnLabel; - MAKE_SWAP_METHOD(lschangeAnnotationSupport, groupsOnLabel) + /** + * 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. + */ + boost::optional<bool> groupsOnLabel; + MAKE_SWAP_METHOD(lschangeAnnotationSupport, groupsOnLabel) }; MAKE_REFLECT_STRUCT(lschangeAnnotationSupport, groupsOnLabel) struct WorkspaceEditCapabilities { - /** - * The client supports versioned document changes in `WorkspaceEdit`s - */ - boost::optional<bool> documentChanges; - - /** - * The client supports resource changes - * in `WorkspaceEdit`s. - * - * @deprecated Since LSP introduces resource operations, use {link #resourceOperations} - */ - - boost::optional<bool> resourceChanges; - - /** - * The resource operations the client supports. Clients should at least - * support 'create', 'rename' and 'delete' files and folders. - * - * @since 3.13.0 - */ - boost::optional< std::vector<std::string> > resourceOperations; - - /** - * The failure handling strategy of a client if applying the workspace edit - * fails. - * - * See {@link FailureHandlingKind} for allowed values. - */ - boost::optional<std::string > failureHandling; - - /** - * 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 specific new line character(s). - * - * @since 3.16.0 - */ - boost::optional<bool> normalizesLineEndings;; - - /** - * Whether the client in general supports change annotations on text edits, - * create file, rename file and delete file changes. - * - * @since 3.16.0 - */ - boost::optional<lschangeAnnotationSupport> changeAnnotationSupport; - - MAKE_SWAP_METHOD(WorkspaceEditCapabilities, documentChanges, resourceChanges, resourceOperations, failureHandling, normalizesLineEndings, changeAnnotationSupport) + /** + * The client supports versioned document changes in `WorkspaceEdit`s + */ + boost::optional<bool> documentChanges; + + /** + * The client supports resource changes + * in `WorkspaceEdit`s. + * + * @deprecated Since LSP introduces resource operations, use {link #resourceOperations} + */ + + boost::optional<bool> resourceChanges; + + /** + * The resource operations the client supports. Clients should at least + * support 'create', 'rename' and 'delete' files and folders. + * + * @since 3.13.0 + */ + boost::optional< std::vector<std::string> > resourceOperations; + + /** + * The failure handling strategy of a client if applying the workspace edit + * fails. + * + * See {@link FailureHandlingKind} for allowed values. + */ + boost::optional<std::string > failureHandling; + + /** + * 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 specific new line character(s). + * + * @since 3.16.0 + */ + boost::optional<bool> normalizesLineEndings;; + + /** + * Whether the client in general supports change annotations on text edits, + * create file, rename file and delete file changes. + * + * @since 3.16.0 + */ + boost::optional<lschangeAnnotationSupport> changeAnnotationSupport; + + MAKE_SWAP_METHOD(WorkspaceEditCapabilities, documentChanges, resourceChanges, resourceOperations, failureHandling, normalizesLineEndings, changeAnnotationSupport) }; MAKE_REFLECT_STRUCT(WorkspaceEditCapabilities,documentChanges, resourceChanges, resourceOperations, failureHandling, normalizesLineEndings, changeAnnotationSupport) struct DynamicRegistrationCapabilities { - // Did foo notification supports dynamic registration. - boost::optional<bool> dynamicRegistration; + // Did foo notification supports dynamic registration. + boost::optional<bool> dynamicRegistration; - MAKE_SWAP_METHOD(DynamicRegistrationCapabilities, - dynamicRegistration); + MAKE_SWAP_METHOD(DynamicRegistrationCapabilities, + dynamicRegistration); }; MAKE_REFLECT_STRUCT(DynamicRegistrationCapabilities, - dynamicRegistration); + dynamicRegistration); // Workspace specific client capabilities. struct SymbolKindCapabilities { - boost::optional< std::vector<lsSymbolKind> > valueSet; + boost::optional< std::vector<lsSymbolKind> > valueSet; - MAKE_SWAP_METHOD(SymbolKindCapabilities, valueSet) + MAKE_SWAP_METHOD(SymbolKindCapabilities, valueSet) }; @@ -114,66 +114,66 @@ MAKE_REFLECT_STRUCT(SymbolKindCapabilities, valueSet) struct SymbolCapabilities :public DynamicRegistrationCapabilities { - /** - * Specific capabilities for the `SymbolKind` in the `workspace/symbol` request. - */ - boost::optional<SymbolKindCapabilities> symbolKind; + /** + * Specific capabilities for the `SymbolKind` in the `workspace/symbol` request. + */ + boost::optional<SymbolKindCapabilities> symbolKind; - MAKE_SWAP_METHOD(SymbolCapabilities, - symbolKind, dynamicRegistration) + MAKE_SWAP_METHOD(SymbolCapabilities, + symbolKind, dynamicRegistration) }; MAKE_REFLECT_STRUCT(SymbolCapabilities, - symbolKind, dynamicRegistration) + symbolKind, dynamicRegistration) struct lsFileOperations { - /** + /** * Whether the client supports dynamic registration for file * requests/notifications. */ - boost::optional<bool> dynamicRegistration ; - - /** - * The client has support for sending didCreateFiles notifications. - */ - boost::optional<bool>didCreate ; - - /** - * The client has support for sending willCreateFiles requests. - */ - boost::optional<bool>willCreate ; - - /** - * The client has support for sending didRenameFiles notifications. - */ - boost::optional<bool>didRename ; - - /** - * The client has support for sending willRenameFiles requests. - */ - boost::optional<bool>willRename ; - - /** - * The client has support for sending didDeleteFiles notifications. - */ - boost::optional<bool>didDelete ; - - /** - * The client has support for sending willDeleteFiles requests. - */ - boost::optional<bool> willDelete ; - MAKE_SWAP_METHOD(lsFileOperations, dynamicRegistration, didCreate, willCreate, - didRename, willRename, didDelete, willDelete) + boost::optional<bool> dynamicRegistration ; + + /** + * The client has support for sending didCreateFiles notifications. + */ + boost::optional<bool>didCreate ; + + /** + * The client has support for sending willCreateFiles requests. + */ + boost::optional<bool>willCreate ; + + /** + * The client has support for sending didRenameFiles notifications. + */ + boost::optional<bool>didRename ; + + /** + * The client has support for sending willRenameFiles requests. + */ + boost::optional<bool>willRename ; + + /** + * The client has support for sending didDeleteFiles notifications. + */ + boost::optional<bool>didDelete ; + + /** + * The client has support for sending willDeleteFiles requests. + */ + boost::optional<bool> willDelete ; + MAKE_SWAP_METHOD(lsFileOperations, dynamicRegistration, didCreate, willCreate, + didRename, willRename, didDelete, willDelete) }; MAKE_REFLECT_STRUCT(lsFileOperations, dynamicRegistration, didCreate, willCreate, - didRename, willRename, didDelete, willDelete) + didRename, willRename, didDelete, willDelete) struct lsWorkspaceClientCapabilites { // The client supports applying batch edits to the workspace. boost::optional<bool> applyEdit; - + // Capabilities specific to `WorkspaceEdit`s boost::optional<WorkspaceEditCapabilities> workspaceEdit; @@ -211,11 +211,11 @@ struct lsWorkspaceClientCapabilites { /** - * Capabilities specific to the semantic token requests scoped to the - * workspace. - * - * @since 3.16.0 - */ + * Capabilities specific to the semantic token requests scoped to the + * workspace. + * + * @since 3.16.0 + */ boost::optional<DynamicRegistrationCapabilities> semanticTokens ; /** @@ -232,14 +232,14 @@ struct lsWorkspaceClientCapabilites { * @since 3.16.0 */ boost::optional<lsFileOperations> fileOperations; - + MAKE_SWAP_METHOD(lsWorkspaceClientCapabilites, - applyEdit, - workspaceEdit, - didChangeConfiguration, - didChangeWatchedFiles, - symbol,executeCommand, workspaceFolders, - configuration, semanticTokens, codeLens, fileOperations) + applyEdit, + workspaceEdit, + didChangeConfiguration, + didChangeWatchedFiles, + symbol,executeCommand, workspaceFolders, + configuration, semanticTokens, codeLens, fileOperations) }; MAKE_REFLECT_STRUCT(lsWorkspaceClientCapabilites, @@ -249,7 +249,7 @@ MAKE_REFLECT_STRUCT(lsWorkspaceClientCapabilites, didChangeWatchedFiles, symbol, executeCommand,workspaceFolders, - configuration, semanticTokens, codeLens, fileOperations) + configuration, semanticTokens, codeLens, fileOperations) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/progress.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/progress.h index 01cb18d68d..bf70d58842 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/progress.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/progress.h @@ -8,9 +8,9 @@ //and partial result progress to support streaming of results. struct ProgressParams { - std::pair<boost::optional<std::string> , boost::optional<int> > token; - lsp::Any value; - MAKE_SWAP_METHOD(ProgressParams, token, value) + std::pair<boost::optional<std::string> , boost::optional<int> > token; + lsp::Any value; + MAKE_SWAP_METHOD(ProgressParams, token, value) }; MAKE_REFLECT_STRUCT(ProgressParams, token, value) DEFINE_NOTIFICATION_TYPE(Notify_Progress, ProgressParams, "$/progress"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/language/language.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/language/language.h index b4c7829e95..3f64946972 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/language/language.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/language/language.h @@ -11,27 +11,27 @@ #endif struct StatusReport { - - std::string ToString() const - { - std::string info; - info += "type:" + type + "\n"; - info += "message:" + message + "\n"; - return info; - } - /** - * The message type. See { - * - */ - - std::string type; - /** - * The actual message - * - */ - - std::string message; - MAKE_SWAP_METHOD(StatusReport, type, message); + + std::string ToString() const + { + std::string info; + info += "type:" + type + "\n"; + info += "message:" + message + "\n"; + return info; + } + /** + * The message type. See { + * + */ + + std::string type; + /** + * The actual message + * + */ + + std::string message; + MAKE_SWAP_METHOD(StatusReport, type, message); }; MAKE_REFLECT_STRUCT(StatusReport, type, message); @@ -44,25 +44,25 @@ DEFINE_NOTIFICATION_TYPE(lang_status, StatusReport, "language/status"); enum class MessageType { - /** - * An error message. - */ - Error=(1), - - /** - * A warning message. - */ - Warning=(2), - - /** - * An information message. - */ - Info=(3), - - /** - * A log message. - */ - Log=(4) + /** + * An error message. + */ + Error=(1), + + /** + * A warning message. + */ + Warning=(2), + + /** + * An information message. + */ + Info=(3), + + /** + * A log message. + */ + Log=(4) }; MAKE_REFLECT_TYPE_PROXY(MessageType); @@ -70,36 +70,36 @@ MAKE_REFLECT_TYPE_PROXY(MessageType); struct ActionableNotification { - - /** - * The message type. See { - * - */ - MessageType severity; - /** - * The actual message - * - */ + /** + * The message type. See { + * + */ + + MessageType severity; + /** + * The actual message + * + */ - std::string message; + std::string message; - /** - * Optional data - * - */ + /** + * Optional data + * + */ - boost::optional<lsp::Any> data; + boost::optional<lsp::Any> data; - /** - * Optional commands - * - */ + /** + * Optional commands + * + */ - std::vector<lsCommandWithAny> commands; + std::vector<lsCommandWithAny> commands; - MAKE_SWAP_METHOD(ActionableNotification, severity, message, data, commands) + MAKE_SWAP_METHOD(ActionableNotification, severity, message, data, commands) }; MAKE_REFLECT_STRUCT(ActionableNotification, severity, message, data, commands) @@ -114,27 +114,27 @@ DEFINE_NOTIFICATION_TYPE(lang_actionableNotification, ActionableNotification, "l struct ProgressReport { - std::string ToString() const; + std::string ToString() const; - std::string id; + std::string id; - std::string task; + std::string task; - std::string subTask; + std::string subTask; - std::string status; + std::string status; - int totalWork = 0; + int totalWork = 0; - int workDone = 0; + int workDone = 0; - bool complete = false; - MAKE_SWAP_METHOD(ProgressReport, id, task, subTask, status, workDone, complete); + bool complete = false; + MAKE_SWAP_METHOD(ProgressReport, id, task, subTask, status, workDone, complete); }; @@ -147,24 +147,24 @@ MAKE_REFLECT_STRUCT(ProgressReport, id, task, subTask, status, workDone, complet DEFINE_NOTIFICATION_TYPE(lang_progressReport, ProgressReport, "language/progressReport"); enum EventType { - /** - * classpath updated event. - */ - ClasspathUpdated = (100), - - /** - * projects imported event. - */ - ProjectsImported = (200) + /** + * classpath updated event. + */ + ClasspathUpdated = (100), + + /** + * projects imported event. + */ + ProjectsImported = (200) }; struct EventNotification { - int eventType; - lsp::Any data; - std::string ToString() const; - MAKE_SWAP_METHOD(EventNotification, eventType, data) + int eventType; + lsp::Any data; + std::string ToString() const; + MAKE_SWAP_METHOD(EventNotification, eventType, data) }; MAKE_REFLECT_STRUCT(EventNotification, eventType, data); -DEFINE_NOTIFICATION_TYPE(lang_eventNotification, EventNotification, "language/eventNotification");
\ No newline at end of file +DEFINE_NOTIFICATION_TYPE(lang_eventNotification, EventNotification, "language/eventNotification"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/location_type.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/location_type.h index 14e130f571..c4197917a9 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/location_type.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/location_type.h @@ -4,15 +4,15 @@ #include "lsRange.h" //Represents a location inside a resource, such as a line inside a text file. struct lsLocation { - lsLocation(); - lsLocation(lsDocumentUri uri, lsRange range); + lsLocation(); + lsLocation(lsDocumentUri uri, lsRange range); - bool operator==(const lsLocation& other) const; - bool operator<(const lsLocation& o) const; + bool operator==(const lsLocation& other) const; + bool operator<(const lsLocation& o) const; - lsDocumentUri uri; - lsRange range; - MAKE_SWAP_METHOD(lsLocation, uri, range) + lsDocumentUri uri; + lsRange range; + MAKE_SWAP_METHOD(lsLocation, uri, range) }; MAKE_REFLECT_STRUCT(lsLocation, uri, range) @@ -20,44 +20,44 @@ MAKE_REFLECT_STRUCT(lsLocation, uri, range) struct LinkLocation :public lsLocation { - std::string displayName; - std::string kind; - MAKE_REFLECT_STRUCT(LinkLocation, uri, range, displayName, kind) + std::string displayName; + std::string kind; + MAKE_REFLECT_STRUCT(LinkLocation, uri, range, displayName, kind) }; MAKE_REFLECT_STRUCT(LinkLocation, uri, range, displayName,kind) //Represents a link between a sourceand a target location. struct LocationLink { - /** - * Span of the origin of this link. - * - * Used as the underlined span for mouse interaction. Defaults to the word range at - * the mouse position. - */ - boost::optional<lsRange> originSelectionRange; + /** + * Span of the origin of this link. + * + * Used as the underlined span for mouse interaction. Defaults to the word range at + * the mouse position. + */ + boost::optional<lsRange> originSelectionRange; - /** - * The target resource identifier of this link. - */ + /** + * The target resource identifier of this link. + */ - lsDocumentUri targetUri; + lsDocumentUri targetUri; - /** - * 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. - */ + /** + * 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. + */ - lsRange targetRange; + lsRange targetRange; - /** - * 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 the `targetRange`. See also `DocumentSymbol#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 the `targetRange`. See also `DocumentSymbol#range` + */ - lsRange targetSelectionRange; + lsRange targetSelectionRange; - MAKE_SWAP_METHOD(LocationLink, originSelectionRange, targetUri, targetRange, targetSelectionRange); + MAKE_SWAP_METHOD(LocationLink, originSelectionRange, targetUri, targetRange, targetSelectionRange); }; -MAKE_REFLECT_STRUCT(LocationLink, originSelectionRange, targetUri, targetRange, targetSelectionRange);
\ No newline at end of file +MAKE_REFLECT_STRUCT(LocationLink, originSelectionRange, targetUri, targetRange, targetSelectionRange); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsAny.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsAny.h index 3335aa86dc..035382669f 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsAny.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsAny.h @@ -5,75 +5,75 @@ #include "LibLsp/JsonRpc/message.h" namespace lsp { - struct Any - { - //! Type of JSON value - enum Type { - kUnKnown=-1, - kNullType = 0, //!< null - kFalseType = 1, //!< false - kTrueType = 2, //!< true - kObjectType = 3, //!< object - kArrayType = 4, //!< array - kStringType = 5, //!< string - kNumberType = 6 //!< number - }; - - - - template <typename T> - bool Get(T& value); - - template <typename T> - void Set(T& value); - - int GuessType(); - int GetType(); - - void Set(std::unique_ptr<LspMessage> value); - - void SetJsonString(std::string&& _data, Type _type); - - void SetJsonString(const std::string& _data, Type _type); - - const std::string& Data()const - { - return data; - } - - void swap(Any& arg) noexcept; - - /* - *Example for GetFromMap - struct A{ - std::string visitor; - bool verbose; - } - REFLECT_MAP_TO_STRUCT(A,visitor,verbose) - - std::string data = "{\"visitor\":\"default\",\"verbose\":\"true\"}; - lsp:Any any; - any.SetJsonString(data, static_cast<lsp::Any::Type>(-1)); - A a_object; - any.GetFromMap(a_object); - */ - template <typename T> - bool GetFromMap(T& value); - - - template <typename T> - bool GetForMapHelper(T& value); - bool GetForMapHelper(std::string& value); - bool GetForMapHelper(boost::optional<std::string>& value); - private: - std::unique_ptr<Reader> GetReader(); - std::unique_ptr<Writer> GetWriter() const; - void SetData(std::unique_ptr<Writer>&); - - std::string data; - int jsonType = kUnKnown; - - }; + struct Any + { + //! Type of JSON value + enum Type { + kUnKnown=-1, + kNullType = 0, //!< null + kFalseType = 1, //!< false + kTrueType = 2, //!< true + kObjectType = 3, //!< object + kArrayType = 4, //!< array + kStringType = 5, //!< string + kNumberType = 6 //!< number + }; + + + + template <typename T> + bool Get(T& value); + + template <typename T> + void Set(T& value); + + int GuessType(); + int GetType(); + + void Set(std::unique_ptr<LspMessage> value); + + void SetJsonString(std::string&& _data, Type _type); + + void SetJsonString(const std::string& _data, Type _type); + + const std::string& Data()const + { + return data; + } + + void swap(Any& arg) noexcept; + + /* + *Example for GetFromMap + struct A{ + std::string visitor; + bool verbose; + } + REFLECT_MAP_TO_STRUCT(A,visitor,verbose) + + std::string data = "{\"visitor\":\"default\",\"verbose\":\"true\"}; + lsp:Any any; + any.SetJsonString(data, static_cast<lsp::Any::Type>(-1)); + A a_object; + any.GetFromMap(a_object); + */ + template <typename T> + bool GetFromMap(T& value); + + + template <typename T> + bool GetForMapHelper(T& value); + bool GetForMapHelper(std::string& value); + bool GetForMapHelper(boost::optional<std::string>& value); + private: + std::unique_ptr<Reader> GetReader(); + std::unique_ptr<Writer> GetWriter() const; + void SetData(std::unique_ptr<Writer>&); + + std::string data; + int jsonType = kUnKnown; + + }; }; @@ -84,22 +84,22 @@ extern void Reflect(Writer& visitor, lsp::Any& value); template <typename T> void ReflectMember(std::map < std::string, lsp::Any>& visitor, const char* name, T& value) { - auto it = visitor.find(name); - if (it != visitor.end()) - { - it->second.GetForMapHelper(value); - } + auto it = visitor.find(name); + if (it != visitor.end()) + { + it->second.GetForMapHelper(value); + } } template <typename T> void ReflectMember(std::map < std::string, std::string>& visitor, const char* name, T& value) { - auto it = visitor.find(name); - if (it != visitor.end()) - { - lsp::Any any; - any.SetJsonString(it->second, static_cast<lsp::Any::Type>(-1)); - any.Get(value); - } + auto it = visitor.find(name); + if (it != visitor.end()) + { + lsp::Any any; + any.SetJsonString(it->second, static_cast<lsp::Any::Type>(-1)); + any.Get(value); + } } #define REFLECT_MAP_TO_STRUCT(type, ...) \ @@ -111,49 +111,49 @@ void ReflectMember(std::map < std::string, std::string>& visitor, const char* na namespace lsp { - template <typename T> - bool Any::Get(T& value) - { - const auto visitor = GetReader(); - Reflect(*visitor, value); - return true; - } - - template <typename T> - void Any::Set(T& value) - { - auto visitor = GetWriter(); - Reflect(*visitor, value); - SetData(visitor); - } - - template <typename T> - bool Any::GetFromMap(T& value) - { - const auto visitor = GetReader(); - std::map < std::string, lsp::Any> _temp; - Reflect(*visitor, _temp); - ReflectMap(_temp, value); - return true; - } - - template <typename T> - bool Any::GetForMapHelper(T& value) - { - jsonType = GetType(); - if (jsonType == kStringType) - { - auto copy = data; - copy.erase(copy.find_last_not_of('"') + 1); - copy.erase(0, copy.find_first_not_of('"')); - lsp::Any any; - any.SetJsonString(copy, kUnKnown); - any.Get(value); - } - else - { - Get(value); - } - return true; - } + template <typename T> + bool Any::Get(T& value) + { + const auto visitor = GetReader(); + Reflect(*visitor, value); + return true; + } + + template <typename T> + void Any::Set(T& value) + { + auto visitor = GetWriter(); + Reflect(*visitor, value); + SetData(visitor); + } + + template <typename T> + bool Any::GetFromMap(T& value) + { + const auto visitor = GetReader(); + std::map < std::string, lsp::Any> _temp; + Reflect(*visitor, _temp); + ReflectMap(_temp, value); + return true; + } + + template <typename T> + bool Any::GetForMapHelper(T& value) + { + jsonType = GetType(); + if (jsonType == kStringType) + { + auto copy = data; + copy.erase(copy.find_last_not_of('"') + 1); + copy.erase(0, copy.find_first_not_of('"')); + lsp::Any any; + any.SetJsonString(copy, kUnKnown); + any.Get(value); + } + else + { + Get(value); + } + return true; + } } diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsCodeAction.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsCodeAction.h index 06a14f1540..cf0a2aa65b 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsCodeAction.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsCodeAction.h @@ -13,46 +13,46 @@ struct CodeAction { - /** - * A short, human-readable, title for this code action. - */ - - std::string title; - - /** - * The kind of the code action. - * - * Used to filter code actions. - */ - boost::optional < std::string> kind; - - /** - * The diagnostics that this code action resolves. - */ - boost::optional < std::vector<lsDiagnostic>> diagnostics; - - /** - * The workspace edit this code action performs. - */ - boost::optional < lsWorkspaceEdit >edit; - - /** - * A command this code action executes. If a code action - * provides a edit and a command, first the edit is - * executed and then the command. - */ - boost::optional< lsCommandWithAny > command; - - MAKE_SWAP_METHOD(CodeAction, title, kind, diagnostics, edit, command) + /** + * A short, human-readable, title for this code action. + */ + + std::string title; + + /** + * The kind of the code action. + * + * Used to filter code actions. + */ + boost::optional < std::string> kind; + + /** + * The diagnostics that this code action resolves. + */ + boost::optional < std::vector<lsDiagnostic>> diagnostics; + + /** + * The workspace edit this code action performs. + */ + boost::optional < lsWorkspaceEdit >edit; + + /** + * A command this code action executes. If a code action + * provides a edit and a command, first the edit is + * executed and then the command. + */ + boost::optional< lsCommandWithAny > command; + + MAKE_SWAP_METHOD(CodeAction, title, kind, diagnostics, edit, command) }; MAKE_REFLECT_STRUCT(CodeAction, title, kind, diagnostics, edit, command) struct TextDocumentCodeAction { - typedef std::pair<boost::optional<lsCommandWithAny>, boost::optional<CodeAction> > Either; + typedef std::pair<boost::optional<lsCommandWithAny>, boost::optional<CodeAction> > Either; }; -extern void Reflect(Reader& visitor, TextDocumentCodeAction::Either& value);
\ No newline at end of file +extern void Reflect(Reader& visitor, TextDocumentCodeAction::Either& value); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsCommand.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsCommand.h index 94307f1479..88ced6e41c 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsCommand.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsCommand.h @@ -15,29 +15,29 @@ //extension code could handle the command.The protocol currently doesn¡¯t specify a set of well - known commands. template <typename AnyArray> struct lsCommand { - // Title of the command (ie, 'save') - std::string title; - // Actual command identifier. - std::string command; - // Arguments to run the command with. - // **NOTE** This must be serialized as an array. Use - // MAKE_REFLECT_STRUCT_WRITER_AS_ARRAY. - boost::optional<AnyArray> arguments; + // Title of the command (ie, 'save') + std::string title; + // Actual command identifier. + std::string command; + // Arguments to run the command with. + // **NOTE** This must be serialized as an array. Use + // MAKE_REFLECT_STRUCT_WRITER_AS_ARRAY. + boost::optional<AnyArray> arguments; - void swap(lsCommand<AnyArray>& arg) noexcept - { - title.swap(arg.title); - command.swap(arg.command); - arguments.swap(arg.arguments); - } + void swap(lsCommand<AnyArray>& arg) noexcept + { + title.swap(arg.title); + command.swap(arg.command); + arguments.swap(arg.arguments); + } }; template <typename TVisitor, typename T> void Reflect(TVisitor& visitor, lsCommand<T>& value) { - REFLECT_MEMBER_START(); - REFLECT_MEMBER(title); - REFLECT_MEMBER(command); - REFLECT_MEMBER(arguments); - REFLECT_MEMBER_END(); + REFLECT_MEMBER_START(); + REFLECT_MEMBER(title); + REFLECT_MEMBER(command); + REFLECT_MEMBER(arguments); + REFLECT_MEMBER_END(); } diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsDocumentUri.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsDocumentUri.h index 5d24f59e3a..255c4c39ba 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsDocumentUri.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsDocumentUri.h @@ -2,24 +2,24 @@ #include "LibLsp/JsonRpc/serializer.h" #include <string> struct lsDocumentUri { - static lsDocumentUri FromPath(const AbsolutePath& path); + static lsDocumentUri FromPath(const AbsolutePath& path); - lsDocumentUri(); - - lsDocumentUri(const AbsolutePath& path); - lsDocumentUri(const lsDocumentUri& other);; - bool operator==(const lsDocumentUri& other) const; - bool operator==(const std::string& other) const; - void SetPath(const AbsolutePath& path); - std::string GetRawPath() const; - AbsolutePath GetAbsolutePath() const; + lsDocumentUri(); - - std::string raw_uri_; - void swap(lsDocumentUri& arg) noexcept - { - raw_uri_.swap(arg.raw_uri_); - } + lsDocumentUri(const AbsolutePath& path); + lsDocumentUri(const lsDocumentUri& other);; + bool operator==(const lsDocumentUri& other) const; + bool operator==(const std::string& other) const; + void SetPath(const AbsolutePath& path); + std::string GetRawPath() const; + AbsolutePath GetAbsolutePath() const; + + + std::string raw_uri_; + void swap(lsDocumentUri& arg) noexcept + { + raw_uri_.swap(arg.raw_uri_); + } }; extern void Reflect(Writer& visitor, lsDocumentUri& value); extern void Reflect(Reader& visitor, lsDocumentUri& value); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsFormattingOptions.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsFormattingOptions.h index a92df9b077..cc3ad4bbac 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsFormattingOptions.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsFormattingOptions.h @@ -3,41 +3,41 @@ #include "LibLsp/JsonRpc/serializer.h" struct lsFormattingOptions { - struct KeyData { - boost::optional<bool> _boolean; - boost::optional<int32_t> _integer; - boost::optional<std::string> _string; - }; + struct KeyData { + boost::optional<bool> _boolean; + boost::optional<int32_t> _integer; + boost::optional<std::string> _string; + }; - // Size of a tab in spaces. - int tabSize =4; - // Prefer spaces over tabs. - bool insertSpaces = true; + // Size of a tab in spaces. + int tabSize =4; + // Prefer spaces over tabs. + bool insertSpaces = true; - /** - * Trim trailing whitespace on a line. - * - * @since 3.15.0 - */ - boost::optional<bool> trimTrailingWhitespace; + /** + * Trim trailing whitespace on a line. + * + * @since 3.15.0 + */ + boost::optional<bool> trimTrailingWhitespace; - /** - * Insert a newline character at the end of the file if one does not exist. - * - * @since 3.15.0 - */ - boost::optional<bool> insertFinalNewline; + /** + * Insert a newline character at the end of the file if one does not exist. + * + * @since 3.15.0 + */ + boost::optional<bool> insertFinalNewline; - /** - * Trim all newlines after the final newline at the end of the file. - * - * @since 3.15.0 - */ - boost::optional<bool> trimFinalNewlines; - boost::optional<KeyData> key; + /** + * Trim all newlines after the final newline at the end of the file. + * + * @since 3.15.0 + */ + boost::optional<bool> trimFinalNewlines; + boost::optional<KeyData> key; MAKE_SWAP_METHOD(lsFormattingOptions, tabSize, insertSpaces, trimTrailingWhitespace, insertFinalNewline, trimFinalNewlines, key) }; MAKE_REFLECT_STRUCT(lsFormattingOptions, tabSize, insertSpaces, trimTrailingWhitespace, insertFinalNewline, trimFinalNewlines, key); extern void Reflect(Reader& visitor, lsFormattingOptions::KeyData& value); -extern void Reflect(Writer& visitor, lsFormattingOptions::KeyData& value);
\ No newline at end of file +extern void Reflect(Writer& visitor, lsFormattingOptions::KeyData& value); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsMarkedString.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsMarkedString.h index 9191aa66d1..975ee4fed0 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsMarkedString.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsMarkedString.h @@ -20,24 +20,24 @@ // Note that markdown strings will be sanitized - that means html will be // escaped. struct lsMarkedString { - boost::optional<std::string> language; - std::string value; + boost::optional<std::string> language; + std::string value; }; struct MarkupContent { - /** - * The type of the Markup. - */ + /** + * The type of the Markup. + */ - std::string kind; + std::string kind; - /** - * The content itself. - */ - - std::string value; + /** + * The content itself. + */ - MAKE_SWAP_METHOD(MarkupContent, kind, value); + std::string value; + + MAKE_SWAP_METHOD(MarkupContent, kind, value); }; MAKE_REFLECT_STRUCT(MarkupContent,kind,value); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsPosition.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsPosition.h index 8c2106e16e..a14d75ed90 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsPosition.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsPosition.h @@ -11,30 +11,30 @@ //A position is between two characters like an ¡®insert¡¯ cursor in a editor.Special values like //for example - 1 to denote the end of a line are not supported. struct lsPosition { - lsPosition(); - lsPosition(int line, int character); - - bool operator==(const lsPosition& other) const; - bool operator<(const lsPosition& other) const; - - std::string ToString() const; - - /** - * Line position in a document (zero-based). - */ - // Note: these are 0-based. - unsigned line = 0; - /** - * Character offset on a line in a document (zero-based). Assuming that - * the line is represented as a string, the `character` value represents - * the gap between the `character` and `character + 1`. - * - * If the character value is greater than the line length it defaults back - * to the line length. - */ - unsigned character = 0; - static const lsPosition kZeroPosition; - - MAKE_SWAP_METHOD(lsPosition, line, character) + lsPosition(); + lsPosition(int line, int character); + + bool operator==(const lsPosition& other) const; + bool operator<(const lsPosition& other) const; + + std::string ToString() const; + + /** + * Line position in a document (zero-based). + */ + // Note: these are 0-based. + unsigned line = 0; + /** + * Character offset on a line in a document (zero-based). Assuming that + * the line is represented as a string, the `character` value represents + * the gap between the `character` and `character + 1`. + * + * If the character value is greater than the line length it defaults back + * to the line length. + */ + unsigned character = 0; + static const lsPosition kZeroPosition; + + MAKE_SWAP_METHOD(lsPosition, line, character) }; -MAKE_REFLECT_STRUCT(lsPosition, line, character);
\ No newline at end of file +MAKE_REFLECT_STRUCT(lsPosition, line, character); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsRange.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsRange.h index 6cc01e37a7..97d78712d7 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsRange.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsRange.h @@ -12,21 +12,21 @@ //If you want to specify a range that contains a line including the line ending character(s) //then use an end position denoting the start of the next line. struct lsRange { - lsRange(); - lsRange(lsPosition start, lsPosition end); + lsRange(); + lsRange(lsPosition start, lsPosition end); - bool operator==(const lsRange& other) const; - bool operator<(const lsRange& other) const; - /** - * The range's start position. - */ - lsPosition start; - /** - * The range's end position. - */ - lsPosition end; - std::string ToString()const; - MAKE_SWAP_METHOD(lsRange, start, end) + bool operator==(const lsRange& other) const; + bool operator<(const lsRange& other) const; + /** + * The range's start position. + */ + lsPosition start; + /** + * The range's end position. + */ + lsPosition end; + std::string ToString()const; + MAKE_SWAP_METHOD(lsRange, start, end) }; -MAKE_REFLECT_STRUCT(lsRange, start, end)
\ No newline at end of file +MAKE_REFLECT_STRUCT(lsRange, start, end) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsResponseError.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsResponseError.h index 6146d6188f..9b0120e3e4 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsResponseError.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsResponseError.h @@ -5,113 +5,113 @@ #include "LibLsp/lsp/lsAny.h" enum class lsErrorCodes:int32_t { - // Defined by JSON RPC - ParseError = -32700, - InvalidRequest = -32600, - MethodNotFound = -32601, - InvalidParams = -32602, - 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 `ServerNotInitialized` and the `UnknownErrorCode` - * are left in the range. - * - * @since 3.16.0 - */ - jsonrpcReservedErrorRangeStart = -32099, - /** @deprecated use jsonrpcReservedErrorRangeStart */ - serverErrorStart = jsonrpcReservedErrorRangeStart, - - /** - * This is the start range of JSON RPC reserved error codes. - * It doesn't denote a real error code. - * - * @since 3.16.0 - */ - jsonrpcReservedErrorRangeEnd = -32000, - /** @deprecated use jsonrpcReservedErrorRangeEnd */ - serverErrorEnd = jsonrpcReservedErrorRangeEnd, - - /** - * Error code indicating that a server received a notification or - * request before the server has received the `initialize` request. - */ - ServerNotInitialized = -32002, - UnknownErrorCode = -32001, - - /** - * This is the start range of LSP reserved error codes. - * It doesn't denote a real error code. - * - * @since 3.16.0 - */ - lspReservedErrorRangeStart= -32899, - - /** - * 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 as detected - * the cancel. - */ - RequestCancelled = -32800, - - /** - * This is the end range of LSP reserved error codes. - * It doesn't denote a real error code. - * - * @since 3.16.0 - */ - lspReservedErrorRangeEnd = -32800, - - + // Defined by JSON RPC + ParseError = -32700, + InvalidRequest = -32600, + MethodNotFound = -32601, + InvalidParams = -32602, + 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 `ServerNotInitialized` and the `UnknownErrorCode` + * are left in the range. + * + * @since 3.16.0 + */ + jsonrpcReservedErrorRangeStart = -32099, + /** @deprecated use jsonrpcReservedErrorRangeStart */ + serverErrorStart = jsonrpcReservedErrorRangeStart, + + /** + * This is the start range of JSON RPC reserved error codes. + * It doesn't denote a real error code. + * + * @since 3.16.0 + */ + jsonrpcReservedErrorRangeEnd = -32000, + /** @deprecated use jsonrpcReservedErrorRangeEnd */ + serverErrorEnd = jsonrpcReservedErrorRangeEnd, + + /** + * Error code indicating that a server received a notification or + * request before the server has received the `initialize` request. + */ + ServerNotInitialized = -32002, + UnknownErrorCode = -32001, + + /** + * This is the start range of LSP reserved error codes. + * It doesn't denote a real error code. + * + * @since 3.16.0 + */ + lspReservedErrorRangeStart= -32899, + + /** + * 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 as detected + * the cancel. + */ + RequestCancelled = -32800, + + /** + * This is the end range of LSP reserved error codes. + * It doesn't denote a real error code. + * + * @since 3.16.0 + */ + lspReservedErrorRangeEnd = -32800, + + }; MAKE_REFLECT_TYPE_PROXY(lsErrorCodes); struct lsResponseError { - lsResponseError(): code(lsErrorCodes::UnknownErrorCode) - { - } - - /** - * A number indicating the error type that occurred. - */ - lsErrorCodes code; - // Short description. - /** - * A string providing a short description of the error. - */ - std::string message; - - /** - * A primitive or structured value that contains additional - * information about the error. Can be omitted. - */ - boost::optional<lsp::Any> data; - std::string ToString(); - void Write(Writer& visitor); - - MAKE_SWAP_METHOD(lsResponseError, code, message, data) + lsResponseError(): code(lsErrorCodes::UnknownErrorCode) + { + } + + /** + * A number indicating the error type that occurred. + */ + lsErrorCodes code; + // Short description. + /** + * A string providing a short description of the error. + */ + std::string message; + + /** + * A primitive or structured value that contains additional + * information about the error. Can be omitted. + */ + boost::optional<lsp::Any> data; + std::string ToString(); + void Write(Writer& visitor); + + MAKE_SWAP_METHOD(lsResponseError, code, message, data) }; -MAKE_REFLECT_STRUCT(lsResponseError, code, message, data)
\ No newline at end of file +MAKE_REFLECT_STRUCT(lsResponseError, code, message, data) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentEdit.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentEdit.h index 0bab8bc3d8..bebbcd48c2 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentEdit.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentEdit.h @@ -8,17 +8,17 @@ struct lsTextDocumentEdit { - // The text document to change. - lsVersionedTextDocumentIdentifier textDocument; - - /** - * The edits to be applied. - * - * @since 3.16.0 - support for AnnotatedTextEdit. This is guarded by the - * client capability `workspace.workspaceEdit.changeAnnotationSupport` - */ - // The edits to be applied. - std::vector< lsAnnotatedTextEdit > edits; - MAKE_SWAP_METHOD(lsTextDocumentEdit, textDocument, edits); + // The text document to change. + lsVersionedTextDocumentIdentifier textDocument; + + /** + * The edits to be applied. + * + * @since 3.16.0 - support for AnnotatedTextEdit. This is guarded by the + * client capability `workspace.workspaceEdit.changeAnnotationSupport` + */ + // The edits to be applied. + std::vector< lsAnnotatedTextEdit > edits; + MAKE_SWAP_METHOD(lsTextDocumentEdit, textDocument, edits); }; -MAKE_REFLECT_STRUCT(lsTextDocumentEdit, textDocument, edits);
\ No newline at end of file +MAKE_REFLECT_STRUCT(lsTextDocumentEdit, textDocument, edits); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentIdentifier.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentIdentifier.h index bb316eae5a..0129df9b99 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentIdentifier.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentIdentifier.h @@ -5,10 +5,10 @@ //Text documents are identified using a URI.On the protocol level, //URIs are passed as strings.The corresponding JSON structure looks like this: struct lsTextDocumentIdentifier { - /** - * The text document's URI. - */ - lsDocumentUri uri; + /** + * The text document's URI. + */ + lsDocumentUri uri; MAKE_SWAP_METHOD(lsTextDocumentIdentifier, uri) }; -MAKE_REFLECT_STRUCT(lsTextDocumentIdentifier, uri)
\ No newline at end of file +MAKE_REFLECT_STRUCT(lsTextDocumentIdentifier, uri) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentItem.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentItem.h index 4d9b4ccc9f..c5bc915132 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentItem.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentItem.h @@ -7,20 +7,20 @@ //An item to transfer a text document from the client to the server. struct lsTextDocumentItem { - // The text document's URI. - lsDocumentUri uri; + // The text document's URI. + lsDocumentUri uri; - // The text document's language identifier. - std::string languageId; + // The text document's language identifier. + std::string languageId; - // The version number of this document (it will strictly increase after each - // change, including undo/redo). - int version = 0; + // The version number of this document (it will strictly increase after each + // change, including undo/redo). + int version = 0; - // The content of the opened text document. - std::string text; + // The content of the opened text document. + std::string text; - MAKE_SWAP_METHOD(lsTextDocumentItem, uri, languageId, version, text) + MAKE_SWAP_METHOD(lsTextDocumentItem, uri, languageId, version, text) }; -MAKE_REFLECT_STRUCT(lsTextDocumentItem, uri, languageId, version, text)
\ No newline at end of file +MAKE_REFLECT_STRUCT(lsTextDocumentItem, uri, languageId, version, text) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentPositionParams.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentPositionParams.h index 52d291351e..6f0940c0b2 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentPositionParams.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentPositionParams.h @@ -9,18 +9,18 @@ * A parameter literal used in requests to pass a text document and a position inside that document. */ struct lsTextDocumentPositionParams { - // The text document. - lsTextDocumentIdentifier textDocument; + // The text document. + lsTextDocumentIdentifier textDocument; - // The position inside the text document. - lsPosition position; + // The position inside the text document. + lsPosition position; + + /** + * Legacy property to support protocol version 1.0 requests. + */ + boost::optional<lsDocumentUri> uri; - /** - * Legacy property to support protocol version 1.0 requests. - */ - boost::optional<lsDocumentUri> uri; - MAKE_SWAP_METHOD(lsTextDocumentPositionParams, textDocument, position, uri); - + }; MAKE_REFLECT_STRUCT(lsTextDocumentPositionParams, textDocument, position, uri); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextEdit.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextEdit.h index 8785e0dcbc..de06e85e92 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextEdit.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextEdit.h @@ -17,24 +17,24 @@ */ struct lsChangeAnnotation { - /** - * A human-readable string describing the actual change. The string - * is rendered prominent in the user interface. - */ - std::string label; - - /** - * A flag which indicates that user confirmation is needed - * before applying the change. - */ - boost::optional<bool> needsConfirmation; - - /** - * A human-readable string which is rendered less prominent in - * the user interface. - */ - boost::optional < std::string > description; - MAKE_REFLECT_STRUCT(lsChangeAnnotation, label, needsConfirmation, description) + /** + * A human-readable string describing the actual change. The string + * is rendered prominent in the user interface. + */ + std::string label; + + /** + * A flag which indicates that user confirmation is needed + * before applying the change. + */ + boost::optional<bool> needsConfirmation; + + /** + * A human-readable string which is rendered less prominent in + * the user interface. + */ + boost::optional < std::string > description; + MAKE_REFLECT_STRUCT(lsChangeAnnotation, label, needsConfirmation, description) }; MAKE_REFLECT_STRUCT(lsChangeAnnotation, label, needsConfirmation, description) @@ -64,23 +64,23 @@ using lsChangeAnnotationIdentifier = std::string; //A textual edit applicable to a text document. struct lsTextEdit { - // The range of the text document to be manipulated. To insert - // text into a document create a range where start === end. - lsRange range; + // The range of the text document to be manipulated. To insert + // text into a document create a range where start === end. + lsRange range; - // The string to be inserted. For delete operations use an - // empty string. - std::string newText; + // The string to be inserted. For delete operations use an + // empty string. + std::string newText; - /** + /** * The actual annotation identifier. */ - boost::optional<lsChangeAnnotationIdentifier> annotationId; - + boost::optional<lsChangeAnnotationIdentifier> annotationId; - bool operator==(const lsTextEdit& that); - std::string ToString() const; - MAKE_SWAP_METHOD(lsTextEdit, range, newText, annotationId) + + bool operator==(const lsTextEdit& that); + std::string ToString() const; + MAKE_SWAP_METHOD(lsTextEdit, range, newText, annotationId) }; MAKE_REFLECT_STRUCT(lsTextEdit, range, newText, annotationId) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsVersionedTextDocumentIdentifier.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsVersionedTextDocumentIdentifier.h index 8a858053b1..7e8ccbd635 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsVersionedTextDocumentIdentifier.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsVersionedTextDocumentIdentifier.h @@ -8,13 +8,13 @@ struct lsVersionedTextDocumentIdentifier { - lsDocumentUri uri; - // The version number of this document. number | null - boost::optional<int> version; + lsDocumentUri uri; + // The version number of this document. number | null + boost::optional<int> version; - lsTextDocumentIdentifier AsTextDocumentIdentifier() const; + lsTextDocumentIdentifier AsTextDocumentIdentifier() const; - MAKE_SWAP_METHOD(lsVersionedTextDocumentIdentifier, uri, version) + MAKE_SWAP_METHOD(lsVersionedTextDocumentIdentifier, uri, version) }; MAKE_REFLECT_STRUCT(lsVersionedTextDocumentIdentifier, uri, version) @@ -29,4 +29,4 @@ MAKE_REFLECT_STRUCT(lsVersionedTextDocumentIdentifier, uri, version) * The version number of a document will increase after each change, * including undo/redo. The number doesn't need to be consecutive. */ -using lsOptionalVersionedTextDocumentIdentifier = lsVersionedTextDocumentIdentifier;
\ No newline at end of file +using lsOptionalVersionedTextDocumentIdentifier = lsVersionedTextDocumentIdentifier; diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsWorkspaceEdit.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsWorkspaceEdit.h index c7fb73930a..4df020d7a2 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsWorkspaceEdit.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsWorkspaceEdit.h @@ -20,36 +20,36 @@ struct lsChangeAnnotations { - lsChangeAnnotation id; - MAKE_SWAP_METHOD(lsChangeAnnotations, id) + lsChangeAnnotation id; + MAKE_SWAP_METHOD(lsChangeAnnotations, id) }; MAKE_REFLECT_STRUCT(lsChangeAnnotations, id) struct lsWorkspaceEdit { - // Holds changes to existing resources. - // changes ? : { [uri:string]: TextEdit[]; }; - // std::unordered_map<lsDocumentUri, std::vector<lsTextEdit>> changes; - - // An array of `TextDocumentEdit`s to express changes to specific a specific - // version of a text document. Whether a client supports versioned document - // edits is expressed via `WorkspaceClientCapabilites.versionedWorkspaceEdit`. - // - boost::optional< std::map<std::string, std::vector<lsTextEdit> > > changes; - typedef std::pair < boost::optional<lsTextDocumentEdit>, boost::optional<lsp::Any> > Either; - - boost::optional < std::vector< Either > > documentChanges; - /** - * 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 - */ - boost::optional< lsChangeAnnotations > changeAnnotations; - - MAKE_SWAP_METHOD(lsWorkspaceEdit, changes, documentChanges, changeAnnotations) + // Holds changes to existing resources. + // changes ? : { [uri:string]: TextEdit[]; }; + // std::unordered_map<lsDocumentUri, std::vector<lsTextEdit>> changes; + + // An array of `TextDocumentEdit`s to express changes to specific a specific + // version of a text document. Whether a client supports versioned document + // edits is expressed via `WorkspaceClientCapabilites.versionedWorkspaceEdit`. + // + boost::optional< std::map<std::string, std::vector<lsTextEdit> > > changes; + typedef std::pair < boost::optional<lsTextDocumentEdit>, boost::optional<lsp::Any> > Either; + + boost::optional < std::vector< Either > > documentChanges; + /** + * 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 + */ + boost::optional< lsChangeAnnotations > changeAnnotations; + + MAKE_SWAP_METHOD(lsWorkspaceEdit, changes, documentChanges, changeAnnotations) }; MAKE_REFLECT_STRUCT(lsWorkspaceEdit, changes, documentChanges, changeAnnotations) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsp_code_action.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsp_code_action.h index 37acc6ca61..2d5c7111fb 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsp_code_action.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsp_code_action.h @@ -13,18 +13,18 @@ struct CommandArgs { }; MAKE_REFLECT_STRUCT_WRITER_AS_ARRAY(CommandArgs, textDocumentUri, edits); inline void Reflect(Reader& visitor, CommandArgs& value) { - int i = 0; - visitor.IterArray([&](Reader& visitor) { - switch (i++) { - case 0: - Reflect(visitor, value.textDocumentUri); - break; - case 1: - Reflect(visitor, value.edits); - break; + int i = 0; + visitor.IterArray([&](Reader& visitor) { + switch (i++) { + case 0: + Reflect(visitor, value.textDocumentUri); + break; + case 1: + Reflect(visitor, value.edits); + break; - } - }); + } + }); } // codeLens diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsp_completion.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsp_completion.h index 250699a44a..d434b31d13 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsp_completion.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsp_completion.h @@ -57,8 +57,8 @@ MAKE_REFLECT_TYPE_PROXY(lsInsertTextFormat); namespace lsp { - std::string ToString(lsCompletionItemKind); - std::string ToString(lsInsertTextFormat); + std::string ToString(lsCompletionItemKind); + std::string ToString(lsInsertTextFormat); } /** * The Completion request is sent from the client to the server to compute completion items at a given cursor position. @@ -67,7 +67,7 @@ namespace lsp * completion item is selected in the user class. */ struct lsCompletionItem { - + // The label of this completion item. By default // also the text that is inserted when selecting // this completion. @@ -89,11 +89,11 @@ struct lsCompletionItem { * Indicates if this item is deprecated. */ boost::optional< bool >deprecated; - + /** * 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. @@ -177,18 +177,18 @@ struct lsCompletionItem { boost::optional<lsp::Any> data; std::string ToString(); MAKE_SWAP_METHOD(lsCompletionItem, - label, - kind, - detail, - documentation, - sortText, - insertText, - filterText, - insertTextFormat, - textEdit, - deprecated, preselect, additionalTextEdits, commitCharacters, - command, data); - + label, + kind, + detail, + documentation, + sortText, + insertText, + filterText, + insertTextFormat, + textEdit, + deprecated, preselect, additionalTextEdits, commitCharacters, + command, data); + }; @@ -204,21 +204,21 @@ MAKE_REFLECT_STRUCT(lsCompletionItem, insertTextFormat, textEdit, deprecated, preselect, additionalTextEdits, commitCharacters, - command, data); + command, data); struct CompletionList { - // This list it not complete. Further typing should result in recomputing - // this list. - bool isIncomplete = false; - // The completion items. - std::vector<lsCompletionItem> items; - - void swap(CompletionList& arg) noexcept - { - items.swap(arg.items); - std::swap(isIncomplete, arg.isIncomplete); - } + // This list it not complete. Further typing should result in recomputing + // this list. + bool isIncomplete = false; + // The completion items. + std::vector<lsCompletionItem> items; + + void swap(CompletionList& arg) noexcept + { + items.swap(arg.items); + std::swap(isIncomplete, arg.isIncomplete); + } }; -MAKE_REFLECT_STRUCT(CompletionList, isIncomplete, items);
\ No newline at end of file +MAKE_REFLECT_STRUCT(CompletionList, isIncomplete, items); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsp_diagnostic.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsp_diagnostic.h index d1b1d1ba78..3ddea4b9ee 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsp_diagnostic.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsp_diagnostic.h @@ -28,20 +28,20 @@ MAKE_REFLECT_TYPE_PROXY(lsDiagnosticSeverity); */ enum class DiagnosticTag :uint8_t { - /** - * 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), }; MAKE_REFLECT_TYPE_PROXY(DiagnosticTag); @@ -56,19 +56,19 @@ MAKE_REFLECT_TYPE_PROXY(DiagnosticTag); */ struct DiagnosticRelatedInformation { - /** - * The location of this related diagnostic information. - */ + /** + * The location of this related diagnostic information. + */ lsLocation location; - /** - * The message of this related diagnostic information. - */ + /** + * The message of this related diagnostic information. + */ - std::string message; + std::string message; - MAKE_SWAP_METHOD(DiagnosticRelatedInformation, location, message) + MAKE_SWAP_METHOD(DiagnosticRelatedInformation, location, message) }; MAKE_REFLECT_STRUCT(DiagnosticRelatedInformation, location, message) /** @@ -77,11 +77,11 @@ MAKE_REFLECT_STRUCT(DiagnosticRelatedInformation, location, message) * @since 3.16.0 */ struct DiagnosticCodeDescription { - /** - * An URI to open with more information about the diagnostic error. - */ - std::string href; - MAKE_SWAP_METHOD(DiagnosticCodeDescription, href) + /** + * An URI to open with more information about the diagnostic error. + */ + std::string href; + MAKE_SWAP_METHOD(DiagnosticCodeDescription, href) }; MAKE_REFLECT_STRUCT(DiagnosticCodeDescription, href) @@ -114,7 +114,7 @@ struct lsDiagnostic { * @since 3.15.0 */ boost::optional<std::vector<DiagnosticTag>> tags; - + /** * An array of related diagnostic information, e.g. when symbol-names within a scope collide @@ -142,8 +142,8 @@ MAKE_REFLECT_STRUCT(lsDiagnostic, range, severity, code, codeDescription, source struct Rsp_Error : ResponseError<lsResponseError, Rsp_Error> { - - MAKE_SWAP_METHOD(Rsp_Error, jsonrpc, id, error) + + MAKE_SWAP_METHOD(Rsp_Error, jsonrpc, id, error) }; MAKE_REFLECT_STRUCT(Rsp_Error, jsonrpc, id, error) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/out_list.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/out_list.h index 36c4aa78ba..60f8ba3c7f 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/out_list.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/out_list.h @@ -15,8 +15,8 @@ namespace LocationListEither{ - typedef std::pair< boost::optional<std::vector<lsLocation>> , boost::optional<std::vector<LocationLink> > > Either; - + typedef std::pair< boost::optional<std::vector<lsLocation>> , boost::optional<std::vector<LocationLink> > > Either; + }; extern void Reflect(Reader& visitor, LocationListEither::Either& value); //DEFINE_RESPONCE_TYPE(Rsp_LocationListEither, LocationListEither::Either); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/symbol.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/symbol.h index 57298b8d7f..87ebfe89ed 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/symbol.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/symbol.h @@ -3,45 +3,45 @@ enum class lsSymbolKind : uint8_t { - Unknown = 0, - - 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, - - // For C++, this is interpreted as "template parameter" (including - // non-type template parameters). - TypeParameter = 26, - - // cquery extensions - // See also https://github.com/Microsoft/language-server-protocol/issues/344 - // for new SymbolKind clang/Index/IndexSymbol.h clang::index::SymbolKind - TypeAlias = 252, - Parameter = 253, - StaticMethod = 254, - Macro = 255, + Unknown = 0, + + 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, + + // For C++, this is interpreted as "template parameter" (including + // non-type template parameters). + TypeParameter = 26, + + // cquery extensions + // See also https://github.com/Microsoft/language-server-protocol/issues/344 + // for new SymbolKind clang/Index/IndexSymbol.h clang::index::SymbolKind + TypeAlias = 252, + Parameter = 253, + StaticMethod = 254, + Macro = 255, }; MAKE_REFLECT_TYPE_PROXY(lsSymbolKind); @@ -113,52 +113,52 @@ MAKE_REFLECT_STRUCT(lsSymbolInformation, name, kind, deprecated, location, conta struct lsDocumentSymbol { - /** - * The name of this symbol. - */ - - std::string name; - - /** - * The kind of this symbol. - */ - - lsSymbolKind kind = lsSymbolKind::Unknown; - - /** - * 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. - */ - - lsRange 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`. - */ - - lsRange selectionRange; - - /** - * More detail for this symbol, e.g the signature of a function. If not provided the - * name is used. - */ - boost::optional< std::string > detail; - - /** - * Indicates if this symbol is deprecated. - */ - boost::optional< bool > deprecated; - - /** - * Children of this symbol, e.g. properties of a class. - */ - boost::optional < std::vector<lsDocumentSymbol> > children; - - //internal use - int flags=0; - - MAKE_SWAP_METHOD(lsDocumentSymbol, name, kind, range, selectionRange, detail, deprecated, children, flags); + /** + * The name of this symbol. + */ + + std::string name; + + /** + * The kind of this symbol. + */ + + lsSymbolKind kind = lsSymbolKind::Unknown; + + /** + * 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. + */ + + lsRange 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`. + */ + + lsRange selectionRange; + + /** + * More detail for this symbol, e.g the signature of a function. If not provided the + * name is used. + */ + boost::optional< std::string > detail; + + /** + * Indicates if this symbol is deprecated. + */ + boost::optional< bool > deprecated; + + /** + * Children of this symbol, e.g. properties of a class. + */ + boost::optional < std::vector<lsDocumentSymbol> > children; + + //internal use + int flags=0; + + MAKE_SWAP_METHOD(lsDocumentSymbol, name, kind, range, selectionRange, detail, deprecated, children, flags); }; -MAKE_REFLECT_STRUCT(lsDocumentSymbol, name, kind, range, selectionRange, detail, deprecated, children, flags);
\ No newline at end of file +MAKE_REFLECT_STRUCT(lsDocumentSymbol, name, kind, range, selectionRange, detail, deprecated, children, flags); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/SemanticTokens.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/SemanticTokens.h index 612d186f6f..7f5978ff84 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/SemanticTokens.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/SemanticTokens.h @@ -4,115 +4,115 @@ #include "LibLsp/lsp/lsVersionedTextDocumentIdentifier.h" #include "LibLsp/JsonRpc/RequestInMessage.h" enum class HighlightingKind_clangD { - Variable = 0, - LocalVariable, - Parameter, - Function, - Method, - StaticMethod, - Field, - StaticField, - Class, - Interface, - Enum, - EnumConstant, - Typedef, - Type, - Unknown, - Namespace, - TemplateParameter, - Concept, - Primitive, - Macro, + Variable = 0, + LocalVariable, + Parameter, + Function, + Method, + StaticMethod, + Field, + StaticField, + Class, + Interface, + Enum, + EnumConstant, + Typedef, + Type, + Unknown, + Namespace, + TemplateParameter, + Concept, + Primitive, + Macro, - // This one is different from the other kinds as it's a line style - // rather than a token style. - InactiveCode, + // This one is different from the other kinds as it's a line style + // rather than a token style. + InactiveCode, - LastKind = InactiveCode + LastKind = InactiveCode }; std::string toSemanticTokenType(HighlightingKind_clangD kind); enum class HighlightingModifier_clangD { - Declaration, - Deprecated, - Deduced, - Readonly, - Static, - Abstract, - DependentName, - DefaultLibrary, + Declaration, + Deprecated, + Deduced, + Readonly, + Static, + Abstract, + DependentName, + DefaultLibrary, - FunctionScope, - ClassScope, - FileScope, - GlobalScope, + FunctionScope, + ClassScope, + FileScope, + GlobalScope, - LastModifier = GlobalScope + LastModifier = GlobalScope }; std::string toSemanticTokenModifier(HighlightingModifier_clangD modifier); enum SemanticTokenType { - ls_namespace=0,// 'namespace', - /** - * Represents a generic type. Acts as a fallback for types which - * can't be mapped to a specific type like class or enum. - */ - ls_type,// 'type', - ls_class,// 'class', - ls_enum,// 'enum', - ls_interface,// 'interface', - ls_struct,// 'struct', - ls_typeParameter,// 'typeParameter', - ls_parameter,// 'parameter', - ls_variable,// 'variable', - ls_property,// 'property', - ls_enumMember,// 'enumMember', - ls_event,// 'event', - ls_function,// 'function', - ls_method,// 'method', - ls_macro,// 'macro', - ls_keyword,// 'keyword', - ls_modifier,// 'modifier', - ls_comment,// 'comment', - ls_string,// 'string', - ls_number,// 'number', - ls_regexp,// 'regexp', - ls_operator,// 'operator' - lastKind = ls_operator + ls_namespace=0,// 'namespace', + /** + * Represents a generic type. Acts as a fallback for types which + * can't be mapped to a specific type like class or enum. + */ + ls_type,// 'type', + ls_class,// 'class', + ls_enum,// 'enum', + ls_interface,// 'interface', + ls_struct,// 'struct', + ls_typeParameter,// 'typeParameter', + ls_parameter,// 'parameter', + ls_variable,// 'variable', + ls_property,// 'property', + ls_enumMember,// 'enumMember', + ls_event,// 'event', + ls_function,// 'function', + ls_method,// 'method', + ls_macro,// 'macro', + ls_keyword,// 'keyword', + ls_modifier,// 'modifier', + ls_comment,// 'comment', + ls_string,// 'string', + ls_number,// 'number', + ls_regexp,// 'regexp', + ls_operator,// 'operator' + lastKind = ls_operator }; std::string to_string(SemanticTokenType); unsigned toSemanticTokenType(std::vector<SemanticTokenType>& modifiers); enum TokenType_JDT { - PACKAGE_JDT=0, - CLASS_JDT, - INTERFACE_JDT, - ENUM_JDT, - ENUM_MEMBER_JDT, - TYPE_JDT, - TYPE_PARAMETER_JDT, - ANNOTATION_JDT, - ANNOTATION_MEMBER_JDT, - METHOD_JDT, - PROPERTY_JDT, - VARIABLE_JDT, - PARAMETER_JDT + PACKAGE_JDT=0, + CLASS_JDT, + INTERFACE_JDT, + ENUM_JDT, + ENUM_MEMBER_JDT, + TYPE_JDT, + TYPE_PARAMETER_JDT, + ANNOTATION_JDT, + ANNOTATION_MEMBER_JDT, + METHOD_JDT, + PROPERTY_JDT, + VARIABLE_JDT, + PARAMETER_JDT }; std::string to_string(TokenType_JDT); enum SemanticTokenModifier { - ls_declaration=0,// 'declaration', - ls_definition,// 'definition', - ls_readonly,// 'readonly', - ls_static,// 'static', - ls_deprecated,// 'deprecated', - ls_abstract,// 'abstract', - ls_async,// 'async', - ls_modification,// 'modification', - ls_documentation,// 'documentation', - ls_defaultLibrary,// 'defaultLibrary' - LastModifier = ls_defaultLibrary + ls_declaration=0,// 'declaration', + ls_definition,// 'definition', + ls_readonly,// 'readonly', + ls_static,// 'static', + ls_deprecated,// 'deprecated', + ls_abstract,// 'abstract', + ls_async,// 'async', + ls_modification,// 'modification', + ls_documentation,// 'documentation', + ls_defaultLibrary,// 'defaultLibrary' + LastModifier = ls_defaultLibrary }; std::string to_string(SemanticTokenModifier); unsigned toSemanticTokenModifiers(std::vector<SemanticTokenModifier>&); @@ -120,85 +120,85 @@ unsigned toSemanticTokenModifiers(std::vector<SemanticTokenModifier>&); /// This struct is not part of LSP, which just encodes lists of tokens as /// arrays of numbers directly. struct SemanticToken { - /// token line number, relative to the previous token - unsigned deltaLine = 0; - /// token start character, relative to the previous token - /// (relative to 0 or the previous token's start if they are on the same line) - unsigned deltaStart = 0; - /// the length of the token. A token cannot be multiline - unsigned length = 0; - /// will be looked up in `SemanticTokensLegend.tokenTypes` - unsigned tokenType = 0; - /// each set bit will be looked up in `SemanticTokensLegend.tokenModifiers` - unsigned tokenModifiers = 0; + /// token line number, relative to the previous token + unsigned deltaLine = 0; + /// token start character, relative to the previous token + /// (relative to 0 or the previous token's start if they are on the same line) + unsigned deltaStart = 0; + /// the length of the token. A token cannot be multiline + unsigned length = 0; + /// will be looked up in `SemanticTokensLegend.tokenTypes` + unsigned tokenType = 0; + /// each set bit will be looked up in `SemanticTokensLegend.tokenModifiers` + unsigned tokenModifiers = 0; }; bool operator==(const SemanticToken&, const SemanticToken&); struct SemanticTokens{ - /** - * Tokens in a file are represented as an array of integers. The position of each token is expressed relative to - * the token before it, because most tokens remain stable relative to each other when edits are made in a file. - * - * --- - * In short, each token takes 5 integers to represent, so a specific token `i` in the file consists of the following array indices: - * - at index `5*i` - `deltaLine`: token line number, relative to the previous token - * - at index `5*i+1` - `deltaStart`: token start character, relative to the previous token (relative to 0 or the previous token's start if they are on the same line) - * - at index `5*i+2` - `length`: the length of the token. A token cannot be multiline. - * - at index `5*i+3` - `tokenType`: will be looked up in `SemanticTokensLegend.tokenTypes`. We currently ask that `tokenType` < 65536. - * - at index `5*i+4` - `tokenModifiers`: each set bit will be looked up in `SemanticTokensLegend.tokenModifiers` - * - * --- - * ### How to encode tokens - * - * Here is an example for encoding a file with 3 tokens in a uint32 array: - * ``` - * { line: 2, startChar: 5, length: 3, tokenType: "property", tokenModifiers: ["private", "static"] }, - * { line: 2, startChar: 10, length: 4, tokenType: "type", tokenModifiers: [] }, - * { line: 5, startChar: 2, length: 7, tokenType: "class", tokenModifiers: [] } - * ``` - * - * 1. First of all, a legend must be devised. This legend must be provided up-front and capture all possible token types. - * For this example, we will choose the following legend which must be passed in when registering the provider: - * ``` - * tokenTypes: ['property', 'type', 'class'], - * tokenModifiers: ['private', 'static'] - * ``` - * - * 2. The first transformation step is to encode `tokenType` and `tokenModifiers` as integers using the legend. Token types are looked - * up by index, so a `tokenType` value of `1` means `tokenTypes[1]`. Multiple token modifiers can be set by using bit flags, - * so a `tokenModifier` value of `3` is first viewed as binary `0b00000011`, which means `[tokenModifiers[0], tokenModifiers[1]]` because - * bits 0 and 1 are set. Using this legend, the tokens now are: - * ``` - * { line: 2, startChar: 5, length: 3, tokenType: 0, tokenModifiers: 3 }, - * { line: 2, startChar: 10, length: 4, tokenType: 1, tokenModifiers: 0 }, - * { line: 5, startChar: 2, length: 7, tokenType: 2, tokenModifiers: 0 } - * ``` - * - * 3. The next step is to represent each token relative to the previous token in the file. In this case, the second token - * is on the same line as the first token, so the `startChar` of the second token is made relative to the `startChar` - * of the first token, so it will be `10 - 5`. The third token is on a different line than the second token, so the - * `startChar` of the third token will not be altered: - * ``` - * { deltaLine: 2, deltaStartChar: 5, length: 3, tokenType: 0, tokenModifiers: 3 }, - * { deltaLine: 0, deltaStartChar: 5, length: 4, tokenType: 1, tokenModifiers: 0 }, - * { deltaLine: 3, deltaStartChar: 2, length: 7, tokenType: 2, tokenModifiers: 0 } - * ``` - * - * 4. Finally, the last step is to inline each of the 5 fields for a token in a single array, which is a memory friendly representation: - * ``` - * // 1st token, 2nd token, 3rd token - * [ 2,5,3,0,3, 0,5,4,1,0, 3,2,7,2,0 ] - * ``` - */ - std::vector<int32_t> data; - static std::vector<int32_t> encodeTokens(std::vector<SemanticToken>& tokens); + /** + * Tokens in a file are represented as an array of integers. The position of each token is expressed relative to + * the token before it, because most tokens remain stable relative to each other when edits are made in a file. + * + * --- + * In short, each token takes 5 integers to represent, so a specific token `i` in the file consists of the following array indices: + * - at index `5*i` - `deltaLine`: token line number, relative to the previous token + * - at index `5*i+1` - `deltaStart`: token start character, relative to the previous token (relative to 0 or the previous token's start if they are on the same line) + * - at index `5*i+2` - `length`: the length of the token. A token cannot be multiline. + * - at index `5*i+3` - `tokenType`: will be looked up in `SemanticTokensLegend.tokenTypes`. We currently ask that `tokenType` < 65536. + * - at index `5*i+4` - `tokenModifiers`: each set bit will be looked up in `SemanticTokensLegend.tokenModifiers` + * + * --- + * ### How to encode tokens + * + * Here is an example for encoding a file with 3 tokens in a uint32 array: + * ``` + * { line: 2, startChar: 5, length: 3, tokenType: "property", tokenModifiers: ["private", "static"] }, + * { line: 2, startChar: 10, length: 4, tokenType: "type", tokenModifiers: [] }, + * { line: 5, startChar: 2, length: 7, tokenType: "class", tokenModifiers: [] } + * ``` + * + * 1. First of all, a legend must be devised. This legend must be provided up-front and capture all possible token types. + * For this example, we will choose the following legend which must be passed in when registering the provider: + * ``` + * tokenTypes: ['property', 'type', 'class'], + * tokenModifiers: ['private', 'static'] + * ``` + * + * 2. The first transformation step is to encode `tokenType` and `tokenModifiers` as integers using the legend. Token types are looked + * up by index, so a `tokenType` value of `1` means `tokenTypes[1]`. Multiple token modifiers can be set by using bit flags, + * so a `tokenModifier` value of `3` is first viewed as binary `0b00000011`, which means `[tokenModifiers[0], tokenModifiers[1]]` because + * bits 0 and 1 are set. Using this legend, the tokens now are: + * ``` + * { line: 2, startChar: 5, length: 3, tokenType: 0, tokenModifiers: 3 }, + * { line: 2, startChar: 10, length: 4, tokenType: 1, tokenModifiers: 0 }, + * { line: 5, startChar: 2, length: 7, tokenType: 2, tokenModifiers: 0 } + * ``` + * + * 3. The next step is to represent each token relative to the previous token in the file. In this case, the second token + * is on the same line as the first token, so the `startChar` of the second token is made relative to the `startChar` + * of the first token, so it will be `10 - 5`. The third token is on a different line than the second token, so the + * `startChar` of the third token will not be altered: + * ``` + * { deltaLine: 2, deltaStartChar: 5, length: 3, tokenType: 0, tokenModifiers: 3 }, + * { deltaLine: 0, deltaStartChar: 5, length: 4, tokenType: 1, tokenModifiers: 0 }, + * { deltaLine: 3, deltaStartChar: 2, length: 7, tokenType: 2, tokenModifiers: 0 } + * ``` + * + * 4. Finally, the last step is to inline each of the 5 fields for a token in a single array, which is a memory friendly representation: + * ``` + * // 1st token, 2nd token, 3rd token + * [ 2,5,3,0,3, 0,5,4,1,0, 3,2,7,2,0 ] + * ``` + */ + std::vector<int32_t> data; + static std::vector<int32_t> encodeTokens(std::vector<SemanticToken>& tokens); - /** - * 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. - */ + /** + * 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. + */ boost::optional<std::string> resultId; MAKE_SWAP_METHOD(SemanticTokens, data, resultId) }; @@ -206,9 +206,9 @@ MAKE_REFLECT_STRUCT(SemanticTokens, data, resultId) /// Body of textDocument/semanticTokens/full request. struct SemanticTokensParams { - /// The text document. - lsTextDocumentIdentifier textDocument; - MAKE_REFLECT_STRUCT(SemanticTokensParams, textDocument) + /// The text document. + lsTextDocumentIdentifier textDocument; + MAKE_REFLECT_STRUCT(SemanticTokensParams, textDocument) }; MAKE_REFLECT_STRUCT(SemanticTokensParams, textDocument) @@ -216,28 +216,28 @@ MAKE_REFLECT_STRUCT(SemanticTokensParams, textDocument) /// Body of textDocument/semanticTokens/full/delta request. /// Requests the changes in semantic tokens since a previous response. struct SemanticTokensDeltaParams { - /// The text document. - lsTextDocumentIdentifier textDocument; - /** - * 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. - */ - std::string previousResultId; + /// The text document. + lsTextDocumentIdentifier textDocument; + /** + * 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. + */ + std::string previousResultId; - MAKE_REFLECT_STRUCT(SemanticTokensDeltaParams, textDocument, previousResultId) + MAKE_REFLECT_STRUCT(SemanticTokensDeltaParams, textDocument, previousResultId) }; MAKE_REFLECT_STRUCT(SemanticTokensDeltaParams, textDocument, previousResultId) /// Describes a a replacement of a contiguous range of semanticTokens. struct SemanticTokensEdit { - // LSP specifies `start` and `deleteCount` which are relative to the array - // encoding of the previous tokens. - // We use token counts instead, and translate when serializing this struct. - unsigned startToken = 0; - unsigned deleteTokens = 0; - std::vector<int32_t> tokens; // encoded as a flat integer array + // LSP specifies `start` and `deleteCount` which are relative to the array + // encoding of the previous tokens. + // We use token counts instead, and translate when serializing this struct. + unsigned startToken = 0; + unsigned deleteTokens = 0; + std::vector<int32_t> tokens; // encoded as a flat integer array - MAKE_REFLECT_STRUCT(SemanticTokensEdit, startToken, deleteTokens, tokens) + MAKE_REFLECT_STRUCT(SemanticTokensEdit, startToken, deleteTokens, tokens) }; MAKE_REFLECT_STRUCT(SemanticTokensEdit, startToken, deleteTokens, tokens) @@ -245,23 +245,23 @@ MAKE_REFLECT_STRUCT(SemanticTokensEdit, startToken, deleteTokens, tokens) /// This models LSP SemanticTokensDelta | SemanticTokens, which is the result of /// textDocument/semanticTokens/full/delta. struct SemanticTokensOrDelta { - boost::optional<std::string > resultId; - /// Set if we computed edits relative to a previous set of tokens. - boost::optional< std::vector<SemanticTokensEdit> > edits; - /// Set if we computed a fresh set of tokens. - /// Set if we computed edits relative to a previous set of tokens. - boost::optional<std::vector<int32_t>> tokens; // encoded as integer array - MAKE_REFLECT_STRUCT(SemanticTokensOrDelta, resultId, edits, tokens) + boost::optional<std::string > resultId; + /// Set if we computed edits relative to a previous set of tokens. + boost::optional< std::vector<SemanticTokensEdit> > edits; + /// Set if we computed a fresh set of tokens. + /// Set if we computed edits relative to a previous set of tokens. + boost::optional<std::vector<int32_t>> tokens; // encoded as integer array + MAKE_REFLECT_STRUCT(SemanticTokensOrDelta, resultId, edits, tokens) }; MAKE_REFLECT_STRUCT(SemanticTokensOrDelta, resultId, edits, tokens) - + struct SemanticTokensLegend { - std::vector<std::string> tokenTypes; - std::vector<std::string> tokenModifiers; - MAKE_REFLECT_STRUCT(SemanticTokensLegend, tokenTypes, tokenModifiers) + std::vector<std::string> tokenTypes; + std::vector<std::string> tokenModifiers; + MAKE_REFLECT_STRUCT(SemanticTokensLegend, tokenTypes, tokenModifiers) }; MAKE_REFLECT_STRUCT(SemanticTokensLegend, tokenTypes, tokenModifiers) DEFINE_REQUEST_RESPONSE_TYPE(td_semanticTokens_full, SemanticTokensParams,boost::optional<SemanticTokens >,"textDocument/semanticTokens/full") -DEFINE_REQUEST_RESPONSE_TYPE(td_semanticTokens_full_delta, SemanticTokensDeltaParams, boost::optional<SemanticTokensOrDelta >, "textDocument/semanticTokens/full/delta")
\ No newline at end of file +DEFINE_REQUEST_RESPONSE_TYPE(td_semanticTokens_full_delta, SemanticTokensDeltaParams, boost::optional<SemanticTokensOrDelta >, "textDocument/semanticTokens/full/delta") diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/callHierarchy.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/callHierarchy.h index a005c182e1..432fa518d5 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/callHierarchy.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/callHierarchy.h @@ -12,56 +12,56 @@ MAKE_REFLECT_TYPE_PROXY(SymbolTag) struct CallHierarchyPrepareParams { - lsTextDocumentIdentifier textDocument; - lsPosition position; + lsTextDocumentIdentifier textDocument; + lsPosition position; - MAKE_SWAP_METHOD(CallHierarchyPrepareParams, - textDocument, - position) + MAKE_SWAP_METHOD(CallHierarchyPrepareParams, + textDocument, + position) }; MAKE_REFLECT_STRUCT(CallHierarchyPrepareParams, - textDocument, - position) + textDocument, + position) - /// Represents programming constructs like functions or constructors - /// in the context of call hierarchy. + /// Represents programming constructs like functions or constructors + /// in the context of call hierarchy. struct CallHierarchyItem { - /// The name of this item. - std::string name; - - /// The kind of this item. - SymbolKind kind; - - /// Tags for this item. - boost::optional<std::vector<SymbolTag>> tags; - - /// More detaill for this item, e.g. the signature of a function. - boost::optional<std::string> detail; - - /// The resource identifier of this item. - lsDocumentUri uri; - - /** - * The range enclosing this symbol not including leading/trailing whitespace - * but everything else, e.g. comments and code. - */ - lsRange 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`](#CallHierarchyItem.range). - */ - lsRange selectionRange; - - /** - * A data entry field that is preserved between a call hierarchy prepare and - * incoming calls or outgoing calls requests. - */ - boost::optional<lsp::Any> data; - MAKE_SWAP_METHOD(CallHierarchyItem, name, kind, tags, detail, uri, range, selectionRange, data) + /// The name of this item. + std::string name; + + /// The kind of this item. + SymbolKind kind; + + /// Tags for this item. + boost::optional<std::vector<SymbolTag>> tags; + + /// More detaill for this item, e.g. the signature of a function. + boost::optional<std::string> detail; + + /// The resource identifier of this item. + lsDocumentUri uri; + + /** + * The range enclosing this symbol not including leading/trailing whitespace + * but everything else, e.g. comments and code. + */ + lsRange 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`](#CallHierarchyItem.range). + */ + lsRange selectionRange; + + /** + * A data entry field that is preserved between a call hierarchy prepare and + * incoming calls or outgoing calls requests. + */ + boost::optional<lsp::Any> data; + MAKE_SWAP_METHOD(CallHierarchyItem, name, kind, tags, detail, uri, range, selectionRange, data) }; MAKE_REFLECT_STRUCT(CallHierarchyItem, name, kind, tags, detail, uri, range, selectionRange, data) @@ -69,21 +69,21 @@ MAKE_REFLECT_STRUCT(CallHierarchyItem, name, kind, tags, detail, uri, range, sel /// The parameter of a `callHierarchy/incomingCalls` request. struct CallHierarchyIncomingCallsParams { - CallHierarchyItem item; - MAKE_SWAP_METHOD(CallHierarchyIncomingCallsParams,item) + CallHierarchyItem item; + MAKE_SWAP_METHOD(CallHierarchyIncomingCallsParams,item) }; MAKE_REFLECT_STRUCT(CallHierarchyIncomingCallsParams, item) /// Represents an incoming call, e.g. a caller of a method or constructor. struct CallHierarchyIncomingCall { - /// The item that makes the call. - CallHierarchyItem from; + /// The item that makes the call. + CallHierarchyItem from; - /// The range at which the calls appear. - /// This is relative to the caller denoted by `From`. - std::vector<lsRange> fromRanges; - MAKE_SWAP_METHOD(CallHierarchyIncomingCall, from, fromRanges) + /// The range at which the calls appear. + /// This is relative to the caller denoted by `From`. + std::vector<lsRange> fromRanges; + MAKE_SWAP_METHOD(CallHierarchyIncomingCall, from, fromRanges) }; MAKE_REFLECT_STRUCT(CallHierarchyIncomingCall, from, fromRanges) @@ -92,30 +92,30 @@ MAKE_REFLECT_STRUCT(CallHierarchyIncomingCall, from, fromRanges) /// The parameter of a `callHierarchy/outgoingCalls` request. struct CallHierarchyOutgoingCallsParams { - CallHierarchyItem item; - MAKE_SWAP_METHOD(CallHierarchyOutgoingCallsParams, item) + CallHierarchyItem item; + MAKE_SWAP_METHOD(CallHierarchyOutgoingCallsParams, item) }; MAKE_REFLECT_STRUCT(CallHierarchyOutgoingCallsParams, item) /// Represents an outgoing call, e.g. calling a getter from a method or /// a method from a constructor etc. struct CallHierarchyOutgoingCall { - /// The item that is called. - CallHierarchyItem to; + /// The item that is called. + CallHierarchyItem to; - /// The range at which this item is called. - /// This is the range relative to the caller, and not `To`. - std::vector<lsRange> fromRanges; - MAKE_SWAP_METHOD(CallHierarchyOutgoingCall, to, fromRanges) + /// The range at which this item is called. + /// This is the range relative to the caller, and not `To`. + std::vector<lsRange> fromRanges; + MAKE_SWAP_METHOD(CallHierarchyOutgoingCall, to, fromRanges) }; MAKE_REFLECT_STRUCT(CallHierarchyOutgoingCall, to, fromRanges) DEFINE_REQUEST_RESPONSE_TYPE(td_prepareCallHierarchy, CallHierarchyPrepareParams, - boost::optional<std::vector<CallHierarchyItem>>, "textDocument/prepareCallHierarchy") + boost::optional<std::vector<CallHierarchyItem>>, "textDocument/prepareCallHierarchy") DEFINE_REQUEST_RESPONSE_TYPE(td_incomingCalls, CallHierarchyIncomingCallsParams, - boost::optional<std::vector<CallHierarchyIncomingCall>>, "callHierarchy/incomingCalls") + boost::optional<std::vector<CallHierarchyIncomingCall>>, "callHierarchy/incomingCalls") DEFINE_REQUEST_RESPONSE_TYPE(td_outgoingCalls, CallHierarchyOutgoingCallsParams, - boost::optional<std::vector<CallHierarchyOutgoingCall>>, "callHierarchy/CallHierarchyOutgoingCall")
\ No newline at end of file + boost::optional<std::vector<CallHierarchyOutgoingCall>>, "callHierarchy/CallHierarchyOutgoingCall") diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/code_action.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/code_action.h index 419fdfbc9b..e72d83af90 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/code_action.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/code_action.h @@ -7,24 +7,24 @@ namespace QuickAssistProcessor { - extern const char* SPLIT_JOIN_VARIABLE_DECLARATION_ID;//$NON-NLS-1$ - extern const char* CONVERT_FOR_LOOP_ID;// ;// "org.eclipse.jdt.ls.correction.convertForLoop.assist"; //$NON-NLS-1$ - extern const char* ASSIGN_TO_LOCAL_ID ;// "org.eclipse.jdt.ls.correction.assignToLocal.assist"; //$NON-NLS-1$ - extern const char* ASSIGN_TO_FIELD_ID ;// "org.eclipse.jdt.ls.correction.assignToField.assist"; //$NON-NLS-1$ - extern const char* ASSIGN_PARAM_TO_FIELD_ID ;// "org.eclipse.jdt.ls.correction.assignParamToField.assist"; //$NON-NLS-1$ - extern const char* ASSIGN_ALL_PARAMS_TO_NEW_FIELDS_ID ;// "org.eclipse.jdt.ls.correction.assignAllParamsToNewFields.assist"; //$NON-NLS-1$ - extern const char* ADD_BLOCK_ID ;// "org.eclipse.jdt.ls.correction.addBlock.assist"; //$NON-NLS-1$ - extern const char* EXTRACT_LOCAL_ID ;// "org.eclipse.jdt.ls.correction.extractLocal.assist"; //$NON-NLS-1$ - extern const char* EXTRACT_LOCAL_NOT_REPLACE_ID ;// "org.eclipse.jdt.ls.correction.extractLocalNotReplaceOccurrences.assist"; //$NON-NLS-1$ - extern const char* EXTRACT_CONSTANT_ID ;// "org.eclipse.jdt.ls.correction.extractConstant.assist"; //$NON-NLS-1$ - extern const char* INLINE_LOCAL_ID ;// "org.eclipse.jdt.ls.correction.inlineLocal.assist"; //$NON-NLS-1$ - extern const char* CONVERT_LOCAL_TO_FIELD_ID ;// "org.eclipse.jdt.ls.correction.convertLocalToField.assist"; //$NON-NLS-1$ - extern const char* CONVERT_ANONYMOUS_TO_LOCAL_ID ;// "org.eclipse.jdt.ls.correction.convertAnonymousToLocal.assist"; //$NON-NLS-1$ - extern const char* CONVERT_TO_STRING_BUFFER_ID ;// "org.eclipse.jdt.ls.correction.convertToStringBuffer.assist"; //$NON-NLS-1$ - extern const char* CONVERT_TO_MESSAGE_FORMAT_ID ;// "org.eclipse.jdt.ls.correction.convertToMessageFormat.assist"; //$NON-NLS-1$; - extern const char* EXTRACT_METHOD_INPLACE_ID ;// "org.eclipse.jdt.ls.correction.extractMethodInplace.assist"; //$NON-NLS-1$; + extern const char* SPLIT_JOIN_VARIABLE_DECLARATION_ID;//$NON-NLS-1$ + extern const char* CONVERT_FOR_LOOP_ID;// ;// "org.eclipse.jdt.ls.correction.convertForLoop.assist"; //$NON-NLS-1$ + extern const char* ASSIGN_TO_LOCAL_ID ;// "org.eclipse.jdt.ls.correction.assignToLocal.assist"; //$NON-NLS-1$ + extern const char* ASSIGN_TO_FIELD_ID ;// "org.eclipse.jdt.ls.correction.assignToField.assist"; //$NON-NLS-1$ + extern const char* ASSIGN_PARAM_TO_FIELD_ID ;// "org.eclipse.jdt.ls.correction.assignParamToField.assist"; //$NON-NLS-1$ + extern const char* ASSIGN_ALL_PARAMS_TO_NEW_FIELDS_ID ;// "org.eclipse.jdt.ls.correction.assignAllParamsToNewFields.assist"; //$NON-NLS-1$ + extern const char* ADD_BLOCK_ID ;// "org.eclipse.jdt.ls.correction.addBlock.assist"; //$NON-NLS-1$ + extern const char* EXTRACT_LOCAL_ID ;// "org.eclipse.jdt.ls.correction.extractLocal.assist"; //$NON-NLS-1$ + extern const char* EXTRACT_LOCAL_NOT_REPLACE_ID ;// "org.eclipse.jdt.ls.correction.extractLocalNotReplaceOccurrences.assist"; //$NON-NLS-1$ + extern const char* EXTRACT_CONSTANT_ID ;// "org.eclipse.jdt.ls.correction.extractConstant.assist"; //$NON-NLS-1$ + extern const char* INLINE_LOCAL_ID ;// "org.eclipse.jdt.ls.correction.inlineLocal.assist"; //$NON-NLS-1$ + extern const char* CONVERT_LOCAL_TO_FIELD_ID ;// "org.eclipse.jdt.ls.correction.convertLocalToField.assist"; //$NON-NLS-1$ + extern const char* CONVERT_ANONYMOUS_TO_LOCAL_ID ;// "org.eclipse.jdt.ls.correction.convertAnonymousToLocal.assist"; //$NON-NLS-1$ + extern const char* CONVERT_TO_STRING_BUFFER_ID ;// "org.eclipse.jdt.ls.correction.convertToStringBuffer.assist"; //$NON-NLS-1$ + extern const char* CONVERT_TO_MESSAGE_FORMAT_ID ;// "org.eclipse.jdt.ls.correction.convertToMessageFormat.assist"; //$NON-NLS-1$; + extern const char* EXTRACT_METHOD_INPLACE_ID ;// "org.eclipse.jdt.ls.correction.extractMethodInplace.assist"; //$NON-NLS-1$; - extern const char* CONVERT_ANONYMOUS_CLASS_TO_NESTED_COMMAND ;// "convertAnonymousClassToNestedCommand"; + extern const char* CONVERT_ANONYMOUS_CLASS_TO_NESTED_COMMAND ;// "convertAnonymousClassToNestedCommand"; }; /** * The code action request is sent from the client to the server to compute diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/code_lens.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/code_lens.h index 7fd5ae0cf9..9dd763333d 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/code_lens.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/code_lens.h @@ -4,7 +4,7 @@ #include "LibLsp/JsonRpc/lsResponseMessage.h" struct lsDocumentCodeLensParams { - + /** * The document to request code lens for. */ @@ -18,15 +18,15 @@ MAKE_REFLECT_STRUCT(lsDocumentCodeLensParams, textDocument); struct lsCodeLens { - // The range in which this code lens is valid. Should only span a single line. - lsRange range; - // The command this code lens represents. - boost::optional<lsCommandWithAny> command; - // A data entry field that is preserved on a code lens item between - // a code lens and a code lens resolve request. - boost::optional< lsp::Any> data; - - MAKE_SWAP_METHOD(lsCodeLens, range, command, data) + // The range in which this code lens is valid. Should only span a single line. + lsRange range; + // The command this code lens represents. + boost::optional<lsCommandWithAny> command; + // A data entry field that is preserved on a code lens item between + // a code lens and a code lens resolve request. + boost::optional< lsp::Any> data; + + MAKE_SWAP_METHOD(lsCodeLens, range, command, data) }; MAKE_REFLECT_STRUCT(lsCodeLens, range, command, data) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/colorPresentation.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/colorPresentation.h index 22574e3e19..c70b6502d2 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/colorPresentation.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/colorPresentation.h @@ -12,52 +12,52 @@ struct ColorPresentationParams { - /** + /** * The text document. */ - lsTextDocumentIdentifier textDocument; + lsTextDocumentIdentifier textDocument; - /** - * The range in the document where this color appers. - */ + /** + * The range in the document where this color appers. + */ - lsRange range; + lsRange range; - /** - * The actual color value for this color range. - */ + /** + * The actual color value for this color range. + */ - TextDocument::Color color; - MAKE_SWAP_METHOD(ColorPresentationParams, textDocument, range, color) + TextDocument::Color color; + MAKE_SWAP_METHOD(ColorPresentationParams, textDocument, range, color) }; MAKE_REFLECT_STRUCT(ColorPresentationParams, textDocument, range, color) struct 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. - */ - - std::string label; - - /** - * An edit which is applied to a document when selecting - * this presentation for the color. When `null` the label is used. - */ - lsTextEdit textEdit; - - /** - * An optional array of additional text edits that are applied when - * selecting this color presentation. Edits must not overlap with the main edit nor with themselves. - */ - std::vector<lsTextEdit> additionalTextEdits; - MAKE_SWAP_METHOD(ColorPresentation, label, textEdit, additionalTextEdits) + /** + * 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. + */ + + std::string label; + + /** + * An edit which is applied to a document when selecting + * this presentation for the color. When `null` the label is used. + */ + lsTextEdit textEdit; + + /** + * An optional array of additional text edits that are applied when + * selecting this color presentation. Edits must not overlap with the main edit nor with themselves. + */ + std::vector<lsTextEdit> additionalTextEdits; + MAKE_SWAP_METHOD(ColorPresentation, label, textEdit, additionalTextEdits) }; MAKE_REFLECT_STRUCT(ColorPresentation, label, textEdit, additionalTextEdits) DEFINE_REQUEST_RESPONSE_TYPE(td_colorPresentation, - ColorPresentationParams, std::vector<ColorPresentation>, "textDocument/colorPresentation")
\ No newline at end of file + ColorPresentationParams, std::vector<ColorPresentation>, "textDocument/colorPresentation") diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/completion.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/completion.h index 883c5cfe3a..916d4550e9 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/completion.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/completion.h @@ -41,9 +41,9 @@ struct lsCompletionParams : lsTextDocumentPositionParams { // send this using // `ClientCapabilities.textDocument.completion.contextSupport === true` boost::optional<lsCompletionContext> context; - + MAKE_SWAP_METHOD(lsCompletionParams, textDocument, position, context); - + }; MAKE_REFLECT_STRUCT(lsCompletionParams, textDocument, position, context); @@ -56,9 +56,9 @@ MAKE_REFLECT_STRUCT(lsCompletionParams, textDocument, position, context); namespace TextDocumentComplete{ - - typedef std::pair< boost::optional<std::vector<lsCompletionItem>>, boost::optional<CompletionList> > Either; - + + typedef std::pair< boost::optional<std::vector<lsCompletionItem>>, boost::optional<CompletionList> > Either; + }; extern void Reflect(Reader& visitor, TextDocumentComplete::Either& value); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/didRenameFiles.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/didRenameFiles.h index e8a6235a00..a7c6fdba34 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/didRenameFiles.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/didRenameFiles.h @@ -9,31 +9,31 @@ class FileRenameEvent { public: - std::string oldUri; - std::string newUri; + std::string oldUri; + std::string newUri; - FileRenameEvent() { - } + FileRenameEvent() { + } - FileRenameEvent(std::string oldUri, std::string newUri) { - this->oldUri = oldUri; - this->newUri = newUri; - } - MAKE_SWAP_METHOD(FileRenameEvent, oldUri, newUri); + FileRenameEvent(std::string oldUri, std::string newUri) { + this->oldUri = oldUri; + this->newUri = newUri; + } + MAKE_SWAP_METHOD(FileRenameEvent, oldUri, newUri); }; MAKE_REFLECT_STRUCT(FileRenameEvent, oldUri, newUri); class FileRenameParams { public: - std::vector <FileRenameEvent> files; + std::vector <FileRenameEvent> files; - FileRenameParams() { - } + FileRenameParams() { + } - FileRenameParams(std::vector<FileRenameEvent>& files) { - this->files = files; - } - MAKE_SWAP_METHOD(FileRenameParams, files); + FileRenameParams(std::vector<FileRenameEvent>& files) { + this->files = files; + } + MAKE_SWAP_METHOD(FileRenameParams, files); }; MAKE_REFLECT_STRUCT(FileRenameParams, files); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_change.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_change.h index 0887bf6602..fda407f93f 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_change.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_change.h @@ -8,38 +8,38 @@ #include "LibLsp/lsp/lsRange.h" #include "LibLsp/lsp/lsDocumentUri.h" struct lsTextDocumentContentChangeEvent { - // The range of the document that changed. - boost::optional<lsRange> range; - // The length of the range that got replaced. - boost::optional<int> rangeLength; - // The new text of the range/document. - std::string text; - - MAKE_SWAP_METHOD(lsTextDocumentContentChangeEvent, range, rangeLength, text); + // The range of the document that changed. + boost::optional<lsRange> range; + // The length of the range that got replaced. + boost::optional<int> rangeLength; + // The new text of the range/document. + std::string text; + + MAKE_SWAP_METHOD(lsTextDocumentContentChangeEvent, range, rangeLength, text); }; MAKE_REFLECT_STRUCT(lsTextDocumentContentChangeEvent, range, rangeLength, text); struct lsTextDocumentDidChangeParams { - lsVersionedTextDocumentIdentifier textDocument; - std::vector<lsTextDocumentContentChangeEvent> contentChanges; - - /** - * Legacy property to support protocol version 1.0 requests. - */ - - boost::optional<lsDocumentUri> uri; - - void swap(lsTextDocumentDidChangeParams& arg) noexcept - { - uri.swap(arg.uri); - contentChanges.swap(arg.contentChanges); - textDocument.swap(arg.textDocument); - } + lsVersionedTextDocumentIdentifier textDocument; + std::vector<lsTextDocumentContentChangeEvent> contentChanges; + + /** + * Legacy property to support protocol version 1.0 requests. + */ + + boost::optional<lsDocumentUri> uri; + + void swap(lsTextDocumentDidChangeParams& arg) noexcept + { + uri.swap(arg.uri); + contentChanges.swap(arg.contentChanges); + textDocument.swap(arg.textDocument); + } }; MAKE_REFLECT_STRUCT(lsTextDocumentDidChangeParams, - textDocument, - contentChanges, uri); + textDocument, + contentChanges, uri); /** * The document change notification is sent from the client to the server to diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_close.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_close.h index e2eaa2cfcd..d064819ae9 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_close.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_close.h @@ -11,11 +11,11 @@ namespace TextDocumentDidClose { struct Params { lsTextDocumentIdentifier textDocument; - void swap(Params& arg) noexcept - { - textDocument.swap(arg.textDocument); - } - + void swap(Params& arg) noexcept + { + textDocument.swap(arg.textDocument); + } + }; }; diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_open.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_open.h index 7be7a735d6..ed5dfa535f 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_open.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_open.h @@ -11,15 +11,15 @@ namespace TextDocumentDidOpen { struct Params { lsTextDocumentItem textDocument; - + /** * Legacy property to support protocol version 1.0 requests. */ boost::optional<std::string> text; - + MAKE_SWAP_METHOD(TextDocumentDidOpen::Params, textDocument, text); - + }; } diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_save.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_save.h index 1ce386c415..649c9b76ec 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_save.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_save.h @@ -15,7 +15,7 @@ namespace TextDocumentDidSave { // when the save notifcation was requested. boost::optional<std::string> text; - MAKE_SWAP_METHOD(TextDocumentDidSave::Params, textDocument, text); + MAKE_SWAP_METHOD(TextDocumentDidSave::Params, textDocument, text); }; }; diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/documentColor.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/documentColor.h index 23a6d08d87..9aeeadba05 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/documentColor.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/documentColor.h @@ -7,12 +7,12 @@ #include "LibLsp/lsp/lsRange.h" #include <vector> struct DocumentColorParams { - /** - * The text document. - */ + /** + * The text document. + */ - lsTextDocumentIdentifier textDocument; - MAKE_SWAP_METHOD(DocumentColorParams, textDocument); + lsTextDocumentIdentifier textDocument; + MAKE_SWAP_METHOD(DocumentColorParams, textDocument); }; MAKE_REFLECT_STRUCT(DocumentColorParams, textDocument); @@ -28,46 +28,46 @@ MAKE_REFLECT_STRUCT(DocumentColorParams, textDocument); */ namespace TextDocument { - struct Color { - /** - * The red component of this color in the range [0-1]. - */ - double red = 0; + struct Color { + /** + * The red component of this color in the range [0-1]. + */ + double red = 0; - /** - * The green component of this color in the range [0-1]. - */ - double green = 0; + /** + * The green component of this color in the range [0-1]. + */ + double green = 0; - /** - * The blue component of this color in the range [0-1]. - */ - double blue = 0; + /** + * The blue component of this color in the range [0-1]. + */ + double blue = 0; - /** - * The alpha component of this color in the range [0-1]. - */ - double alpha = 0; - MAKE_SWAP_METHOD(TextDocument::Color, red, green, blue, alpha) - }; + /** + * The alpha component of this color in the range [0-1]. + */ + double alpha = 0; + MAKE_SWAP_METHOD(TextDocument::Color, red, green, blue, alpha) + }; } MAKE_REFLECT_STRUCT(TextDocument::Color, red, green, blue, alpha) struct ColorInformation { - /** - * The range in the document where this color appers. - */ + /** + * The range in the document where this color appers. + */ - lsRange range; + lsRange range; - /** - * The actual color value for this color range. - */ + /** + * The actual color value for this color range. + */ - TextDocument::Color color; - MAKE_SWAP_METHOD(ColorInformation, range, color) + TextDocument::Color color; + MAKE_SWAP_METHOD(ColorInformation, range, color) }; MAKE_REFLECT_STRUCT(ColorInformation,range,color) -DEFINE_REQUEST_RESPONSE_TYPE(td_documentColor, DocumentColorParams,std::vector<ColorInformation>, "textDocument/documentColor");
\ No newline at end of file +DEFINE_REQUEST_RESPONSE_TYPE(td_documentColor, DocumentColorParams,std::vector<ColorInformation>, "textDocument/documentColor"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/document_link.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/document_link.h index 536a625c4c..e450a08df1 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/document_link.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/document_link.h @@ -9,7 +9,7 @@ namespace TextDocumentDocumentLink { struct Params { // The document to provide document links for. lsTextDocumentIdentifier textDocument; - MAKE_SWAP_METHOD(Params, textDocument) + MAKE_SWAP_METHOD(Params, textDocument) }; }; @@ -27,9 +27,9 @@ struct lsDocumentLink { boost::optional<lsDocumentUri> target; boost::optional<lsp::Any> data; - + MAKE_SWAP_METHOD(lsDocumentLink, range, target, data) - + }; MAKE_REFLECT_STRUCT(lsDocumentLink, range, target,data); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/document_symbol.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/document_symbol.h index 8aa6e8b00e..150dde1f0b 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/document_symbol.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/document_symbol.h @@ -18,7 +18,7 @@ MAKE_REFLECT_STRUCT(lsDocumentSymbolParams, textDocument); struct TextDocumentDocumentSymbol{ - typedef std::pair< boost::optional<lsSymbolInformation> , boost::optional<lsDocumentSymbol> > Either; + typedef std::pair< boost::optional<lsSymbolInformation> , boost::optional<lsDocumentSymbol> > Either; }; void Reflect(Reader& visitor, TextDocumentDocumentSymbol::Either& value); @@ -42,14 +42,14 @@ void Reflect(Reader& visitor, TextDocumentDocumentSymbol::Either& value); * </p> */ -//DEFINE_REQUEST_RESPONSE_TYPE(td_symbol, -// lsDocumentSymbolParams, -// std::vector<TextDocumentDocumentSymbol::Either> ); +//DEFINE_REQUEST_RESPONSE_TYPE(td_symbol, +// lsDocumentSymbolParams, +// std::vector<TextDocumentDocumentSymbol::Either> ); // -DEFINE_REQUEST_RESPONSE_TYPE(td_symbol, - lsDocumentSymbolParams, - std::vector< lsDocumentSymbol >,"textDocument/documentSymbol" ); +DEFINE_REQUEST_RESPONSE_TYPE(td_symbol, + lsDocumentSymbolParams, + std::vector< lsDocumentSymbol >,"textDocument/documentSymbol" ); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/foldingRange.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/foldingRange.h index 27977a4517..f863b4991d 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/foldingRange.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/foldingRange.h @@ -9,47 +9,47 @@ struct FoldingRangeRequestParams { - /** - * The text document. - */ + /** + * The text document. + */ - lsTextDocumentIdentifier textDocument; - MAKE_SWAP_METHOD(FoldingRangeRequestParams, textDocument) + lsTextDocumentIdentifier textDocument; + MAKE_SWAP_METHOD(FoldingRangeRequestParams, textDocument) }; MAKE_REFLECT_STRUCT(FoldingRangeRequestParams, textDocument) struct FoldingRange { - /** - * The zero-based line number from where the folded range starts. - */ - int startLine; - - /** - * The zero-based line number where the folded range ends. - */ - int endLine; - - /** - * The zero-based character offset from where the folded range starts. If not defined, defaults - * to the length of the start line. - */ - int startCharacter; - - /** - * The zero-based character offset before the folded range ends. If not defined, defaults to the - * length of the end line. - */ - int endCharacter; - - /** - * 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 - * FoldingRangeKind for an enumeration of standardized kinds. - */ - std::string kind; - - MAKE_SWAP_METHOD(FoldingRange, startLine, endLine, startCharacter, endCharacter, kind) + /** + * The zero-based line number from where the folded range starts. + */ + int startLine; + + /** + * The zero-based line number where the folded range ends. + */ + int endLine; + + /** + * The zero-based character offset from where the folded range starts. If not defined, defaults + * to the length of the start line. + */ + int startCharacter; + + /** + * The zero-based character offset before the folded range ends. If not defined, defaults to the + * length of the end line. + */ + int endCharacter; + + /** + * 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 + * FoldingRangeKind for an enumeration of standardized kinds. + */ + std::string kind; + + MAKE_SWAP_METHOD(FoldingRange, startLine, endLine, startCharacter, endCharacter, kind) }; MAKE_REFLECT_STRUCT(FoldingRange,startLine,endLine,startCharacter,endCharacter,kind) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/formatting.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/formatting.h index ad54e24bf9..49b7883b5f 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/formatting.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/formatting.h @@ -8,15 +8,15 @@ namespace TextDocumentFormatting { struct Params { - /** - * The document to format. - */ + /** + * The document to format. + */ lsTextDocumentIdentifier textDocument; - /** - * The format options. - */ + /** + * The format options. + */ lsFormattingOptions options; - MAKE_SWAP_METHOD(Params, textDocument, options); + MAKE_SWAP_METHOD(Params, textDocument, options); }; }; @@ -28,5 +28,5 @@ MAKE_REFLECT_STRUCT(TextDocumentFormatting::Params, textDocument, options); * Registration Options: TextDocumentRegistrationOptions */ DEFINE_REQUEST_RESPONSE_TYPE(td_formatting, TextDocumentFormatting::Params, - std::vector<lsTextEdit>, "textDocument/formatting"); + std::vector<lsTextEdit>, "textDocument/formatting"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/highlight.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/highlight.h index 332baf69e1..0e01416126 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/highlight.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/highlight.h @@ -14,5 +14,5 @@ */ DEFINE_REQUEST_RESPONSE_TYPE(td_highlight, lsTextDocumentPositionParams, - std::vector<lsDocumentHighlight>, "textDocument/documentHighlight"); + std::vector<lsDocumentHighlight>, "textDocument/documentHighlight"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/hover.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/hover.h index 5302316c6f..06f3f9613e 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/hover.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/hover.h @@ -16,21 +16,21 @@ namespace TextDocumentHover { - typedef boost::optional< std::vector< std::pair<boost::optional<std::string>, boost::optional<lsMarkedString>> > > Left; - typedef std::pair< Left, boost::optional<MarkupContent> > Either; - struct Result { - /** - * The hover's content as markdown - */ - Either contents; - - /** - * An boost::optional range - */ - boost::optional<lsRange> range; - - MAKE_SWAP_METHOD(Result, contents, range) - }; + typedef boost::optional< std::vector< std::pair<boost::optional<std::string>, boost::optional<lsMarkedString>> > > Left; + typedef std::pair< Left, boost::optional<MarkupContent> > Either; + struct Result { + /** + * The hover's content as markdown + */ + Either contents; + + /** + * An boost::optional range + */ + boost::optional<lsRange> range; + + MAKE_SWAP_METHOD(Result, contents, range) + }; } MAKE_REFLECT_STRUCT(TextDocumentHover::Result, contents, range); @@ -44,12 +44,12 @@ DEFINE_REQUEST_RESPONSE_TYPE(td_hover, lsTextDocumentPositionParams, TextDocumen // //}; //MAKE_REFLECT_STRUCT(Rsp_TextDocumentHover, -// jsonrpc, -// id, -// result); +// jsonrpc, +// id, +// result); //MAKE_REFLECT_STRUCT_OPTIONALS_MANDATORY(Rsp_TextDocumentHover, // jsonrpc, -// id, +// id, // result); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/linkedEditingRange.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/linkedEditingRange.h index e4055d359f..96e938a89f 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/linkedEditingRange.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/linkedEditingRange.h @@ -12,40 +12,40 @@ struct LinkedEditingRangeParams { - lsTextDocumentIdentifier textDocument; - lsPosition position; + lsTextDocumentIdentifier textDocument; + lsPosition position; - MAKE_SWAP_METHOD(LinkedEditingRangeParams, - textDocument, - position) + MAKE_SWAP_METHOD(LinkedEditingRangeParams, + textDocument, + position) }; MAKE_REFLECT_STRUCT(LinkedEditingRangeParams, - textDocument, - position) + textDocument, + position) struct LinkedEditingRanges { - /** + /** * A list of ranges that can be renamed together. The ranges must have * identical length and contain identical text content. The ranges cannot overlap. */ std::vector<lsRange> ranges; - /** - * 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. - */ - - boost::optional<std::string> wordPattern; - MAKE_SWAP_METHOD(LinkedEditingRanges, - ranges, - wordPattern) + /** + * 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. + */ + + boost::optional<std::string> wordPattern; + MAKE_SWAP_METHOD(LinkedEditingRanges, + ranges, + wordPattern) }; MAKE_REFLECT_STRUCT(LinkedEditingRanges, - ranges, - wordPattern) + ranges, + wordPattern) DEFINE_REQUEST_RESPONSE_TYPE(td_linkedEditingRange, LinkedEditingRangeParams, - boost::optional<std::vector<LinkedEditingRanges >>,"textDocument/linkedEditingRange")
\ No newline at end of file + boost::optional<std::vector<LinkedEditingRanges >>,"textDocument/linkedEditingRange") diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/onTypeFormatting.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/onTypeFormatting.h index df14ea5d3d..ada2162d12 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/onTypeFormatting.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/onTypeFormatting.h @@ -17,20 +17,20 @@ struct lsDocumentOnTypeFormattingParams lsPosition position; - /** - * The character that has been typed. - */ + /** + * The character that has been typed. + */ std::string ch; MAKE_SWAP_METHOD(lsDocumentOnTypeFormattingParams, - textDocument, - position, - options, ch); + textDocument, + position, + options, ch); }; MAKE_REFLECT_STRUCT(lsDocumentOnTypeFormattingParams, textDocument, - position, + position, options,ch); /** @@ -40,5 +40,5 @@ MAKE_REFLECT_STRUCT(lsDocumentOnTypeFormattingParams, * Registration Options: TextDocumentRegistrationOptions */ DEFINE_REQUEST_RESPONSE_TYPE(td_onTypeFormatting, - lsDocumentOnTypeFormattingParams, std::vector<lsTextEdit>, "textDocument/onTypeFormatting"); + lsDocumentOnTypeFormattingParams, std::vector<lsTextEdit>, "textDocument/onTypeFormatting"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/prepareRename.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/prepareRename.h index 8c653d9864..a7ece38114 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/prepareRename.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/prepareRename.h @@ -13,20 +13,20 @@ * Registration Options: TextDocumentRegistrationOptions */ struct PrepareRenameResult{ - /** - * The range of the string to rename - */ - - lsRange range; + /** + * The range of the string to rename + */ + + lsRange range; /** * A placeholder text of the string content to be renamed. */ - std::string placeholder; - - MAKE_SWAP_METHOD(PrepareRenameResult, range, placeholder) - + std::string placeholder; + + MAKE_SWAP_METHOD(PrepareRenameResult, range, placeholder) + }; MAKE_REFLECT_STRUCT(PrepareRenameResult,range,placeholder) @@ -36,5 +36,5 @@ typedef std::pair< boost::optional< lsRange>, boost::optional<PrepareRenameResu extern void Reflect(Reader& visitor, TextDocumentPrepareRenameResult& value); -DEFINE_REQUEST_RESPONSE_TYPE(td_prepareRename, - lsTextDocumentPositionParams, TextDocumentPrepareRenameResult, "textDocument/prepareRename");
\ No newline at end of file +DEFINE_REQUEST_RESPONSE_TYPE(td_prepareRename, + lsTextDocumentPositionParams, TextDocumentPrepareRenameResult, "textDocument/prepareRename"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/publishDiagnostics.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/publishDiagnostics.h index bf28104bbb..8272df10e8 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/publishDiagnostics.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/publishDiagnostics.h @@ -11,14 +11,14 @@ namespace TextDocumentPublishDiagnostics{ // An array of diagnostic information items. std::vector<lsDiagnostic> diagnostics; - MAKE_SWAP_METHOD(Params,uri,diagnostics); + MAKE_SWAP_METHOD(Params,uri,diagnostics); }; - + }; MAKE_REFLECT_STRUCT(TextDocumentPublishDiagnostics::Params, - uri, - diagnostics); + uri, + diagnostics); /** * Diagnostics notifications are sent from the server to the client to diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/range_formatting.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/range_formatting.h index b2fe750af1..c3c5ff0d0b 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/range_formatting.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/range_formatting.h @@ -13,9 +13,9 @@ struct lsTextDocumentRangeFormattingParams { lsFormattingOptions options; MAKE_SWAP_METHOD(lsTextDocumentRangeFormattingParams, - textDocument, - range, - options) + textDocument, + range, + options) }; MAKE_REFLECT_STRUCT(lsTextDocumentRangeFormattingParams, textDocument, @@ -29,7 +29,7 @@ MAKE_REFLECT_STRUCT(lsTextDocumentRangeFormattingParams, * Registration Options: TextDocumentRegistrationOptions */ DEFINE_REQUEST_RESPONSE_TYPE(td_rangeFormatting, lsTextDocumentRangeFormattingParams, std::vector<lsTextEdit>, - "textDocument/rangeFormatting"); + "textDocument/rangeFormatting"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/references.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/references.h index 2376912756..f398a0b859 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/references.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/references.h @@ -13,16 +13,16 @@ namespace TextDocumentReferences { // Include the declaration of the current symbol. boost::optional<bool> includeDeclaration; MAKE_REFLECT_STRUCT(lsReferenceContext, - includeDeclaration) + includeDeclaration) }; struct Params { lsTextDocumentIdentifier textDocument; lsPosition position; lsReferenceContext context; - MAKE_SWAP_METHOD(Params, - textDocument, - position, - context) + MAKE_SWAP_METHOD(Params, + textDocument, + position, + context) }; @@ -44,5 +44,5 @@ MAKE_REFLECT_STRUCT(TextDocumentReferences::Params, * * Registration Options: TextDocumentRegistrationOptions */ -DEFINE_REQUEST_RESPONSE_TYPE(td_references, TextDocumentReferences::Params, +DEFINE_REQUEST_RESPONSE_TYPE(td_references, TextDocumentReferences::Params, std::vector<lsLocation>, "textDocument/references"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/rename.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/rename.h index 35895f0f4f..8b6d085910 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/rename.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/rename.h @@ -20,10 +20,10 @@ namespace TextDocumentRename { // request must return a [ResponseError](#ResponseError) with an // appropriate message set. std::string newName; - MAKE_SWAP_METHOD(Params, - textDocument, - position, - newName); + MAKE_SWAP_METHOD(Params, + textDocument, + position, + newName); }; }; diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/resolveTypeHierarchy.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/resolveTypeHierarchy.h index eab5f838fc..dceba1fb8f 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/resolveTypeHierarchy.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/resolveTypeHierarchy.h @@ -9,23 +9,23 @@ #include "typeHierarchy.h" struct ResolveTypeHierarchyItemParams { - /** - * The hierarchy item to resolve. - */ + /** + * The hierarchy item to resolve. + */ - TypeHierarchyItem item; + TypeHierarchyItem item; - /** - * The number of hierarchy levels to resolve. {@code 0} indicates no hierarchy level. - */ - boost::optional<int> resolve; + /** + * The number of hierarchy levels to resolve. {@code 0} indicates no hierarchy level. + */ + boost::optional<int> resolve; - /** - * The direction of the type hierarchy resolution. - */ + /** + * The direction of the type hierarchy resolution. + */ - TypeHierarchyDirection direction; - MAKE_SWAP_METHOD(ResolveTypeHierarchyItemParams, item, resolve, direction) + TypeHierarchyDirection direction; + MAKE_SWAP_METHOD(ResolveTypeHierarchyItemParams, item, resolve, direction) }; MAKE_REFLECT_STRUCT(ResolveTypeHierarchyItemParams,item,resolve,direction) DEFINE_REQUEST_RESPONSE_TYPE(typeHierarchy_resolve, ResolveTypeHierarchyItemParams, TypeHierarchyItem, "typeHierarchy/resolve") diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/selectionRange.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/selectionRange.h index 47590e4152..91915275bd 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/selectionRange.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/selectionRange.h @@ -8,35 +8,35 @@ #include "LibLsp/lsp/lsTextDocumentIdentifier.h" struct SelectionRangeParams { - /** - * The text document. - */ + /** + * The text document. + */ - lsTextDocumentIdentifier textDocument; + lsTextDocumentIdentifier textDocument; - /** - * The positions inside the text document. - */ + /** + * The positions inside the text document. + */ + + std::vector<lsPosition> positions; + + MAKE_SWAP_METHOD(SelectionRangeParams, textDocument, positions) - std::vector<lsPosition> positions; - - MAKE_SWAP_METHOD(SelectionRangeParams, textDocument, positions) - }; MAKE_REFLECT_STRUCT(SelectionRangeParams, textDocument, positions) struct SelectionRange { - /** - * The [range](#Range) of this selection range. - */ + /** + * The [range](#Range) of this selection range. + */ - lsRange range; + lsRange range; - /** - * The parent selection range containing this range. Therefore `parent.range` must contain `this.range`. - */ - boost::optional<SelectionRange*> parent; - MAKE_SWAP_METHOD(SelectionRange, range, parent) + /** + * The parent selection range containing this range. Therefore `parent.range` must contain `this.range`. + */ + boost::optional<SelectionRange*> parent; + MAKE_SWAP_METHOD(SelectionRange, range, parent) }; extern void Reflect(Reader& visitor, boost::optional<SelectionRange*>& value); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/semanticHighlighting.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/semanticHighlighting.h index 32bc86f5fb..bfb8619559 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/semanticHighlighting.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/semanticHighlighting.h @@ -10,19 +10,19 @@ */ struct SemanticHighlightingInformation { - /** - * The zero-based line position in the text document. - */ - int line = 0; + /** + * The zero-based line position in the text document. + */ + int line = 0; - /** - * A base64 encoded string representing every single highlighted ranges in the line with its start position, length - * and the "lookup table" index of of the semantic highlighting <a href="https://manual.macromates.com/en/language_grammars"> - * TextMate scopes</a>. If the {@code tokens} is empty or not defined, then no highlighted positions are available for the line. - */ - std::string tokens; + /** + * A base64 encoded string representing every single highlighted ranges in the line with its start position, length + * and the "lookup table" index of of the semantic highlighting <a href="https://manual.macromates.com/en/language_grammars"> + * TextMate scopes</a>. If the {@code tokens} is empty or not defined, then no highlighted positions are available for the line. + */ + std::string tokens; - MAKE_SWAP_METHOD(SemanticHighlightingInformation, line, tokens) + MAKE_SWAP_METHOD(SemanticHighlightingInformation, line, tokens) }; MAKE_REFLECT_STRUCT(SemanticHighlightingInformation, line, tokens); @@ -32,35 +32,35 @@ MAKE_REFLECT_STRUCT(SemanticHighlightingInformation, line, tokens); */ struct SemanticHighlightingParams { - /** - * The text document that has to be decorated with the semantic highlighting information. - */ - - lsVersionedTextDocumentIdentifier textDocument; + /** + * The text document that has to be decorated with the semantic highlighting information. + */ - /** - * An array of semantic highlighting information. - */ + lsVersionedTextDocumentIdentifier textDocument; + + /** + * An array of semantic highlighting information. + */ + + std::vector<SemanticHighlightingInformation> lines; + + MAKE_SWAP_METHOD(SemanticHighlightingParams, textDocument, lines) - std::vector<SemanticHighlightingInformation> lines; - - MAKE_SWAP_METHOD(SemanticHighlightingParams, textDocument, lines) - }; MAKE_REFLECT_STRUCT(SemanticHighlightingParams, textDocument, lines); /** - * The {@code textDocument/semanticHighlighting} notification is pushed from the server to the client - * to inform the client about additional semantic highlighting information that has to be applied - * on the text document. It is the server's responsibility to decide which lines are included in - * the highlighting information. In other words, the server is capable of sending only a delta - * information. For instance, after opening the text document ({@code DidOpenTextDocumentNotification}) - * the server sends the semantic highlighting information for the entire document, but if the server - * receives a {@code DidChangeTextDocumentNotification}, it pushes the information only about - * the affected lines in the document. - * - * <p> - * <b>Note:</b> the <a href= - * "https://github.com/Microsoft/vscode-languageserver-node/pull/367">{@code textDocument/semanticHighlighting} - * language feature</a> is not yet part of the official LSP specification. - */ -DEFINE_NOTIFICATION_TYPE(Notify_semanticHighlighting, SemanticHighlightingParams, "textDocument/semanticHighlighting");
\ No newline at end of file + * The {@code textDocument/semanticHighlighting} notification is pushed from the server to the client + * to inform the client about additional semantic highlighting information that has to be applied + * on the text document. It is the server's responsibility to decide which lines are included in + * the highlighting information. In other words, the server is capable of sending only a delta + * information. For instance, after opening the text document ({@code DidOpenTextDocumentNotification}) + * the server sends the semantic highlighting information for the entire document, but if the server + * receives a {@code DidChangeTextDocumentNotification}, it pushes the information only about + * the affected lines in the document. + * + * <p> + * <b>Note:</b> the <a href= + * "https://github.com/Microsoft/vscode-languageserver-node/pull/367">{@code textDocument/semanticHighlighting} + * language feature</a> is not yet part of the official LSP specification. + */ +DEFINE_NOTIFICATION_TYPE(Notify_semanticHighlighting, SemanticHighlightingParams, "textDocument/semanticHighlighting"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/signature_help.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/signature_help.h index 2a83645901..837096695e 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/signature_help.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/signature_help.h @@ -6,8 +6,8 @@ #include "LibLsp/lsp/lsMarkedString.h" #include "LibLsp/lsp/lsTextDocumentPositionParams.h" -extern void Reflect(Reader& visitor, - std::pair<boost::optional<std::string>, boost::optional<MarkupContent>>& value); +extern void Reflect(Reader& visitor, + std::pair<boost::optional<std::string>, boost::optional<MarkupContent>>& value); @@ -72,9 +72,9 @@ struct lsSignatureHelp { MAKE_SWAP_METHOD(lsSignatureHelp, - signatures, - activeSignature, - activeParameter) + signatures, + activeSignature, + activeParameter) }; MAKE_REFLECT_STRUCT(lsSignatureHelp, signatures, @@ -89,4 +89,4 @@ MAKE_REFLECT_STRUCT(lsSignatureHelp, * * Registration Options: SignatureHelpRegistrationOptions */ -DEFINE_REQUEST_RESPONSE_TYPE(td_signatureHelp, lsTextDocumentPositionParams, lsSignatureHelp, "textDocument/signatureHelp");
\ No newline at end of file +DEFINE_REQUEST_RESPONSE_TYPE(td_signatureHelp, lsTextDocumentPositionParams, lsSignatureHelp, "textDocument/signatureHelp"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/typeHierarchy.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/typeHierarchy.h index b554d751f3..384cfb68c9 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/typeHierarchy.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/typeHierarchy.h @@ -6,34 +6,34 @@ #include "LibLsp/lsp/symbol.h" #include "LibLsp/lsp/lsAny.h" /** - * The {@code textDocument/typeHierarchy} request is sent from the client to the - * server to retrieve a {@link TypeHierarchyItem type hierarchy item} based on - * the {@link TypeHierarchyParams cursor position in the text document}. This - * request would also allow to specify if the item should be resolved and - * whether sub- or supertypes are to be resolved. If no type hierarchy item can - * be found under the given text document position, resolves to {@code null}. - * - * <p> - * <b>Note:</b> the <a href= - * "https://github.com/Microsoft/vscode-languageserver-node/pull/426">{@code textDocument/typeHierarchy} - * language feature</a> is not yet part of the official LSP specification. - */ + * The {@code textDocument/typeHierarchy} request is sent from the client to the + * server to retrieve a {@link TypeHierarchyItem type hierarchy item} based on + * the {@link TypeHierarchyParams cursor position in the text document}. This + * request would also allow to specify if the item should be resolved and + * whether sub- or supertypes are to be resolved. If no type hierarchy item can + * be found under the given text document position, resolves to {@code null}. + * + * <p> + * <b>Note:</b> the <a href= + * "https://github.com/Microsoft/vscode-languageserver-node/pull/426">{@code textDocument/typeHierarchy} + * language feature</a> is not yet part of the official LSP specification. + */ enum class TypeHierarchyDirection : uint32_t{ - /** - * Flag for retrieving/resolving the subtypes. Value: {@code 0}. - */ - Children = 0, + /** + * Flag for retrieving/resolving the subtypes. Value: {@code 0}. + */ + Children = 0, - /** - * Flag to use when retrieving/resolving the supertypes. Value: {@code 1}. - */ - Parents =1, + /** + * Flag to use when retrieving/resolving the supertypes. Value: {@code 1}. + */ + Parents =1, - /** - * Flag for resolving both the super- and subtypes. Value: {@code 2}. - */ - Both=2 + /** + * Flag for resolving both the super- and subtypes. Value: {@code 2}. + */ + Both=2 }; void Reflect(Reader& reader, TypeHierarchyDirection& value); @@ -42,10 +42,10 @@ void Reflect(Writer& writer, TypeHierarchyDirection& value); struct TypeHierarchyParams :public lsTextDocumentPositionParams { - boost::optional<int> resolve; - boost::optional<TypeHierarchyDirection> direction ; - - MAKE_SWAP_METHOD(TypeHierarchyParams, textDocument, position, resolve, direction) + boost::optional<int> resolve; + boost::optional<TypeHierarchyDirection> direction ; + + MAKE_SWAP_METHOD(TypeHierarchyParams, textDocument, position, resolve, direction) }; MAKE_REFLECT_STRUCT(TypeHierarchyParams, textDocument, position, resolve, direction); @@ -58,76 +58,76 @@ MAKE_REFLECT_STRUCT(TypeHierarchyParams, textDocument, position, resolve, direc */ struct TypeHierarchyItem { - /** - * The human readable name of the hierarchy item. - */ - - std::string name; - - /** - * Optional detail for the hierarchy item. It can be, for instance, the signature of a function or method. - */ - boost::optional<std::string> - detail; - - /** - * The kind of the hierarchy item. For instance, class or interface. - */ - - SymbolKind kind; - - /** - * {@code true} if the hierarchy item is deprecated. Otherwise, {@code false}. It is {@code false} by default. - */ - - boost::optional<bool> deprecated; - - /** - * The URI of the text document where this type hierarchy item belongs to. - */ - - lsDocumentUri uri; - - /** - * The range enclosing this type hierarchy item not including leading/trailing whitespace but everything else - * like comments. This information is typically used to determine if the clients cursor is inside the type - * hierarchy item to reveal in the symbol in the UI. - * - * @see TypeHierarchyItem#selectionRange - */ - - lsRange range; - - /** - * The range that should be selected and revealed when this type hierarchy item is being picked, e.g the name of a function. - * Must be contained by the the {@link TypeHierarchyItem#getRange range}. - * - * @see TypeHierarchyItem#range - */ - - lsRange selectionRange; - - /** - * If this type hierarchy item is resolved, it contains the direct parents. Could be empty if the item does not have any - * direct parents. If not defined, the parents have not been resolved yet. - */ - boost::optional< std::vector<TypeHierarchyItem> > parents; - - /** - * If this type hierarchy item is resolved, it contains the direct children of the current item. - * Could be empty if the item does not have any descendants. If not defined, the children have not been resolved. - */ - boost::optional< std::vector<TypeHierarchyItem> > children; - - /** + /** + * The human readable name of the hierarchy item. + */ + + std::string name; + + /** + * Optional detail for the hierarchy item. It can be, for instance, the signature of a function or method. + */ + boost::optional<std::string> + detail; + + /** + * The kind of the hierarchy item. For instance, class or interface. + */ + + SymbolKind kind; + + /** + * {@code true} if the hierarchy item is deprecated. Otherwise, {@code false}. It is {@code false} by default. + */ + + boost::optional<bool> deprecated; + + /** + * The URI of the text document where this type hierarchy item belongs to. + */ + + lsDocumentUri uri; + + /** + * The range enclosing this type hierarchy item not including leading/trailing whitespace but everything else + * like comments. This information is typically used to determine if the clients cursor is inside the type + * hierarchy item to reveal in the symbol in the UI. + * + * @see TypeHierarchyItem#selectionRange + */ + + lsRange range; + + /** + * The range that should be selected and revealed when this type hierarchy item is being picked, e.g the name of a function. + * Must be contained by the the {@link TypeHierarchyItem#getRange range}. + * + * @see TypeHierarchyItem#range + */ + + lsRange selectionRange; + + /** + * If this type hierarchy item is resolved, it contains the direct parents. Could be empty if the item does not have any + * direct parents. If not defined, the parents have not been resolved yet. + */ + boost::optional< std::vector<TypeHierarchyItem> > parents; + + /** + * If this type hierarchy item is resolved, it contains the direct children of the current item. + * Could be empty if the item does not have any descendants. If not defined, the children have not been resolved. + */ + boost::optional< std::vector<TypeHierarchyItem> > children; + + /** * An boost::optional data field can be used to identify a type hierarchy item in a resolve request. */ - boost::optional<lsp::Any> data; + boost::optional<lsp::Any> data; - MAKE_SWAP_METHOD(TypeHierarchyItem, name, detail, kind, deprecated, uri, range, selectionRange, parents, children, data) + MAKE_SWAP_METHOD(TypeHierarchyItem, name, detail, kind, deprecated, uri, range, selectionRange, parents, children, data) }; MAKE_REFLECT_STRUCT(TypeHierarchyItem, name, detail, kind, deprecated, uri, range, selectionRange, parents, children, data); -DEFINE_REQUEST_RESPONSE_TYPE(td_typeHierarchy, TypeHierarchyParams, TypeHierarchyItem, "textDocument/typeHierarchy");
\ No newline at end of file +DEFINE_REQUEST_RESPONSE_TYPE(td_typeHierarchy, TypeHierarchyParams, TypeHierarchyItem, "textDocument/typeHierarchy"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/type_definition.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/type_definition.h index 38ced43b42..196a65c5d3 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/type_definition.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/type_definition.h @@ -13,4 +13,4 @@ * Since version 3.6.0 */ DEFINE_REQUEST_RESPONSE_TYPE(td_typeDefinition, - lsTextDocumentPositionParams, LocationListEither::Either, "textDocument/typeDefinition");
\ No newline at end of file + lsTextDocumentPositionParams, LocationListEither::Either, "textDocument/typeDefinition"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/willSave.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/willSave.h index 84aa0badaa..29afcac41a 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/willSave.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/willSave.h @@ -8,41 +8,41 @@ namespace WillSaveTextDocumentParams { - /** - * Represents reasons why a text document is saved. - */ - enum class 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) - }; - + /** + * Represents reasons why a text document is saved. + */ + enum class 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) + }; + struct Params { - /** - * The document that will be saved. - */ + /** + * The document that will be saved. + */ lsTextDocumentIdentifier textDocument; /* * A reason why a text document is saved. */ - boost::optional<TextDocumentSaveReason> reason; + boost::optional<TextDocumentSaveReason> reason; - MAKE_SWAP_METHOD(Params, textDocument, reason); + MAKE_SWAP_METHOD(Params, textDocument, reason); }; }; @@ -67,5 +67,5 @@ DEFINE_NOTIFICATION_TYPE(td_willSave, WillSaveTextDocumentParams::Params, "textD * Registration Options: TextDocumentRegistrationOptions */ DEFINE_REQUEST_RESPONSE_TYPE(td_willSaveWaitUntil, - WillSaveTextDocumentParams::Params, std::vector<lsTextEdit>, "textDocument/willSaveWaitUntil"); + WillSaveTextDocumentParams::Params, std::vector<lsTextEdit>, "textDocument/willSaveWaitUntil"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/utils.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/utils.h index 796b5d2569..95064c34d6 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/utils.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/utils.h @@ -15,7 +15,7 @@ namespace lsp { - + // Returns true if |value| starts/ends with |start| or |ending|. bool StartsWith(std::string value, std::string start); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/windows/MessageNotify.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/windows/MessageNotify.h index 8499304f55..332fb7e2e7 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/windows/MessageNotify.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/windows/MessageNotify.h @@ -11,20 +11,20 @@ struct MessageParams { /** * The message type. */ - - lsMessageType type = lsMessageType::Error; - + + lsMessageType type = lsMessageType::Error; + /** * The actual message. */ - std::string message; - - void swap(MessageParams& arg) noexcept { - lsMessageType temp = type; - type = arg.type; - arg.type = temp; - message.swap(arg.message); - } + std::string message; + + void swap(MessageParams& arg) noexcept { + lsMessageType temp = type; + type = arg.type; + arg.type = temp; + message.swap(arg.message); + } }; MAKE_REFLECT_STRUCT(MessageParams, type, message) @@ -49,23 +49,23 @@ DEFINE_NOTIFICATION_TYPE(Notify_ShowMessage, MessageParams, "window/showMessage" * answer from the client. */ struct MessageActionItem { - /** - * A short title like 'Retry', 'Open Log' etc. - */ + /** + * A short title like 'Retry', 'Open Log' etc. + */ - std::string title; - MAKE_SWAP_METHOD(MessageActionItem, title) + std::string title; + MAKE_SWAP_METHOD(MessageActionItem, title) }; MAKE_REFLECT_STRUCT(MessageActionItem, title); struct ShowMessageRequestParams :public MessageParams { - /** - * The message action items to present. - */ - std::vector<MessageActionItem> actions; - - MAKE_SWAP_METHOD(ShowMessageRequestParams, type, message, actions) + /** + * The message action items to present. + */ + std::vector<MessageActionItem> actions; + + MAKE_SWAP_METHOD(ShowMessageRequestParams, type, message, actions) }; MAKE_REFLECT_STRUCT(ShowMessageRequestParams, type, message, actions) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/working_files.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/working_files.h index e305fee8d0..916268f0fa 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/working_files.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/working_files.h @@ -44,9 +44,9 @@ struct WorkingFiles { bool GetFileBufferContent(const AbsolutePath& filename, std::wstring& out) { auto file = GetFileByFilename(filename); - if(!file) + if(!file) return false; - return GetFileBufferContent(file, out); + return GetFileBufferContent(file, out); } bool GetFileBufferContent(const AbsolutePath& filename,std::string& out) { diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/applyEdit.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/applyEdit.h index 7e2d8bee0a..d1d4bc85df 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/applyEdit.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/applyEdit.h @@ -8,20 +8,20 @@ struct ApplyWorkspaceEditParams { - /** - * The edits to apply. - */ + /** + * The edits to apply. + */ - lsWorkspaceEdit edit; + lsWorkspaceEdit edit; - /** - * 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. - */ - std::string label; + /** + * 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. + */ + std::string label; - MAKE_SWAP_METHOD(ApplyWorkspaceEditParams, edit, label) + MAKE_SWAP_METHOD(ApplyWorkspaceEditParams, edit, label) }; /** * The workspace/applyEdit request is sent from the server to the client to modify resource on the client side. @@ -32,9 +32,9 @@ MAKE_REFLECT_STRUCT(ApplyWorkspaceEditParams, edit, label); struct ApplyWorkspaceEditResponse { - bool applied; - boost::optional<std::string> failureReason; - MAKE_SWAP_METHOD(ApplyWorkspaceEditResponse, applied, failureReason) + bool applied; + boost::optional<std::string> failureReason; + MAKE_SWAP_METHOD(ApplyWorkspaceEditResponse, applied, failureReason) }; MAKE_REFLECT_STRUCT(ApplyWorkspaceEditResponse, applied, failureReason); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/configuration.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/configuration.h index f7709aa607..ad22bf0185 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/configuration.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/configuration.h @@ -7,22 +7,22 @@ struct ConfigurationItem { - /** - * The scope to get the configuration section for. - */ - lsDocumentUri scopeUri; + /** + * The scope to get the configuration section for. + */ + lsDocumentUri scopeUri; - /** - * The configuration section asked for. - */ - std::string section; - MAKE_SWAP_METHOD(ConfigurationItem, scopeUri, section); + /** + * The configuration section asked for. + */ + std::string section; + MAKE_SWAP_METHOD(ConfigurationItem, scopeUri, section); }; MAKE_REFLECT_STRUCT(ConfigurationItem, scopeUri, section); struct ConfigurationParams { - std::vector<ConfigurationItem> items; - MAKE_SWAP_METHOD(ConfigurationParams, items) + std::vector<ConfigurationItem> items; + MAKE_SWAP_METHOD(ConfigurationParams, items) }; MAKE_REFLECT_STRUCT(ConfigurationParams, items); @@ -34,4 +34,4 @@ MAKE_REFLECT_STRUCT(ConfigurationParams, items); * order of the passed ConfigurationItems (e.g. the first item in the response is the * result for the first configuration item in the params). */ -DEFINE_REQUEST_RESPONSE_TYPE(WorkspaceConfiguration, ConfigurationParams,std::vector<lsp::Any>, "workspace/configuration");
\ No newline at end of file +DEFINE_REQUEST_RESPONSE_TYPE(WorkspaceConfiguration, ConfigurationParams,std::vector<lsp::Any>, "workspace/configuration"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/didChangeWorkspaceFolders.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/didChangeWorkspaceFolders.h index 78f000f30d..1c6cd83b62 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/didChangeWorkspaceFolders.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/didChangeWorkspaceFolders.h @@ -5,30 +5,30 @@ * The workspace folder change event. */ struct WorkspaceFoldersChangeEvent { - /** - * The array of added workspace folders - */ + /** + * The array of added workspace folders + */ - std::vector<WorkspaceFolder> added; + std::vector<WorkspaceFolder> added; - /** - * The array of the removed workspace folders - */ + /** + * The array of the removed workspace folders + */ + + std::vector <WorkspaceFolder> removed; + MAKE_SWAP_METHOD(WorkspaceFoldersChangeEvent, added, removed); - std::vector <WorkspaceFolder> removed; - MAKE_SWAP_METHOD(WorkspaceFoldersChangeEvent, added, removed); - }; MAKE_REFLECT_STRUCT(WorkspaceFoldersChangeEvent, added, removed); struct DidChangeWorkspaceFoldersParams { - /** - * The actual workspace folder change event. - */ + /** + * The actual workspace folder change event. + */ + + WorkspaceFoldersChangeEvent event; - WorkspaceFoldersChangeEvent event; - - MAKE_SWAP_METHOD(DidChangeWorkspaceFoldersParams, event); + MAKE_SWAP_METHOD(DidChangeWorkspaceFoldersParams, event); }; MAKE_REFLECT_STRUCT(DidChangeWorkspaceFoldersParams, event); @@ -40,8 +40,8 @@ MAKE_REFLECT_STRUCT(DidChangeWorkspaceFoldersParams, event); * and ClientCapabilities/workspace/workspaceFolders are true; or if the server has * registered to receive this notification it first. */ -DEFINE_NOTIFICATION_TYPE(Notify_WorkspaceDidChangeWorkspaceFolders, - DidChangeWorkspaceFoldersParams, "workspace/didChangeWorkspaceFolders"); +DEFINE_NOTIFICATION_TYPE(Notify_WorkspaceDidChangeWorkspaceFolders, + DidChangeWorkspaceFoldersParams, "workspace/didChangeWorkspaceFolders"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/did_change_configuration.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/did_change_configuration.h index 8f8acceea4..3e7ca6dded 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/did_change_configuration.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/did_change_configuration.h @@ -9,11 +9,11 @@ struct lsDidChangeConfigurationParams { - /** - * The actual changed settings. - */ - lsp::Any settings; - MAKE_SWAP_METHOD(lsDidChangeConfigurationParams, settings); + /** + * The actual changed settings. + */ + lsp::Any settings; + MAKE_SWAP_METHOD(lsDidChangeConfigurationParams, settings); }; MAKE_REFLECT_STRUCT(lsDidChangeConfigurationParams, settings); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/workspaceFolders.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/workspaceFolders.h index 7cedcfa5f4..1ba33b501c 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/workspaceFolders.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/workspaceFolders.h @@ -5,18 +5,18 @@ #include "LibLsp/lsp/lsDocumentUri.h" struct WorkspaceFolder { - /** - * The associated URI for this workspace folder. - */ + /** + * The associated URI for this workspace folder. + */ - lsDocumentUri uri; + lsDocumentUri uri; - /** - * The name of the workspace folder. Defaults to the uri's basename. - */ - std::string name; + /** + * The name of the workspace folder. Defaults to the uri's basename. + */ + std::string name; - MAKE_SWAP_METHOD(WorkspaceFolder, uri, name) + MAKE_SWAP_METHOD(WorkspaceFolder, uri, name) }; MAKE_REFLECT_STRUCT(WorkspaceFolder, uri, name); @@ -29,6 +29,6 @@ MAKE_REFLECT_STRUCT(WorkspaceFolder, uri, name); * an empty array if a workspace is open but no folders are configured, * the workspace folders otherwise. */ -DEFINE_REQUEST_RESPONSE_TYPE(WorkspaceFolders, - boost::optional<JsonNull>, boost::optional<std::vector< WorkspaceFolder>>, "workspace/workspaceFolders"); +DEFINE_REQUEST_RESPONSE_TYPE(WorkspaceFolders, + boost::optional<JsonNull>, boost::optional<std::vector< WorkspaceFolder>>, "workspace/workspaceFolders"); |