From 4d517794eaac7dfe6196e9a36d709d66c5720492 Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 17 Jun 2025 21:36:10 -0700 Subject: LanguageServer: Enhance auto completion for override. (#7465) * Add additional completion keywords. * LanguageServer: Enhance auto completion for `override`. --- source/compiler-core/slang-json-value.h | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'source/compiler-core/slang-json-value.h') diff --git a/source/compiler-core/slang-json-value.h b/source/compiler-core/slang-json-value.h index d9b17f1d5..ae0123d30 100644 --- a/source/compiler-core/slang-json-value.h +++ b/source/compiler-core/slang-json-value.h @@ -8,6 +8,8 @@ #include "slang-json-parser.h" #include "slang-source-loc.h" +#include + namespace Slang { @@ -439,6 +441,39 @@ protected: List m_objectValues; }; +template +class JSONOptional +{ +public: + bool hasValue = false; + T value; + JSONOptional() = default; + JSONOptional(std::nullopt_t) {} + JSONOptional(const T& inValue) + : hasValue(true), value(inValue) + { + } +}; + +template +struct GetRttiInfo> +{ + static const OptionalRttiInfo _make() + { + OptionalRttiInfo info; + info.init>(RttiInfo::Kind::Optional); + info.m_elementType = GetRttiInfo::get(); + info.m_valueOffset = (uint32_t)offsetof(JSONOptional, value); + return info; + } + static const RttiInfo* get() + { + static const OptionalRttiInfo g_info = _make(); + return &g_info; + } +}; + + class JSONBuilder : public JSONListener { public: -- cgit v1.2.3