diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp index c4d64c668f..ce3f1e64c1 100644 --- a/source/slang/slang-check-decl.cpp +++ b/source/slang/slang-check-decl.cpp @@ -2133,6 +2133,7 @@ void SemanticsDeclHeaderVisitor::visitStructDecl(StructDecl* structDecl) member->nameAndLoc.name = getName("inner"); member->nameAndLoc.loc = structDecl->wrappedType.exp->loc; member->loc = member->nameAndLoc.loc; + addModifier(member, m_astBuilder->create()); structDecl->addMember(member); } checkVisibility(structDecl); diff --git a/source/slang/slang-language-server-ast-lookup.cpp b/source/slang/slang-language-server-ast-lookup.cpp index 3f738c504b..ebc3fe9ad0 100644 --- a/source/slang/slang-language-server-ast-lookup.cpp +++ b/source/slang/slang-language-server-ast-lookup.cpp @@ -665,6 +665,13 @@ bool _findAstNodeImpl(ASTLookupContext& context, SyntaxNode* node) { if (_isLocInRange(&context, decl->nameAndLoc.loc, _getDeclNameLength(decl->getName()))) { + for (auto modifier : decl->modifiers) + { + if (as(modifier)) + return false; + if (as(modifier)) + return false; + } ASTLookupResult result; result.path = context.nodePath; context.results.add(_Move(result)); diff --git a/source/slang/slang-language-server-semantic-tokens.cpp b/source/slang/slang-language-server-semantic-tokens.cpp index 4ac40321c2..5d0e41ecb2 100644 --- a/source/slang/slang-language-server-semantic-tokens.cpp +++ b/source/slang/slang-language-server-semantic-tokens.cpp @@ -74,6 +74,8 @@ List getSemanticTokens( .pathInfo.foundPath.getUnownedSlice() .endsWithCaseInsensitive(fileName)) return; + if (decl->hasModifier()) + return; SemanticToken token = _createSemanticToken(manager, loc, name); auto target = decl; if (as(target)) @@ -137,6 +139,17 @@ List getSemanticTokens( module->getModuleDecl(), [&](SyntaxNode* node) { + if (auto decl = as(node)) + { + for (auto modifier : decl->modifiers) + { + if (as(modifier)) + return; + if (as(modifier)) + return; + } + } + if (auto declRefExpr = as(node)) { handleDeclRef( @@ -173,19 +186,16 @@ List getSemanticTokens( maybeInsertToken(token); } } - else if (auto aggTypeDecl = as(node)) + else if (auto aggTypeDeclBase = as(node)) { - if (aggTypeDecl->getName() && - aggTypeDecl->findModifier() == - nullptr) - { - SemanticToken token = _createSemanticToken( - manager, - aggTypeDecl->getNameLoc(), - aggTypeDecl->getName()); - token.type = SemanticTokenType::Type; - maybeInsertToken(token); - } + if (!aggTypeDeclBase->getName()) + return; + SemanticToken token = _createSemanticToken( + manager, + aggTypeDeclBase->getNameLoc(), + aggTypeDeclBase->getName()); + token.type = SemanticTokenType::Type; + maybeInsertToken(token); } else if (auto enumCase = as(node)) {