diff --git a/integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/index/SchemaIndex.java b/integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/index/SchemaIndex.java index a267aefdbabe..49d3c7d429e9 100644 --- a/integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/index/SchemaIndex.java +++ b/integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/index/SchemaIndex.java @@ -210,6 +210,7 @@ public List findSymbols(Symbol symbol) { public List findSymbols(Symbol scope, SymbolType type, String shortIdentifier) { // First candidates are all symbols with correct type and correct short identifier + // Special case for schema and document because a schema can sometimes refer to a document and vice versa if (type == SymbolType.SCHEMA || type == SymbolType.DOCUMENT) { SymbolType firstCheck = (type == SymbolType.SCHEMA ? SymbolType.SCHEMA : SymbolType.DOCUMENT); List schemaDefinitions = diff --git a/integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/schemadocument/SchemaDocument.java b/integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/schemadocument/SchemaDocument.java index 146020d78365..61dbcc967fbb 100644 --- a/integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/schemadocument/SchemaDocument.java +++ b/integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/schemadocument/SchemaDocument.java @@ -110,9 +110,9 @@ public void updateFileContent(String content) { this.CST = parsingResult.CST().get(); lexer.setCST(CST); - logger.info("======== CST for file: " + fileURI + " ========"); + //logger.info("======== CST for file: " + fileURI + " ========"); - CSTUtils.printTree(logger, CST); + //CSTUtils.printTree(logger, CST); } diff --git a/integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/schemadocument/parser/IdentifySymbolDefinition.java b/integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/schemadocument/parser/IdentifySymbolDefinition.java index 75e466140581..090740c67fbc 100644 --- a/integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/schemadocument/parser/IdentifySymbolDefinition.java +++ b/integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/schemadocument/parser/IdentifySymbolDefinition.java @@ -350,8 +350,6 @@ private void handleTensorTypeDefinitions(SchemaNode identifierNode, SchemaNode t Optional existingSymbolMapped = context.schemaIndex().findSymbolInScope(scope, SymbolType.TENSOR_DIMENSION_MAPPED, identifierNode.getText()); Optional existingSymbolIndexed = context.schemaIndex().findSymbolInScope(scope, SymbolType.TENSOR_DIMENSION_INDEXED, identifierNode.getText()); - // I want to keep this check here to give a message, - // but we have to change some stuff in the CongoCC parser for it to take effect. if (existingSymbolMapped.isPresent() || existingSymbolIndexed.isPresent()) { identifierNode.setSymbolStatus(SymbolStatus.INVALID); diagnostics.add(new SchemaDiagnostic.Builder() @@ -363,6 +361,7 @@ private void handleTensorTypeDefinitions(SchemaNode identifierNode, SchemaNode t } identifierNode.setSymbolStatus(SymbolStatus.DEFINITION); + context.schemaIndex().insertSymbolDefinition(identifierNode.getSymbol()); } private static final Set reservedFunctionNames = ReservedFunctionNames.getReservedNames(); diff --git a/integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/schemadocument/resolvers/RankExpressionSymbolResolver.java b/integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/schemadocument/resolvers/RankExpressionSymbolResolver.java index 0add48e847a8..d4426ac7f335 100644 --- a/integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/schemadocument/resolvers/RankExpressionSymbolResolver.java +++ b/integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/schemadocument/resolvers/RankExpressionSymbolResolver.java @@ -144,6 +144,8 @@ private static void findBuiltInFunction(RankNode node, ParseContext context, Lis // add(SymbolType.PARAMETER); // This is a special case add(SymbolType.FUNCTION); add(SymbolType.RANK_CONSTANT); + add(SymbolType.TENSOR_DIMENSION_MAPPED); + add(SymbolType.TENSOR_DIMENSION_INDEXED); }}; private static void resolveReference(RankNode referenceNode, ParseContext context, List diagnostics) {