summaryrefslogtreecommitdiffstats
path: root/source/compiler-core/slang-language-server-protocol.h
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2024-10-29 14:49:26 +0800
committerGitHub <noreply@github.com>2024-10-29 14:49:26 +0800
commitf65d756bff8d4c5cbc15bd0322a2ae8e6b896a21 (patch)
treeea1d61342cd29368e19135000ec2948813096205 /source/compiler-core/slang-language-server-protocol.h
parenta729c15e9dce9f5116a38afc66329ab2ca4cea54 (diff)
format
* format * Minor test fixes * enable checking cpp format in ci
Diffstat (limited to 'source/compiler-core/slang-language-server-protocol.h')
-rw-r--r--source/compiler-core/slang-language-server-protocol.h85
1 files changed, 32 insertions, 53 deletions
diff --git a/source/compiler-core/slang-language-server-protocol.h b/source/compiler-core/slang-language-server-protocol.h
index 506969dcc..d96099da6 100644
--- a/source/compiler-core/slang-language-server-protocol.h
+++ b/source/compiler-core/slang-language-server-protocol.h
@@ -1,11 +1,11 @@
#pragma once
+#include "../../source/compiler-core/slang-json-value.h"
+#include "../../source/core/slang-rtti-info.h"
#include "slang-com-helper.h"
#include "slang-com-ptr.h"
#include "slang.h"
-#include "../../source/core/slang-rtti-info.h"
-#include "../../source/compiler-core/slang-json-value.h"
#include <optional>
namespace Slang
@@ -192,7 +192,6 @@ struct TextEdit
String newText;
static const StructRttiInfo g_rttiInfo;
-
};
struct DidOpenTextDocumentParams
@@ -264,7 +263,6 @@ struct InlayHintOptions
*/
bool resolveProvider = false;
static const StructRttiInfo g_rttiInfo;
-
};
struct DocumentOnTypeFormattingOptions
@@ -436,8 +434,7 @@ struct Diagnostic
HashCode getHashCode() const
{
- return combineHash(
- code, combineHash(range.start.line, message.getHashCode()));
+ return combineHash(code, combineHash(range.start.line, message.getHashCode()));
}
static const StructRttiInfo g_rttiInfo;
@@ -473,17 +470,13 @@ struct TextDocumentPositionParams
static const StructRttiInfo g_rttiInfo;
};
-struct HoverParams
- : WorkDoneProgressParams
- ,TextDocumentPositionParams
+struct HoverParams : WorkDoneProgressParams, TextDocumentPositionParams
{
static const StructRttiInfo g_rttiInfo;
static const UnownedStringSlice methodName;
};
-struct DefinitionParams
- : WorkDoneProgressParams
- , TextDocumentPositionParams
+struct DefinitionParams : WorkDoneProgressParams, TextDocumentPositionParams
{
static const StructRttiInfo g_rttiInfo;
static const UnownedStringSlice methodName;
@@ -556,9 +549,7 @@ struct CompletionContext
static const StructRttiInfo g_rttiInfo;
};
-struct CompletionParams
- : WorkDoneProgressParams
- , TextDocumentPositionParams
+struct CompletionParams : WorkDoneProgressParams, TextDocumentPositionParams
{
CompletionContext context;
@@ -713,9 +704,7 @@ struct SemanticTokens
static const StructRttiInfo g_rttiInfo;
};
-struct SignatureHelpParams
- : WorkDoneProgressParams
- , TextDocumentPositionParams
+struct SignatureHelpParams : WorkDoneProgressParams, TextDocumentPositionParams
{
static const UnownedStringSlice methodName;
@@ -740,7 +729,7 @@ struct ParameterInformation
* signature label. Its intended use case is to highlight the parameter
* label part in the `SignatureInformation.label`.
*/
- uint32_t label[2] = { 0, 0 };
+ uint32_t label[2] = {0, 0};
/**
* The human-readable doc-comment of this parameter. Will be shown
@@ -848,14 +837,14 @@ struct ConfigurationParams
struct Registration
{
/**
- * The id used to register the request. The id can be used to deregister
- * the request again.
- */
+ * The id used to register the request. The id can be used to deregister
+ * the request again.
+ */
String id;
/**
- * The method / capability to register for.
- */
+ * The method / capability to register for.
+ */
String method;
static const StructRttiInfo g_rttiInfo;
@@ -1052,7 +1041,6 @@ struct InlayHint
bool paddingRight = false;
static const StructRttiInfo g_rttiInfo;
-
};
struct DocumentOnTypeFormattingParams
@@ -1080,7 +1068,7 @@ struct DocumentOnTypeFormattingParams
/**
* The formatting options.
*/
- //FormattingOptions options;
+ // FormattingOptions options;
static const StructRttiInfo g_rttiInfo;
static const UnownedStringSlice methodName;
@@ -1101,7 +1089,7 @@ struct DocumentRangeFormattingParams
/**
* The format options
*/
- //FormattingOptions options;
+ // FormattingOptions options;
static const StructRttiInfo g_rttiInfo;
static const UnownedStringSlice methodName;
@@ -1117,7 +1105,7 @@ struct DocumentFormattingParams
/**
* The format options
*/
- //FormattingOptions options;
+ // FormattingOptions options;
static const StructRttiInfo g_rttiInfo;
static const UnownedStringSlice methodName;
@@ -1128,29 +1116,20 @@ struct DocumentFormattingParams
namespace Slang
{
- template<typename T>
- struct LanguageServerResult
+template<typename T>
+struct LanguageServerResult
+{
+ SlangResult returnCode;
+ bool isNull = true;
+ T result;
+ LanguageServerResult() { returnCode = SLANG_OK; }
+ LanguageServerResult(std::nullopt_t) { returnCode = SLANG_OK; }
+ LanguageServerResult(const T& value)
{
- SlangResult returnCode;
- bool isNull = true;
- T result;
- LanguageServerResult()
- {
- returnCode = SLANG_OK;
- }
- LanguageServerResult(std::nullopt_t)
- {
- returnCode = SLANG_OK;
- }
- LanguageServerResult(const T& value)
- {
- result = value;
- isNull = false;
- returnCode = SLANG_OK;
- }
- LanguageServerResult(SlangResult code)
- {
- returnCode = code;
- }
- };
-}
+ result = value;
+ isNull = false;
+ returnCode = SLANG_OK;
+ }
+ LanguageServerResult(SlangResult code) { returnCode = code; }
+};
+} // namespace Slang