summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-07-08 19:33:51 -0700
committerGitHub <noreply@github.com>2024-07-08 19:33:51 -0700
commita453fadfb373499f08779dd7df8f2347d292fd91 (patch)
tree6fa9ad6f395e68b5dd8eb84f67dd8b992dabae3f /source
parent4a49769c5b6b351b3c1c9a9968b3926839504606 (diff)
Language server performance and document symbol fix. (#4561)
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-check-decl.cpp1
-rw-r--r--source/slang/slang-language-server-document-symbols.cpp2
-rw-r--r--source/slang/slang.cpp8
3 files changed, 10 insertions, 1 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp
index c3074bc55..66bdbc18e 100644
--- a/source/slang/slang-check-decl.cpp
+++ b/source/slang/slang-check-decl.cpp
@@ -1823,6 +1823,7 @@ namespace Slang
static ConstructorDecl* _createCtor(SemanticsDeclVisitorBase* visitor, ASTBuilder* m_astBuilder, AggTypeDecl* decl)
{
auto ctor = m_astBuilder->create<ConstructorDecl>();
+ addModifier(ctor, m_astBuilder->create<SynthesizedModifier>());
auto ctorName = visitor->getName("$init");
ctor->ownedScope = m_astBuilder->create<Scope>();
ctor->ownedScope->containerDecl = ctor;
diff --git a/source/slang/slang-language-server-document-symbols.cpp b/source/slang/slang-language-server-document-symbols.cpp
index 26366d6cf..ec9b434eb 100644
--- a/source/slang/slang-language-server-document-symbols.cpp
+++ b/source/slang/slang-language-server-document-symbols.cpp
@@ -150,6 +150,8 @@ namespace Slang
continue;
if (!nameLoc.loc.isValid())
continue;
+ if (child->hasModifier<SynthesizedModifier>() || child->hasModifier<ToBeSynthesizedModifier>())
+ continue;
auto humaneLoc = srcManager->getHumaneLoc(nameLoc.loc, SourceLocType::Actual);
if (humaneLoc.line == 0)
continue;
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index 67492d9b2..adfa031f5 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -3669,8 +3669,14 @@ RefPtr<Module> Linkage::findOrImportModule(
// Look for a precompiled module first, if not exist, load from source.
- for (int checkBinaryModule = 1; checkBinaryModule >= 0; checkBinaryModule--)
+ bool shouldCheckBinaryModuleSettings[2] = { true, false };
+
+ for (auto checkBinaryModule : shouldCheckBinaryModuleSettings)
{
+ // When in language server, we always prefer to use source module if it is available.
+ if (isInLanguageServer())
+ checkBinaryModule = !checkBinaryModule;
+
// Try without translating `_` to `-` first, if that fails, try translating.
for (int translateUnderScore = 0; translateUnderScore <= 1; translateUnderScore++)
{