feat: support concurrency
This commit is contained in:
@@ -1,244 +1,244 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
|
||||
using integer = std::int32_t;
|
||||
using uinteger = std::uint32_t;
|
||||
using decimal = double;
|
||||
using boolean = bool;
|
||||
using string = std::string;
|
||||
|
||||
// LSPAny 这样设计是为了glaz序列化
|
||||
struct LSPAny;
|
||||
using LSPObject = std::map<string, LSPAny>;
|
||||
using LSPArray = std::vector<LSPAny>;
|
||||
|
||||
struct LSPAny
|
||||
{
|
||||
using LSPAnyVariant = std::variant<
|
||||
LSPObject,
|
||||
LSPArray,
|
||||
string,
|
||||
decimal, // 放在前面,优先匹配数字
|
||||
boolean,
|
||||
std::nullptr_t>;
|
||||
|
||||
LSPAnyVariant value;
|
||||
|
||||
// 默认构造函数
|
||||
LSPAny();
|
||||
// 拷贝和移动构造函数
|
||||
LSPAny(const LSPAny& other);
|
||||
LSPAny(LSPAny&& other) noexcept;
|
||||
// 针对每种支持的类型的构造函数
|
||||
LSPAny(const std::map<string, LSPAny>& val);
|
||||
LSPAny(std::map<string, LSPAny>&& val);
|
||||
LSPAny(const std::vector<LSPAny>& val);
|
||||
LSPAny(std::vector<LSPAny>&& val);
|
||||
LSPAny(const string& val);
|
||||
LSPAny(string&& val);
|
||||
LSPAny(const char* val);
|
||||
|
||||
// 所有数字类型都转换为 decimal
|
||||
LSPAny(int val);
|
||||
LSPAny(long val);
|
||||
LSPAny(long long val);
|
||||
LSPAny(unsigned int val);
|
||||
LSPAny(unsigned long val);
|
||||
LSPAny(unsigned long long val);
|
||||
LSPAny(float val);
|
||||
LSPAny(double val);
|
||||
LSPAny(long double val);
|
||||
LSPAny(boolean val);
|
||||
LSPAny(std::nullptr_t);
|
||||
|
||||
// 赋值操作符
|
||||
LSPAny& operator=(const LSPAny& other);
|
||||
LSPAny& operator=(LSPAny&& other) noexcept;
|
||||
LSPAny& operator=(const std::map<string, LSPAny>& val);
|
||||
LSPAny& operator=(std::map<string, LSPAny>&& val);
|
||||
LSPAny& operator=(const std::vector<LSPAny>& val);
|
||||
LSPAny& operator=(std::vector<LSPAny>&& val);
|
||||
LSPAny& operator=(const string& val);
|
||||
LSPAny& operator=(string&& val);
|
||||
LSPAny& operator=(const char* val);
|
||||
LSPAny& operator=(int val);
|
||||
LSPAny& operator=(long val);
|
||||
LSPAny& operator=(long long val);
|
||||
LSPAny& operator=(unsigned int val);
|
||||
LSPAny& operator=(unsigned long val);
|
||||
LSPAny& operator=(unsigned long long val);
|
||||
LSPAny& operator=(float val);
|
||||
LSPAny& operator=(double val);
|
||||
LSPAny& operator=(long double val);
|
||||
LSPAny& operator=(boolean val);
|
||||
LSPAny& operator=(std::nullptr_t);
|
||||
|
||||
// 类型检查辅助函数
|
||||
template<typename T>
|
||||
bool is() const;
|
||||
|
||||
template<typename T>
|
||||
T& get();
|
||||
|
||||
template<typename T>
|
||||
const T& get() const;
|
||||
|
||||
// 访问操作符
|
||||
template<typename Visitor>
|
||||
auto visit(Visitor&& visitor) const;
|
||||
|
||||
template<typename Visitor>
|
||||
auto visit(Visitor&& visitor);
|
||||
};
|
||||
|
||||
using ProgressToken = std::variant<integer, string>;
|
||||
|
||||
template<typename T>
|
||||
struct ProgressParams
|
||||
{
|
||||
ProgressToken token;
|
||||
T value;
|
||||
};
|
||||
|
||||
using DocumentUri = string;
|
||||
using URI = string;
|
||||
|
||||
struct Position
|
||||
{
|
||||
uinteger line;
|
||||
uinteger character;
|
||||
};
|
||||
|
||||
using PositionEncodingKind = std::string_view;
|
||||
namespace PositionEncodingKindLiterals
|
||||
{
|
||||
inline constexpr PositionEncodingKind UTF8 = "utf-8";
|
||||
inline constexpr PositionEncodingKind UTF16 = "utf-16";
|
||||
inline constexpr PositionEncodingKind UTF32 = "utf-32";
|
||||
}
|
||||
|
||||
struct Range
|
||||
{
|
||||
Position start;
|
||||
Position end;
|
||||
};
|
||||
|
||||
struct DocumentFilter
|
||||
{
|
||||
string language;
|
||||
string scheme;
|
||||
std::optional<string> pattern;
|
||||
};
|
||||
|
||||
using DocumentSelector = std::vector<DocumentFilter>;
|
||||
|
||||
struct TextEdit
|
||||
{
|
||||
Range range;
|
||||
string newText;
|
||||
};
|
||||
|
||||
struct ChangeAnnotation
|
||||
{
|
||||
string label;
|
||||
boolean needsConfirmation;
|
||||
string description;
|
||||
};
|
||||
|
||||
using ChangeAnnotationIdentifier = string;
|
||||
|
||||
struct AnnotatedTextEdit : TextEdit
|
||||
{
|
||||
ChangeAnnotationIdentifier annotationId;
|
||||
};
|
||||
|
||||
struct Location
|
||||
{
|
||||
DocumentUri uri;
|
||||
Range range;
|
||||
};
|
||||
|
||||
struct LocationLink
|
||||
{
|
||||
Range originSelectionRange;
|
||||
DocumentUri targetUri;
|
||||
Range targetRange;
|
||||
Range targetSelectionRange;
|
||||
};
|
||||
|
||||
struct Command
|
||||
{
|
||||
string title;
|
||||
string command;
|
||||
std::optional<LSPAny> arguments;
|
||||
};
|
||||
|
||||
using MarkupKind = std::string_view;
|
||||
namespace MarkupKindLiterals
|
||||
{
|
||||
inline constexpr MarkupKind PlainText = "plaintext";
|
||||
inline constexpr MarkupKind Markdown = "markdown";
|
||||
};
|
||||
|
||||
struct MarkupContent
|
||||
{
|
||||
MarkupKind kind;
|
||||
string value;
|
||||
};
|
||||
|
||||
struct RegularExpressionsClientCapabilities
|
||||
{
|
||||
string engine;
|
||||
std::optional<string> version;
|
||||
};
|
||||
|
||||
struct MarkdownClientCapabilities
|
||||
{
|
||||
string parser;
|
||||
std::optional<string> version;
|
||||
std::optional<std::vector<string>> allowedTags;
|
||||
};
|
||||
|
||||
// LSP模板方法
|
||||
template<typename T>
|
||||
bool LSPAny::is() const
|
||||
{
|
||||
return std::holds_alternative<T>(value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T& LSPAny::get()
|
||||
{
|
||||
return std::get<T>(value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const T& LSPAny::get() const
|
||||
{
|
||||
return std::get<T>(value);
|
||||
}
|
||||
|
||||
// 访问操作符
|
||||
template<typename Visitor>
|
||||
auto LSPAny::visit(Visitor&& visitor) const
|
||||
{
|
||||
return std::visit(std::forward<Visitor>(visitor), value);
|
||||
}
|
||||
|
||||
template<typename Visitor>
|
||||
auto LSPAny::visit(Visitor&& visitor)
|
||||
{
|
||||
return std::visit(std::forward<Visitor>(visitor), value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#include "./lsp_any.inl"
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
|
||||
using integer = std::int32_t;
|
||||
using uinteger = std::uint32_t;
|
||||
using decimal = double;
|
||||
using boolean = bool;
|
||||
using string = std::string;
|
||||
|
||||
// LSPAny 这样设计是为了glaz序列化
|
||||
struct LSPAny;
|
||||
using LSPObject = std::map<string, LSPAny>;
|
||||
using LSPArray = std::vector<LSPAny>;
|
||||
|
||||
struct LSPAny
|
||||
{
|
||||
using LSPAnyVariant = std::variant<
|
||||
LSPObject,
|
||||
LSPArray,
|
||||
string,
|
||||
decimal, // 放在前面,优先匹配数字
|
||||
boolean,
|
||||
std::nullptr_t>;
|
||||
|
||||
LSPAnyVariant value;
|
||||
|
||||
// 默认构造函数
|
||||
LSPAny();
|
||||
// 拷贝和移动构造函数
|
||||
LSPAny(const LSPAny& other);
|
||||
LSPAny(LSPAny&& other) noexcept;
|
||||
// 针对每种支持的类型的构造函数
|
||||
LSPAny(const std::map<string, LSPAny>& val);
|
||||
LSPAny(std::map<string, LSPAny>&& val);
|
||||
LSPAny(const std::vector<LSPAny>& val);
|
||||
LSPAny(std::vector<LSPAny>&& val);
|
||||
LSPAny(const string& val);
|
||||
LSPAny(string&& val);
|
||||
LSPAny(const char* val);
|
||||
|
||||
// 所有数字类型都转换为 decimal
|
||||
LSPAny(int val);
|
||||
LSPAny(long val);
|
||||
LSPAny(long long val);
|
||||
LSPAny(unsigned int val);
|
||||
LSPAny(unsigned long val);
|
||||
LSPAny(unsigned long long val);
|
||||
LSPAny(float val);
|
||||
LSPAny(double val);
|
||||
LSPAny(long double val);
|
||||
LSPAny(boolean val);
|
||||
LSPAny(std::nullptr_t);
|
||||
|
||||
// 赋值操作符
|
||||
LSPAny& operator=(const LSPAny& other);
|
||||
LSPAny& operator=(LSPAny&& other) noexcept;
|
||||
LSPAny& operator=(const std::map<string, LSPAny>& val);
|
||||
LSPAny& operator=(std::map<string, LSPAny>&& val);
|
||||
LSPAny& operator=(const std::vector<LSPAny>& val);
|
||||
LSPAny& operator=(std::vector<LSPAny>&& val);
|
||||
LSPAny& operator=(const string& val);
|
||||
LSPAny& operator=(string&& val);
|
||||
LSPAny& operator=(const char* val);
|
||||
LSPAny& operator=(int val);
|
||||
LSPAny& operator=(long val);
|
||||
LSPAny& operator=(long long val);
|
||||
LSPAny& operator=(unsigned int val);
|
||||
LSPAny& operator=(unsigned long val);
|
||||
LSPAny& operator=(unsigned long long val);
|
||||
LSPAny& operator=(float val);
|
||||
LSPAny& operator=(double val);
|
||||
LSPAny& operator=(long double val);
|
||||
LSPAny& operator=(boolean val);
|
||||
LSPAny& operator=(std::nullptr_t);
|
||||
|
||||
// 类型检查辅助函数
|
||||
template<typename T>
|
||||
bool is() const;
|
||||
|
||||
template<typename T>
|
||||
T& get();
|
||||
|
||||
template<typename T>
|
||||
const T& get() const;
|
||||
|
||||
// 访问操作符
|
||||
template<typename Visitor>
|
||||
auto visit(Visitor&& visitor) const;
|
||||
|
||||
template<typename Visitor>
|
||||
auto visit(Visitor&& visitor);
|
||||
};
|
||||
|
||||
using ProgressToken = std::variant<integer, string>;
|
||||
|
||||
template<typename T>
|
||||
struct ProgressParams
|
||||
{
|
||||
ProgressToken token;
|
||||
T value;
|
||||
};
|
||||
|
||||
using DocumentUri = string;
|
||||
using URI = string;
|
||||
|
||||
struct Position
|
||||
{
|
||||
uinteger line;
|
||||
uinteger character;
|
||||
};
|
||||
|
||||
using PositionEncodingKind = std::string_view;
|
||||
namespace PositionEncodingKindLiterals
|
||||
{
|
||||
inline constexpr PositionEncodingKind UTF8 = "utf-8";
|
||||
inline constexpr PositionEncodingKind UTF16 = "utf-16";
|
||||
inline constexpr PositionEncodingKind UTF32 = "utf-32";
|
||||
}
|
||||
|
||||
struct Range
|
||||
{
|
||||
Position start;
|
||||
Position end;
|
||||
};
|
||||
|
||||
struct DocumentFilter
|
||||
{
|
||||
string language;
|
||||
string scheme;
|
||||
std::optional<string> pattern;
|
||||
};
|
||||
|
||||
using DocumentSelector = std::vector<DocumentFilter>;
|
||||
|
||||
struct TextEdit
|
||||
{
|
||||
Range range;
|
||||
string newText;
|
||||
};
|
||||
|
||||
struct ChangeAnnotation
|
||||
{
|
||||
string label;
|
||||
boolean needsConfirmation;
|
||||
string description;
|
||||
};
|
||||
|
||||
using ChangeAnnotationIdentifier = string;
|
||||
|
||||
struct AnnotatedTextEdit : TextEdit
|
||||
{
|
||||
ChangeAnnotationIdentifier annotationId;
|
||||
};
|
||||
|
||||
struct Location
|
||||
{
|
||||
DocumentUri uri;
|
||||
Range range;
|
||||
};
|
||||
|
||||
struct LocationLink
|
||||
{
|
||||
Range originSelectionRange;
|
||||
DocumentUri targetUri;
|
||||
Range targetRange;
|
||||
Range targetSelectionRange;
|
||||
};
|
||||
|
||||
struct Command
|
||||
{
|
||||
string title;
|
||||
string command;
|
||||
std::optional<LSPAny> arguments;
|
||||
};
|
||||
|
||||
using MarkupKind = std::string_view;
|
||||
namespace MarkupKindLiterals
|
||||
{
|
||||
inline constexpr MarkupKind PlainText = "plaintext";
|
||||
inline constexpr MarkupKind Markdown = "markdown";
|
||||
};
|
||||
|
||||
struct MarkupContent
|
||||
{
|
||||
MarkupKind kind;
|
||||
string value;
|
||||
};
|
||||
|
||||
struct RegularExpressionsClientCapabilities
|
||||
{
|
||||
string engine;
|
||||
std::optional<string> version;
|
||||
};
|
||||
|
||||
struct MarkdownClientCapabilities
|
||||
{
|
||||
string parser;
|
||||
std::optional<string> version;
|
||||
std::optional<std::vector<string>> allowedTags;
|
||||
};
|
||||
|
||||
// LSP模板方法
|
||||
template<typename T>
|
||||
bool LSPAny::is() const
|
||||
{
|
||||
return std::holds_alternative<T>(value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T& LSPAny::get()
|
||||
{
|
||||
return std::get<T>(value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const T& LSPAny::get() const
|
||||
{
|
||||
return std::get<T>(value);
|
||||
}
|
||||
|
||||
// 访问操作符
|
||||
template<typename Visitor>
|
||||
auto LSPAny::visit(Visitor&& visitor) const
|
||||
{
|
||||
return std::visit(std::forward<Visitor>(visitor), value);
|
||||
}
|
||||
|
||||
template<typename Visitor>
|
||||
auto LSPAny::visit(Visitor&& visitor)
|
||||
{
|
||||
return std::visit(std::forward<Visitor>(visitor), value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#include "./lsp_any.inl"
|
||||
|
||||
@@ -1,212 +1,212 @@
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./progress.hpp"
|
||||
#include "./diagnostics.hpp"
|
||||
#include "./workspace.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
#include "./completion.hpp"
|
||||
#include "./document_features.hpp"
|
||||
#include "./symbols.hpp"
|
||||
#include "./navigation.hpp"
|
||||
#include "./code_actions.hpp"
|
||||
#include "./formatting.hpp"
|
||||
#include "./rename.hpp"
|
||||
#include "./semantic_tokens.hpp"
|
||||
#include "./inline_features.hpp"
|
||||
#include "./signature_help.hpp"
|
||||
#include "./notebook.hpp"
|
||||
#include "./file_operations.hpp"
|
||||
#include "./configuration.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
struct TextDocumentClientCapabilities
|
||||
{
|
||||
std::optional<TextDocumentSyncClientCapabilities> synchronization;
|
||||
std::optional<CompletionClientCapabilities> completion;
|
||||
std::optional<HoverClientCapabilities> hover;
|
||||
std::optional<SignatureHelpClientCapabilities> singatureHelp;
|
||||
std::optional<DeclarationClientCapabilities> declatration;
|
||||
std::optional<DefinitionClientCapabilities> definition;
|
||||
std::optional<TypeDefinitionClientCapabilities> typeDefinition;
|
||||
std::optional<ImplementationClientCapabilities> implementation;
|
||||
std::optional<ReferenceClientCapabilities> reference;
|
||||
std::optional<DocumentHighlightClientCapabilities> documentHighlight;
|
||||
std::optional<DocumentSymbolClientCapabilities> documentSymbol;
|
||||
std::optional<CodeActionClientCapabilities> codeAction;
|
||||
std::optional<CodeLensClientCapabilities> codeLens;
|
||||
std::optional<DocumentLinkClientCapabilities> documentLink;
|
||||
std::optional<DocumentColorClientCapabilities> colorProvider;
|
||||
std::optional<DocumentFormattingClientCapabilities> formatting;
|
||||
std::optional<DocumentRangeFormattingClientCapabilities> rangeFormatting;
|
||||
std::optional<DocumentOnTypeFormattingClientCapabilities> onTypeFormatting;
|
||||
std::optional<RenameClientCapabilities> rename;
|
||||
std::optional<PublishDiagnosticsClientCapabilities> publishDiagnostics;
|
||||
std::optional<FoldingRangeClientCapabilities> foldingRange;
|
||||
std::optional<SelectionRangeClientCapabilities> selectionRange;
|
||||
std::optional<LinkedEditingRangeClientCapabilities> linkedEditingRange;
|
||||
std::optional<CallHierarchyClientCapabilities> callHierarchy;
|
||||
std::optional<SemanticTokensClientCapabilities> semanticTokens;
|
||||
std::optional<MonikerClientCapabilities> moniker;
|
||||
std::optional<TypeHierarchyClientCapabilities> typeHierarchy;
|
||||
std::optional<InlineValueClientCapabilities> inlineValue;
|
||||
std::optional<InlayHintClientCapabilities> inlayHint;
|
||||
std::optional<DiagnosticClientCapabilities> diagnostic;
|
||||
};
|
||||
|
||||
struct ClientCapabilities
|
||||
{
|
||||
struct Workspace
|
||||
{
|
||||
struct FileOperations
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<boolean> didCreate;
|
||||
std::optional<boolean> willCreate;
|
||||
std::optional<boolean> didRename;
|
||||
std::optional<boolean> willRename;
|
||||
std::optional<boolean> didDelete;
|
||||
std::optional<boolean> willDelete;
|
||||
};
|
||||
|
||||
std::optional<boolean> applyEdit;
|
||||
std::optional<WorkspaceEditClientCapabilities> workspaceEdit;
|
||||
std::optional<DidChangeConfigurationClientCapabilities> didChangeConfiguration;
|
||||
std::optional<DidChangeWatchedFilesClientCapabilities> didChangeWatchedFiles;
|
||||
std::optional<WorkspaceSymbolClientCapabilities> symbol;
|
||||
std::optional<ExecuteCommandClientCapabilities> executeCommand;
|
||||
std::optional<boolean> workspaceFolders;
|
||||
std::optional<boolean> configuration;
|
||||
std::optional<SemanticTokensWorkspaceClientCapabilities> semanticTokens;
|
||||
std::optional<CodeLensWorkspaceClientCapabilities> codeLens;
|
||||
std::optional<FileOperations> fileOperations;
|
||||
std::optional<InlineValueClientCapabilities> inlineValue;
|
||||
std::optional<InlayHintClientCapabilities> inlayHint;
|
||||
std::optional<DiagnosticClientCapabilities> diagnostic;
|
||||
};
|
||||
struct Window
|
||||
{
|
||||
std::optional<boolean> workDoneProgress;
|
||||
std::optional<ShowMessageRequestClientCapabilities> showMessage;
|
||||
std::optional<ShowDocumentClientCapabilities> showDocument;
|
||||
};
|
||||
struct General
|
||||
{
|
||||
struct StaleRequestSupport
|
||||
{
|
||||
boolean cancel;
|
||||
std::vector<string> retryOnContentModified;
|
||||
};
|
||||
|
||||
std::optional<StaleRequestSupport> staleRequestSupport;
|
||||
std::optional<RegularExpressionsClientCapabilities> regularExpression;
|
||||
std::optional<MarkdownClientCapabilities> markdown;
|
||||
std::optional<std::vector<PositionEncodingKind>> positionEncodings;
|
||||
};
|
||||
|
||||
std::optional<Workspace> workspace;
|
||||
std::optional<TextDocumentClientCapabilities> textDocument;
|
||||
std::optional<NotebookDocumentClientCapabilities> notebookDocument;
|
||||
std::optional<Window> window;
|
||||
std::optional<General> general;
|
||||
std::optional<LSPAny> experimental;
|
||||
};
|
||||
|
||||
struct ServerCapabilities
|
||||
{
|
||||
struct Workspace
|
||||
{
|
||||
struct FileOperations
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<boolean> didCreate;
|
||||
std::optional<boolean> willCreate;
|
||||
std::optional<boolean> didRename;
|
||||
std::optional<boolean> willRename;
|
||||
std::optional<boolean> didDelete;
|
||||
std::optional<boolean> willDelete;
|
||||
};
|
||||
|
||||
std::optional<WorkspaceFolderServerCapabilities> workspaceFolders;
|
||||
std::optional<FileOperations> fileOperations;
|
||||
};
|
||||
|
||||
std::optional<PositionEncodingKind> positionEncoding;
|
||||
std::optional<std::variant<TextDocumentSyncOptions, TextDocumentSyncKind>> textDocumentSync;
|
||||
std::optional<std::variant<NotebookDocumentSyncOptions, NotebookDocumentSyncRegistrationOptions>> notebookDocumentSync;
|
||||
std::optional<CompletionOptions> completionProvider;
|
||||
std::optional<std::variant<boolean, HoverOptions>> hoverProvider;
|
||||
std::optional<SignatureHelpOptions> signatureHelpProvider;
|
||||
std::optional<std::variant<boolean, DeclarationOptions, DeclarationRegistrationOptions>> declarationProvider;
|
||||
std::optional<std::variant<boolean, DefinitionOptions>> definitionProvider;
|
||||
std::optional<std::variant<boolean, TypeDefinitionOptions, TypeDefinitionRegistrationOptions>> typeDefinitionProvider;
|
||||
std::optional<std::variant<boolean, ImplementationOptions, ImplementationRegistrationOptions>> implementationProvider;
|
||||
std::optional<std::variant<boolean, ReferenceOptions>> referencesProvider;
|
||||
std::optional<std::variant<boolean, DocumentHighlightOptions>> documentHighlightProvider;
|
||||
std::optional<std::variant<boolean, DocumentSymbolOptions>> documentSymbolProvider;
|
||||
std::optional<std::variant<boolean, CodeActionOptions>> codeActionProvider;
|
||||
std::optional<CodeLensOptions> codeLensProvider;
|
||||
std::optional<DocumentLinkOptions> documentLinkProvider;
|
||||
std::optional<std::variant<boolean, DocumentColorOptions, DocumentColorRegistrationOptions>> colorProvider;
|
||||
std::optional<std::variant<boolean, DocumentFormattingOptions>> documentFormattingProvider;
|
||||
std::optional<std::variant<boolean, DocumentRangeFormattingOptions>> documentRangeFormattingProvider;
|
||||
std::optional<DocumentOnTypeFormattingOptions> documentOnTypeFormattingProvider;
|
||||
std::optional<std::variant<boolean, RenameOptions>> renameProvider;
|
||||
std::optional<std::variant<boolean, FoldingRangeOptions, FoldingRangeRegistrationOptions>> foldingRangeProvider;
|
||||
std::optional<ExecuteCommandOptions> executeCommandProvider;
|
||||
std::optional<std::variant<boolean, SelectionRangeOptions, SelectionRangeRegistrationOptions>> selectionRangeProvider;
|
||||
std::optional<std::variant<boolean, LinkedEditingRangeOptions, LinkedEditingRangeRegistrationOptions>> linkedEditingRangeProvider;
|
||||
std::optional<std::variant<boolean, CallHierarchyOptions, CallHierarchyRegistrationOptions>> callHierarchyProvider;
|
||||
std::optional<std::variant<SemanticTokensOptions, SemanticTokensRegistrationOptions>> semanticTokensProvider;
|
||||
std::optional<std::variant<boolean, MonikerOptions, MonikerRegistrationOptions>> monikerProvider;
|
||||
std::optional<std::variant<boolean, TypeHierarchyOptions, TypeHierarchyRegistrationOptions>> typeHierarchyProvider;
|
||||
std::optional<std::variant<boolean, InlineValueOptions, InlineValueRegistrationOptions>> inlineValueProvider;
|
||||
std::optional<std::variant<boolean, InlayHintOptions, InlayHintRegistrationOptions>> inlayHintProvider;
|
||||
std::optional<std::variant<DiagnosticOptions, DiagnosticRegistrationOptions>> diagnosticProvider;
|
||||
std::optional<std::variant<boolean, WorkspaceSymbolOptions>> workspaceSymbolProvider;
|
||||
std::optional<Workspace> workspace;
|
||||
std::optional<LSPAny> experimental;
|
||||
};
|
||||
|
||||
struct InitializeResult
|
||||
{
|
||||
struct ServerInfo
|
||||
{
|
||||
string name;
|
||||
std::optional<string> version;
|
||||
};
|
||||
|
||||
ServerCapabilities capabilities;
|
||||
ServerInfo serverInfo;
|
||||
};
|
||||
|
||||
enum class InitializeErrorCodes
|
||||
{
|
||||
kUnknownProtocolVersion = 1
|
||||
};
|
||||
|
||||
struct InitializeError
|
||||
{
|
||||
boolean retry;
|
||||
};
|
||||
|
||||
struct InitializeParams : WorkDoneProgressParams
|
||||
{
|
||||
struct ClientInfo
|
||||
{
|
||||
string name;
|
||||
std::optional<string> version;
|
||||
};
|
||||
|
||||
std::optional<integer> processId;
|
||||
std::optional<ClientInfo> clientInfo;
|
||||
std::optional<string> locale;
|
||||
std::optional<string> rootPath;
|
||||
std::optional<DocumentUri> rootUri;
|
||||
std::optional<LSPAny> initializationOptions;
|
||||
std::optional<ClientCapabilities> capabilities;
|
||||
TraceValue trace;
|
||||
std::optional<std::vector<WorkspaceFolder>> workspaceFolders;
|
||||
};
|
||||
|
||||
}
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./progress.hpp"
|
||||
#include "./diagnostics.hpp"
|
||||
#include "./workspace.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
#include "./completion.hpp"
|
||||
#include "./document_features.hpp"
|
||||
#include "./symbols.hpp"
|
||||
#include "./navigation.hpp"
|
||||
#include "./code_actions.hpp"
|
||||
#include "./formatting.hpp"
|
||||
#include "./rename.hpp"
|
||||
#include "./semantic_tokens.hpp"
|
||||
#include "./inline_features.hpp"
|
||||
#include "./signature_help.hpp"
|
||||
#include "./notebook.hpp"
|
||||
#include "./file_operations.hpp"
|
||||
#include "./configuration.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
struct TextDocumentClientCapabilities
|
||||
{
|
||||
std::optional<TextDocumentSyncClientCapabilities> synchronization;
|
||||
std::optional<CompletionClientCapabilities> completion;
|
||||
std::optional<HoverClientCapabilities> hover;
|
||||
std::optional<SignatureHelpClientCapabilities> singatureHelp;
|
||||
std::optional<DeclarationClientCapabilities> declatration;
|
||||
std::optional<DefinitionClientCapabilities> definition;
|
||||
std::optional<TypeDefinitionClientCapabilities> typeDefinition;
|
||||
std::optional<ImplementationClientCapabilities> implementation;
|
||||
std::optional<ReferenceClientCapabilities> reference;
|
||||
std::optional<DocumentHighlightClientCapabilities> documentHighlight;
|
||||
std::optional<DocumentSymbolClientCapabilities> documentSymbol;
|
||||
std::optional<CodeActionClientCapabilities> codeAction;
|
||||
std::optional<CodeLensClientCapabilities> codeLens;
|
||||
std::optional<DocumentLinkClientCapabilities> documentLink;
|
||||
std::optional<DocumentColorClientCapabilities> colorProvider;
|
||||
std::optional<DocumentFormattingClientCapabilities> formatting;
|
||||
std::optional<DocumentRangeFormattingClientCapabilities> rangeFormatting;
|
||||
std::optional<DocumentOnTypeFormattingClientCapabilities> onTypeFormatting;
|
||||
std::optional<RenameClientCapabilities> rename;
|
||||
std::optional<PublishDiagnosticsClientCapabilities> publishDiagnostics;
|
||||
std::optional<FoldingRangeClientCapabilities> foldingRange;
|
||||
std::optional<SelectionRangeClientCapabilities> selectionRange;
|
||||
std::optional<LinkedEditingRangeClientCapabilities> linkedEditingRange;
|
||||
std::optional<CallHierarchyClientCapabilities> callHierarchy;
|
||||
std::optional<SemanticTokensClientCapabilities> semanticTokens;
|
||||
std::optional<MonikerClientCapabilities> moniker;
|
||||
std::optional<TypeHierarchyClientCapabilities> typeHierarchy;
|
||||
std::optional<InlineValueClientCapabilities> inlineValue;
|
||||
std::optional<InlayHintClientCapabilities> inlayHint;
|
||||
std::optional<DiagnosticClientCapabilities> diagnostic;
|
||||
};
|
||||
|
||||
struct ClientCapabilities
|
||||
{
|
||||
struct Workspace
|
||||
{
|
||||
struct FileOperations
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<boolean> didCreate;
|
||||
std::optional<boolean> willCreate;
|
||||
std::optional<boolean> didRename;
|
||||
std::optional<boolean> willRename;
|
||||
std::optional<boolean> didDelete;
|
||||
std::optional<boolean> willDelete;
|
||||
};
|
||||
|
||||
std::optional<boolean> applyEdit;
|
||||
std::optional<WorkspaceEditClientCapabilities> workspaceEdit;
|
||||
std::optional<DidChangeConfigurationClientCapabilities> didChangeConfiguration;
|
||||
std::optional<DidChangeWatchedFilesClientCapabilities> didChangeWatchedFiles;
|
||||
std::optional<WorkspaceSymbolClientCapabilities> symbol;
|
||||
std::optional<ExecuteCommandClientCapabilities> executeCommand;
|
||||
std::optional<boolean> workspaceFolders;
|
||||
std::optional<boolean> configuration;
|
||||
std::optional<SemanticTokensWorkspaceClientCapabilities> semanticTokens;
|
||||
std::optional<CodeLensWorkspaceClientCapabilities> codeLens;
|
||||
std::optional<FileOperations> fileOperations;
|
||||
std::optional<InlineValueClientCapabilities> inlineValue;
|
||||
std::optional<InlayHintClientCapabilities> inlayHint;
|
||||
std::optional<DiagnosticClientCapabilities> diagnostic;
|
||||
};
|
||||
struct Window
|
||||
{
|
||||
std::optional<boolean> workDoneProgress;
|
||||
std::optional<ShowMessageRequestClientCapabilities> showMessage;
|
||||
std::optional<ShowDocumentClientCapabilities> showDocument;
|
||||
};
|
||||
struct General
|
||||
{
|
||||
struct StaleRequestSupport
|
||||
{
|
||||
boolean cancel;
|
||||
std::vector<string> retryOnContentModified;
|
||||
};
|
||||
|
||||
std::optional<StaleRequestSupport> staleRequestSupport;
|
||||
std::optional<RegularExpressionsClientCapabilities> regularExpression;
|
||||
std::optional<MarkdownClientCapabilities> markdown;
|
||||
std::optional<std::vector<PositionEncodingKind>> positionEncodings;
|
||||
};
|
||||
|
||||
std::optional<Workspace> workspace;
|
||||
std::optional<TextDocumentClientCapabilities> textDocument;
|
||||
std::optional<NotebookDocumentClientCapabilities> notebookDocument;
|
||||
std::optional<Window> window;
|
||||
std::optional<General> general;
|
||||
std::optional<LSPAny> experimental;
|
||||
};
|
||||
|
||||
struct ServerCapabilities
|
||||
{
|
||||
struct Workspace
|
||||
{
|
||||
struct FileOperations
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<boolean> didCreate;
|
||||
std::optional<boolean> willCreate;
|
||||
std::optional<boolean> didRename;
|
||||
std::optional<boolean> willRename;
|
||||
std::optional<boolean> didDelete;
|
||||
std::optional<boolean> willDelete;
|
||||
};
|
||||
|
||||
std::optional<WorkspaceFolderServerCapabilities> workspaceFolders;
|
||||
std::optional<FileOperations> fileOperations;
|
||||
};
|
||||
|
||||
std::optional<PositionEncodingKind> positionEncoding;
|
||||
std::optional<std::variant<TextDocumentSyncOptions, TextDocumentSyncKind>> textDocumentSync;
|
||||
std::optional<std::variant<NotebookDocumentSyncOptions, NotebookDocumentSyncRegistrationOptions>> notebookDocumentSync;
|
||||
std::optional<CompletionOptions> completionProvider;
|
||||
std::optional<std::variant<boolean, HoverOptions>> hoverProvider;
|
||||
std::optional<SignatureHelpOptions> signatureHelpProvider;
|
||||
std::optional<std::variant<boolean, DeclarationOptions, DeclarationRegistrationOptions>> declarationProvider;
|
||||
std::optional<std::variant<boolean, DefinitionOptions>> definitionProvider;
|
||||
std::optional<std::variant<boolean, TypeDefinitionOptions, TypeDefinitionRegistrationOptions>> typeDefinitionProvider;
|
||||
std::optional<std::variant<boolean, ImplementationOptions, ImplementationRegistrationOptions>> implementationProvider;
|
||||
std::optional<std::variant<boolean, ReferenceOptions>> referencesProvider;
|
||||
std::optional<std::variant<boolean, DocumentHighlightOptions>> documentHighlightProvider;
|
||||
std::optional<std::variant<boolean, DocumentSymbolOptions>> documentSymbolProvider;
|
||||
std::optional<std::variant<boolean, CodeActionOptions>> codeActionProvider;
|
||||
std::optional<CodeLensOptions> codeLensProvider;
|
||||
std::optional<DocumentLinkOptions> documentLinkProvider;
|
||||
std::optional<std::variant<boolean, DocumentColorOptions, DocumentColorRegistrationOptions>> colorProvider;
|
||||
std::optional<std::variant<boolean, DocumentFormattingOptions>> documentFormattingProvider;
|
||||
std::optional<std::variant<boolean, DocumentRangeFormattingOptions>> documentRangeFormattingProvider;
|
||||
std::optional<DocumentOnTypeFormattingOptions> documentOnTypeFormattingProvider;
|
||||
std::optional<std::variant<boolean, RenameOptions>> renameProvider;
|
||||
std::optional<std::variant<boolean, FoldingRangeOptions, FoldingRangeRegistrationOptions>> foldingRangeProvider;
|
||||
std::optional<ExecuteCommandOptions> executeCommandProvider;
|
||||
std::optional<std::variant<boolean, SelectionRangeOptions, SelectionRangeRegistrationOptions>> selectionRangeProvider;
|
||||
std::optional<std::variant<boolean, LinkedEditingRangeOptions, LinkedEditingRangeRegistrationOptions>> linkedEditingRangeProvider;
|
||||
std::optional<std::variant<boolean, CallHierarchyOptions, CallHierarchyRegistrationOptions>> callHierarchyProvider;
|
||||
std::optional<std::variant<SemanticTokensOptions, SemanticTokensRegistrationOptions>> semanticTokensProvider;
|
||||
std::optional<std::variant<boolean, MonikerOptions, MonikerRegistrationOptions>> monikerProvider;
|
||||
std::optional<std::variant<boolean, TypeHierarchyOptions, TypeHierarchyRegistrationOptions>> typeHierarchyProvider;
|
||||
std::optional<std::variant<boolean, InlineValueOptions, InlineValueRegistrationOptions>> inlineValueProvider;
|
||||
std::optional<std::variant<boolean, InlayHintOptions, InlayHintRegistrationOptions>> inlayHintProvider;
|
||||
std::optional<std::variant<DiagnosticOptions, DiagnosticRegistrationOptions>> diagnosticProvider;
|
||||
std::optional<std::variant<boolean, WorkspaceSymbolOptions>> workspaceSymbolProvider;
|
||||
std::optional<Workspace> workspace;
|
||||
std::optional<LSPAny> experimental;
|
||||
};
|
||||
|
||||
struct InitializeResult
|
||||
{
|
||||
struct ServerInfo
|
||||
{
|
||||
string name;
|
||||
std::optional<string> version;
|
||||
};
|
||||
|
||||
ServerCapabilities capabilities;
|
||||
ServerInfo serverInfo;
|
||||
};
|
||||
|
||||
enum class InitializeErrorCodes
|
||||
{
|
||||
kUnknownProtocolVersion = 1
|
||||
};
|
||||
|
||||
struct InitializeError
|
||||
{
|
||||
boolean retry;
|
||||
};
|
||||
|
||||
struct InitializeParams : WorkDoneProgressParams
|
||||
{
|
||||
struct ClientInfo
|
||||
{
|
||||
string name;
|
||||
std::optional<string> version;
|
||||
};
|
||||
|
||||
std::optional<integer> processId;
|
||||
std::optional<ClientInfo> clientInfo;
|
||||
std::optional<string> locale;
|
||||
std::optional<string> rootPath;
|
||||
std::optional<DocumentUri> rootUri;
|
||||
std::optional<LSPAny> initializationOptions;
|
||||
std::optional<ClientCapabilities> capabilities;
|
||||
TraceValue trace;
|
||||
std::optional<std::vector<WorkspaceFolder>> workspaceFolders;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,141 +1,141 @@
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
#include "./progress.hpp"
|
||||
#include "./workspace.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
using CodeActionKind = std::string_view;
|
||||
namespace CodeActionKindLiterals
|
||||
{
|
||||
inline constexpr CodeActionKind Empty = "";
|
||||
inline constexpr CodeActionKind QuickFix = "quickfix";
|
||||
inline constexpr CodeActionKind Refactor = "refactor";
|
||||
inline constexpr CodeActionKind RefactorExtract = "refactor.extract";
|
||||
inline constexpr CodeActionKind RefactorInline = "refactor.inline";
|
||||
inline constexpr CodeActionKind RefactorRewrite = "refactor.rewrite";
|
||||
inline constexpr CodeActionKind Source = "source";
|
||||
inline constexpr CodeActionKind SourceOrganizeImports = "source.organizeImports";
|
||||
inline constexpr CodeActionKind SourceFixAll = "source.fixAll";
|
||||
}
|
||||
|
||||
struct CodeActionClientCapabilities
|
||||
{
|
||||
struct CodeActionLiteralSupport
|
||||
{
|
||||
struct CodeActionKinds
|
||||
{
|
||||
std::vector<CodeActionKind> valueSet;
|
||||
};
|
||||
};
|
||||
|
||||
struct ResolveSupport
|
||||
{
|
||||
std::vector<string> properties;
|
||||
};
|
||||
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<CodeActionLiteralSupport> codeActionLiteralSupport;
|
||||
std::optional<boolean> isPreferredSupport;
|
||||
std::optional<boolean> disabledSupport;
|
||||
std::optional<ResolveSupport> resolveSupport;
|
||||
std::optional<boolean> honorsChangeAnnotations;
|
||||
};
|
||||
|
||||
struct CodeActionOptions : WorkDoneProgressOptions
|
||||
{
|
||||
std::optional<std::vector<CodeActionKind>> codeActionKinds;
|
||||
std::optional<boolean> resolveProvider;
|
||||
};
|
||||
|
||||
struct CodeActionRegistrationOptions : TextDocumentRegistrationOptions, CodeActionOptions
|
||||
{
|
||||
};
|
||||
|
||||
enum class CodeActionTriggerKind
|
||||
{
|
||||
kInvoked = 1,
|
||||
kAutomatic = 2
|
||||
};
|
||||
|
||||
struct CodeActionContext
|
||||
{
|
||||
std::vector<Diagnostic> diagnostics;
|
||||
std::optional<std::vector<CodeActionKind>> only;
|
||||
std::optional<CodeActionTriggerKind> triggerKind;
|
||||
};
|
||||
|
||||
struct CodeActionParams : TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
Range range;
|
||||
CodeActionContext context;
|
||||
};
|
||||
|
||||
struct CodeAction
|
||||
{
|
||||
struct Disabled
|
||||
{
|
||||
string reason;
|
||||
};
|
||||
|
||||
string title;
|
||||
std::optional<CodeActionKind> kind;
|
||||
std::optional<std::vector<Diagnostic>> diagnostics;
|
||||
std::optional<boolean> isPreferred;
|
||||
std::optional<Disabled> disabled;
|
||||
std::optional<WorkspaceEdit> edit;
|
||||
std::optional<Command> command;
|
||||
std::optional<LSPAny> data;
|
||||
};
|
||||
|
||||
// Color
|
||||
struct DocumentColorClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct DocumentColorOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DocumentColorRegistrationOptions : TextDocumentRegistrationOptions, DocumentColorOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DocumentColorParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
};
|
||||
|
||||
struct Color
|
||||
{
|
||||
decimal red;
|
||||
decimal green;
|
||||
decimal blue;
|
||||
decimal alpha;
|
||||
};
|
||||
|
||||
struct ColorInformation
|
||||
{
|
||||
Range range;
|
||||
Color color;
|
||||
};
|
||||
|
||||
struct ColorPresentationParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
Color color;
|
||||
Range range;
|
||||
};
|
||||
|
||||
struct ColorPresentation
|
||||
{
|
||||
string label;
|
||||
std::optional<TextEdit> textEdit;
|
||||
std::optional<std::vector<TextEdit>> additionalTextEdits;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
#include "./progress.hpp"
|
||||
#include "./workspace.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
using CodeActionKind = std::string_view;
|
||||
namespace CodeActionKindLiterals
|
||||
{
|
||||
inline constexpr CodeActionKind Empty = "";
|
||||
inline constexpr CodeActionKind QuickFix = "quickfix";
|
||||
inline constexpr CodeActionKind Refactor = "refactor";
|
||||
inline constexpr CodeActionKind RefactorExtract = "refactor.extract";
|
||||
inline constexpr CodeActionKind RefactorInline = "refactor.inline";
|
||||
inline constexpr CodeActionKind RefactorRewrite = "refactor.rewrite";
|
||||
inline constexpr CodeActionKind Source = "source";
|
||||
inline constexpr CodeActionKind SourceOrganizeImports = "source.organizeImports";
|
||||
inline constexpr CodeActionKind SourceFixAll = "source.fixAll";
|
||||
}
|
||||
|
||||
struct CodeActionClientCapabilities
|
||||
{
|
||||
struct CodeActionLiteralSupport
|
||||
{
|
||||
struct CodeActionKinds
|
||||
{
|
||||
std::vector<CodeActionKind> valueSet;
|
||||
};
|
||||
};
|
||||
|
||||
struct ResolveSupport
|
||||
{
|
||||
std::vector<string> properties;
|
||||
};
|
||||
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<CodeActionLiteralSupport> codeActionLiteralSupport;
|
||||
std::optional<boolean> isPreferredSupport;
|
||||
std::optional<boolean> disabledSupport;
|
||||
std::optional<ResolveSupport> resolveSupport;
|
||||
std::optional<boolean> honorsChangeAnnotations;
|
||||
};
|
||||
|
||||
struct CodeActionOptions : WorkDoneProgressOptions
|
||||
{
|
||||
std::optional<std::vector<CodeActionKind>> codeActionKinds;
|
||||
std::optional<boolean> resolveProvider;
|
||||
};
|
||||
|
||||
struct CodeActionRegistrationOptions : TextDocumentRegistrationOptions, CodeActionOptions
|
||||
{
|
||||
};
|
||||
|
||||
enum class CodeActionTriggerKind
|
||||
{
|
||||
kInvoked = 1,
|
||||
kAutomatic = 2
|
||||
};
|
||||
|
||||
struct CodeActionContext
|
||||
{
|
||||
std::vector<Diagnostic> diagnostics;
|
||||
std::optional<std::vector<CodeActionKind>> only;
|
||||
std::optional<CodeActionTriggerKind> triggerKind;
|
||||
};
|
||||
|
||||
struct CodeActionParams : TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
Range range;
|
||||
CodeActionContext context;
|
||||
};
|
||||
|
||||
struct CodeAction
|
||||
{
|
||||
struct Disabled
|
||||
{
|
||||
string reason;
|
||||
};
|
||||
|
||||
string title;
|
||||
std::optional<CodeActionKind> kind;
|
||||
std::optional<std::vector<Diagnostic>> diagnostics;
|
||||
std::optional<boolean> isPreferred;
|
||||
std::optional<Disabled> disabled;
|
||||
std::optional<WorkspaceEdit> edit;
|
||||
std::optional<Command> command;
|
||||
std::optional<LSPAny> data;
|
||||
};
|
||||
|
||||
// Color
|
||||
struct DocumentColorClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct DocumentColorOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DocumentColorRegistrationOptions : TextDocumentRegistrationOptions, DocumentColorOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DocumentColorParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
};
|
||||
|
||||
struct Color
|
||||
{
|
||||
decimal red;
|
||||
decimal green;
|
||||
decimal blue;
|
||||
decimal alpha;
|
||||
};
|
||||
|
||||
struct ColorInformation
|
||||
{
|
||||
Range range;
|
||||
Color color;
|
||||
};
|
||||
|
||||
struct ColorPresentationParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
Color color;
|
||||
Range range;
|
||||
};
|
||||
|
||||
struct ColorPresentation
|
||||
{
|
||||
string label;
|
||||
std::optional<TextEdit> textEdit;
|
||||
std::optional<std::vector<TextEdit>> additionalTextEdits;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,185 +1,185 @@
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
#include "./progress.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
enum class CompletionItemTag
|
||||
{
|
||||
kDeprecated = 1
|
||||
};
|
||||
|
||||
enum class InsertTextMode
|
||||
{
|
||||
kAsIs = 1,
|
||||
kAdjustIndentation = 2
|
||||
};
|
||||
|
||||
enum class CompletionItemKind
|
||||
{
|
||||
kText = 1,
|
||||
kMethod = 2,
|
||||
kFunction = 3,
|
||||
kConstructor = 4,
|
||||
kField = 5,
|
||||
kVariable = 6,
|
||||
kClass = 7,
|
||||
kInterface = 8,
|
||||
kModule = 9,
|
||||
kProperty = 10,
|
||||
kUnit = 11,
|
||||
kValue = 12,
|
||||
kEnum = 13,
|
||||
kKeyword = 14,
|
||||
kSnippet = 15,
|
||||
kColor = 16,
|
||||
kFile = 17,
|
||||
kReference = 18,
|
||||
kFolder = 19,
|
||||
kEnumMember = 20,
|
||||
kConstant = 21,
|
||||
kStruct = 22,
|
||||
kEvent = 23,
|
||||
kOperator = 24,
|
||||
kTypeParameter = 25
|
||||
};
|
||||
|
||||
enum class InsertTextFormat
|
||||
{
|
||||
kPlainText = 1,
|
||||
kSnippet = 2
|
||||
};
|
||||
|
||||
enum CompletionTriggerKind
|
||||
{
|
||||
kInvoked = 1,
|
||||
kTriggerCharacter = 2,
|
||||
kTriggerForIncompleteCompletions = 3
|
||||
};
|
||||
|
||||
struct CompletionContext
|
||||
{
|
||||
CompletionTriggerKind triggerKind;
|
||||
std::optional<string> triggerCharacter;
|
||||
};
|
||||
|
||||
struct InsertReplaceEdit
|
||||
{
|
||||
string newText;
|
||||
Range insert;
|
||||
Range replace;
|
||||
};
|
||||
|
||||
struct CompletionItemLabelDetails
|
||||
{
|
||||
std::optional<std::string> detail;
|
||||
std::optional<std::string> description;
|
||||
};
|
||||
|
||||
struct CompletionItem
|
||||
{
|
||||
string label;
|
||||
std::optional<CompletionItemLabelDetails> labelDetails;
|
||||
std::optional<CompletionItemKind> kind;
|
||||
std::optional<string> detail;
|
||||
std::optional<std::variant<string, MarkupContent>> documentation;
|
||||
std::optional<boolean> preselect;
|
||||
std::optional<string> sortText;
|
||||
std::optional<string> filterText;
|
||||
std::optional<string> insertText;
|
||||
std::optional<InsertTextFormat> insertTextFormat;
|
||||
std::optional<InsertTextMode> insertTextMode;
|
||||
std::optional<std::variant<TextEdit, InsertReplaceEdit>> textEdit;
|
||||
std::optional<string> textEditText;
|
||||
std::optional<std::vector<TextEdit>> additionalTextEdits;
|
||||
std::optional<std::vector<string>> commitCharacters;
|
||||
std::optional<Command> command;
|
||||
std::optional<LSPAny> data;
|
||||
};
|
||||
|
||||
struct CompletionList
|
||||
{
|
||||
struct ItemDefaults
|
||||
{
|
||||
struct EditRange
|
||||
{
|
||||
Range insert;
|
||||
Range replace;
|
||||
};
|
||||
std::optional<std::vector<string>> commitCharacters;
|
||||
std::optional<std::variant<Range, EditRange>> editRange;
|
||||
std::optional<InsertTextFormat> insertTextFormat;
|
||||
std::optional<InsertTextMode> insertTextMode;
|
||||
std::optional<LSPAny> data;
|
||||
};
|
||||
boolean isIncomplete;
|
||||
ItemDefaults itemDefaults;
|
||||
std::vector<CompletionItem> items;
|
||||
};
|
||||
|
||||
struct CompletionClientCapabilities
|
||||
{
|
||||
struct CompletionItem
|
||||
{
|
||||
struct TagSupport
|
||||
{
|
||||
std::optional<std::vector<CompletionItemTag>> valueSet;
|
||||
};
|
||||
struct ResolveSupport
|
||||
{
|
||||
std::vector<string> properties;
|
||||
};
|
||||
struct InsertTextModeSupport
|
||||
{
|
||||
std::optional<std::vector<InsertTextMode>> valueSet;
|
||||
};
|
||||
|
||||
boolean snippetSupport;
|
||||
std::optional<boolean> commitCharactersSupport;
|
||||
std::optional<std::vector<MarkupKind>> documentationFormat;
|
||||
std::optional<boolean> deprecatedSupport;
|
||||
std::optional<boolean> preselectSupport;
|
||||
std::optional<TagSupport> tagSupport;
|
||||
boolean insertReplaceSupport;
|
||||
ResolveSupport resolveSupport;
|
||||
std::optional<InsertTextModeSupport> insertTextModeSupport;
|
||||
boolean labelDetailsSupport;
|
||||
};
|
||||
struct CompletionItemKinds
|
||||
{
|
||||
std::optional<std::vector<string>> valueSet;
|
||||
};
|
||||
struct CompletionList
|
||||
{
|
||||
std::vector<string> itemDefault;
|
||||
};
|
||||
|
||||
boolean dynamicRegistration;
|
||||
std::optional<CompletionItem> completionItem;
|
||||
std::optional<CompletionItemKinds> completionItemKind;
|
||||
std::optional<boolean> contextSupport;
|
||||
std::optional<InsertTextMode> insertTextMode;
|
||||
std::optional<CompletionList> completionList;
|
||||
};
|
||||
|
||||
struct CompletionOptions : WorkDoneProgressOptions
|
||||
{
|
||||
struct CompletionItem
|
||||
{
|
||||
std::optional<boolean> labelDetailsSupport;
|
||||
};
|
||||
std::optional<std::vector<string>> triggerCharacters;
|
||||
std::optional<std::vector<string>> allCommitCharacters;
|
||||
std::optional<boolean> resolveProvider;
|
||||
std::optional<CompletionItem> completionItem;
|
||||
};
|
||||
struct CompletionRegistrationOptions : TextDocumentRegistrationOptions, CompletionOptions
|
||||
{
|
||||
};
|
||||
struct CompletionParams : TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
std::optional<CompletionContext> context;
|
||||
};
|
||||
|
||||
}
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
#include "./progress.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
enum class CompletionItemTag
|
||||
{
|
||||
kDeprecated = 1
|
||||
};
|
||||
|
||||
enum class InsertTextMode
|
||||
{
|
||||
kAsIs = 1,
|
||||
kAdjustIndentation = 2
|
||||
};
|
||||
|
||||
enum class CompletionItemKind
|
||||
{
|
||||
kText = 1,
|
||||
kMethod = 2,
|
||||
kFunction = 3,
|
||||
kConstructor = 4,
|
||||
kField = 5,
|
||||
kVariable = 6,
|
||||
kClass = 7,
|
||||
kInterface = 8,
|
||||
kModule = 9,
|
||||
kProperty = 10,
|
||||
kUnit = 11,
|
||||
kValue = 12,
|
||||
kEnum = 13,
|
||||
kKeyword = 14,
|
||||
kSnippet = 15,
|
||||
kColor = 16,
|
||||
kFile = 17,
|
||||
kReference = 18,
|
||||
kFolder = 19,
|
||||
kEnumMember = 20,
|
||||
kConstant = 21,
|
||||
kStruct = 22,
|
||||
kEvent = 23,
|
||||
kOperator = 24,
|
||||
kTypeParameter = 25
|
||||
};
|
||||
|
||||
enum class InsertTextFormat
|
||||
{
|
||||
kPlainText = 1,
|
||||
kSnippet = 2
|
||||
};
|
||||
|
||||
enum CompletionTriggerKind
|
||||
{
|
||||
kInvoked = 1,
|
||||
kTriggerCharacter = 2,
|
||||
kTriggerForIncompleteCompletions = 3
|
||||
};
|
||||
|
||||
struct CompletionContext
|
||||
{
|
||||
CompletionTriggerKind triggerKind;
|
||||
std::optional<string> triggerCharacter;
|
||||
};
|
||||
|
||||
struct InsertReplaceEdit
|
||||
{
|
||||
string newText;
|
||||
Range insert;
|
||||
Range replace;
|
||||
};
|
||||
|
||||
struct CompletionItemLabelDetails
|
||||
{
|
||||
std::optional<std::string> detail;
|
||||
std::optional<std::string> description;
|
||||
};
|
||||
|
||||
struct CompletionItem
|
||||
{
|
||||
string label;
|
||||
std::optional<CompletionItemLabelDetails> labelDetails;
|
||||
std::optional<CompletionItemKind> kind;
|
||||
std::optional<string> detail;
|
||||
std::optional<std::variant<string, MarkupContent>> documentation;
|
||||
std::optional<boolean> preselect;
|
||||
std::optional<string> sortText;
|
||||
std::optional<string> filterText;
|
||||
std::optional<string> insertText;
|
||||
std::optional<InsertTextFormat> insertTextFormat;
|
||||
std::optional<InsertTextMode> insertTextMode;
|
||||
std::optional<std::variant<TextEdit, InsertReplaceEdit>> textEdit;
|
||||
std::optional<string> textEditText;
|
||||
std::optional<std::vector<TextEdit>> additionalTextEdits;
|
||||
std::optional<std::vector<string>> commitCharacters;
|
||||
std::optional<Command> command;
|
||||
std::optional<LSPAny> data;
|
||||
};
|
||||
|
||||
struct CompletionList
|
||||
{
|
||||
struct ItemDefaults
|
||||
{
|
||||
struct EditRange
|
||||
{
|
||||
Range insert;
|
||||
Range replace;
|
||||
};
|
||||
std::optional<std::vector<string>> commitCharacters;
|
||||
std::optional<std::variant<Range, EditRange>> editRange;
|
||||
std::optional<InsertTextFormat> insertTextFormat;
|
||||
std::optional<InsertTextMode> insertTextMode;
|
||||
std::optional<LSPAny> data;
|
||||
};
|
||||
boolean isIncomplete;
|
||||
ItemDefaults itemDefaults;
|
||||
std::vector<CompletionItem> items;
|
||||
};
|
||||
|
||||
struct CompletionClientCapabilities
|
||||
{
|
||||
struct CompletionItem
|
||||
{
|
||||
struct TagSupport
|
||||
{
|
||||
std::optional<std::vector<CompletionItemTag>> valueSet;
|
||||
};
|
||||
struct ResolveSupport
|
||||
{
|
||||
std::vector<string> properties;
|
||||
};
|
||||
struct InsertTextModeSupport
|
||||
{
|
||||
std::optional<std::vector<InsertTextMode>> valueSet;
|
||||
};
|
||||
|
||||
boolean snippetSupport;
|
||||
std::optional<boolean> commitCharactersSupport;
|
||||
std::optional<std::vector<MarkupKind>> documentationFormat;
|
||||
std::optional<boolean> deprecatedSupport;
|
||||
std::optional<boolean> preselectSupport;
|
||||
std::optional<TagSupport> tagSupport;
|
||||
boolean insertReplaceSupport;
|
||||
ResolveSupport resolveSupport;
|
||||
std::optional<InsertTextModeSupport> insertTextModeSupport;
|
||||
boolean labelDetailsSupport;
|
||||
};
|
||||
struct CompletionItemKinds
|
||||
{
|
||||
std::optional<std::vector<string>> valueSet;
|
||||
};
|
||||
struct CompletionList
|
||||
{
|
||||
std::vector<string> itemDefault;
|
||||
};
|
||||
|
||||
boolean dynamicRegistration;
|
||||
std::optional<CompletionItem> completionItem;
|
||||
std::optional<CompletionItemKinds> completionItemKind;
|
||||
std::optional<boolean> contextSupport;
|
||||
std::optional<InsertTextMode> insertTextMode;
|
||||
std::optional<CompletionList> completionList;
|
||||
};
|
||||
|
||||
struct CompletionOptions : WorkDoneProgressOptions
|
||||
{
|
||||
struct CompletionItem
|
||||
{
|
||||
std::optional<boolean> labelDetailsSupport;
|
||||
};
|
||||
std::optional<std::vector<string>> triggerCharacters;
|
||||
std::optional<std::vector<string>> allCommitCharacters;
|
||||
std::optional<boolean> resolveProvider;
|
||||
std::optional<CompletionItem> completionItem;
|
||||
};
|
||||
struct CompletionRegistrationOptions : TextDocumentRegistrationOptions, CompletionOptions
|
||||
{
|
||||
};
|
||||
struct CompletionParams : TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
std::optional<CompletionContext> context;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,111 +1,111 @@
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./progress.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
// Configuration
|
||||
struct ConfigurationItem
|
||||
{
|
||||
std::optional<URI> scopeUri;
|
||||
std::optional<string> section;
|
||||
};
|
||||
|
||||
struct ConfigurationParams
|
||||
{
|
||||
std::vector<ConfigurationParams> items;
|
||||
};
|
||||
|
||||
struct DidChangeConfigurationClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct DidChangeConfigurationParams
|
||||
{
|
||||
LSPAny settings;
|
||||
};
|
||||
|
||||
// Command Execution
|
||||
struct ExecuteCommandClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct ExecuteCommandOptions : WorkDoneProgressOptions
|
||||
{
|
||||
std::vector<Command> commands;
|
||||
};
|
||||
|
||||
struct ExecuteCommandRegistrationOptions : ExecuteCommandOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct ExecuteCommandParams : WorkDoneProgressParams
|
||||
{
|
||||
string command;
|
||||
std::optional<std::vector<LSPAny>> arguments;
|
||||
};
|
||||
|
||||
// Message
|
||||
enum class MessageType
|
||||
{
|
||||
kError = 1,
|
||||
kWarning = 2,
|
||||
kInfo = 3,
|
||||
kLog = 4,
|
||||
kDebug = 5
|
||||
};
|
||||
|
||||
struct ShowMessageParams
|
||||
{
|
||||
MessageType type;
|
||||
string message;
|
||||
};
|
||||
|
||||
struct ShowMessageRequestClientCapabilities
|
||||
{
|
||||
struct MessageActionItem
|
||||
{
|
||||
std::optional<boolean> additionalPropertiesSupport;
|
||||
};
|
||||
std::optional<MessageActionItem> messageActionItem;
|
||||
};
|
||||
|
||||
struct MessageActionItem
|
||||
{
|
||||
std::string title;
|
||||
};
|
||||
|
||||
struct ShowMessageRequestParams
|
||||
{
|
||||
MessageType type;
|
||||
string message;
|
||||
std::optional<std::vector<MessageActionItem>> actions;
|
||||
};
|
||||
|
||||
struct ShowDocumentClientCapabilities
|
||||
{
|
||||
boolean support;
|
||||
};
|
||||
|
||||
struct ShowDocumentParams
|
||||
{
|
||||
URI uri;
|
||||
std::optional<boolean> external;
|
||||
std::optional<boolean> takeFocus;
|
||||
std::optional<boolean> selection;
|
||||
};
|
||||
|
||||
struct ShowDocumentResult
|
||||
{
|
||||
boolean success;
|
||||
};
|
||||
|
||||
struct LogMessageParams
|
||||
{
|
||||
MessageType type;
|
||||
string message;
|
||||
};
|
||||
|
||||
}
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./progress.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
// Configuration
|
||||
struct ConfigurationItem
|
||||
{
|
||||
std::optional<URI> scopeUri;
|
||||
std::optional<string> section;
|
||||
};
|
||||
|
||||
struct ConfigurationParams
|
||||
{
|
||||
std::vector<ConfigurationParams> items;
|
||||
};
|
||||
|
||||
struct DidChangeConfigurationClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct DidChangeConfigurationParams
|
||||
{
|
||||
LSPAny settings;
|
||||
};
|
||||
|
||||
// Command Execution
|
||||
struct ExecuteCommandClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct ExecuteCommandOptions : WorkDoneProgressOptions
|
||||
{
|
||||
std::vector<Command> commands;
|
||||
};
|
||||
|
||||
struct ExecuteCommandRegistrationOptions : ExecuteCommandOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct ExecuteCommandParams : WorkDoneProgressParams
|
||||
{
|
||||
string command;
|
||||
std::optional<std::vector<LSPAny>> arguments;
|
||||
};
|
||||
|
||||
// Message
|
||||
enum class MessageType
|
||||
{
|
||||
kError = 1,
|
||||
kWarning = 2,
|
||||
kInfo = 3,
|
||||
kLog = 4,
|
||||
kDebug = 5
|
||||
};
|
||||
|
||||
struct ShowMessageParams
|
||||
{
|
||||
MessageType type;
|
||||
string message;
|
||||
};
|
||||
|
||||
struct ShowMessageRequestClientCapabilities
|
||||
{
|
||||
struct MessageActionItem
|
||||
{
|
||||
std::optional<boolean> additionalPropertiesSupport;
|
||||
};
|
||||
std::optional<MessageActionItem> messageActionItem;
|
||||
};
|
||||
|
||||
struct MessageActionItem
|
||||
{
|
||||
std::string title;
|
||||
};
|
||||
|
||||
struct ShowMessageRequestParams
|
||||
{
|
||||
MessageType type;
|
||||
string message;
|
||||
std::optional<std::vector<MessageActionItem>> actions;
|
||||
};
|
||||
|
||||
struct ShowDocumentClientCapabilities
|
||||
{
|
||||
boolean support;
|
||||
};
|
||||
|
||||
struct ShowDocumentParams
|
||||
{
|
||||
URI uri;
|
||||
std::optional<boolean> external;
|
||||
std::optional<boolean> takeFocus;
|
||||
std::optional<boolean> selection;
|
||||
};
|
||||
|
||||
struct ShowDocumentResult
|
||||
{
|
||||
boolean success;
|
||||
};
|
||||
|
||||
struct LogMessageParams
|
||||
{
|
||||
MessageType type;
|
||||
string message;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,169 +1,169 @@
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
#include "./progress.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
enum class DiagnosticSeverity
|
||||
{
|
||||
kError = 1,
|
||||
kWarning = 2,
|
||||
kInformation = 3,
|
||||
kHint = 4
|
||||
};
|
||||
|
||||
enum class DiagnosticTag
|
||||
{
|
||||
kUnnecessary = 1,
|
||||
kDeprecated = 2
|
||||
};
|
||||
|
||||
struct DiagnosticRelatedInformation
|
||||
{
|
||||
Location location;
|
||||
string message;
|
||||
};
|
||||
|
||||
struct CodeDescription
|
||||
{
|
||||
string href;
|
||||
};
|
||||
|
||||
struct Diagnostic
|
||||
{
|
||||
Range range;
|
||||
std::optional<DiagnosticSeverity> severity;
|
||||
std::optional<integer> code;
|
||||
std::optional<string> codeDescription;
|
||||
std::optional<string> source;
|
||||
string message;
|
||||
std::optional<std::vector<DiagnosticTag>> tags;
|
||||
std::optional<std::vector<DiagnosticRelatedInformation>> relatedInformation;
|
||||
std::optional<LSPAny> data;
|
||||
};
|
||||
|
||||
struct PublishDiagnosticsClientCapabilities
|
||||
{
|
||||
struct TagSupport
|
||||
{
|
||||
std::vector<DiagnosticTag> valueSet;
|
||||
};
|
||||
std::optional<boolean> relatedInformation;
|
||||
std::optional<TagSupport> tagSupport;
|
||||
std::optional<boolean> versionSupport;
|
||||
std::optional<boolean> codeDescriptionSupport;
|
||||
std::optional<boolean> dataSupport;
|
||||
};
|
||||
|
||||
struct PublishDiagnosticsParams
|
||||
{
|
||||
DocumentUri uri;
|
||||
std::optional<integer> version;
|
||||
std::vector<Diagnostic> diagnostics;
|
||||
};
|
||||
|
||||
struct DiagnosticClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<boolean> relatedDocumentSupport;
|
||||
};
|
||||
struct DiagnosticOptions : WorkDoneProgressOptions
|
||||
{
|
||||
std::optional<string> identifier;
|
||||
boolean interFileDependencies;
|
||||
boolean workspaceDiagnostics;
|
||||
};
|
||||
struct DiagnosticRegistrationOptions : TextDocumentRegistrationOptions, DiagnosticOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
struct DiagnosticParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
std::optional<string> identifier;
|
||||
std::optional<string> previousResultId;
|
||||
};
|
||||
|
||||
using DocumentDiagnosticReportKind = std::string_view;
|
||||
namespace DocumentDiagnosticReportKindLiterals
|
||||
{
|
||||
inline constexpr DocumentDiagnosticReportKind Full = "full";
|
||||
inline constexpr DocumentDiagnosticReportKind Unchanged = "unchanged";
|
||||
}
|
||||
|
||||
struct FullDocumentDiagnosticReport
|
||||
{
|
||||
DocumentDiagnosticReportKind kind = DocumentDiagnosticReportKindLiterals::Full;
|
||||
std::optional<string> resultId;
|
||||
std::vector<Diagnostic> items;
|
||||
};
|
||||
|
||||
struct UnchangedDocumentDiagnosticReport
|
||||
{
|
||||
DocumentDiagnosticReportKind kind = DocumentDiagnosticReportKindLiterals::Unchanged;
|
||||
std::optional<string> resultId;
|
||||
};
|
||||
|
||||
struct RelatedFullDocumentDiagnosticReport : FullDocumentDiagnosticReport
|
||||
{
|
||||
std::optional<std::map<string, std::variant<FullDocumentDiagnosticReport, UnchangedDocumentDiagnosticReport>>> relatedDocuments;
|
||||
};
|
||||
|
||||
struct RelatedUnchangedDocumentDiagnosticReport : UnchangedDocumentDiagnosticReport
|
||||
{
|
||||
std::optional<std::map<string, std::variant<FullDocumentDiagnosticReport, UnchangedDocumentDiagnosticReport>>> relatedDocuments;
|
||||
};
|
||||
|
||||
struct DocumentDiagnosticReportPartialResult
|
||||
{
|
||||
std::optional<std::map<string, std::variant<FullDocumentDiagnosticReport, UnchangedDocumentDiagnosticReport>>> relatedDocuments;
|
||||
};
|
||||
|
||||
using DocumentDiagnosticReport = std::variant<RelatedFullDocumentDiagnosticReport, RelatedUnchangedDocumentDiagnosticReport>;
|
||||
|
||||
struct DiagnosticServerCancellationData
|
||||
{
|
||||
std::optional<boolean> retriggerRequest;
|
||||
};
|
||||
|
||||
struct PreviousResultId
|
||||
{
|
||||
DocumentUri uri;
|
||||
string value;
|
||||
};
|
||||
|
||||
struct WorkspaceDiagnosticParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
std::optional<string> identifier;
|
||||
std::vector<PreviousResultId> previousResultIds;
|
||||
};
|
||||
|
||||
struct WorkspaceFullDocumentDiagnosticReport : FullDocumentDiagnosticReport
|
||||
{
|
||||
DocumentUri uri;
|
||||
std::optional<integer> version;
|
||||
};
|
||||
|
||||
struct WorkspaceUnchangedDocumentDiagnosticReport : UnchangedDocumentDiagnosticReport
|
||||
{
|
||||
DocumentUri uri;
|
||||
std::optional<integer> version;
|
||||
};
|
||||
|
||||
using WorkspaceDocumentDiagnosticReport = std::variant<WorkspaceFullDocumentDiagnosticReport, WorkspaceUnchangedDocumentDiagnosticReport>;
|
||||
struct WorkspaceDiagnosticReport
|
||||
{
|
||||
std::vector<WorkspaceDocumentDiagnosticReport> items;
|
||||
};
|
||||
|
||||
struct WorkspaceDiagnosticReportPartialResult
|
||||
{
|
||||
std::vector<WorkspaceDocumentDiagnosticReport> items;
|
||||
};
|
||||
|
||||
struct DiagnosticWorkspaceClientCapabilities
|
||||
{
|
||||
std::optional<boolean> refreshSupport;
|
||||
};
|
||||
|
||||
}
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
#include "./progress.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
enum class DiagnosticSeverity
|
||||
{
|
||||
kError = 1,
|
||||
kWarning = 2,
|
||||
kInformation = 3,
|
||||
kHint = 4
|
||||
};
|
||||
|
||||
enum class DiagnosticTag
|
||||
{
|
||||
kUnnecessary = 1,
|
||||
kDeprecated = 2
|
||||
};
|
||||
|
||||
struct DiagnosticRelatedInformation
|
||||
{
|
||||
Location location;
|
||||
string message;
|
||||
};
|
||||
|
||||
struct CodeDescription
|
||||
{
|
||||
string href;
|
||||
};
|
||||
|
||||
struct Diagnostic
|
||||
{
|
||||
Range range;
|
||||
std::optional<DiagnosticSeverity> severity;
|
||||
std::optional<integer> code;
|
||||
std::optional<string> codeDescription;
|
||||
std::optional<string> source;
|
||||
string message;
|
||||
std::optional<std::vector<DiagnosticTag>> tags;
|
||||
std::optional<std::vector<DiagnosticRelatedInformation>> relatedInformation;
|
||||
std::optional<LSPAny> data;
|
||||
};
|
||||
|
||||
struct PublishDiagnosticsClientCapabilities
|
||||
{
|
||||
struct TagSupport
|
||||
{
|
||||
std::vector<DiagnosticTag> valueSet;
|
||||
};
|
||||
std::optional<boolean> relatedInformation;
|
||||
std::optional<TagSupport> tagSupport;
|
||||
std::optional<boolean> versionSupport;
|
||||
std::optional<boolean> codeDescriptionSupport;
|
||||
std::optional<boolean> dataSupport;
|
||||
};
|
||||
|
||||
struct PublishDiagnosticsParams
|
||||
{
|
||||
DocumentUri uri;
|
||||
std::optional<integer> version;
|
||||
std::vector<Diagnostic> diagnostics;
|
||||
};
|
||||
|
||||
struct DiagnosticClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<boolean> relatedDocumentSupport;
|
||||
};
|
||||
struct DiagnosticOptions : WorkDoneProgressOptions
|
||||
{
|
||||
std::optional<string> identifier;
|
||||
boolean interFileDependencies;
|
||||
boolean workspaceDiagnostics;
|
||||
};
|
||||
struct DiagnosticRegistrationOptions : TextDocumentRegistrationOptions, DiagnosticOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
struct DiagnosticParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
std::optional<string> identifier;
|
||||
std::optional<string> previousResultId;
|
||||
};
|
||||
|
||||
using DocumentDiagnosticReportKind = std::string_view;
|
||||
namespace DocumentDiagnosticReportKindLiterals
|
||||
{
|
||||
inline constexpr DocumentDiagnosticReportKind Full = "full";
|
||||
inline constexpr DocumentDiagnosticReportKind Unchanged = "unchanged";
|
||||
}
|
||||
|
||||
struct FullDocumentDiagnosticReport
|
||||
{
|
||||
DocumentDiagnosticReportKind kind = DocumentDiagnosticReportKindLiterals::Full;
|
||||
std::optional<string> resultId;
|
||||
std::vector<Diagnostic> items;
|
||||
};
|
||||
|
||||
struct UnchangedDocumentDiagnosticReport
|
||||
{
|
||||
DocumentDiagnosticReportKind kind = DocumentDiagnosticReportKindLiterals::Unchanged;
|
||||
std::optional<string> resultId;
|
||||
};
|
||||
|
||||
struct RelatedFullDocumentDiagnosticReport : FullDocumentDiagnosticReport
|
||||
{
|
||||
std::optional<std::map<string, std::variant<FullDocumentDiagnosticReport, UnchangedDocumentDiagnosticReport>>> relatedDocuments;
|
||||
};
|
||||
|
||||
struct RelatedUnchangedDocumentDiagnosticReport : UnchangedDocumentDiagnosticReport
|
||||
{
|
||||
std::optional<std::map<string, std::variant<FullDocumentDiagnosticReport, UnchangedDocumentDiagnosticReport>>> relatedDocuments;
|
||||
};
|
||||
|
||||
struct DocumentDiagnosticReportPartialResult
|
||||
{
|
||||
std::optional<std::map<string, std::variant<FullDocumentDiagnosticReport, UnchangedDocumentDiagnosticReport>>> relatedDocuments;
|
||||
};
|
||||
|
||||
using DocumentDiagnosticReport = std::variant<RelatedFullDocumentDiagnosticReport, RelatedUnchangedDocumentDiagnosticReport>;
|
||||
|
||||
struct DiagnosticServerCancellationData
|
||||
{
|
||||
std::optional<boolean> retriggerRequest;
|
||||
};
|
||||
|
||||
struct PreviousResultId
|
||||
{
|
||||
DocumentUri uri;
|
||||
string value;
|
||||
};
|
||||
|
||||
struct WorkspaceDiagnosticParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
std::optional<string> identifier;
|
||||
std::vector<PreviousResultId> previousResultIds;
|
||||
};
|
||||
|
||||
struct WorkspaceFullDocumentDiagnosticReport : FullDocumentDiagnosticReport
|
||||
{
|
||||
DocumentUri uri;
|
||||
std::optional<integer> version;
|
||||
};
|
||||
|
||||
struct WorkspaceUnchangedDocumentDiagnosticReport : UnchangedDocumentDiagnosticReport
|
||||
{
|
||||
DocumentUri uri;
|
||||
std::optional<integer> version;
|
||||
};
|
||||
|
||||
using WorkspaceDocumentDiagnosticReport = std::variant<WorkspaceFullDocumentDiagnosticReport, WorkspaceUnchangedDocumentDiagnosticReport>;
|
||||
struct WorkspaceDiagnosticReport
|
||||
{
|
||||
std::vector<WorkspaceDocumentDiagnosticReport> items;
|
||||
};
|
||||
|
||||
struct WorkspaceDiagnosticReportPartialResult
|
||||
{
|
||||
std::vector<WorkspaceDocumentDiagnosticReport> items;
|
||||
};
|
||||
|
||||
struct DiagnosticWorkspaceClientCapabilities
|
||||
{
|
||||
std::optional<boolean> refreshSupport;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,209 +1,209 @@
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
#include "./progress.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
// Document Highlight
|
||||
struct DocumentHighlightClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct DocumentHighlightOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DocumentHighlightRegistrationOptions : TextDocumentRegistrationOptions, DocumentHighlightOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DocumentHighlightParams : TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
};
|
||||
|
||||
enum class DocumentHighlightKind
|
||||
{
|
||||
Text = 1,
|
||||
Read = 2,
|
||||
Write = 3
|
||||
};
|
||||
|
||||
struct DocumentHighlight
|
||||
{
|
||||
Range range;
|
||||
DocumentHighlightKind kind;
|
||||
};
|
||||
|
||||
// Document Link
|
||||
struct DocumentLinkClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<boolean> tooltipSupport;
|
||||
};
|
||||
|
||||
struct DocumentLinkOptions : WorkDoneProgressOptions
|
||||
{
|
||||
boolean resolveProvider;
|
||||
};
|
||||
|
||||
struct DocumentLinkRegistrationOptions : TextDocumentRegistrationOptions, DocumentLinkOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DocumentLinkParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
};
|
||||
|
||||
struct DocumentLink
|
||||
{
|
||||
Range range;
|
||||
std::optional<URI> target;
|
||||
std::optional<string> tooltip;
|
||||
std::optional<LSPAny> data;
|
||||
};
|
||||
|
||||
// Hover
|
||||
struct HoverClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<std::vector<MarkupKind>> contentFormat;
|
||||
};
|
||||
|
||||
struct HoverOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct HoverRegistrationOptions : TextDocumentRegistrationOptions, HoverOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct HoverParams : TextDocumentPositionParams, WorkDoneProgressParams
|
||||
{
|
||||
};
|
||||
|
||||
struct Hover
|
||||
{
|
||||
struct MarkedStringObject
|
||||
{
|
||||
std::string language;
|
||||
std::string value;
|
||||
};
|
||||
|
||||
using MarkedString = std::variant<std::string, MarkedStringObject>;
|
||||
|
||||
std::variant<MarkedString, std::vector<MarkedString>, MarkupContent> contents;
|
||||
std::optional<Range> range;
|
||||
};
|
||||
|
||||
// CodeLens
|
||||
struct CodeLensClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct CodeLensOptions : WorkDoneProgressOptions
|
||||
{
|
||||
std::optional<boolean> resolveProvider;
|
||||
};
|
||||
|
||||
struct CodeLensRegistrationOptions : TextDocumentRegistrationOptions, CodeLensOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct CodeLensParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
};
|
||||
|
||||
struct CodeLens
|
||||
{
|
||||
Range range;
|
||||
std::optional<Command> command;
|
||||
std::optional<LSPAny> data;
|
||||
};
|
||||
|
||||
struct CodeLensWorkspaceClientCapabilities
|
||||
{
|
||||
std::optional<boolean> refreshSupport;
|
||||
};
|
||||
|
||||
// Fold Range
|
||||
using FoldingRangeKind = std::string_view;
|
||||
namespace FoldingRangeKindLiterals
|
||||
{
|
||||
inline constexpr FoldingRangeKind Comment = "comment";
|
||||
inline constexpr FoldingRangeKind Imports = "imports";
|
||||
inline constexpr FoldingRangeKind Region = "region";
|
||||
}
|
||||
|
||||
struct FoldingRangeClientCapabilities
|
||||
{
|
||||
struct FoldingRangeKinds
|
||||
{
|
||||
std::vector<FoldingRangeKind> valueSet;
|
||||
};
|
||||
struct FoldingRange
|
||||
{
|
||||
std::optional<boolean> collapsedText;
|
||||
};
|
||||
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<uinteger> rangeLimit;
|
||||
std::optional<boolean> lineFoldingOnly;
|
||||
std::optional<FoldingRangeKinds> foldingRangeKind;
|
||||
std::optional<FoldingRange> foldingRange;
|
||||
};
|
||||
|
||||
struct FoldingRangeOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct FoldingRangeRegistrationOptions : TextDocumentRegistrationOptions, FoldingRangeOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct FoldingRangeParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
};
|
||||
|
||||
struct FoldingRange
|
||||
{
|
||||
uinteger startLine;
|
||||
std::optional<uinteger> startCharacter;
|
||||
uinteger endLine;
|
||||
std::optional<uinteger> endCharacter;
|
||||
std::optional<FoldingRangeKind> kind;
|
||||
std::optional<string> collapsedText;
|
||||
};
|
||||
|
||||
// Sekection Range
|
||||
struct SelectionRangeClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct SelectionRangeOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct SelectionRangeRegistrationOptions : SelectionRangeOptions, TextDocumentRegistrationOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct SelectionRangeParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
std::vector<Position> positions;
|
||||
};
|
||||
|
||||
struct SelectionRange
|
||||
{
|
||||
Range range;
|
||||
std::optional<SelectionRange*> selectionRange;
|
||||
};
|
||||
|
||||
}
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
#include "./progress.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
// Document Highlight
|
||||
struct DocumentHighlightClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct DocumentHighlightOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DocumentHighlightRegistrationOptions : TextDocumentRegistrationOptions, DocumentHighlightOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DocumentHighlightParams : TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
};
|
||||
|
||||
enum class DocumentHighlightKind
|
||||
{
|
||||
Text = 1,
|
||||
Read = 2,
|
||||
Write = 3
|
||||
};
|
||||
|
||||
struct DocumentHighlight
|
||||
{
|
||||
Range range;
|
||||
DocumentHighlightKind kind;
|
||||
};
|
||||
|
||||
// Document Link
|
||||
struct DocumentLinkClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<boolean> tooltipSupport;
|
||||
};
|
||||
|
||||
struct DocumentLinkOptions : WorkDoneProgressOptions
|
||||
{
|
||||
boolean resolveProvider;
|
||||
};
|
||||
|
||||
struct DocumentLinkRegistrationOptions : TextDocumentRegistrationOptions, DocumentLinkOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DocumentLinkParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
};
|
||||
|
||||
struct DocumentLink
|
||||
{
|
||||
Range range;
|
||||
std::optional<URI> target;
|
||||
std::optional<string> tooltip;
|
||||
std::optional<LSPAny> data;
|
||||
};
|
||||
|
||||
// Hover
|
||||
struct HoverClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<std::vector<MarkupKind>> contentFormat;
|
||||
};
|
||||
|
||||
struct HoverOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct HoverRegistrationOptions : TextDocumentRegistrationOptions, HoverOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct HoverParams : TextDocumentPositionParams, WorkDoneProgressParams
|
||||
{
|
||||
};
|
||||
|
||||
struct Hover
|
||||
{
|
||||
struct MarkedStringObject
|
||||
{
|
||||
std::string language;
|
||||
std::string value;
|
||||
};
|
||||
|
||||
using MarkedString = std::variant<std::string, MarkedStringObject>;
|
||||
|
||||
std::variant<MarkedString, std::vector<MarkedString>, MarkupContent> contents;
|
||||
std::optional<Range> range;
|
||||
};
|
||||
|
||||
// CodeLens
|
||||
struct CodeLensClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct CodeLensOptions : WorkDoneProgressOptions
|
||||
{
|
||||
std::optional<boolean> resolveProvider;
|
||||
};
|
||||
|
||||
struct CodeLensRegistrationOptions : TextDocumentRegistrationOptions, CodeLensOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct CodeLensParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
};
|
||||
|
||||
struct CodeLens
|
||||
{
|
||||
Range range;
|
||||
std::optional<Command> command;
|
||||
std::optional<LSPAny> data;
|
||||
};
|
||||
|
||||
struct CodeLensWorkspaceClientCapabilities
|
||||
{
|
||||
std::optional<boolean> refreshSupport;
|
||||
};
|
||||
|
||||
// Fold Range
|
||||
using FoldingRangeKind = std::string_view;
|
||||
namespace FoldingRangeKindLiterals
|
||||
{
|
||||
inline constexpr FoldingRangeKind Comment = "comment";
|
||||
inline constexpr FoldingRangeKind Imports = "imports";
|
||||
inline constexpr FoldingRangeKind Region = "region";
|
||||
}
|
||||
|
||||
struct FoldingRangeClientCapabilities
|
||||
{
|
||||
struct FoldingRangeKinds
|
||||
{
|
||||
std::vector<FoldingRangeKind> valueSet;
|
||||
};
|
||||
struct FoldingRange
|
||||
{
|
||||
std::optional<boolean> collapsedText;
|
||||
};
|
||||
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<uinteger> rangeLimit;
|
||||
std::optional<boolean> lineFoldingOnly;
|
||||
std::optional<FoldingRangeKinds> foldingRangeKind;
|
||||
std::optional<FoldingRange> foldingRange;
|
||||
};
|
||||
|
||||
struct FoldingRangeOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct FoldingRangeRegistrationOptions : TextDocumentRegistrationOptions, FoldingRangeOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct FoldingRangeParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
};
|
||||
|
||||
struct FoldingRange
|
||||
{
|
||||
uinteger startLine;
|
||||
std::optional<uinteger> startCharacter;
|
||||
uinteger endLine;
|
||||
std::optional<uinteger> endCharacter;
|
||||
std::optional<FoldingRangeKind> kind;
|
||||
std::optional<string> collapsedText;
|
||||
};
|
||||
|
||||
// Sekection Range
|
||||
struct SelectionRangeClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct SelectionRangeOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct SelectionRangeRegistrationOptions : SelectionRangeOptions, TextDocumentRegistrationOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct SelectionRangeParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
std::vector<Position> positions;
|
||||
};
|
||||
|
||||
struct SelectionRange
|
||||
{
|
||||
Range range;
|
||||
std::optional<SelectionRange*> selectionRange;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,120 +1,120 @@
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./registration.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
struct TextDocumentSyncClientCapabilities
|
||||
{
|
||||
boolean dynamicRegistration;
|
||||
std::optional<boolean> willSave;
|
||||
std::optional<boolean> willSaveWaitUntil;
|
||||
std::optional<boolean> didSave;
|
||||
};
|
||||
|
||||
enum class TextDocumentSyncKind
|
||||
{
|
||||
kNone = 0,
|
||||
kFull = 1,
|
||||
kIncremental = 2
|
||||
};
|
||||
|
||||
struct TextDocumentSyncOptions
|
||||
{
|
||||
std::optional<boolean> openClose;
|
||||
std::optional<TextDocumentSyncKind> change;
|
||||
};
|
||||
|
||||
struct TextDocumentItem
|
||||
{
|
||||
DocumentUri uri;
|
||||
string languageId;
|
||||
integer version;
|
||||
string text;
|
||||
};
|
||||
|
||||
struct TextDocumentIdentifier
|
||||
{
|
||||
DocumentUri uri;
|
||||
};
|
||||
|
||||
struct VersionedTextDocumentIdentifier : TextDocumentIdentifier
|
||||
{
|
||||
integer version;
|
||||
};
|
||||
|
||||
struct OptionalVersionedTextDocumentIdentifier : TextDocumentIdentifier
|
||||
{
|
||||
std::optional<integer> version;
|
||||
};
|
||||
|
||||
struct TextDocumentPositionParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
Position position;
|
||||
};
|
||||
|
||||
struct DidOpenTextDocumentParams
|
||||
{
|
||||
TextDocumentItem textDocument;
|
||||
};
|
||||
|
||||
struct TextDocumentChangeRegistrationOptions : TextDocumentRegistrationOptions
|
||||
{
|
||||
TextDocumentSyncKind syncKind;
|
||||
};
|
||||
|
||||
struct TextDocumentContentChangeEvent
|
||||
{
|
||||
Range range;
|
||||
uinteger rangeLength;
|
||||
string text;
|
||||
};
|
||||
|
||||
struct DidChangeTextDocumentParams
|
||||
{
|
||||
VersionedTextDocumentIdentifier textDocument;
|
||||
std::vector<TextDocumentContentChangeEvent> contentChanges;
|
||||
};
|
||||
|
||||
enum class TextDocumentSaveReason
|
||||
{
|
||||
Manual = 1,
|
||||
AfterDelay = 2,
|
||||
FocusOut = 3
|
||||
};
|
||||
|
||||
struct WillSaveTextDocumentParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
TextDocumentSaveReason reason;
|
||||
};
|
||||
|
||||
struct SaveOptions
|
||||
{
|
||||
std::optional<boolean> includeText;
|
||||
};
|
||||
|
||||
struct TextDocumentSaveRegistrationOptions : TextDocumentRegistrationOptions
|
||||
{
|
||||
std::optional<boolean> includeText;
|
||||
};
|
||||
|
||||
struct DidSaveTextDocumentParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
std::optional<string> text;
|
||||
};
|
||||
|
||||
struct DidCloseTextDocumentParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
};
|
||||
|
||||
struct TextDocumentEdit
|
||||
{
|
||||
// OptionalVersionedTextDocumentIdentifier textDocument;
|
||||
std::variant<std::vector<TextEdit>, std::vector<AnnotatedTextEdit>> edits;
|
||||
};
|
||||
|
||||
}
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./registration.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
struct TextDocumentSyncClientCapabilities
|
||||
{
|
||||
boolean dynamicRegistration;
|
||||
std::optional<boolean> willSave;
|
||||
std::optional<boolean> willSaveWaitUntil;
|
||||
std::optional<boolean> didSave;
|
||||
};
|
||||
|
||||
enum class TextDocumentSyncKind
|
||||
{
|
||||
kNone = 0,
|
||||
kFull = 1,
|
||||
kIncremental = 2
|
||||
};
|
||||
|
||||
struct TextDocumentSyncOptions
|
||||
{
|
||||
std::optional<boolean> openClose;
|
||||
std::optional<TextDocumentSyncKind> change;
|
||||
};
|
||||
|
||||
struct TextDocumentItem
|
||||
{
|
||||
DocumentUri uri;
|
||||
string languageId;
|
||||
integer version;
|
||||
string text;
|
||||
};
|
||||
|
||||
struct TextDocumentIdentifier
|
||||
{
|
||||
DocumentUri uri;
|
||||
};
|
||||
|
||||
struct VersionedTextDocumentIdentifier : TextDocumentIdentifier
|
||||
{
|
||||
integer version;
|
||||
};
|
||||
|
||||
struct OptionalVersionedTextDocumentIdentifier : TextDocumentIdentifier
|
||||
{
|
||||
std::optional<integer> version;
|
||||
};
|
||||
|
||||
struct TextDocumentPositionParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
Position position;
|
||||
};
|
||||
|
||||
struct DidOpenTextDocumentParams
|
||||
{
|
||||
TextDocumentItem textDocument;
|
||||
};
|
||||
|
||||
struct TextDocumentChangeRegistrationOptions : TextDocumentRegistrationOptions
|
||||
{
|
||||
TextDocumentSyncKind syncKind;
|
||||
};
|
||||
|
||||
struct TextDocumentContentChangeEvent
|
||||
{
|
||||
Range range;
|
||||
uinteger rangeLength;
|
||||
string text;
|
||||
};
|
||||
|
||||
struct DidChangeTextDocumentParams
|
||||
{
|
||||
VersionedTextDocumentIdentifier textDocument;
|
||||
std::vector<TextDocumentContentChangeEvent> contentChanges;
|
||||
};
|
||||
|
||||
enum class TextDocumentSaveReason
|
||||
{
|
||||
Manual = 1,
|
||||
AfterDelay = 2,
|
||||
FocusOut = 3
|
||||
};
|
||||
|
||||
struct WillSaveTextDocumentParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
TextDocumentSaveReason reason;
|
||||
};
|
||||
|
||||
struct SaveOptions
|
||||
{
|
||||
std::optional<boolean> includeText;
|
||||
};
|
||||
|
||||
struct TextDocumentSaveRegistrationOptions : TextDocumentRegistrationOptions
|
||||
{
|
||||
std::optional<boolean> includeText;
|
||||
};
|
||||
|
||||
struct DidSaveTextDocumentParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
std::optional<string> text;
|
||||
};
|
||||
|
||||
struct DidCloseTextDocumentParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
};
|
||||
|
||||
struct TextDocumentEdit
|
||||
{
|
||||
// OptionalVersionedTextDocumentIdentifier textDocument;
|
||||
std::variant<std::vector<TextEdit>, std::vector<AnnotatedTextEdit>> edits;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,122 +1,122 @@
|
||||
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./workspace.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
using FileOperationPatternKind = std::string_view;
|
||||
namespace FileOperationPatternKindLiterals
|
||||
{
|
||||
inline constexpr FileOperationPatternKind File = "file";
|
||||
inline constexpr FileOperationPatternKind Folder = "folder";
|
||||
}
|
||||
|
||||
struct FileOperationPatternOptions
|
||||
{
|
||||
std::optional<boolean> ignoreCase;
|
||||
};
|
||||
|
||||
struct FileOperationPattern
|
||||
{
|
||||
string glob;
|
||||
std::optional<FileOperationPatternKind> matches;
|
||||
std::optional<FileOperationPatternOptions> options;
|
||||
};
|
||||
|
||||
struct FileOperationFilter
|
||||
{
|
||||
std::optional<string> scheme;
|
||||
FileOperationPattern pattern;
|
||||
};
|
||||
|
||||
struct FileCreate
|
||||
{
|
||||
string uri;
|
||||
};
|
||||
|
||||
struct CreateFilesParams
|
||||
{
|
||||
std::vector<FileCreate> files;
|
||||
};
|
||||
|
||||
struct FileOperationRegistrationOptions
|
||||
{
|
||||
std::vector<FileOperationFilter> filters;
|
||||
};
|
||||
|
||||
struct FileRename
|
||||
{
|
||||
string oldUri;
|
||||
string newUri;
|
||||
};
|
||||
|
||||
struct RenameFilesParams
|
||||
{
|
||||
std::vector<FileRename> files;
|
||||
};
|
||||
|
||||
struct FileDelete
|
||||
{
|
||||
string uri;
|
||||
};
|
||||
|
||||
struct DeleteFilesParams
|
||||
{
|
||||
std::vector<FileDelete> files;
|
||||
};
|
||||
|
||||
// File Watching
|
||||
struct DidChangeWatchedFilesClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<boolean> relativePatternSupport;
|
||||
};
|
||||
|
||||
using Pattern = string;
|
||||
|
||||
struct RelativePattern
|
||||
{
|
||||
std::variant<WorkspaceFolder, URI> baseUri;
|
||||
Pattern pattern;
|
||||
};
|
||||
|
||||
using GlobPattern = std::variant<Pattern, RelativePattern>;
|
||||
|
||||
enum class WatchKind
|
||||
{
|
||||
kCreate = 1,
|
||||
kChange = 2,
|
||||
kDelete = 4
|
||||
};
|
||||
|
||||
struct FileSystemWatcher
|
||||
{
|
||||
GlobPattern globPattern;
|
||||
std::optional<WatchKind> kind;
|
||||
};
|
||||
|
||||
struct DidChangeWatchedFilesRegistrationOptions
|
||||
{
|
||||
std::vector<FileSystemWatcher> watchers;
|
||||
};
|
||||
|
||||
enum class FileChangeType
|
||||
{
|
||||
kCreated = 1,
|
||||
kChanged = 2,
|
||||
kDeleted = 3
|
||||
};
|
||||
|
||||
struct FileEvent
|
||||
{
|
||||
DocumentUri uri;
|
||||
FileChangeType type;
|
||||
};
|
||||
|
||||
struct DidChangeWatchedFilesParams
|
||||
{
|
||||
std::vector<FileEvent> changes;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./workspace.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
using FileOperationPatternKind = std::string_view;
|
||||
namespace FileOperationPatternKindLiterals
|
||||
{
|
||||
inline constexpr FileOperationPatternKind File = "file";
|
||||
inline constexpr FileOperationPatternKind Folder = "folder";
|
||||
}
|
||||
|
||||
struct FileOperationPatternOptions
|
||||
{
|
||||
std::optional<boolean> ignoreCase;
|
||||
};
|
||||
|
||||
struct FileOperationPattern
|
||||
{
|
||||
string glob;
|
||||
std::optional<FileOperationPatternKind> matches;
|
||||
std::optional<FileOperationPatternOptions> options;
|
||||
};
|
||||
|
||||
struct FileOperationFilter
|
||||
{
|
||||
std::optional<string> scheme;
|
||||
FileOperationPattern pattern;
|
||||
};
|
||||
|
||||
struct FileCreate
|
||||
{
|
||||
string uri;
|
||||
};
|
||||
|
||||
struct CreateFilesParams
|
||||
{
|
||||
std::vector<FileCreate> files;
|
||||
};
|
||||
|
||||
struct FileOperationRegistrationOptions
|
||||
{
|
||||
std::vector<FileOperationFilter> filters;
|
||||
};
|
||||
|
||||
struct FileRename
|
||||
{
|
||||
string oldUri;
|
||||
string newUri;
|
||||
};
|
||||
|
||||
struct RenameFilesParams
|
||||
{
|
||||
std::vector<FileRename> files;
|
||||
};
|
||||
|
||||
struct FileDelete
|
||||
{
|
||||
string uri;
|
||||
};
|
||||
|
||||
struct DeleteFilesParams
|
||||
{
|
||||
std::vector<FileDelete> files;
|
||||
};
|
||||
|
||||
// File Watching
|
||||
struct DidChangeWatchedFilesClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<boolean> relativePatternSupport;
|
||||
};
|
||||
|
||||
using Pattern = string;
|
||||
|
||||
struct RelativePattern
|
||||
{
|
||||
std::variant<WorkspaceFolder, URI> baseUri;
|
||||
Pattern pattern;
|
||||
};
|
||||
|
||||
using GlobPattern = std::variant<Pattern, RelativePattern>;
|
||||
|
||||
enum class WatchKind
|
||||
{
|
||||
kCreate = 1,
|
||||
kChange = 2,
|
||||
kDelete = 4
|
||||
};
|
||||
|
||||
struct FileSystemWatcher
|
||||
{
|
||||
GlobPattern globPattern;
|
||||
std::optional<WatchKind> kind;
|
||||
};
|
||||
|
||||
struct DidChangeWatchedFilesRegistrationOptions
|
||||
{
|
||||
std::vector<FileSystemWatcher> watchers;
|
||||
};
|
||||
|
||||
enum class FileChangeType
|
||||
{
|
||||
kCreated = 1,
|
||||
kChanged = 2,
|
||||
kDeleted = 3
|
||||
};
|
||||
|
||||
struct FileEvent
|
||||
{
|
||||
DocumentUri uri;
|
||||
FileChangeType type;
|
||||
};
|
||||
|
||||
struct DidChangeWatchedFilesParams
|
||||
{
|
||||
std::vector<FileEvent> changes;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,82 +1,82 @@
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
#include "./progress.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
// Document Formatting
|
||||
struct DocumentFormattingClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct DocumentFormattingOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DocumentFormattingRegistrationOptions : TextDocumentRegistrationOptions, DocumentFormattingOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct FormattingOptions
|
||||
{
|
||||
uinteger tabSize;
|
||||
boolean insertSpaces;
|
||||
std::optional<boolean> trimTrailingWhitespace;
|
||||
std::optional<boolean> insertFinalNewline;
|
||||
std::optional<boolean> trimFinalNewlines;
|
||||
std::map<string, std::variant<boolean, integer, string>> key;
|
||||
};
|
||||
|
||||
struct DocumentFormattingParams : WorkDoneProgressParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
FormattingOptions options;
|
||||
};
|
||||
|
||||
// Document Range Formatting
|
||||
struct DocumentRangeFormattingClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct DocumentRangeFormattingOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DocumentRangeFormattingRegistrationOptions : TextDocumentRegistrationOptions, DocumentRangeFormattingOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DocumentRangeFormattingParams : WorkDoneProgressParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
Range range;
|
||||
FormattingOptions options;
|
||||
};
|
||||
|
||||
// Document On Type Formatting
|
||||
struct DocumentOnTypeFormattingClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct DocumentOnTypeFormattingOptions : WorkDoneProgressOptions
|
||||
{
|
||||
string firstTriggerCharacter;
|
||||
std::optional<std::vector<string>> moreTriggerCharacter;
|
||||
};
|
||||
|
||||
struct DocumentOnTypeFormattingRegistrationOptions : TextDocumentRegistrationOptions, DocumentOnTypeFormattingOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DocumentOnTypeFormattingParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
Position position;
|
||||
string ch;
|
||||
FormattingOptions options;
|
||||
};
|
||||
}
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
#include "./progress.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
// Document Formatting
|
||||
struct DocumentFormattingClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct DocumentFormattingOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DocumentFormattingRegistrationOptions : TextDocumentRegistrationOptions, DocumentFormattingOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct FormattingOptions
|
||||
{
|
||||
uinteger tabSize;
|
||||
boolean insertSpaces;
|
||||
std::optional<boolean> trimTrailingWhitespace;
|
||||
std::optional<boolean> insertFinalNewline;
|
||||
std::optional<boolean> trimFinalNewlines;
|
||||
std::map<string, std::variant<boolean, integer, string>> key;
|
||||
};
|
||||
|
||||
struct DocumentFormattingParams : WorkDoneProgressParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
FormattingOptions options;
|
||||
};
|
||||
|
||||
// Document Range Formatting
|
||||
struct DocumentRangeFormattingClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct DocumentRangeFormattingOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DocumentRangeFormattingRegistrationOptions : TextDocumentRegistrationOptions, DocumentRangeFormattingOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DocumentRangeFormattingParams : WorkDoneProgressParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
Range range;
|
||||
FormattingOptions options;
|
||||
};
|
||||
|
||||
// Document On Type Formatting
|
||||
struct DocumentOnTypeFormattingClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct DocumentOnTypeFormattingOptions : WorkDoneProgressOptions
|
||||
{
|
||||
string firstTriggerCharacter;
|
||||
std::optional<std::vector<string>> moreTriggerCharacter;
|
||||
};
|
||||
|
||||
struct DocumentOnTypeFormattingRegistrationOptions : TextDocumentRegistrationOptions, DocumentOnTypeFormattingOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DocumentOnTypeFormattingParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
Position position;
|
||||
string ch;
|
||||
FormattingOptions options;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,162 +1,162 @@
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
#include "./progress.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
// Inlay Hints
|
||||
struct InlayHintClientCapabilities
|
||||
{
|
||||
struct ResolveSupport
|
||||
{
|
||||
std::vector<string> properties;
|
||||
};
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<ResolveSupport> resolveSupport;
|
||||
};
|
||||
|
||||
struct InlayHintOptions : WorkDoneProgressOptions
|
||||
{
|
||||
std::optional<boolean> resolveProvider;
|
||||
};
|
||||
|
||||
struct InlayHintRegistrationOptions : TextDocumentRegistrationOptions, InlayHintOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct InlayHintParams : WorkDoneProgressParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
Range range;
|
||||
};
|
||||
|
||||
struct InlayHintLabelPart
|
||||
{
|
||||
string value;
|
||||
std::optional<std::variant<string, MarkupContent>> tooltip;
|
||||
std::optional<Location> location;
|
||||
std::optional<Command> command;
|
||||
};
|
||||
|
||||
enum class InlayHintKind
|
||||
{
|
||||
kType = 1,
|
||||
kParameter = 2
|
||||
};
|
||||
|
||||
struct InlayHint
|
||||
{
|
||||
Position position;
|
||||
std::variant<string, std::vector<InlayHintLabelPart>> label;
|
||||
std::optional<InlayHintKind> kind;
|
||||
std::optional<std::vector<TextEdit>> textEdits;
|
||||
;
|
||||
std::optional<std::variant<string, MarkupContent>> tooltip;
|
||||
std::optional<boolean> paddingLeft;
|
||||
std::optional<boolean> paddingRight;
|
||||
std::optional<LSPAny> data;
|
||||
};
|
||||
|
||||
struct InlayHintWorkspaceClientCapabilities
|
||||
{
|
||||
std::optional<boolean> refreshSupport;
|
||||
};
|
||||
|
||||
// Inline Values
|
||||
struct InlineValueClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct InlineValueOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct InlineValueRegistrationOptions : TextDocumentRegistrationOptions, InlineValueOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct InlineValueContent
|
||||
{
|
||||
integer frameId;
|
||||
Range stoppedLocation;
|
||||
};
|
||||
|
||||
struct InlineValueText
|
||||
{
|
||||
Range range;
|
||||
string text;
|
||||
};
|
||||
|
||||
struct InlineValueParams : WorkDoneProgressParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
Range range;
|
||||
InlineValueContent context;
|
||||
};
|
||||
|
||||
struct InlineValueVariableLookup
|
||||
{
|
||||
Range range;
|
||||
std::optional<string> variableName;
|
||||
std::optional<boolean> caseSensitiveLookup;
|
||||
};
|
||||
|
||||
struct InlineValueEvaluatableExpression
|
||||
{
|
||||
Range range;
|
||||
std::optional<string> expression;
|
||||
};
|
||||
using InlineValue = std::variant<InlineValueText, InlineValueVariableLookup, InlineValueEvaluatableExpression>;
|
||||
|
||||
struct InlineValueWorkspaceClientCapabilities
|
||||
{
|
||||
std::optional<boolean> refreshSupport;
|
||||
};
|
||||
|
||||
// Moniker
|
||||
struct MonikerClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct MonikerOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct MonikerRegistrationOptions : TextDocumentRegistrationOptions, MonikerOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct MonikerParams : TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
};
|
||||
|
||||
using UniquenessLevel = std::string_view;
|
||||
namespace UniquenessLevelLiterals
|
||||
{
|
||||
inline constexpr UniquenessLevel Document = "document";
|
||||
inline constexpr UniquenessLevel Project = "project";
|
||||
inline constexpr UniquenessLevel Group = "group";
|
||||
inline constexpr UniquenessLevel Scheme = "scheme";
|
||||
inline constexpr UniquenessLevel Global = "global";
|
||||
}
|
||||
|
||||
using MonikerKind = std::string_view;
|
||||
namespace MonikerKindLiterals
|
||||
{
|
||||
inline constexpr MonikerKind Import = "import";
|
||||
inline constexpr MonikerKind Export = "export";
|
||||
inline constexpr MonikerKind Local = "local";
|
||||
}
|
||||
|
||||
struct Moniker
|
||||
{
|
||||
string scheme;
|
||||
string identifier;
|
||||
UniquenessLevel unique;
|
||||
std::optional<MonikerKind> kind;
|
||||
};
|
||||
|
||||
}
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
#include "./progress.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
// Inlay Hints
|
||||
struct InlayHintClientCapabilities
|
||||
{
|
||||
struct ResolveSupport
|
||||
{
|
||||
std::vector<string> properties;
|
||||
};
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<ResolveSupport> resolveSupport;
|
||||
};
|
||||
|
||||
struct InlayHintOptions : WorkDoneProgressOptions
|
||||
{
|
||||
std::optional<boolean> resolveProvider;
|
||||
};
|
||||
|
||||
struct InlayHintRegistrationOptions : TextDocumentRegistrationOptions, InlayHintOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct InlayHintParams : WorkDoneProgressParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
Range range;
|
||||
};
|
||||
|
||||
struct InlayHintLabelPart
|
||||
{
|
||||
string value;
|
||||
std::optional<std::variant<string, MarkupContent>> tooltip;
|
||||
std::optional<Location> location;
|
||||
std::optional<Command> command;
|
||||
};
|
||||
|
||||
enum class InlayHintKind
|
||||
{
|
||||
kType = 1,
|
||||
kParameter = 2
|
||||
};
|
||||
|
||||
struct InlayHint
|
||||
{
|
||||
Position position;
|
||||
std::variant<string, std::vector<InlayHintLabelPart>> label;
|
||||
std::optional<InlayHintKind> kind;
|
||||
std::optional<std::vector<TextEdit>> textEdits;
|
||||
;
|
||||
std::optional<std::variant<string, MarkupContent>> tooltip;
|
||||
std::optional<boolean> paddingLeft;
|
||||
std::optional<boolean> paddingRight;
|
||||
std::optional<LSPAny> data;
|
||||
};
|
||||
|
||||
struct InlayHintWorkspaceClientCapabilities
|
||||
{
|
||||
std::optional<boolean> refreshSupport;
|
||||
};
|
||||
|
||||
// Inline Values
|
||||
struct InlineValueClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct InlineValueOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct InlineValueRegistrationOptions : TextDocumentRegistrationOptions, InlineValueOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct InlineValueContent
|
||||
{
|
||||
integer frameId;
|
||||
Range stoppedLocation;
|
||||
};
|
||||
|
||||
struct InlineValueText
|
||||
{
|
||||
Range range;
|
||||
string text;
|
||||
};
|
||||
|
||||
struct InlineValueParams : WorkDoneProgressParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
Range range;
|
||||
InlineValueContent context;
|
||||
};
|
||||
|
||||
struct InlineValueVariableLookup
|
||||
{
|
||||
Range range;
|
||||
std::optional<string> variableName;
|
||||
std::optional<boolean> caseSensitiveLookup;
|
||||
};
|
||||
|
||||
struct InlineValueEvaluatableExpression
|
||||
{
|
||||
Range range;
|
||||
std::optional<string> expression;
|
||||
};
|
||||
using InlineValue = std::variant<InlineValueText, InlineValueVariableLookup, InlineValueEvaluatableExpression>;
|
||||
|
||||
struct InlineValueWorkspaceClientCapabilities
|
||||
{
|
||||
std::optional<boolean> refreshSupport;
|
||||
};
|
||||
|
||||
// Moniker
|
||||
struct MonikerClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct MonikerOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct MonikerRegistrationOptions : TextDocumentRegistrationOptions, MonikerOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct MonikerParams : TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
};
|
||||
|
||||
using UniquenessLevel = std::string_view;
|
||||
namespace UniquenessLevelLiterals
|
||||
{
|
||||
inline constexpr UniquenessLevel Document = "document";
|
||||
inline constexpr UniquenessLevel Project = "project";
|
||||
inline constexpr UniquenessLevel Group = "group";
|
||||
inline constexpr UniquenessLevel Scheme = "scheme";
|
||||
inline constexpr UniquenessLevel Global = "global";
|
||||
}
|
||||
|
||||
using MonikerKind = std::string_view;
|
||||
namespace MonikerKindLiterals
|
||||
{
|
||||
inline constexpr MonikerKind Import = "import";
|
||||
inline constexpr MonikerKind Export = "export";
|
||||
inline constexpr MonikerKind Local = "local";
|
||||
}
|
||||
|
||||
struct Moniker
|
||||
{
|
||||
string scheme;
|
||||
string identifier;
|
||||
UniquenessLevel unique;
|
||||
std::optional<MonikerKind> kind;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,193 +1,193 @@
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
|
||||
inline LSPAny::LSPAny() :
|
||||
value(nullptr) {}
|
||||
|
||||
inline LSPAny::LSPAny(const LSPAny& other) :
|
||||
value(other.value) {}
|
||||
|
||||
inline LSPAny::LSPAny(LSPAny&& other) noexcept :
|
||||
value(std::move(other.value)) {}
|
||||
|
||||
inline LSPAny::LSPAny(const std::map<string, LSPAny>& val) :
|
||||
value(val) {}
|
||||
|
||||
inline LSPAny::LSPAny(std::map<string, LSPAny>&& val) :
|
||||
value(std::move(val)) {}
|
||||
|
||||
inline LSPAny::LSPAny(const std::vector<LSPAny>& val) :
|
||||
value(val) {}
|
||||
|
||||
inline LSPAny::LSPAny(std::vector<LSPAny>&& val) :
|
||||
value(std::move(val)) {}
|
||||
|
||||
inline LSPAny::LSPAny(const string& val) :
|
||||
value(val) {}
|
||||
|
||||
inline LSPAny::LSPAny(string&& val) :
|
||||
value(std::move(val)) {}
|
||||
|
||||
inline LSPAny::LSPAny(const char* val) :
|
||||
value(string(val)) {}
|
||||
|
||||
inline LSPAny::LSPAny(int val) :
|
||||
value(static_cast<decimal>(val)) {}
|
||||
|
||||
inline LSPAny::LSPAny(long val) :
|
||||
value(static_cast<decimal>(val)) {}
|
||||
|
||||
inline LSPAny::LSPAny(long long val) :
|
||||
value(static_cast<decimal>(val)) {}
|
||||
|
||||
inline LSPAny::LSPAny(unsigned int val) :
|
||||
value(static_cast<decimal>(val)) {}
|
||||
|
||||
inline LSPAny::LSPAny(unsigned long val) :
|
||||
value(static_cast<decimal>(val)) {}
|
||||
|
||||
inline LSPAny::LSPAny(unsigned long long val) :
|
||||
value(static_cast<decimal>(val)) {}
|
||||
|
||||
inline LSPAny::LSPAny(float val) :
|
||||
value(static_cast<decimal>(val)) {}
|
||||
|
||||
inline LSPAny::LSPAny(double val) :
|
||||
value(val) {}
|
||||
|
||||
inline LSPAny::LSPAny(long double val) :
|
||||
value(static_cast<decimal>(val)) {}
|
||||
|
||||
inline LSPAny::LSPAny(boolean val) :
|
||||
value(val) {}
|
||||
|
||||
inline LSPAny::LSPAny(std::nullptr_t) :
|
||||
value(nullptr) {}
|
||||
|
||||
// 赋值操作符
|
||||
inline LSPAny& LSPAny::operator=(const LSPAny& other)
|
||||
{
|
||||
value = other.value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(LSPAny&& other) noexcept
|
||||
{
|
||||
value = std::move(other.value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 针对每种支持的类型的赋值操作符
|
||||
inline LSPAny& LSPAny::operator=(const std::map<string, LSPAny>& val)
|
||||
{
|
||||
value = val;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(std::map<string, LSPAny>&& val)
|
||||
{
|
||||
value = std::move(val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(const std::vector<LSPAny>& val)
|
||||
{
|
||||
value = val;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(std::vector<LSPAny>&& val)
|
||||
{
|
||||
value = std::move(val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(const string& val)
|
||||
{
|
||||
value = val;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(string&& val)
|
||||
{
|
||||
value = std::move(val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(const char* val)
|
||||
{
|
||||
value = string(val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 所有数字类型都转换为 decimal
|
||||
inline LSPAny& LSPAny::operator=(int val)
|
||||
{
|
||||
value = static_cast<decimal>(val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(long val)
|
||||
{
|
||||
value = static_cast<decimal>(val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(long long val)
|
||||
{
|
||||
value = static_cast<decimal>(val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(unsigned int val)
|
||||
{
|
||||
value = static_cast<decimal>(val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(unsigned long val)
|
||||
{
|
||||
value = static_cast<decimal>(val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(unsigned long long val)
|
||||
{
|
||||
value = static_cast<decimal>(val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(float val)
|
||||
{
|
||||
value = static_cast<decimal>(val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(double val)
|
||||
{
|
||||
value = val;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(long double val)
|
||||
{
|
||||
value = static_cast<decimal>(val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(boolean val)
|
||||
{
|
||||
value = val;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(std::nullptr_t)
|
||||
{
|
||||
value = nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
}
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
|
||||
inline LSPAny::LSPAny() :
|
||||
value(nullptr) {}
|
||||
|
||||
inline LSPAny::LSPAny(const LSPAny& other) :
|
||||
value(other.value) {}
|
||||
|
||||
inline LSPAny::LSPAny(LSPAny&& other) noexcept :
|
||||
value(std::move(other.value)) {}
|
||||
|
||||
inline LSPAny::LSPAny(const std::map<string, LSPAny>& val) :
|
||||
value(val) {}
|
||||
|
||||
inline LSPAny::LSPAny(std::map<string, LSPAny>&& val) :
|
||||
value(std::move(val)) {}
|
||||
|
||||
inline LSPAny::LSPAny(const std::vector<LSPAny>& val) :
|
||||
value(val) {}
|
||||
|
||||
inline LSPAny::LSPAny(std::vector<LSPAny>&& val) :
|
||||
value(std::move(val)) {}
|
||||
|
||||
inline LSPAny::LSPAny(const string& val) :
|
||||
value(val) {}
|
||||
|
||||
inline LSPAny::LSPAny(string&& val) :
|
||||
value(std::move(val)) {}
|
||||
|
||||
inline LSPAny::LSPAny(const char* val) :
|
||||
value(string(val)) {}
|
||||
|
||||
inline LSPAny::LSPAny(int val) :
|
||||
value(static_cast<decimal>(val)) {}
|
||||
|
||||
inline LSPAny::LSPAny(long val) :
|
||||
value(static_cast<decimal>(val)) {}
|
||||
|
||||
inline LSPAny::LSPAny(long long val) :
|
||||
value(static_cast<decimal>(val)) {}
|
||||
|
||||
inline LSPAny::LSPAny(unsigned int val) :
|
||||
value(static_cast<decimal>(val)) {}
|
||||
|
||||
inline LSPAny::LSPAny(unsigned long val) :
|
||||
value(static_cast<decimal>(val)) {}
|
||||
|
||||
inline LSPAny::LSPAny(unsigned long long val) :
|
||||
value(static_cast<decimal>(val)) {}
|
||||
|
||||
inline LSPAny::LSPAny(float val) :
|
||||
value(static_cast<decimal>(val)) {}
|
||||
|
||||
inline LSPAny::LSPAny(double val) :
|
||||
value(val) {}
|
||||
|
||||
inline LSPAny::LSPAny(long double val) :
|
||||
value(static_cast<decimal>(val)) {}
|
||||
|
||||
inline LSPAny::LSPAny(boolean val) :
|
||||
value(val) {}
|
||||
|
||||
inline LSPAny::LSPAny(std::nullptr_t) :
|
||||
value(nullptr) {}
|
||||
|
||||
// 赋值操作符
|
||||
inline LSPAny& LSPAny::operator=(const LSPAny& other)
|
||||
{
|
||||
value = other.value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(LSPAny&& other) noexcept
|
||||
{
|
||||
value = std::move(other.value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 针对每种支持的类型的赋值操作符
|
||||
inline LSPAny& LSPAny::operator=(const std::map<string, LSPAny>& val)
|
||||
{
|
||||
value = val;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(std::map<string, LSPAny>&& val)
|
||||
{
|
||||
value = std::move(val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(const std::vector<LSPAny>& val)
|
||||
{
|
||||
value = val;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(std::vector<LSPAny>&& val)
|
||||
{
|
||||
value = std::move(val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(const string& val)
|
||||
{
|
||||
value = val;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(string&& val)
|
||||
{
|
||||
value = std::move(val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(const char* val)
|
||||
{
|
||||
value = string(val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 所有数字类型都转换为 decimal
|
||||
inline LSPAny& LSPAny::operator=(int val)
|
||||
{
|
||||
value = static_cast<decimal>(val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(long val)
|
||||
{
|
||||
value = static_cast<decimal>(val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(long long val)
|
||||
{
|
||||
value = static_cast<decimal>(val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(unsigned int val)
|
||||
{
|
||||
value = static_cast<decimal>(val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(unsigned long val)
|
||||
{
|
||||
value = static_cast<decimal>(val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(unsigned long long val)
|
||||
{
|
||||
value = static_cast<decimal>(val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(float val)
|
||||
{
|
||||
value = static_cast<decimal>(val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(double val)
|
||||
{
|
||||
value = val;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(long double val)
|
||||
{
|
||||
value = static_cast<decimal>(val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(boolean val)
|
||||
{
|
||||
value = val;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline LSPAny& LSPAny::operator=(std::nullptr_t)
|
||||
{
|
||||
value = nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,64 +1,64 @@
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
enum class ErrorCode : int
|
||||
{
|
||||
kParseError = -32700,
|
||||
kInvalidRequest = -32600,
|
||||
kMethodNotFound = -32601,
|
||||
kInvalidParams = -32602,
|
||||
kInternalError = -32603,
|
||||
|
||||
kJsonrpcReservedErrorRangeStart = -32099,
|
||||
kServerNotInitialized = -32002,
|
||||
kUnknownErrorCode = -32001,
|
||||
kJsonrpcReservedErrorRangeEnd = -32000,
|
||||
kLspReservedErrorRangeStart = -32899,
|
||||
kRequestFailed = -32803,
|
||||
kServerCancelled = -32802,
|
||||
kContentModified = -32801,
|
||||
kRequestCancelled = -32800,
|
||||
kLspReservedErrorRangeEnd = -32800
|
||||
};
|
||||
|
||||
struct Message
|
||||
{
|
||||
string jsonrpc = "2.0";
|
||||
};
|
||||
|
||||
struct RequestMessage: Message
|
||||
{
|
||||
std::variant<integer, string> id;
|
||||
string method;
|
||||
std::optional<std::variant<LSPArray, LSPObject>> params;
|
||||
};
|
||||
|
||||
struct ResponseError: Message
|
||||
{
|
||||
ErrorCode code;
|
||||
string message;
|
||||
std::optional<LSPAny> data;
|
||||
};
|
||||
|
||||
struct ResponseMessage: Message
|
||||
{
|
||||
std::variant<integer, string> id;
|
||||
std::optional<LSPAny> result;
|
||||
std::optional<ResponseError> error;
|
||||
};
|
||||
|
||||
struct NotificationMessage: Message
|
||||
{
|
||||
string method;
|
||||
std::optional<LSPAny> params;
|
||||
};
|
||||
|
||||
struct CancelParams
|
||||
{
|
||||
std::variant<integer, string> id;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
enum class ErrorCode : int
|
||||
{
|
||||
kParseError = -32700,
|
||||
kInvalidRequest = -32600,
|
||||
kMethodNotFound = -32601,
|
||||
kInvalidParams = -32602,
|
||||
kInternalError = -32603,
|
||||
|
||||
kJsonrpcReservedErrorRangeStart = -32099,
|
||||
kServerNotInitialized = -32002,
|
||||
kUnknownErrorCode = -32001,
|
||||
kJsonrpcReservedErrorRangeEnd = -32000,
|
||||
kLspReservedErrorRangeStart = -32899,
|
||||
kRequestFailed = -32803,
|
||||
kServerCancelled = -32802,
|
||||
kContentModified = -32801,
|
||||
kRequestCancelled = -32800,
|
||||
kLspReservedErrorRangeEnd = -32800
|
||||
};
|
||||
|
||||
struct Message
|
||||
{
|
||||
string jsonrpc = "2.0";
|
||||
};
|
||||
|
||||
struct RequestMessage: Message
|
||||
{
|
||||
std::variant<integer, string> id;
|
||||
string method;
|
||||
std::optional<std::variant<LSPArray, LSPObject>> params;
|
||||
};
|
||||
|
||||
struct ResponseError: Message
|
||||
{
|
||||
ErrorCode code;
|
||||
string message;
|
||||
std::optional<LSPAny> data;
|
||||
};
|
||||
|
||||
struct ResponseMessage: Message
|
||||
{
|
||||
std::variant<integer, string> id;
|
||||
std::optional<LSPAny> result;
|
||||
std::optional<ResponseError> error;
|
||||
};
|
||||
|
||||
struct NotificationMessage: Message
|
||||
{
|
||||
string method;
|
||||
std::optional<LSPAny> params;
|
||||
};
|
||||
|
||||
struct CancelParams
|
||||
{
|
||||
std::variant<integer, string> id;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,199 +1,199 @@
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
#include "./progress.hpp"
|
||||
#include "./symbols.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
// Declaration
|
||||
struct DeclarationClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<boolean> linkSupport;
|
||||
};
|
||||
|
||||
struct DeclarationOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DeclarationRegistrationOptions : DeclarationOptions, TextDocumentRegistrationOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DeclarationParams : TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
};
|
||||
|
||||
// Definition
|
||||
struct DefinitionClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<boolean> linkSupport;
|
||||
};
|
||||
|
||||
struct DefinitionOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DefinitionRegistrationOptions : TextDocumentRegistrationOptions, DefinitionOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DefinitionParams : TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
};
|
||||
|
||||
// TypeDefinition
|
||||
struct TypeDefinitionClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<boolean> linkSupport;
|
||||
};
|
||||
|
||||
struct TypeDefinitionOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct TypeDefinitionRegistrationOptions : TextDocumentRegistrationOptions, TypeDefinitionOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct TypeDefinitionParams : TextDocumentPositionParams, WorkDoneProgressParams
|
||||
{
|
||||
};
|
||||
|
||||
// Implementation
|
||||
struct ImplementationClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<boolean> linkSupport;
|
||||
};
|
||||
|
||||
struct ImplementationOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct ImplementationRegistrationOptions : TextDocumentRegistrationOptions, ImplementationOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct ImplementationParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
};
|
||||
|
||||
// Reference
|
||||
struct ReferenceContext
|
||||
{
|
||||
boolean includeDeclaration;
|
||||
};
|
||||
struct ReferenceClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
struct ReferenceOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
struct ReferenceRegistrationOptions : TextDocumentRegistrationOptions, ReferenceOptions
|
||||
{
|
||||
};
|
||||
struct ReferenceParams : TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
ReferenceContext context;
|
||||
};
|
||||
|
||||
// CallHierarchy
|
||||
struct CallHierarchyClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct CallHierarchyOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct CallHierarchyRegistrationOptions : TextDocumentRegistrationOptions, CallHierarchyOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct CallHierarchyParams : TextDocumentPositionParams, WorkDoneProgressParams
|
||||
{
|
||||
};
|
||||
|
||||
struct CallHierarchyItem
|
||||
{
|
||||
string name;
|
||||
SymbolKind kind;
|
||||
std::vector<SymbolTag> tags;
|
||||
DocumentUri uri;
|
||||
Range range;
|
||||
Range selectionRange;
|
||||
std::optional<LSPAny> data;
|
||||
};
|
||||
|
||||
struct CallHierarchyIncomingCallsParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
CallHierarchyItem item;
|
||||
};
|
||||
|
||||
struct CallHierarchyIncomingCall
|
||||
{
|
||||
CallHierarchyItem from;
|
||||
std::vector<Range> fromRanges;
|
||||
};
|
||||
|
||||
struct CallHierarchyOutgoingCallsParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
CallHierarchyItem item;
|
||||
};
|
||||
|
||||
struct CallHierarchyOutgoingCall
|
||||
{
|
||||
CallHierarchyItem from;
|
||||
std::vector<Range> fromRanges;
|
||||
};
|
||||
|
||||
// TypeHierarchy
|
||||
struct TypeHierarchyClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct TypeHierarchyOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct TypeHierarchyRegistrationOptions : TextDocumentRegistrationOptions, TypeHierarchyOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct TypeHierarchyParams : TextDocumentPositionParams, WorkDoneProgressParams
|
||||
{
|
||||
};
|
||||
|
||||
struct TypeHierarchyPrepareParams : TextDocumentPositionParams, WorkDoneProgressParams
|
||||
{
|
||||
};
|
||||
|
||||
struct TypeHierarchyItem
|
||||
{
|
||||
string name;
|
||||
SymbolKind kind;
|
||||
std::vector<SymbolTag> tags;
|
||||
DocumentUri uri;
|
||||
Range range;
|
||||
Range selectionRange;
|
||||
std::optional<LSPAny> data;
|
||||
};
|
||||
|
||||
struct TypeHierarchySupertypesParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TypeHierarchyItem item;
|
||||
};
|
||||
|
||||
struct TypeHierarchySubtypesParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TypeHierarchyItem item;
|
||||
};
|
||||
|
||||
}
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
#include "./progress.hpp"
|
||||
#include "./symbols.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
// Declaration
|
||||
struct DeclarationClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<boolean> linkSupport;
|
||||
};
|
||||
|
||||
struct DeclarationOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DeclarationRegistrationOptions : DeclarationOptions, TextDocumentRegistrationOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DeclarationParams : TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
};
|
||||
|
||||
// Definition
|
||||
struct DefinitionClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<boolean> linkSupport;
|
||||
};
|
||||
|
||||
struct DefinitionOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DefinitionRegistrationOptions : TextDocumentRegistrationOptions, DefinitionOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DefinitionParams : TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
};
|
||||
|
||||
// TypeDefinition
|
||||
struct TypeDefinitionClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<boolean> linkSupport;
|
||||
};
|
||||
|
||||
struct TypeDefinitionOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct TypeDefinitionRegistrationOptions : TextDocumentRegistrationOptions, TypeDefinitionOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct TypeDefinitionParams : TextDocumentPositionParams, WorkDoneProgressParams
|
||||
{
|
||||
};
|
||||
|
||||
// Implementation
|
||||
struct ImplementationClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<boolean> linkSupport;
|
||||
};
|
||||
|
||||
struct ImplementationOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct ImplementationRegistrationOptions : TextDocumentRegistrationOptions, ImplementationOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct ImplementationParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
};
|
||||
|
||||
// Reference
|
||||
struct ReferenceContext
|
||||
{
|
||||
boolean includeDeclaration;
|
||||
};
|
||||
struct ReferenceClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
struct ReferenceOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
struct ReferenceRegistrationOptions : TextDocumentRegistrationOptions, ReferenceOptions
|
||||
{
|
||||
};
|
||||
struct ReferenceParams : TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
ReferenceContext context;
|
||||
};
|
||||
|
||||
// CallHierarchy
|
||||
struct CallHierarchyClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct CallHierarchyOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct CallHierarchyRegistrationOptions : TextDocumentRegistrationOptions, CallHierarchyOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct CallHierarchyParams : TextDocumentPositionParams, WorkDoneProgressParams
|
||||
{
|
||||
};
|
||||
|
||||
struct CallHierarchyItem
|
||||
{
|
||||
string name;
|
||||
SymbolKind kind;
|
||||
std::vector<SymbolTag> tags;
|
||||
DocumentUri uri;
|
||||
Range range;
|
||||
Range selectionRange;
|
||||
std::optional<LSPAny> data;
|
||||
};
|
||||
|
||||
struct CallHierarchyIncomingCallsParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
CallHierarchyItem item;
|
||||
};
|
||||
|
||||
struct CallHierarchyIncomingCall
|
||||
{
|
||||
CallHierarchyItem from;
|
||||
std::vector<Range> fromRanges;
|
||||
};
|
||||
|
||||
struct CallHierarchyOutgoingCallsParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
CallHierarchyItem item;
|
||||
};
|
||||
|
||||
struct CallHierarchyOutgoingCall
|
||||
{
|
||||
CallHierarchyItem from;
|
||||
std::vector<Range> fromRanges;
|
||||
};
|
||||
|
||||
// TypeHierarchy
|
||||
struct TypeHierarchyClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct TypeHierarchyOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct TypeHierarchyRegistrationOptions : TextDocumentRegistrationOptions, TypeHierarchyOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct TypeHierarchyParams : TextDocumentPositionParams, WorkDoneProgressParams
|
||||
{
|
||||
};
|
||||
|
||||
struct TypeHierarchyPrepareParams : TextDocumentPositionParams, WorkDoneProgressParams
|
||||
{
|
||||
};
|
||||
|
||||
struct TypeHierarchyItem
|
||||
{
|
||||
string name;
|
||||
SymbolKind kind;
|
||||
std::vector<SymbolTag> tags;
|
||||
DocumentUri uri;
|
||||
Range range;
|
||||
Range selectionRange;
|
||||
std::optional<LSPAny> data;
|
||||
};
|
||||
|
||||
struct TypeHierarchySupertypesParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TypeHierarchyItem item;
|
||||
};
|
||||
|
||||
struct TypeHierarchySubtypesParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TypeHierarchyItem item;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,148 +1,148 @@
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
enum class NotebookCellKind
|
||||
{
|
||||
Markup = 1,
|
||||
Code = 2,
|
||||
};
|
||||
|
||||
struct ExecutionSummary
|
||||
{
|
||||
uinteger executionOrder;
|
||||
std::optional<boolean> success;
|
||||
};
|
||||
|
||||
struct NotebookCell
|
||||
{
|
||||
NotebookCellKind kind;
|
||||
DocumentUri document;
|
||||
std::optional<LSPObject> metadata;
|
||||
std::optional<ExecutionSummary> executionSummary;
|
||||
};
|
||||
|
||||
struct NotebookDocument
|
||||
{
|
||||
URI uri;
|
||||
string notebookType;
|
||||
integer version;
|
||||
LSPObject metadata;
|
||||
std::vector<NotebookCell> cells;
|
||||
};
|
||||
|
||||
struct NotebookDocumentFilter
|
||||
{
|
||||
string notebookType;
|
||||
std::optional<string> scheme;
|
||||
std::optional<string> pattern;
|
||||
};
|
||||
|
||||
struct NotebookCellTextDocumentFilter
|
||||
{
|
||||
std::variant<string, NotebookDocumentFilter> notebook;
|
||||
std::optional<string> language;
|
||||
};
|
||||
|
||||
struct NotebookSelector
|
||||
{
|
||||
struct Cell
|
||||
{
|
||||
string language;
|
||||
};
|
||||
|
||||
std::variant<string, NotebookDocumentFilter> notebook;
|
||||
std::optional<std::vector<Cell>> cells;
|
||||
};
|
||||
|
||||
struct NotebookDocumentSyncOptions
|
||||
{
|
||||
std::vector<NotebookSelector> notebookSelector;
|
||||
std::optional<boolean> save;
|
||||
};
|
||||
|
||||
struct NotebookDocumentSyncRegistrationOptions : NotebookDocumentSyncOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct NotebookDocumentSyncClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<boolean> executionSummarySupport;
|
||||
};
|
||||
|
||||
struct NotebookDocumentClientCapabilities
|
||||
{
|
||||
NotebookDocumentSyncClientCapabilities synchronization;
|
||||
};
|
||||
|
||||
struct DidOpenNotebookDocumentParams
|
||||
{
|
||||
NotebookDocument notebookDocument;
|
||||
std::vector<TextDocumentItem> cellTextDocuments;
|
||||
};
|
||||
|
||||
struct VersionedNotebookDocumentIdentifier
|
||||
{
|
||||
integer version;
|
||||
URI uri;
|
||||
};
|
||||
|
||||
struct NotebookCellArrayChange
|
||||
{
|
||||
uinteger start;
|
||||
uinteger deleteCount;
|
||||
std::optional<std::vector<NotebookCell>> cells;
|
||||
};
|
||||
|
||||
struct NotebookDocumentChangeEvent
|
||||
{
|
||||
struct Cell
|
||||
{
|
||||
struct Structure
|
||||
{
|
||||
NotebookCellArrayChange array;
|
||||
std::optional<std::vector<TextDocumentItem>> didOpen;
|
||||
std::optional<std::vector<TextDocumentIdentifier>> didClose;
|
||||
};
|
||||
|
||||
struct TextContent
|
||||
{
|
||||
VersionedTextDocumentIdentifier document;
|
||||
std::vector<TextDocumentContentChangeEvent> changes;
|
||||
};
|
||||
|
||||
std::optional<Structure> structure;
|
||||
std::optional<std::vector<NotebookCell>> data;
|
||||
std::optional<TextContent> textContent;
|
||||
};
|
||||
|
||||
std::optional<LSPObject> metadata;
|
||||
std::optional<std::vector<Cell>> cells;
|
||||
};
|
||||
|
||||
struct DidChangeNotebookDocumentParams
|
||||
{
|
||||
VersionedNotebookDocumentIdentifier notebookDocument;
|
||||
NotebookDocumentChangeEvent change;
|
||||
};
|
||||
|
||||
struct NotebookDocumentIdentifier
|
||||
{
|
||||
URI uri;
|
||||
};
|
||||
|
||||
struct DidSaveNotebookDocumentParams
|
||||
{
|
||||
NotebookDocumentIdentifier notebookDocument;
|
||||
};
|
||||
|
||||
struct DidCloseNotebookDocumentParams
|
||||
{
|
||||
NotebookDocumentIdentifier notebookDocument;
|
||||
std::vector<TextDocumentIdentifier> cellTextDocuments;
|
||||
};
|
||||
|
||||
}
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
enum class NotebookCellKind
|
||||
{
|
||||
Markup = 1,
|
||||
Code = 2,
|
||||
};
|
||||
|
||||
struct ExecutionSummary
|
||||
{
|
||||
uinteger executionOrder;
|
||||
std::optional<boolean> success;
|
||||
};
|
||||
|
||||
struct NotebookCell
|
||||
{
|
||||
NotebookCellKind kind;
|
||||
DocumentUri document;
|
||||
std::optional<LSPObject> metadata;
|
||||
std::optional<ExecutionSummary> executionSummary;
|
||||
};
|
||||
|
||||
struct NotebookDocument
|
||||
{
|
||||
URI uri;
|
||||
string notebookType;
|
||||
integer version;
|
||||
LSPObject metadata;
|
||||
std::vector<NotebookCell> cells;
|
||||
};
|
||||
|
||||
struct NotebookDocumentFilter
|
||||
{
|
||||
string notebookType;
|
||||
std::optional<string> scheme;
|
||||
std::optional<string> pattern;
|
||||
};
|
||||
|
||||
struct NotebookCellTextDocumentFilter
|
||||
{
|
||||
std::variant<string, NotebookDocumentFilter> notebook;
|
||||
std::optional<string> language;
|
||||
};
|
||||
|
||||
struct NotebookSelector
|
||||
{
|
||||
struct Cell
|
||||
{
|
||||
string language;
|
||||
};
|
||||
|
||||
std::variant<string, NotebookDocumentFilter> notebook;
|
||||
std::optional<std::vector<Cell>> cells;
|
||||
};
|
||||
|
||||
struct NotebookDocumentSyncOptions
|
||||
{
|
||||
std::vector<NotebookSelector> notebookSelector;
|
||||
std::optional<boolean> save;
|
||||
};
|
||||
|
||||
struct NotebookDocumentSyncRegistrationOptions : NotebookDocumentSyncOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct NotebookDocumentSyncClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<boolean> executionSummarySupport;
|
||||
};
|
||||
|
||||
struct NotebookDocumentClientCapabilities
|
||||
{
|
||||
NotebookDocumentSyncClientCapabilities synchronization;
|
||||
};
|
||||
|
||||
struct DidOpenNotebookDocumentParams
|
||||
{
|
||||
NotebookDocument notebookDocument;
|
||||
std::vector<TextDocumentItem> cellTextDocuments;
|
||||
};
|
||||
|
||||
struct VersionedNotebookDocumentIdentifier
|
||||
{
|
||||
integer version;
|
||||
URI uri;
|
||||
};
|
||||
|
||||
struct NotebookCellArrayChange
|
||||
{
|
||||
uinteger start;
|
||||
uinteger deleteCount;
|
||||
std::optional<std::vector<NotebookCell>> cells;
|
||||
};
|
||||
|
||||
struct NotebookDocumentChangeEvent
|
||||
{
|
||||
struct Cell
|
||||
{
|
||||
struct Structure
|
||||
{
|
||||
NotebookCellArrayChange array;
|
||||
std::optional<std::vector<TextDocumentItem>> didOpen;
|
||||
std::optional<std::vector<TextDocumentIdentifier>> didClose;
|
||||
};
|
||||
|
||||
struct TextContent
|
||||
{
|
||||
VersionedTextDocumentIdentifier document;
|
||||
std::vector<TextDocumentContentChangeEvent> changes;
|
||||
};
|
||||
|
||||
std::optional<Structure> structure;
|
||||
std::optional<std::vector<NotebookCell>> data;
|
||||
std::optional<TextContent> textContent;
|
||||
};
|
||||
|
||||
std::optional<LSPObject> metadata;
|
||||
std::optional<std::vector<Cell>> cells;
|
||||
};
|
||||
|
||||
struct DidChangeNotebookDocumentParams
|
||||
{
|
||||
VersionedNotebookDocumentIdentifier notebookDocument;
|
||||
NotebookDocumentChangeEvent change;
|
||||
};
|
||||
|
||||
struct NotebookDocumentIdentifier
|
||||
{
|
||||
URI uri;
|
||||
};
|
||||
|
||||
struct DidSaveNotebookDocumentParams
|
||||
{
|
||||
NotebookDocumentIdentifier notebookDocument;
|
||||
};
|
||||
|
||||
struct DidCloseNotebookDocumentParams
|
||||
{
|
||||
NotebookDocumentIdentifier notebookDocument;
|
||||
std::vector<TextDocumentIdentifier> cellTextDocuments;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,73 +1,73 @@
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
struct WorkDoneProgressBegin
|
||||
{
|
||||
string kind = "begin";
|
||||
string title;
|
||||
boolean cancellable;
|
||||
std::optional<string> message;
|
||||
uinteger percentage;
|
||||
};
|
||||
|
||||
struct WorkDoneProgressReport
|
||||
{
|
||||
string kind = "report";
|
||||
boolean cancellable;
|
||||
std::optional<string> message;
|
||||
uinteger percentage;
|
||||
};
|
||||
|
||||
struct WorkDoneProgressEnd
|
||||
{
|
||||
string kind = "end";
|
||||
string message;
|
||||
};
|
||||
|
||||
struct WorkDoneProgressParams
|
||||
{
|
||||
ProgressToken workDoneToken;
|
||||
};
|
||||
|
||||
struct WorkDoneProgressOptions
|
||||
{
|
||||
boolean workDoneProgress;
|
||||
};
|
||||
|
||||
struct PartialResultParams
|
||||
{
|
||||
ProgressToken partialResultToken;
|
||||
};
|
||||
|
||||
struct WorkDoneProgressCreateParams
|
||||
{
|
||||
ProgressToken token;
|
||||
};
|
||||
|
||||
struct WorkDoneProgressCancelParams
|
||||
{
|
||||
ProgressToken token;
|
||||
};
|
||||
|
||||
using TraceValue = std::string_view;
|
||||
namespace TraceValueLiterals
|
||||
{
|
||||
inline constexpr TraceValue Off = "off";
|
||||
inline constexpr TraceValue Messages = "messages";
|
||||
inline constexpr TraceValue Verbose = "verbose";
|
||||
}
|
||||
|
||||
struct SetTraceParams
|
||||
{
|
||||
TraceValue value;
|
||||
};
|
||||
|
||||
struct LogTraceParams
|
||||
{
|
||||
string message;
|
||||
std::optional<string> verbose;
|
||||
};
|
||||
|
||||
}
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
struct WorkDoneProgressBegin
|
||||
{
|
||||
string kind = "begin";
|
||||
string title;
|
||||
boolean cancellable;
|
||||
std::optional<string> message;
|
||||
uinteger percentage;
|
||||
};
|
||||
|
||||
struct WorkDoneProgressReport
|
||||
{
|
||||
string kind = "report";
|
||||
boolean cancellable;
|
||||
std::optional<string> message;
|
||||
uinteger percentage;
|
||||
};
|
||||
|
||||
struct WorkDoneProgressEnd
|
||||
{
|
||||
string kind = "end";
|
||||
string message;
|
||||
};
|
||||
|
||||
struct WorkDoneProgressParams
|
||||
{
|
||||
ProgressToken workDoneToken;
|
||||
};
|
||||
|
||||
struct WorkDoneProgressOptions
|
||||
{
|
||||
std::optional<boolean> workDoneProgress;
|
||||
};
|
||||
|
||||
struct PartialResultParams
|
||||
{
|
||||
ProgressToken partialResultToken;
|
||||
};
|
||||
|
||||
struct WorkDoneProgressCreateParams
|
||||
{
|
||||
ProgressToken token;
|
||||
};
|
||||
|
||||
struct WorkDoneProgressCancelParams
|
||||
{
|
||||
ProgressToken token;
|
||||
};
|
||||
|
||||
using TraceValue = std::string_view;
|
||||
namespace TraceValueLiterals
|
||||
{
|
||||
inline constexpr TraceValue Off = "off";
|
||||
inline constexpr TraceValue Messages = "messages";
|
||||
inline constexpr TraceValue Verbose = "verbose";
|
||||
}
|
||||
|
||||
struct SetTraceParams
|
||||
{
|
||||
TraceValue value;
|
||||
};
|
||||
|
||||
struct LogTraceParams
|
||||
{
|
||||
string message;
|
||||
std::optional<string> verbose;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,39 +1,39 @@
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
struct Registration
|
||||
{
|
||||
string id;
|
||||
string method;
|
||||
std::optional<LSPAny> registerOptions;
|
||||
};
|
||||
|
||||
struct RegistrationParams
|
||||
{
|
||||
std::vector<Registration> registrations;
|
||||
};
|
||||
|
||||
struct StaticRegistrationOptions
|
||||
{
|
||||
std::optional<string> id;
|
||||
};
|
||||
|
||||
struct TextDocumentRegistrationOptions
|
||||
{
|
||||
std::optional<DocumentSelector> documentSelector;
|
||||
};
|
||||
|
||||
struct Unregistration
|
||||
{
|
||||
string id;
|
||||
string method;
|
||||
};
|
||||
|
||||
struct UnregistrationParams
|
||||
{
|
||||
std::vector<Unregistration> unregistration;
|
||||
};
|
||||
|
||||
} // namespace lsp::protocol
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
struct Registration
|
||||
{
|
||||
string id;
|
||||
string method;
|
||||
std::optional<LSPAny> registerOptions;
|
||||
};
|
||||
|
||||
struct RegistrationParams
|
||||
{
|
||||
std::vector<Registration> registrations;
|
||||
};
|
||||
|
||||
struct StaticRegistrationOptions
|
||||
{
|
||||
std::optional<string> id;
|
||||
};
|
||||
|
||||
struct TextDocumentRegistrationOptions
|
||||
{
|
||||
std::optional<DocumentSelector> documentSelector;
|
||||
};
|
||||
|
||||
struct Unregistration
|
||||
{
|
||||
string id;
|
||||
string method;
|
||||
};
|
||||
|
||||
struct UnregistrationParams
|
||||
{
|
||||
std::vector<Unregistration> unregistration;
|
||||
};
|
||||
|
||||
} // namespace lsp::protocol
|
||||
|
||||
@@ -1,64 +1,64 @@
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
#include "./progress.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
enum class PrepareSupportDefaultBehavior
|
||||
{
|
||||
kIdentifier = 1
|
||||
};
|
||||
|
||||
// Rename
|
||||
struct RenameClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<boolean> prepareSupport;
|
||||
std::optional<PrepareSupportDefaultBehavior> prepareSupportDefaultBehavior;
|
||||
std::optional<boolean> honorsChangeAnnotations;
|
||||
};
|
||||
|
||||
struct RenameOptions : WorkDoneProgressOptions
|
||||
{
|
||||
std::optional<boolean> prepareProvider;
|
||||
};
|
||||
|
||||
struct RenameRegistrationOptions : TextDocumentRegistrationOptions, RenameOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct RenameParams : TextDocumentPositionParams, WorkDoneProgressParams
|
||||
{
|
||||
string newName;
|
||||
};
|
||||
|
||||
struct PrepareRenameParams : TextDocumentPositionParams, WorkDoneProgressParams
|
||||
{
|
||||
};
|
||||
|
||||
// Linked Editing Range
|
||||
struct LinkedEditingRangeClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct LinkedEditingRangeOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct LinkedEditingRangeRegistrationOptions : TextDocumentRegistrationOptions, LinkedEditingRangeOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct LinkedEditingRangeParams : TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
};
|
||||
|
||||
struct LinkedEditingRanges
|
||||
{
|
||||
std::vector<Range> ranges;
|
||||
std::optional<string> wordPattern;
|
||||
};
|
||||
|
||||
}
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
#include "./progress.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
enum class PrepareSupportDefaultBehavior
|
||||
{
|
||||
kIdentifier = 1
|
||||
};
|
||||
|
||||
// Rename
|
||||
struct RenameClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<boolean> prepareSupport;
|
||||
std::optional<PrepareSupportDefaultBehavior> prepareSupportDefaultBehavior;
|
||||
std::optional<boolean> honorsChangeAnnotations;
|
||||
};
|
||||
|
||||
struct RenameOptions : WorkDoneProgressOptions
|
||||
{
|
||||
std::optional<boolean> prepareProvider;
|
||||
};
|
||||
|
||||
struct RenameRegistrationOptions : TextDocumentRegistrationOptions, RenameOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct RenameParams : TextDocumentPositionParams, WorkDoneProgressParams
|
||||
{
|
||||
string newName;
|
||||
};
|
||||
|
||||
struct PrepareRenameParams : TextDocumentPositionParams, WorkDoneProgressParams
|
||||
{
|
||||
};
|
||||
|
||||
// Linked Editing Range
|
||||
struct LinkedEditingRangeClientCapabilities
|
||||
{
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
};
|
||||
|
||||
struct LinkedEditingRangeOptions : WorkDoneProgressOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct LinkedEditingRangeRegistrationOptions : TextDocumentRegistrationOptions, LinkedEditingRangeOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct LinkedEditingRangeParams : TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
};
|
||||
|
||||
struct LinkedEditingRanges
|
||||
{
|
||||
std::vector<Range> ranges;
|
||||
std::optional<string> wordPattern;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,151 +1,151 @@
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
#include "./progress.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
using SemanticTokenType = std::string_view;
|
||||
namespace SemanticTokenTypesLiterals
|
||||
{
|
||||
inline constexpr SemanticTokenType Namespace = "namespace";
|
||||
inline constexpr SemanticTokenType Type = "type";
|
||||
inline constexpr SemanticTokenType Class = "class";
|
||||
inline constexpr SemanticTokenType Enum = "enum";
|
||||
inline constexpr SemanticTokenType Interface = "interface";
|
||||
inline constexpr SemanticTokenType Struct = "struct";
|
||||
inline constexpr SemanticTokenType TypeParameter = "typeParameter";
|
||||
inline constexpr SemanticTokenType Parameter = "parameter";
|
||||
inline constexpr SemanticTokenType Variable = "variable";
|
||||
inline constexpr SemanticTokenType Property = "property";
|
||||
inline constexpr SemanticTokenType EnumMember = "enumMember";
|
||||
inline constexpr SemanticTokenType Event = "event";
|
||||
inline constexpr SemanticTokenType Function = "function";
|
||||
inline constexpr SemanticTokenType Method = "method";
|
||||
inline constexpr SemanticTokenType Macro = "macro";
|
||||
inline constexpr SemanticTokenType Keyword = "keyword";
|
||||
inline constexpr SemanticTokenType Modifier = "modifier";
|
||||
inline constexpr SemanticTokenType Comment = "comment";
|
||||
inline constexpr SemanticTokenType String = "string";
|
||||
inline constexpr SemanticTokenType Number = "number";
|
||||
inline constexpr SemanticTokenType Regexp = "regexp";
|
||||
inline constexpr SemanticTokenType Operator = "operator";
|
||||
inline constexpr SemanticTokenType Decorator = "decorator";
|
||||
}
|
||||
|
||||
using SemanticTokenModifiers = std::string_view;
|
||||
namespace SemanticTokenModifiersLiterals
|
||||
{
|
||||
inline constexpr SemanticTokenModifiers Declaration = "declaration";
|
||||
inline constexpr SemanticTokenModifiers Definition = "definition";
|
||||
inline constexpr SemanticTokenModifiers Readonly = "readonly";
|
||||
inline constexpr SemanticTokenModifiers Static = "static";
|
||||
inline constexpr SemanticTokenModifiers Deprecated = "deprecated";
|
||||
inline constexpr SemanticTokenModifiers Abstract = "abstract";
|
||||
inline constexpr SemanticTokenModifiers Async = "async";
|
||||
inline constexpr SemanticTokenModifiers Modification = "modification";
|
||||
inline constexpr SemanticTokenModifiers Documentation = "documentation";
|
||||
inline constexpr SemanticTokenModifiers DefaultLibrary = "defaultLibrary";
|
||||
}
|
||||
|
||||
using TokenFormat = std::string_view;
|
||||
namespace TokenFormatLiterals
|
||||
{
|
||||
inline constexpr TokenFormat Relative = "relative";
|
||||
}
|
||||
|
||||
struct SemanticTokensLegend
|
||||
{
|
||||
std::vector<string> tokenType;
|
||||
std::vector<string> tokenModifiers;
|
||||
};
|
||||
|
||||
struct SemanticTokensClientCapabilities
|
||||
{
|
||||
struct Requests
|
||||
{
|
||||
struct Full
|
||||
{
|
||||
std::optional<boolean> delta;
|
||||
};
|
||||
|
||||
std::optional<boolean> range;
|
||||
std::variant<Full, boolean> full;
|
||||
};
|
||||
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::vector<string> tokenType;
|
||||
std::vector<string> tokenModifiers;
|
||||
std::optional<boolean> overlappingTokenSupport;
|
||||
std::optional<boolean> multilineTokenSupport;
|
||||
std::optional<boolean> serverCancelSupport;
|
||||
std::optional<boolean> augmentsSyntaxTokens;
|
||||
};
|
||||
|
||||
struct SemanticTokensOptions : WorkDoneProgressOptions
|
||||
{
|
||||
struct Full
|
||||
{
|
||||
std::optional<boolean> delta;
|
||||
};
|
||||
|
||||
SemanticTokensLegend legend;
|
||||
std::optional<boolean> range;
|
||||
std::variant<Full, boolean> full;
|
||||
};
|
||||
|
||||
struct SemanticTokensRegistrationOptions : TextDocumentRegistrationOptions, SemanticTokensOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct SemanticTokensParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
};
|
||||
|
||||
struct SemanticTokens
|
||||
{
|
||||
std::optional<string> resultId;
|
||||
std::vector<uinteger> data;
|
||||
};
|
||||
|
||||
struct SemanticTokensPartialResult
|
||||
{
|
||||
std::vector<uinteger> data;
|
||||
};
|
||||
|
||||
struct SemanticTokensDeltaParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
string previousResultId;
|
||||
};
|
||||
|
||||
struct SemanticTokensEdit
|
||||
{
|
||||
uinteger start;
|
||||
uinteger deleteCount;
|
||||
std::optional<uinteger> data;
|
||||
};
|
||||
|
||||
struct SemanticTokensDelta
|
||||
{
|
||||
std::optional<string> resultId;
|
||||
std::optional<std::vector<SemanticTokensEdit>> edits;
|
||||
};
|
||||
|
||||
struct SemanticTokensDeltaPartialResult
|
||||
{
|
||||
std::optional<std::vector<SemanticTokensEdit>> edits;
|
||||
};
|
||||
|
||||
struct SemanticTokensRangeParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
Range range;
|
||||
};
|
||||
|
||||
struct SemanticTokensWorkspaceClientCapabilities
|
||||
{
|
||||
std::optional<boolean> refreshSupport;
|
||||
};
|
||||
}
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
#include "./progress.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
using SemanticTokenType = std::string_view;
|
||||
namespace SemanticTokenTypesLiterals
|
||||
{
|
||||
inline constexpr SemanticTokenType Namespace = "namespace";
|
||||
inline constexpr SemanticTokenType Type = "type";
|
||||
inline constexpr SemanticTokenType Class = "class";
|
||||
inline constexpr SemanticTokenType Enum = "enum";
|
||||
inline constexpr SemanticTokenType Interface = "interface";
|
||||
inline constexpr SemanticTokenType Struct = "struct";
|
||||
inline constexpr SemanticTokenType TypeParameter = "typeParameter";
|
||||
inline constexpr SemanticTokenType Parameter = "parameter";
|
||||
inline constexpr SemanticTokenType Variable = "variable";
|
||||
inline constexpr SemanticTokenType Property = "property";
|
||||
inline constexpr SemanticTokenType EnumMember = "enumMember";
|
||||
inline constexpr SemanticTokenType Event = "event";
|
||||
inline constexpr SemanticTokenType Function = "function";
|
||||
inline constexpr SemanticTokenType Method = "method";
|
||||
inline constexpr SemanticTokenType Macro = "macro";
|
||||
inline constexpr SemanticTokenType Keyword = "keyword";
|
||||
inline constexpr SemanticTokenType Modifier = "modifier";
|
||||
inline constexpr SemanticTokenType Comment = "comment";
|
||||
inline constexpr SemanticTokenType String = "string";
|
||||
inline constexpr SemanticTokenType Number = "number";
|
||||
inline constexpr SemanticTokenType Regexp = "regexp";
|
||||
inline constexpr SemanticTokenType Operator = "operator";
|
||||
inline constexpr SemanticTokenType Decorator = "decorator";
|
||||
}
|
||||
|
||||
using SemanticTokenModifiers = std::string_view;
|
||||
namespace SemanticTokenModifiersLiterals
|
||||
{
|
||||
inline constexpr SemanticTokenModifiers Declaration = "declaration";
|
||||
inline constexpr SemanticTokenModifiers Definition = "definition";
|
||||
inline constexpr SemanticTokenModifiers Readonly = "readonly";
|
||||
inline constexpr SemanticTokenModifiers Static = "static";
|
||||
inline constexpr SemanticTokenModifiers Deprecated = "deprecated";
|
||||
inline constexpr SemanticTokenModifiers Abstract = "abstract";
|
||||
inline constexpr SemanticTokenModifiers Async = "async";
|
||||
inline constexpr SemanticTokenModifiers Modification = "modification";
|
||||
inline constexpr SemanticTokenModifiers Documentation = "documentation";
|
||||
inline constexpr SemanticTokenModifiers DefaultLibrary = "defaultLibrary";
|
||||
}
|
||||
|
||||
using TokenFormat = std::string_view;
|
||||
namespace TokenFormatLiterals
|
||||
{
|
||||
inline constexpr TokenFormat Relative = "relative";
|
||||
}
|
||||
|
||||
struct SemanticTokensLegend
|
||||
{
|
||||
std::vector<string> tokenType;
|
||||
std::vector<string> tokenModifiers;
|
||||
};
|
||||
|
||||
struct SemanticTokensClientCapabilities
|
||||
{
|
||||
struct Requests
|
||||
{
|
||||
struct Full
|
||||
{
|
||||
std::optional<boolean> delta;
|
||||
};
|
||||
|
||||
std::optional<boolean> range;
|
||||
std::variant<Full, boolean> full;
|
||||
};
|
||||
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::vector<string> tokenType;
|
||||
std::vector<string> tokenModifiers;
|
||||
std::optional<boolean> overlappingTokenSupport;
|
||||
std::optional<boolean> multilineTokenSupport;
|
||||
std::optional<boolean> serverCancelSupport;
|
||||
std::optional<boolean> augmentsSyntaxTokens;
|
||||
};
|
||||
|
||||
struct SemanticTokensOptions : WorkDoneProgressOptions
|
||||
{
|
||||
struct Full
|
||||
{
|
||||
std::optional<boolean> delta;
|
||||
};
|
||||
|
||||
SemanticTokensLegend legend;
|
||||
std::optional<boolean> range;
|
||||
std::variant<Full, boolean> full;
|
||||
};
|
||||
|
||||
struct SemanticTokensRegistrationOptions : TextDocumentRegistrationOptions, SemanticTokensOptions, StaticRegistrationOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct SemanticTokensParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
};
|
||||
|
||||
struct SemanticTokens
|
||||
{
|
||||
std::optional<string> resultId;
|
||||
std::vector<uinteger> data;
|
||||
};
|
||||
|
||||
struct SemanticTokensPartialResult
|
||||
{
|
||||
std::vector<uinteger> data;
|
||||
};
|
||||
|
||||
struct SemanticTokensDeltaParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
string previousResultId;
|
||||
};
|
||||
|
||||
struct SemanticTokensEdit
|
||||
{
|
||||
uinteger start;
|
||||
uinteger deleteCount;
|
||||
std::optional<uinteger> data;
|
||||
};
|
||||
|
||||
struct SemanticTokensDelta
|
||||
{
|
||||
std::optional<string> resultId;
|
||||
std::optional<std::vector<SemanticTokensEdit>> edits;
|
||||
};
|
||||
|
||||
struct SemanticTokensDeltaPartialResult
|
||||
{
|
||||
std::optional<std::vector<SemanticTokensEdit>> edits;
|
||||
};
|
||||
|
||||
struct SemanticTokensRangeParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
Range range;
|
||||
};
|
||||
|
||||
struct SemanticTokensWorkspaceClientCapabilities
|
||||
{
|
||||
std::optional<boolean> refreshSupport;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,78 +1,78 @@
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
#include "./progress.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
struct SignatureHelpClientCapabilities
|
||||
{
|
||||
struct SignatureInformation
|
||||
{
|
||||
struct ParammeterInformation
|
||||
{
|
||||
std::optional<boolean> labelOffsetSupport;
|
||||
};
|
||||
|
||||
std::optional<std::vector<MarkupKind>> documentationFormat;
|
||||
std::optional<ParammeterInformation> parameterInformation;
|
||||
std::optional<boolean> activeParameterSupport;
|
||||
};
|
||||
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<SignatureInformation> signatureInformation;
|
||||
std::optional<boolean> contextSupport;
|
||||
};
|
||||
|
||||
struct SignatureHelpOptions : WorkDoneProgressOptions
|
||||
{
|
||||
std::optional<std::vector<string>> triggerCharacters;
|
||||
std::optional<std::vector<string>> retriggerCharacters;
|
||||
};
|
||||
|
||||
struct SignatureHelpRegistrationOptions : TextDocumentRegistrationOptions, SignatureHelpOptions
|
||||
{
|
||||
};
|
||||
|
||||
enum class SignatureHelpTriggerKind
|
||||
{
|
||||
kInvoked = 1,
|
||||
kTriggerCharacter = 2,
|
||||
kContentChange = 3
|
||||
};
|
||||
|
||||
struct ParammeterInformation
|
||||
{
|
||||
string label;
|
||||
std::variant<string, MarkupContent> documentation;
|
||||
};
|
||||
|
||||
struct SignatureInformation
|
||||
{
|
||||
string label;
|
||||
std::optional<std::variant<string, MarkupContent>> documentation;
|
||||
std::optional<std::vector<ParammeterInformation>> parameters;
|
||||
std::optional<uinteger> activeParameter;
|
||||
};
|
||||
|
||||
struct SignatureHelp
|
||||
{
|
||||
std::vector<SignatureInformation> signatures;
|
||||
std::optional<uinteger> activeSignature;
|
||||
std::optional<uinteger> activeParameter;
|
||||
};
|
||||
|
||||
struct SignatureHelpContext
|
||||
{
|
||||
SignatureHelpTriggerKind triggerKind;
|
||||
string triggerCharacter;
|
||||
boolean isRetrigger;
|
||||
std::optional<SignatureHelp> activeSignatureHelp;
|
||||
};
|
||||
|
||||
struct SignatureHelpParams : TextDocumentPositionParams, WorkDoneProgressParams
|
||||
{
|
||||
std::optional<SignatureHelpContext> contextSupport;
|
||||
};
|
||||
|
||||
}
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
#include "./progress.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
struct SignatureHelpClientCapabilities
|
||||
{
|
||||
struct SignatureInformation
|
||||
{
|
||||
struct ParammeterInformation
|
||||
{
|
||||
std::optional<boolean> labelOffsetSupport;
|
||||
};
|
||||
|
||||
std::optional<std::vector<MarkupKind>> documentationFormat;
|
||||
std::optional<ParammeterInformation> parameterInformation;
|
||||
std::optional<boolean> activeParameterSupport;
|
||||
};
|
||||
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<SignatureInformation> signatureInformation;
|
||||
std::optional<boolean> contextSupport;
|
||||
};
|
||||
|
||||
struct SignatureHelpOptions : WorkDoneProgressOptions
|
||||
{
|
||||
std::optional<std::vector<string>> triggerCharacters;
|
||||
std::optional<std::vector<string>> retriggerCharacters;
|
||||
};
|
||||
|
||||
struct SignatureHelpRegistrationOptions : TextDocumentRegistrationOptions, SignatureHelpOptions
|
||||
{
|
||||
};
|
||||
|
||||
enum class SignatureHelpTriggerKind
|
||||
{
|
||||
kInvoked = 1,
|
||||
kTriggerCharacter = 2,
|
||||
kContentChange = 3
|
||||
};
|
||||
|
||||
struct ParammeterInformation
|
||||
{
|
||||
string label;
|
||||
std::variant<string, MarkupContent> documentation;
|
||||
};
|
||||
|
||||
struct SignatureInformation
|
||||
{
|
||||
string label;
|
||||
std::optional<std::variant<string, MarkupContent>> documentation;
|
||||
std::optional<std::vector<ParammeterInformation>> parameters;
|
||||
std::optional<uinteger> activeParameter;
|
||||
};
|
||||
|
||||
struct SignatureHelp
|
||||
{
|
||||
std::vector<SignatureInformation> signatures;
|
||||
std::optional<uinteger> activeSignature;
|
||||
std::optional<uinteger> activeParameter;
|
||||
};
|
||||
|
||||
struct SignatureHelpContext
|
||||
{
|
||||
SignatureHelpTriggerKind triggerKind;
|
||||
string triggerCharacter;
|
||||
boolean isRetrigger;
|
||||
std::optional<SignatureHelp> activeSignatureHelp;
|
||||
};
|
||||
|
||||
struct SignatureHelpParams : TextDocumentPositionParams, WorkDoneProgressParams
|
||||
{
|
||||
std::optional<SignatureHelpContext> contextSupport;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,147 +1,147 @@
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
#include "./progress.hpp"
|
||||
#include "./completion.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
enum class SymbolKind
|
||||
{
|
||||
kFile = 1,
|
||||
kModule = 2,
|
||||
kNamespace = 3,
|
||||
kPackage = 4,
|
||||
kClass = 5,
|
||||
kMethod = 6,
|
||||
kProperty = 7,
|
||||
kField = 8,
|
||||
kConstructor = 9,
|
||||
kEnum = 10,
|
||||
kInterface = 11,
|
||||
kFunction = 12,
|
||||
kVariable = 13,
|
||||
kConstant = 14,
|
||||
kString = 15,
|
||||
kNumber = 16,
|
||||
kBoolean = 17,
|
||||
kArray = 18,
|
||||
kObject = 19,
|
||||
kKey = 20,
|
||||
kNull = 21,
|
||||
kEnumMember = 22,
|
||||
kStruct = 23,
|
||||
kEvent = 24,
|
||||
kOperator = 25,
|
||||
kTypeParameter = 26
|
||||
};
|
||||
|
||||
enum class SymbolTag
|
||||
{
|
||||
Deprecated = 1
|
||||
};
|
||||
|
||||
struct DocumentSymbol
|
||||
{
|
||||
string name;
|
||||
std::optional<string> detail;
|
||||
SymbolKind kind;
|
||||
std::optional<std::vector<SymbolTag>> tags;
|
||||
std::optional<boolean> deprecated;
|
||||
Range range;
|
||||
Range selectionRange;
|
||||
std::optional<std::vector<DocumentSymbol>> children;
|
||||
};
|
||||
|
||||
struct SymbolInformation
|
||||
{
|
||||
string name;
|
||||
SymbolKind kind;
|
||||
std::optional<std::vector<SymbolTag>> tags;
|
||||
std::optional<boolean> deprecated;
|
||||
Location location;
|
||||
std::optional<string> containerName;
|
||||
};
|
||||
|
||||
struct DocumentSymbolClientCapabilities
|
||||
{
|
||||
struct SymbolKinds
|
||||
{
|
||||
std::vector<SymbolKind> valueSet;
|
||||
};
|
||||
struct TagSupport
|
||||
{
|
||||
std::optional<std::vector<CompletionItemTag>> valueSet;
|
||||
};
|
||||
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<SymbolKinds> symbolKind;
|
||||
std::optional<boolean> hierarchicalDocumentSymbolSupport;
|
||||
std::optional<TagSupport> tagSupport;
|
||||
std::optional<boolean> labelSupport;
|
||||
};
|
||||
|
||||
struct DocumentSymbolOptions : WorkDoneProgressOptions
|
||||
{
|
||||
std::optional<string> label;
|
||||
};
|
||||
|
||||
struct DocumentSymbolRegistrationOptions : TextDocumentRegistrationOptions, DocumentSymbolOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DocumentSymbolParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
};
|
||||
|
||||
struct WorkspaceSymbolClientCapabilities
|
||||
{
|
||||
struct SymbolKinds
|
||||
{
|
||||
std::vector<SymbolKind> valueSet;
|
||||
};
|
||||
struct TagSupport
|
||||
{
|
||||
std::optional<std::vector<CompletionItemTag>> valueSet;
|
||||
};
|
||||
struct ResolveSupport
|
||||
{
|
||||
std::vector<string> properties;
|
||||
};
|
||||
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<SymbolKinds> symbolKind;
|
||||
std::optional<TagSupport> tagSupport;
|
||||
std::optional<ResolveSupport> resolveSupport;
|
||||
};
|
||||
|
||||
struct WorkspaceSymbolOptions : WorkDoneProgressOptions
|
||||
{
|
||||
std::optional<boolean> resolveProvider;
|
||||
};
|
||||
|
||||
struct WorkspaceSymbolRegistrationOptions : WorkspaceSymbolOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct WorkspaceSymbolParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
string query;
|
||||
};
|
||||
|
||||
struct WorkspaceSymbol
|
||||
{
|
||||
struct LocationUriOnly
|
||||
{
|
||||
DocumentUri uri;
|
||||
};
|
||||
string name;
|
||||
SymbolKind kind;
|
||||
std::optional<std::vector<SymbolTag>> tags;
|
||||
std::optional<string> containerName;
|
||||
std::variant<Location, LocationUriOnly> location;
|
||||
std::optional<LSPAny> data;
|
||||
};
|
||||
|
||||
}
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
#include "./progress.hpp"
|
||||
#include "./completion.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
enum class SymbolKind
|
||||
{
|
||||
kFile = 1,
|
||||
kModule = 2,
|
||||
kNamespace = 3,
|
||||
kPackage = 4,
|
||||
kClass = 5,
|
||||
kMethod = 6,
|
||||
kProperty = 7,
|
||||
kField = 8,
|
||||
kConstructor = 9,
|
||||
kEnum = 10,
|
||||
kInterface = 11,
|
||||
kFunction = 12,
|
||||
kVariable = 13,
|
||||
kConstant = 14,
|
||||
kString = 15,
|
||||
kNumber = 16,
|
||||
kBoolean = 17,
|
||||
kArray = 18,
|
||||
kObject = 19,
|
||||
kKey = 20,
|
||||
kNull = 21,
|
||||
kEnumMember = 22,
|
||||
kStruct = 23,
|
||||
kEvent = 24,
|
||||
kOperator = 25,
|
||||
kTypeParameter = 26
|
||||
};
|
||||
|
||||
enum class SymbolTag
|
||||
{
|
||||
Deprecated = 1
|
||||
};
|
||||
|
||||
struct DocumentSymbol
|
||||
{
|
||||
string name;
|
||||
std::optional<string> detail;
|
||||
SymbolKind kind;
|
||||
std::optional<std::vector<SymbolTag>> tags;
|
||||
std::optional<boolean> deprecated;
|
||||
Range range;
|
||||
Range selectionRange;
|
||||
std::optional<std::vector<DocumentSymbol>> children;
|
||||
};
|
||||
|
||||
struct SymbolInformation
|
||||
{
|
||||
string name;
|
||||
SymbolKind kind;
|
||||
std::optional<std::vector<SymbolTag>> tags;
|
||||
std::optional<boolean> deprecated;
|
||||
Location location;
|
||||
std::optional<string> containerName;
|
||||
};
|
||||
|
||||
struct DocumentSymbolClientCapabilities
|
||||
{
|
||||
struct SymbolKinds
|
||||
{
|
||||
std::vector<SymbolKind> valueSet;
|
||||
};
|
||||
struct TagSupport
|
||||
{
|
||||
std::optional<std::vector<CompletionItemTag>> valueSet;
|
||||
};
|
||||
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<SymbolKinds> symbolKind;
|
||||
std::optional<boolean> hierarchicalDocumentSymbolSupport;
|
||||
std::optional<TagSupport> tagSupport;
|
||||
std::optional<boolean> labelSupport;
|
||||
};
|
||||
|
||||
struct DocumentSymbolOptions : WorkDoneProgressOptions
|
||||
{
|
||||
std::optional<string> label;
|
||||
};
|
||||
|
||||
struct DocumentSymbolRegistrationOptions : TextDocumentRegistrationOptions, DocumentSymbolOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct DocumentSymbolParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
TextDocumentIdentifier textDocument;
|
||||
};
|
||||
|
||||
struct WorkspaceSymbolClientCapabilities
|
||||
{
|
||||
struct SymbolKinds
|
||||
{
|
||||
std::vector<SymbolKind> valueSet;
|
||||
};
|
||||
struct TagSupport
|
||||
{
|
||||
std::optional<std::vector<CompletionItemTag>> valueSet;
|
||||
};
|
||||
struct ResolveSupport
|
||||
{
|
||||
std::vector<string> properties;
|
||||
};
|
||||
|
||||
std::optional<boolean> dynamicRegistration;
|
||||
std::optional<SymbolKinds> symbolKind;
|
||||
std::optional<TagSupport> tagSupport;
|
||||
std::optional<ResolveSupport> resolveSupport;
|
||||
};
|
||||
|
||||
struct WorkspaceSymbolOptions : WorkDoneProgressOptions
|
||||
{
|
||||
std::optional<boolean> resolveProvider;
|
||||
};
|
||||
|
||||
struct WorkspaceSymbolRegistrationOptions : WorkspaceSymbolOptions
|
||||
{
|
||||
};
|
||||
|
||||
struct WorkspaceSymbolParams : WorkDoneProgressParams, PartialResultParams
|
||||
{
|
||||
string query;
|
||||
};
|
||||
|
||||
struct WorkspaceSymbol
|
||||
{
|
||||
struct LocationUriOnly
|
||||
{
|
||||
DocumentUri uri;
|
||||
};
|
||||
string name;
|
||||
SymbolKind kind;
|
||||
std::optional<std::vector<SymbolTag>> tags;
|
||||
std::optional<string> containerName;
|
||||
std::variant<Location, LocationUriOnly> location;
|
||||
std::optional<LSPAny> data;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,121 +1,121 @@
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
#include "./diagnostics.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
struct CreateFileOptions
|
||||
{
|
||||
boolean overwrite;
|
||||
boolean ignoreIfExists;
|
||||
};
|
||||
|
||||
struct CreateFile
|
||||
{
|
||||
string kind = "create";
|
||||
DocumentUri uri;
|
||||
std::optional<CreateFileOptions> options;
|
||||
std::optional<string> annotationId;
|
||||
};
|
||||
|
||||
struct RenameFileOptions
|
||||
{
|
||||
boolean overwrite;
|
||||
boolean ignoreIfExists;
|
||||
};
|
||||
|
||||
struct RenameFile
|
||||
{
|
||||
string kind = "rename";
|
||||
DocumentUri oldUri;
|
||||
DocumentUri newUri;
|
||||
std::optional<RenameFileOptions> options;
|
||||
std::optional<string> annotationId;
|
||||
};
|
||||
|
||||
struct DeleteFileOptions
|
||||
{
|
||||
boolean recursive;
|
||||
boolean ignoreIfNotExists;
|
||||
};
|
||||
|
||||
struct DeleteFile
|
||||
{
|
||||
string kind = "delete";
|
||||
DocumentUri uri;
|
||||
std::optional<DeleteFileOptions> options;
|
||||
std::optional<string> annotationId;
|
||||
};
|
||||
|
||||
struct WorkspaceEdit
|
||||
{
|
||||
std::map<DocumentUri, std::vector<TextEdit>> changes;
|
||||
std::variant<std::vector<TextDocumentEdit>, std::vector<CreateFile>, std::vector<RenameFile>, std::vector<DeleteFile>> documentChanges;
|
||||
std::optional<std::map<string, ChangeAnnotation>> changeAnnotations;
|
||||
};
|
||||
|
||||
using ResourceOperationKind = std::string_view;
|
||||
namespace ResourceOperationKindLiterals
|
||||
{
|
||||
inline constexpr ResourceOperationKind Create = "create";
|
||||
inline constexpr ResourceOperationKind Rename = "rename";
|
||||
inline constexpr ResourceOperationKind Delete = "delete";
|
||||
}
|
||||
|
||||
using FailureHandlingKind = std::string_view;
|
||||
namespace FailureHandlingKindLiterals
|
||||
{
|
||||
inline constexpr FailureHandlingKind Abort = "abort";
|
||||
inline constexpr FailureHandlingKind Transactional = "transactional";
|
||||
inline constexpr FailureHandlingKind TextOnlyTransactional = "textOnlyTransactional";
|
||||
inline constexpr FailureHandlingKind Undo = "undo";
|
||||
inline constexpr FailureHandlingKind Commit = "commit";
|
||||
}
|
||||
|
||||
struct WorkspaceEditClientCapabilities
|
||||
{
|
||||
struct ChangeAnnotationSupport
|
||||
{
|
||||
std::optional<bool> groupsOnLabel;
|
||||
};
|
||||
|
||||
boolean documentChanges;
|
||||
std::optional<std::vector<ResourceOperationKind>> resourceOperations;
|
||||
std::optional<FailureHandlingKind> failureHandling;
|
||||
std::optional<boolean> normalizesLineEndings;
|
||||
ChangeAnnotationSupport changeAnnotationSupport;
|
||||
};
|
||||
|
||||
struct WorkspaceFolder
|
||||
{
|
||||
URI uri;
|
||||
string name;
|
||||
};
|
||||
|
||||
struct WorkspaceFolderServerCapabilities
|
||||
{
|
||||
std::optional<boolean> supported;
|
||||
std::optional<std::variant<string, boolean>> changeNotifications;
|
||||
};
|
||||
|
||||
struct WorkspaceFoldersChangeEvent
|
||||
{
|
||||
std::vector<WorkspaceFolder> added;
|
||||
std::vector<WorkspaceFolder> removed;
|
||||
};
|
||||
|
||||
struct ApplyWorkspaceEditParams
|
||||
{
|
||||
std::optional<string> label;
|
||||
WorkspaceEdit edit;
|
||||
};
|
||||
|
||||
struct ApplyWorkspaceEditResult
|
||||
{
|
||||
boolean applied;
|
||||
std::optional<string> failureReason;
|
||||
std::optional<std::vector<Diagnostic>> failedChanges;
|
||||
};
|
||||
|
||||
}
|
||||
#pragma once
|
||||
#include "./basic_types.hpp"
|
||||
#include "./document_sync.hpp"
|
||||
#include "./diagnostics.hpp"
|
||||
|
||||
namespace lsp::protocol
|
||||
{
|
||||
struct CreateFileOptions
|
||||
{
|
||||
boolean overwrite;
|
||||
boolean ignoreIfExists;
|
||||
};
|
||||
|
||||
struct CreateFile
|
||||
{
|
||||
string kind = "create";
|
||||
DocumentUri uri;
|
||||
std::optional<CreateFileOptions> options;
|
||||
std::optional<string> annotationId;
|
||||
};
|
||||
|
||||
struct RenameFileOptions
|
||||
{
|
||||
boolean overwrite;
|
||||
boolean ignoreIfExists;
|
||||
};
|
||||
|
||||
struct RenameFile
|
||||
{
|
||||
string kind = "rename";
|
||||
DocumentUri oldUri;
|
||||
DocumentUri newUri;
|
||||
std::optional<RenameFileOptions> options;
|
||||
std::optional<string> annotationId;
|
||||
};
|
||||
|
||||
struct DeleteFileOptions
|
||||
{
|
||||
boolean recursive;
|
||||
boolean ignoreIfNotExists;
|
||||
};
|
||||
|
||||
struct DeleteFile
|
||||
{
|
||||
string kind = "delete";
|
||||
DocumentUri uri;
|
||||
std::optional<DeleteFileOptions> options;
|
||||
std::optional<string> annotationId;
|
||||
};
|
||||
|
||||
struct WorkspaceEdit
|
||||
{
|
||||
std::map<DocumentUri, std::vector<TextEdit>> changes;
|
||||
std::variant<std::vector<TextDocumentEdit>, std::vector<CreateFile>, std::vector<RenameFile>, std::vector<DeleteFile>> documentChanges;
|
||||
std::optional<std::map<string, ChangeAnnotation>> changeAnnotations;
|
||||
};
|
||||
|
||||
using ResourceOperationKind = std::string_view;
|
||||
namespace ResourceOperationKindLiterals
|
||||
{
|
||||
inline constexpr ResourceOperationKind Create = "create";
|
||||
inline constexpr ResourceOperationKind Rename = "rename";
|
||||
inline constexpr ResourceOperationKind Delete = "delete";
|
||||
}
|
||||
|
||||
using FailureHandlingKind = std::string_view;
|
||||
namespace FailureHandlingKindLiterals
|
||||
{
|
||||
inline constexpr FailureHandlingKind Abort = "abort";
|
||||
inline constexpr FailureHandlingKind Transactional = "transactional";
|
||||
inline constexpr FailureHandlingKind TextOnlyTransactional = "textOnlyTransactional";
|
||||
inline constexpr FailureHandlingKind Undo = "undo";
|
||||
inline constexpr FailureHandlingKind Commit = "commit";
|
||||
}
|
||||
|
||||
struct WorkspaceEditClientCapabilities
|
||||
{
|
||||
struct ChangeAnnotationSupport
|
||||
{
|
||||
std::optional<bool> groupsOnLabel;
|
||||
};
|
||||
|
||||
boolean documentChanges;
|
||||
std::optional<std::vector<ResourceOperationKind>> resourceOperations;
|
||||
std::optional<FailureHandlingKind> failureHandling;
|
||||
std::optional<boolean> normalizesLineEndings;
|
||||
ChangeAnnotationSupport changeAnnotationSupport;
|
||||
};
|
||||
|
||||
struct WorkspaceFolder
|
||||
{
|
||||
URI uri;
|
||||
string name;
|
||||
};
|
||||
|
||||
struct WorkspaceFolderServerCapabilities
|
||||
{
|
||||
std::optional<boolean> supported;
|
||||
std::optional<std::variant<string, boolean>> changeNotifications;
|
||||
};
|
||||
|
||||
struct WorkspaceFoldersChangeEvent
|
||||
{
|
||||
std::vector<WorkspaceFolder> added;
|
||||
std::vector<WorkspaceFolder> removed;
|
||||
};
|
||||
|
||||
struct ApplyWorkspaceEditParams
|
||||
{
|
||||
std::optional<string> label;
|
||||
WorkspaceEdit edit;
|
||||
};
|
||||
|
||||
struct ApplyWorkspaceEditResult
|
||||
{
|
||||
boolean applied;
|
||||
std::optional<string> failureReason;
|
||||
std::optional<std::vector<Diagnostic>> failedChanges;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
+1274
-1274
File diff suppressed because it is too large
Load Diff
@@ -1,41 +1,41 @@
|
||||
#pragma once
|
||||
#include <type_traits>
|
||||
#include <stdexcept>
|
||||
#include <exception>
|
||||
#include "../detail/basic_types.hpp"
|
||||
|
||||
namespace lsp::transform
|
||||
{
|
||||
// 通用错误类
|
||||
class ConversionError : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
explicit ConversionError(const std::string& message)
|
||||
: std::runtime_error("LSP Conversion Error: " + message) {}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct is_lsp_basic_type: std::false_type {};
|
||||
|
||||
template<> struct is_lsp_basic_type<protocol::boolean> : std::true_type {};
|
||||
template<> struct is_lsp_basic_type<protocol::string> : std::true_type {};
|
||||
template<> struct is_lsp_basic_type<protocol::decimal> : std::true_type {};
|
||||
template<> struct is_lsp_basic_type<std::nullptr_t> : std::true_type {};
|
||||
|
||||
template<typename T>
|
||||
struct is_lsp_container_type : std::false_type {};
|
||||
|
||||
template<> struct is_lsp_container_type<protocol::LSPObject> : std::true_type {};
|
||||
template<> struct is_lsp_container_type<protocol::LSPArray> : std::true_type {};
|
||||
template<> struct is_lsp_container_type<protocol::LSPAny> : std::true_type {};
|
||||
|
||||
// struct类型判断
|
||||
template<typename T>
|
||||
struct is_user_struct : std::integral_constant<bool,
|
||||
!std::is_arithmetic<T>::value &&
|
||||
!std::is_same<T, protocol::string>::value &&
|
||||
!std::is_same<T, const char*>::value &&
|
||||
!std::is_same<T, std::nullptr_t>::value &&
|
||||
!is_lsp_basic_type<T>::value &&
|
||||
!is_lsp_container_type<T>::value> {};
|
||||
}
|
||||
#pragma once
|
||||
#include <type_traits>
|
||||
#include <stdexcept>
|
||||
#include <exception>
|
||||
#include "../detail/basic_types.hpp"
|
||||
|
||||
namespace lsp::transform
|
||||
{
|
||||
// 通用错误类
|
||||
class ConversionError : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
explicit ConversionError(const std::string& message)
|
||||
: std::runtime_error("LSP Conversion Error: " + message) {}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct is_lsp_basic_type: std::false_type {};
|
||||
|
||||
template<> struct is_lsp_basic_type<protocol::boolean> : std::true_type {};
|
||||
template<> struct is_lsp_basic_type<protocol::string> : std::true_type {};
|
||||
template<> struct is_lsp_basic_type<protocol::decimal> : std::true_type {};
|
||||
template<> struct is_lsp_basic_type<std::nullptr_t> : std::true_type {};
|
||||
|
||||
template<typename T>
|
||||
struct is_lsp_container_type : std::false_type {};
|
||||
|
||||
template<> struct is_lsp_container_type<protocol::LSPObject> : std::true_type {};
|
||||
template<> struct is_lsp_container_type<protocol::LSPArray> : std::true_type {};
|
||||
template<> struct is_lsp_container_type<protocol::LSPAny> : std::true_type {};
|
||||
|
||||
// struct类型判断
|
||||
template<typename T>
|
||||
struct is_user_struct : std::integral_constant<bool,
|
||||
!std::is_arithmetic<T>::value &&
|
||||
!std::is_same<T, protocol::string>::value &&
|
||||
!std::is_same<T, const char*>::value &&
|
||||
!std::is_same<T, std::nullptr_t>::value &&
|
||||
!is_lsp_basic_type<T>::value &&
|
||||
!is_lsp_container_type<T>::value> {};
|
||||
}
|
||||
|
||||
@@ -1,93 +1,103 @@
|
||||
#pragma once
|
||||
#include "./transformer.hpp"
|
||||
|
||||
namespace lsp::transform
|
||||
{
|
||||
|
||||
// ===== 全局便利函数 =====
|
||||
// 基本类型
|
||||
template<typename T>
|
||||
protocol::LSPAny LSPAny(const T& obj);
|
||||
|
||||
// // struct 类型
|
||||
// template<typename T>
|
||||
// typename std::enable_if<is_user_struct<T>::value, protocol::LSPAny>::type LSPAny(const T& value);
|
||||
|
||||
// 容器类型
|
||||
template<typename T>
|
||||
protocol::LSPAny LSPAny(const std::vector<T>& vec);
|
||||
|
||||
template<typename T>
|
||||
protocol::LSPAny LSPAny(const std::map<protocol::string, T>& map);
|
||||
|
||||
template<typename T>
|
||||
protocol::LSPAny LSPAny(const std::optional<T>& opt);
|
||||
|
||||
template<typename T>
|
||||
T As(const protocol::LSPAny& any);
|
||||
|
||||
template<typename T, typename From>
|
||||
std::optional<T> As(const std::optional<From>& opt);
|
||||
|
||||
template<typename T, typename... Ts>
|
||||
T As(const std::variant<Ts...>& var);
|
||||
|
||||
template<typename T>
|
||||
T As(const protocol::LSPObject& obj);
|
||||
|
||||
template<typename T>
|
||||
T As(const protocol::LSPArray& arr);
|
||||
|
||||
template<typename T>
|
||||
T Number(const protocol::LSPAny& any);
|
||||
|
||||
template<typename T>
|
||||
std::vector<T> Vector(const protocol::LSPAny& any);
|
||||
|
||||
template<typename T>
|
||||
std::optional<T> Optional(const protocol::LSPAny& any);
|
||||
|
||||
template<typename T>
|
||||
protocol::LSPObject LSPObject(const T& obj);
|
||||
|
||||
template<typename T>
|
||||
protocol::LSPArray LSPArray(const T& vec);
|
||||
|
||||
protocol::string String(const protocol::LSPAny& any);
|
||||
protocol::boolean Bool(const protocol::LSPAny& any);
|
||||
|
||||
// === 外观接口:类型检查 ===
|
||||
namespace check
|
||||
{
|
||||
inline bool IsObject(const protocol::LSPAny& any) { return any.is<protocol::LSPObject>(); }
|
||||
inline bool IsArray(const protocol::LSPAny& any) { return any.is<protocol::LSPArray>(); }
|
||||
inline bool IsString(const protocol::LSPAny& any) { return any.is<protocol::string>(); }
|
||||
inline bool IsNumber(const protocol::LSPAny& any) { return any.is<protocol::decimal>(); }
|
||||
inline bool IsBool(const protocol::LSPAny& any) { return any.is<protocol::boolean>(); }
|
||||
inline bool IsNull(const protocol::LSPAny& any) { return any.is<std::nullptr_t>(); }
|
||||
}
|
||||
|
||||
// === 外观接口:调试功能 ===
|
||||
|
||||
namespace debug
|
||||
{
|
||||
inline std::string GetTypeName(const protocol::LSPAny& any)
|
||||
{
|
||||
if (any.is<protocol::LSPObject>())
|
||||
return "LSPObject";
|
||||
if (any.is<protocol::LSPArray>())
|
||||
return "LSPArray";
|
||||
if (any.is<protocol::string>())
|
||||
return "string";
|
||||
if (any.is<protocol::decimal>())
|
||||
return "decimal";
|
||||
if (any.is<protocol::boolean>())
|
||||
return "boolean";
|
||||
if (any.is<std::nullptr_t>())
|
||||
return "null";
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "./facade.inl"
|
||||
#pragma once
|
||||
#include "./transformer.hpp"
|
||||
|
||||
namespace lsp::transform
|
||||
{
|
||||
|
||||
// ===== 全局便利函数 =====
|
||||
// 基本类型
|
||||
template<typename T>
|
||||
protocol::LSPAny LSPAny(const T& obj);
|
||||
|
||||
// // struct 类型
|
||||
// template<typename T>
|
||||
// typename std::enable_if<is_user_struct<T>::value, protocol::LSPAny>::type LSPAny(const T& value);
|
||||
|
||||
// 容器类型
|
||||
template<typename T>
|
||||
protocol::LSPAny LSPAny(const std::vector<T>& vec);
|
||||
|
||||
template<typename T>
|
||||
protocol::LSPAny LSPAny(const std::map<protocol::string, T>& map);
|
||||
|
||||
template<typename T>
|
||||
protocol::LSPAny LSPAny(const std::optional<T>& opt);
|
||||
|
||||
template<typename T>
|
||||
T As(const protocol::LSPAny& any);
|
||||
|
||||
template<typename T, typename From>
|
||||
std::optional<T> As(const std::optional<From>& opt);
|
||||
|
||||
template<typename T, typename... Ts>
|
||||
T As(const std::variant<Ts...>& var);
|
||||
|
||||
template<typename T>
|
||||
T As(const protocol::LSPObject& obj);
|
||||
|
||||
template<typename T>
|
||||
T As(const protocol::LSPArray& arr);
|
||||
|
||||
template<typename T>
|
||||
T Number(const protocol::LSPAny& any);
|
||||
|
||||
template<typename T>
|
||||
std::vector<T> Vector(const protocol::LSPAny& any);
|
||||
|
||||
template<typename T>
|
||||
std::optional<T> Optional(const protocol::LSPAny& any);
|
||||
|
||||
template<typename T>
|
||||
protocol::LSPObject LSPObject(const T& obj);
|
||||
|
||||
template<typename T>
|
||||
protocol::LSPArray LSPArray(const T& vec);
|
||||
|
||||
protocol::string String(const protocol::LSPAny& any);
|
||||
protocol::boolean Bool(const protocol::LSPAny& any);
|
||||
|
||||
// === 外观接口:类型检查 ===
|
||||
namespace check
|
||||
{
|
||||
inline bool IsObject(const protocol::LSPAny& any) { return any.is<protocol::LSPObject>(); }
|
||||
inline bool IsArray(const protocol::LSPAny& any) { return any.is<protocol::LSPArray>(); }
|
||||
inline bool IsString(const protocol::LSPAny& any) { return any.is<protocol::string>(); }
|
||||
inline bool IsNumber(const protocol::LSPAny& any) { return any.is<protocol::decimal>(); }
|
||||
inline bool IsBool(const protocol::LSPAny& any) { return any.is<protocol::boolean>(); }
|
||||
inline bool IsNull(const protocol::LSPAny& any) { return any.is<std::nullptr_t>(); }
|
||||
}
|
||||
|
||||
// === 外观接口:调试功能 ===
|
||||
|
||||
namespace debug
|
||||
{
|
||||
inline std::string GetTypeName(const protocol::LSPAny& any)
|
||||
{
|
||||
if (any.is<protocol::LSPObject>())
|
||||
return "LSPObject";
|
||||
if (any.is<protocol::LSPArray>())
|
||||
return "LSPArray";
|
||||
if (any.is<protocol::string>())
|
||||
return "string";
|
||||
if (any.is<protocol::decimal>())
|
||||
return "decimal";
|
||||
if (any.is<protocol::boolean>())
|
||||
return "boolean";
|
||||
if (any.is<std::nullptr_t>())
|
||||
return "null";
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
inline std::string GetIdString(const std::variant<int, std::string>& id)
|
||||
{
|
||||
return std::visit([](const auto& value) -> std::string {
|
||||
if constexpr (std::is_same_v<std::decay_t<decltype(value)>, int>)
|
||||
return std::to_string(value);
|
||||
else
|
||||
return value;
|
||||
}, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "./facade.inl"
|
||||
|
||||
@@ -1,120 +1,120 @@
|
||||
#pragma once
|
||||
#include "./facade.hpp"
|
||||
|
||||
namespace lsp::transform
|
||||
{
|
||||
template<typename T>
|
||||
inline protocol::LSPAny LSPAny(const T& obj)
|
||||
{
|
||||
return LSPAnyConverter::ToLSPAny(obj);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline protocol::LSPAny LSPAny(const std::vector<T>& vec)
|
||||
{
|
||||
return LSPAnyConverter::ToLSPAny(vec);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline protocol::LSPAny LSPAny(const std::map<protocol::string, T>& map)
|
||||
{
|
||||
return LSPAnyConverter::ToLSPAny(map);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline protocol::LSPAny LSPAny(const std::optional<T>& opt)
|
||||
{
|
||||
return LSPAnyConverter::ToLSPAny(opt);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline T As(const protocol::LSPAny& any)
|
||||
{
|
||||
return LSPAnyConverter::FromLSPAny<T>(any);
|
||||
}
|
||||
|
||||
template<typename T, typename From>
|
||||
inline std::optional<T> As(const std::optional<From>& opt)
|
||||
{
|
||||
return LSPAnyConverter::As<T>(opt);
|
||||
}
|
||||
|
||||
template<typename T, typename... Ts>
|
||||
inline T As(const std::variant<Ts...>& var)
|
||||
{
|
||||
return LSPAnyConverter::As<T>(var);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline T As(const protocol::LSPObject& obj)
|
||||
{
|
||||
return LSPAnyConverter::As<T>(obj);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline T As(const protocol::LSPArray& arr)
|
||||
{
|
||||
return LSPAnyConverter::As<T>(arr);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline T Number(const protocol::LSPAny& any)
|
||||
{
|
||||
return LSPAnyConverter::ToNumber<T>(any);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline std::vector<T> Vector(const protocol::LSPAny& any)
|
||||
{
|
||||
return LSPAnyConverter::ToVector<T>(any);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline std::optional<T> Optional(const protocol::LSPAny& any)
|
||||
{
|
||||
return LSPAnyConverter::ToOptional<T>(any);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline protocol::LSPObject LSPObject(const T& obj)
|
||||
{
|
||||
// 如果已经是 LSPAny,直接获取其中的 LSPObject
|
||||
if constexpr (std::is_same_v<T, protocol::LSPAny>)
|
||||
{
|
||||
return LSPAnyConverter::ToLSPObject(obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 否则先转换为 LSPAny,再获取 LSPObject
|
||||
protocol::LSPAny any = LSPAnyConverter::ToLSPAny(obj);
|
||||
return LSPAnyConverter::ToLSPObject(any);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline protocol::LSPArray LSPArray(const T& container)
|
||||
{
|
||||
// 如果已经是 LSPAny,直接获取其中的 LSPArray
|
||||
if constexpr (std::is_same_v<T, protocol::LSPAny>)
|
||||
{
|
||||
return LSPAnyConverter::ToLSPArray(container);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 否则转换为 LSPAny
|
||||
protocol::LSPAny any = LSPAnyConverter::ToLSPAny(container);
|
||||
return LSPAnyConverter::ToLSPArray(any);
|
||||
}
|
||||
}
|
||||
|
||||
inline protocol::string String(const protocol::LSPAny& any)
|
||||
{
|
||||
return LSPAnyConverter::ToString(any);
|
||||
}
|
||||
|
||||
inline protocol::boolean Bool(const protocol::LSPAny& any)
|
||||
{
|
||||
return LSPAnyConverter::ToBool(any);
|
||||
}
|
||||
|
||||
}
|
||||
#pragma once
|
||||
#include "./facade.hpp"
|
||||
|
||||
namespace lsp::transform
|
||||
{
|
||||
template<typename T>
|
||||
inline protocol::LSPAny LSPAny(const T& obj)
|
||||
{
|
||||
return LSPAnyConverter::ToLSPAny(obj);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline protocol::LSPAny LSPAny(const std::vector<T>& vec)
|
||||
{
|
||||
return LSPAnyConverter::ToLSPAny(vec);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline protocol::LSPAny LSPAny(const std::map<protocol::string, T>& map)
|
||||
{
|
||||
return LSPAnyConverter::ToLSPAny(map);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline protocol::LSPAny LSPAny(const std::optional<T>& opt)
|
||||
{
|
||||
return LSPAnyConverter::ToLSPAny(opt);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline T As(const protocol::LSPAny& any)
|
||||
{
|
||||
return LSPAnyConverter::FromLSPAny<T>(any);
|
||||
}
|
||||
|
||||
template<typename T, typename From>
|
||||
inline std::optional<T> As(const std::optional<From>& opt)
|
||||
{
|
||||
return LSPAnyConverter::As<T>(opt);
|
||||
}
|
||||
|
||||
template<typename T, typename... Ts>
|
||||
inline T As(const std::variant<Ts...>& var)
|
||||
{
|
||||
return LSPAnyConverter::As<T>(var);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline T As(const protocol::LSPObject& obj)
|
||||
{
|
||||
return LSPAnyConverter::As<T>(obj);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline T As(const protocol::LSPArray& arr)
|
||||
{
|
||||
return LSPAnyConverter::As<T>(arr);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline T Number(const protocol::LSPAny& any)
|
||||
{
|
||||
return LSPAnyConverter::ToNumber<T>(any);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline std::vector<T> Vector(const protocol::LSPAny& any)
|
||||
{
|
||||
return LSPAnyConverter::ToVector<T>(any);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline std::optional<T> Optional(const protocol::LSPAny& any)
|
||||
{
|
||||
return LSPAnyConverter::ToOptional<T>(any);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline protocol::LSPObject LSPObject(const T& obj)
|
||||
{
|
||||
// 如果已经是 LSPAny,直接获取其中的 LSPObject
|
||||
if constexpr (std::is_same_v<T, protocol::LSPAny>)
|
||||
{
|
||||
return LSPAnyConverter::ToLSPObject(obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 否则先转换为 LSPAny,再获取 LSPObject
|
||||
protocol::LSPAny any = LSPAnyConverter::ToLSPAny(obj);
|
||||
return LSPAnyConverter::ToLSPObject(any);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline protocol::LSPArray LSPArray(const T& container)
|
||||
{
|
||||
// 如果已经是 LSPAny,直接获取其中的 LSPArray
|
||||
if constexpr (std::is_same_v<T, protocol::LSPAny>)
|
||||
{
|
||||
return LSPAnyConverter::ToLSPArray(container);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 否则转换为 LSPAny
|
||||
protocol::LSPAny any = LSPAnyConverter::ToLSPAny(container);
|
||||
return LSPAnyConverter::ToLSPArray(any);
|
||||
}
|
||||
}
|
||||
|
||||
inline protocol::string String(const protocol::LSPAny& any)
|
||||
{
|
||||
return LSPAnyConverter::ToString(any);
|
||||
}
|
||||
|
||||
inline protocol::boolean Bool(const protocol::LSPAny& any)
|
||||
{
|
||||
return LSPAnyConverter::ToBool(any);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,85 +1,85 @@
|
||||
#pragma once
|
||||
#include "../protocol.hpp"
|
||||
#include "./common.hpp"
|
||||
|
||||
namespace lsp::transform
|
||||
{
|
||||
// LSPAny 序列化/反序列化工具类
|
||||
class LSPAnyConverter
|
||||
{
|
||||
public:
|
||||
// === 基本类型的转换 ===
|
||||
static protocol::LSPAny ToLSPAny(protocol::boolean value);
|
||||
static protocol::LSPAny ToLSPAny(int value);
|
||||
static protocol::LSPAny ToLSPAny(long value);
|
||||
static protocol::LSPAny ToLSPAny(long long value);
|
||||
static protocol::LSPAny ToLSPAny(unsigned int value);
|
||||
static protocol::LSPAny ToLSPAny(unsigned long value);
|
||||
static protocol::LSPAny ToLSPAny(unsigned long long value);
|
||||
static protocol::LSPAny ToLSPAny(float value);
|
||||
static protocol::LSPAny ToLSPAny(double value);
|
||||
static protocol::LSPAny ToLSPAny(long double value);
|
||||
static protocol::LSPAny ToLSPAny(const protocol::string& str);
|
||||
static protocol::LSPAny ToLSPAny(const char* str);
|
||||
static protocol::LSPAny ToLSPAny(std::nullptr_t);
|
||||
static protocol::LSPAny ToLSPAny(const protocol::LSPAny& any);
|
||||
|
||||
// === LSPAny 到基本类型的转换 ===
|
||||
static protocol::boolean ToBool(const protocol::LSPAny& any);
|
||||
static protocol::string ToString(const protocol::LSPAny& any);
|
||||
|
||||
// 其他转换
|
||||
static protocol::LSPObject ToLSPObject(const protocol::LSPAny& any);
|
||||
static protocol::LSPArray ToLSPArray(const protocol::LSPAny& any);
|
||||
|
||||
// === 容器类型的转换 ===
|
||||
template<typename T>
|
||||
static protocol::LSPAny ToLSPAny(const std::vector<T>& vec);
|
||||
|
||||
template<typename T>
|
||||
static protocol::LSPAny ToLSPAny(const std::map<protocol::string, T>& map);
|
||||
|
||||
template<typename T>
|
||||
static protocol::LSPAny ToLSPAny(const std::optional<T>& opt);
|
||||
|
||||
// === Struct 到 LSPAny 的转换 ===
|
||||
template<typename T>
|
||||
static typename std::enable_if<is_user_struct<T>::value, protocol::LSPAny>::type ToLSPAny(const T& obj);
|
||||
|
||||
template<typename T>
|
||||
static typename std::enable_if<std::is_arithmetic<T>::value && !std::is_same<T, protocol::boolean>::value, T>::type ToNumber(const protocol::LSPAny& any);
|
||||
|
||||
// === LSPAny 到容器类型的转换 ===
|
||||
template<typename T>
|
||||
static std::vector<T> ToVector(const protocol::LSPAny& any);
|
||||
|
||||
template<typename T>
|
||||
static std::optional<T> ToOptional(const protocol::LSPAny& any);
|
||||
|
||||
template<typename T>
|
||||
static typename std::enable_if<is_user_struct<T>::value, T>::type FromLSPAny(const protocol::LSPAny& any);
|
||||
|
||||
// 处理 std::optional<T>
|
||||
template<typename T, typename From>
|
||||
static std::optional<T> As(const std::optional<From>& opt);
|
||||
|
||||
// 处理 std::variant<Ts...>
|
||||
template<typename T, typename... Ts>
|
||||
static T As(const std::variant<Ts...>& var);
|
||||
|
||||
// 处理 LSPObject 和 LSPArray
|
||||
template<typename T>
|
||||
static T As(const protocol::LSPObject& obj);
|
||||
|
||||
template<typename T>
|
||||
static T As(const protocol::LSPArray& arr);
|
||||
|
||||
|
||||
private:
|
||||
template<typename T>
|
||||
static T FromLSPAnyImpl(const protocol::LSPAny& any);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#include "./transformer.inl"
|
||||
#pragma once
|
||||
#include "../protocol.hpp"
|
||||
#include "./common.hpp"
|
||||
|
||||
namespace lsp::transform
|
||||
{
|
||||
// LSPAny 序列化/反序列化工具类
|
||||
class LSPAnyConverter
|
||||
{
|
||||
public:
|
||||
// === 基本类型的转换 ===
|
||||
static protocol::LSPAny ToLSPAny(protocol::boolean value);
|
||||
static protocol::LSPAny ToLSPAny(int value);
|
||||
static protocol::LSPAny ToLSPAny(long value);
|
||||
static protocol::LSPAny ToLSPAny(long long value);
|
||||
static protocol::LSPAny ToLSPAny(unsigned int value);
|
||||
static protocol::LSPAny ToLSPAny(unsigned long value);
|
||||
static protocol::LSPAny ToLSPAny(unsigned long long value);
|
||||
static protocol::LSPAny ToLSPAny(float value);
|
||||
static protocol::LSPAny ToLSPAny(double value);
|
||||
static protocol::LSPAny ToLSPAny(long double value);
|
||||
static protocol::LSPAny ToLSPAny(const protocol::string& str);
|
||||
static protocol::LSPAny ToLSPAny(const char* str);
|
||||
static protocol::LSPAny ToLSPAny(std::nullptr_t);
|
||||
static protocol::LSPAny ToLSPAny(const protocol::LSPAny& any);
|
||||
|
||||
// === LSPAny 到基本类型的转换 ===
|
||||
static protocol::boolean ToBool(const protocol::LSPAny& any);
|
||||
static protocol::string ToString(const protocol::LSPAny& any);
|
||||
|
||||
// 其他转换
|
||||
static protocol::LSPObject ToLSPObject(const protocol::LSPAny& any);
|
||||
static protocol::LSPArray ToLSPArray(const protocol::LSPAny& any);
|
||||
|
||||
// === 容器类型的转换 ===
|
||||
template<typename T>
|
||||
static protocol::LSPAny ToLSPAny(const std::vector<T>& vec);
|
||||
|
||||
template<typename T>
|
||||
static protocol::LSPAny ToLSPAny(const std::map<protocol::string, T>& map);
|
||||
|
||||
template<typename T>
|
||||
static protocol::LSPAny ToLSPAny(const std::optional<T>& opt);
|
||||
|
||||
// === Struct 到 LSPAny 的转换 ===
|
||||
template<typename T>
|
||||
static typename std::enable_if<is_user_struct<T>::value, protocol::LSPAny>::type ToLSPAny(const T& obj);
|
||||
|
||||
template<typename T>
|
||||
static typename std::enable_if<std::is_arithmetic<T>::value && !std::is_same<T, protocol::boolean>::value, T>::type ToNumber(const protocol::LSPAny& any);
|
||||
|
||||
// === LSPAny 到容器类型的转换 ===
|
||||
template<typename T>
|
||||
static std::vector<T> ToVector(const protocol::LSPAny& any);
|
||||
|
||||
template<typename T>
|
||||
static std::optional<T> ToOptional(const protocol::LSPAny& any);
|
||||
|
||||
template<typename T>
|
||||
static typename std::enable_if<is_user_struct<T>::value, T>::type FromLSPAny(const protocol::LSPAny& any);
|
||||
|
||||
// 处理 std::optional<T>
|
||||
template<typename T, typename From>
|
||||
static std::optional<T> As(const std::optional<From>& opt);
|
||||
|
||||
// 处理 std::variant<Ts...>
|
||||
template<typename T, typename... Ts>
|
||||
static T As(const std::variant<Ts...>& var);
|
||||
|
||||
// 处理 LSPObject 和 LSPArray
|
||||
template<typename T>
|
||||
static T As(const protocol::LSPObject& obj);
|
||||
|
||||
template<typename T>
|
||||
static T As(const protocol::LSPArray& arr);
|
||||
|
||||
|
||||
private:
|
||||
template<typename T>
|
||||
static T FromLSPAnyImpl(const protocol::LSPAny& any);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#include "./transformer.inl"
|
||||
|
||||
@@ -1,259 +1,259 @@
|
||||
#pragma once
|
||||
#include "./transformer.hpp"
|
||||
|
||||
namespace lsp::transform
|
||||
{
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(protocol::boolean value)
|
||||
{
|
||||
return protocol::LSPAny(value);
|
||||
}
|
||||
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(int value)
|
||||
{
|
||||
return protocol::LSPAny(value);
|
||||
}
|
||||
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(long value)
|
||||
{
|
||||
return protocol::LSPAny(value);
|
||||
}
|
||||
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(long long value)
|
||||
{
|
||||
return protocol::LSPAny(value);
|
||||
}
|
||||
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(unsigned int value)
|
||||
{
|
||||
return protocol::LSPAny(value);
|
||||
}
|
||||
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(unsigned long value)
|
||||
{
|
||||
return protocol::LSPAny(value);
|
||||
}
|
||||
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(unsigned long long value)
|
||||
{
|
||||
return protocol::LSPAny(value);
|
||||
}
|
||||
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(float value)
|
||||
{
|
||||
return protocol::LSPAny(value);
|
||||
}
|
||||
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(double value)
|
||||
{
|
||||
return protocol::LSPAny(value);
|
||||
}
|
||||
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(long double value)
|
||||
{
|
||||
return protocol::LSPAny(value);
|
||||
}
|
||||
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(const protocol::string& str)
|
||||
{
|
||||
return protocol::LSPAny(str);
|
||||
}
|
||||
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(const char* str)
|
||||
{
|
||||
return protocol::LSPAny(str);
|
||||
}
|
||||
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(std::nullptr_t)
|
||||
{
|
||||
return protocol::LSPAny(nullptr);
|
||||
}
|
||||
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(const protocol::LSPAny& any)
|
||||
{
|
||||
return any;
|
||||
}
|
||||
|
||||
inline protocol::boolean LSPAnyConverter::ToBool(const protocol::LSPAny& any)
|
||||
{
|
||||
if (!any.is<protocol::boolean>())
|
||||
throw ConversionError("LSPAny does not contain a boolean");
|
||||
return any.get<protocol::boolean>();
|
||||
}
|
||||
|
||||
inline protocol::string LSPAnyConverter::ToString(const protocol::LSPAny& any)
|
||||
{
|
||||
if (!any.is<protocol::string>())
|
||||
throw ConversionError("LSPAny does not contain a string");
|
||||
return any.get<protocol::string>();
|
||||
}
|
||||
|
||||
inline protocol::LSPObject LSPAnyConverter::ToLSPObject(const protocol::LSPAny& any)
|
||||
{
|
||||
if (!any.is<protocol::LSPObject>())
|
||||
throw ConversionError("LSPAny does not contain LSPObject");
|
||||
return any.get<protocol::LSPObject>();
|
||||
}
|
||||
|
||||
inline protocol::LSPArray LSPAnyConverter::ToLSPArray(const protocol::LSPAny& any)
|
||||
{
|
||||
if (!any.is<protocol::LSPArray>())
|
||||
throw ConversionError("LSPAny does not contain LSPArray");
|
||||
return any.get<protocol::LSPArray>();
|
||||
}
|
||||
|
||||
// 模板实现
|
||||
template<typename T>
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(const std::vector<T>& vec)
|
||||
{
|
||||
protocol::LSPArray arr;
|
||||
arr.reserve(vec.size());
|
||||
for (const auto& item : vec)
|
||||
arr.push_back(ToLSPAny(item));
|
||||
return protocol::LSPAny(std::move(arr));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(const std::map<protocol::string, T>& map)
|
||||
{
|
||||
protocol::LSPObject obj;
|
||||
for (const auto& [key, value] : map)
|
||||
obj[key] = ToLSPAny(value);
|
||||
return protocol::LSPAny(std::move(obj));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(const std::optional<T>& opt)
|
||||
{
|
||||
if (opt.has_value())
|
||||
return ToLSPAny(*opt);
|
||||
return protocol::LSPAny(nullptr);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline typename std::enable_if<is_user_struct<T>::value, protocol::LSPAny>::type
|
||||
LSPAnyConverter::ToLSPAny(const T& obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 使用glaze序列化为JSON字符串
|
||||
std::string json;
|
||||
auto ec = glz::write_json(obj, json);
|
||||
if (ec)
|
||||
{
|
||||
throw ConversionError("Failed to serialize struct to JSON: " + std::string(glz::format_error(ec, json)));
|
||||
}
|
||||
|
||||
// 直接解析为LSPAny
|
||||
protocol::LSPAny result;
|
||||
ec = glz::read_json(result, json);
|
||||
if (ec)
|
||||
{
|
||||
throw ConversionError("Failed to parse JSON to LSPAny: " + std::string(glz::format_error(ec, json)));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
throw ConversionError("struct to LSPAny conversion failed: " + std::string(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
// Fromprotocol::LSPAny 实现
|
||||
template<typename T>
|
||||
inline typename std::enable_if<std::is_arithmetic<T>::value && !std::is_same<T, protocol::boolean>::value, T>::type LSPAnyConverter::ToNumber(const protocol::LSPAny& any)
|
||||
{
|
||||
if (!any.is<protocol::decimal>())
|
||||
throw ConversionError("LSPAny does not contain a number");
|
||||
return static_cast<T>(any.get<protocol::decimal>());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline std::vector<T> LSPAnyConverter::ToVector(const protocol::LSPAny& any)
|
||||
{
|
||||
if (!any.is<protocol::LSPArray>())
|
||||
throw ConversionError("LSPAny does not contain an array");
|
||||
|
||||
const auto& arr = any.get<protocol::LSPArray>();
|
||||
std::vector<T> result;
|
||||
result.reserve(arr.size());
|
||||
for (const auto& item : arr)
|
||||
result.push_back(FromLSPAny<T>(item));
|
||||
return result;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline std::optional<T> LSPAnyConverter::ToOptional(const protocol::LSPAny& any)
|
||||
{
|
||||
if (any.is<std::nullptr_t>())
|
||||
return std::nullopt;
|
||||
return FromLSPAny<T>(any);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline typename std::enable_if<is_user_struct<T>::value, T>::type
|
||||
LSPAnyConverter::FromLSPAny(const protocol::LSPAny& any)
|
||||
{
|
||||
return FromLSPAnyImpl<T>(any);
|
||||
}
|
||||
|
||||
// 处理 std::optional<T>
|
||||
template<typename T, typename From>
|
||||
inline std::optional<T> LSPAnyConverter::As(const std::optional<From>& opt)
|
||||
{
|
||||
if (opt.has_value())
|
||||
return As<T>(*opt);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// 处理 std::variant<Ts...>
|
||||
template<typename T, typename... Ts>
|
||||
inline T LSPAnyConverter::As(const std::variant<Ts...>& var)
|
||||
{
|
||||
return std::visit([](const auto& val) -> T {
|
||||
return As<T>(val);
|
||||
}, var);
|
||||
}
|
||||
|
||||
// 处理 LSPObject
|
||||
template<typename T>
|
||||
inline T LSPAnyConverter::As(const protocol::LSPObject& obj)
|
||||
{
|
||||
protocol::LSPAny any(obj);
|
||||
return FromLSPAny<T>(any);
|
||||
}
|
||||
|
||||
// 处理 LSPArray
|
||||
template<typename T>
|
||||
inline T LSPAnyConverter::As(const protocol::LSPArray& arr)
|
||||
{
|
||||
protocol::LSPAny any(arr);
|
||||
return FromLSPAny<T>(any);
|
||||
}
|
||||
|
||||
// FromLSPAnyImpl 实现
|
||||
template<typename T>
|
||||
inline T LSPAnyConverter::FromLSPAnyImpl(const protocol::LSPAny& any)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 序列化LSPAny为JSON
|
||||
std::string json;
|
||||
auto ec = glz::write_json(any.value, json);
|
||||
if (ec)
|
||||
throw ConversionError("Failed to serialize LSPAny to JSON: " + std::string(glz::format_error(ec, json)));
|
||||
|
||||
// 解析JSON到目标类型
|
||||
T result;
|
||||
ec = glz::read_json(result, json);
|
||||
if (ec)
|
||||
throw ConversionError("Failed to parse JSON to target type: " + std::string(glz::format_error(ec, json)));
|
||||
return result;
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
throw ConversionError("LSPAny to struct conversion failed: " + std::string(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#pragma once
|
||||
#include "./transformer.hpp"
|
||||
|
||||
namespace lsp::transform
|
||||
{
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(protocol::boolean value)
|
||||
{
|
||||
return protocol::LSPAny(value);
|
||||
}
|
||||
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(int value)
|
||||
{
|
||||
return protocol::LSPAny(value);
|
||||
}
|
||||
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(long value)
|
||||
{
|
||||
return protocol::LSPAny(value);
|
||||
}
|
||||
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(long long value)
|
||||
{
|
||||
return protocol::LSPAny(value);
|
||||
}
|
||||
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(unsigned int value)
|
||||
{
|
||||
return protocol::LSPAny(value);
|
||||
}
|
||||
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(unsigned long value)
|
||||
{
|
||||
return protocol::LSPAny(value);
|
||||
}
|
||||
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(unsigned long long value)
|
||||
{
|
||||
return protocol::LSPAny(value);
|
||||
}
|
||||
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(float value)
|
||||
{
|
||||
return protocol::LSPAny(value);
|
||||
}
|
||||
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(double value)
|
||||
{
|
||||
return protocol::LSPAny(value);
|
||||
}
|
||||
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(long double value)
|
||||
{
|
||||
return protocol::LSPAny(value);
|
||||
}
|
||||
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(const protocol::string& str)
|
||||
{
|
||||
return protocol::LSPAny(str);
|
||||
}
|
||||
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(const char* str)
|
||||
{
|
||||
return protocol::LSPAny(str);
|
||||
}
|
||||
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(std::nullptr_t)
|
||||
{
|
||||
return protocol::LSPAny(nullptr);
|
||||
}
|
||||
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(const protocol::LSPAny& any)
|
||||
{
|
||||
return any;
|
||||
}
|
||||
|
||||
inline protocol::boolean LSPAnyConverter::ToBool(const protocol::LSPAny& any)
|
||||
{
|
||||
if (!any.is<protocol::boolean>())
|
||||
throw ConversionError("LSPAny does not contain a boolean");
|
||||
return any.get<protocol::boolean>();
|
||||
}
|
||||
|
||||
inline protocol::string LSPAnyConverter::ToString(const protocol::LSPAny& any)
|
||||
{
|
||||
if (!any.is<protocol::string>())
|
||||
throw ConversionError("LSPAny does not contain a string");
|
||||
return any.get<protocol::string>();
|
||||
}
|
||||
|
||||
inline protocol::LSPObject LSPAnyConverter::ToLSPObject(const protocol::LSPAny& any)
|
||||
{
|
||||
if (!any.is<protocol::LSPObject>())
|
||||
throw ConversionError("LSPAny does not contain LSPObject");
|
||||
return any.get<protocol::LSPObject>();
|
||||
}
|
||||
|
||||
inline protocol::LSPArray LSPAnyConverter::ToLSPArray(const protocol::LSPAny& any)
|
||||
{
|
||||
if (!any.is<protocol::LSPArray>())
|
||||
throw ConversionError("LSPAny does not contain LSPArray");
|
||||
return any.get<protocol::LSPArray>();
|
||||
}
|
||||
|
||||
// 模板实现
|
||||
template<typename T>
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(const std::vector<T>& vec)
|
||||
{
|
||||
protocol::LSPArray arr;
|
||||
arr.reserve(vec.size());
|
||||
for (const auto& item : vec)
|
||||
arr.push_back(ToLSPAny(item));
|
||||
return protocol::LSPAny(std::move(arr));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(const std::map<protocol::string, T>& map)
|
||||
{
|
||||
protocol::LSPObject obj;
|
||||
for (const auto& [key, value] : map)
|
||||
obj[key] = ToLSPAny(value);
|
||||
return protocol::LSPAny(std::move(obj));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline protocol::LSPAny LSPAnyConverter::ToLSPAny(const std::optional<T>& opt)
|
||||
{
|
||||
if (opt.has_value())
|
||||
return ToLSPAny(*opt);
|
||||
return protocol::LSPAny(nullptr);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline typename std::enable_if<is_user_struct<T>::value, protocol::LSPAny>::type
|
||||
LSPAnyConverter::ToLSPAny(const T& obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 使用glaze序列化为JSON字符串
|
||||
std::string json;
|
||||
auto ec = glz::write_json(obj, json);
|
||||
if (ec)
|
||||
{
|
||||
throw ConversionError("Failed to serialize struct to JSON: " + std::string(glz::format_error(ec, json)));
|
||||
}
|
||||
|
||||
// 直接解析为LSPAny
|
||||
protocol::LSPAny result;
|
||||
ec = glz::read_json(result, json);
|
||||
if (ec)
|
||||
{
|
||||
throw ConversionError("Failed to parse JSON to LSPAny: " + std::string(glz::format_error(ec, json)));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
throw ConversionError("struct to LSPAny conversion failed: " + std::string(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
// Fromprotocol::LSPAny 实现
|
||||
template<typename T>
|
||||
inline typename std::enable_if<std::is_arithmetic<T>::value && !std::is_same<T, protocol::boolean>::value, T>::type LSPAnyConverter::ToNumber(const protocol::LSPAny& any)
|
||||
{
|
||||
if (!any.is<protocol::decimal>())
|
||||
throw ConversionError("LSPAny does not contain a number");
|
||||
return static_cast<T>(any.get<protocol::decimal>());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline std::vector<T> LSPAnyConverter::ToVector(const protocol::LSPAny& any)
|
||||
{
|
||||
if (!any.is<protocol::LSPArray>())
|
||||
throw ConversionError("LSPAny does not contain an array");
|
||||
|
||||
const auto& arr = any.get<protocol::LSPArray>();
|
||||
std::vector<T> result;
|
||||
result.reserve(arr.size());
|
||||
for (const auto& item : arr)
|
||||
result.push_back(FromLSPAny<T>(item));
|
||||
return result;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline std::optional<T> LSPAnyConverter::ToOptional(const protocol::LSPAny& any)
|
||||
{
|
||||
if (any.is<std::nullptr_t>())
|
||||
return std::nullopt;
|
||||
return FromLSPAny<T>(any);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline typename std::enable_if<is_user_struct<T>::value, T>::type
|
||||
LSPAnyConverter::FromLSPAny(const protocol::LSPAny& any)
|
||||
{
|
||||
return FromLSPAnyImpl<T>(any);
|
||||
}
|
||||
|
||||
// 处理 std::optional<T>
|
||||
template<typename T, typename From>
|
||||
inline std::optional<T> LSPAnyConverter::As(const std::optional<From>& opt)
|
||||
{
|
||||
if (opt.has_value())
|
||||
return As<T>(*opt);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// 处理 std::variant<Ts...>
|
||||
template<typename T, typename... Ts>
|
||||
inline T LSPAnyConverter::As(const std::variant<Ts...>& var)
|
||||
{
|
||||
return std::visit([](const auto& val) -> T {
|
||||
return As<T>(val);
|
||||
}, var);
|
||||
}
|
||||
|
||||
// 处理 LSPObject
|
||||
template<typename T>
|
||||
inline T LSPAnyConverter::As(const protocol::LSPObject& obj)
|
||||
{
|
||||
protocol::LSPAny any(obj);
|
||||
return FromLSPAny<T>(any);
|
||||
}
|
||||
|
||||
// 处理 LSPArray
|
||||
template<typename T>
|
||||
inline T LSPAnyConverter::As(const protocol::LSPArray& arr)
|
||||
{
|
||||
protocol::LSPAny any(arr);
|
||||
return FromLSPAny<T>(any);
|
||||
}
|
||||
|
||||
// FromLSPAnyImpl 实现
|
||||
template<typename T>
|
||||
inline T LSPAnyConverter::FromLSPAnyImpl(const protocol::LSPAny& any)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 序列化LSPAny为JSON
|
||||
std::string json;
|
||||
auto ec = glz::write_json(any.value, json);
|
||||
if (ec)
|
||||
throw ConversionError("Failed to serialize LSPAny to JSON: " + std::string(glz::format_error(ec, json)));
|
||||
|
||||
// 解析JSON到目标类型
|
||||
T result;
|
||||
ec = glz::read_json(result, json);
|
||||
if (ec)
|
||||
throw ConversionError("Failed to parse JSON to target type: " + std::string(glz::format_error(ec, json)));
|
||||
return result;
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
throw ConversionError("LSPAny to struct conversion failed: " + std::string(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user