diff --git a/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/services/XMLCompletions.java b/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/services/XMLCompletions.java index f8a85bb0a..f8ddb20bf 100644 --- a/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/services/XMLCompletions.java +++ b/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/services/XMLCompletions.java @@ -109,6 +109,7 @@ public CompletionList doComplete(DOMDocument xmlDocument, Position position, Sha Scanner scanner = XMLScanner.createScanner(text, node.getStart(), isInsideDTDContent(node, xmlDocument)); String currentTag = ""; TokenType token = scanner.scan(); + TokenType lastToken = null; while (token != TokenType.EOS && scanner.getTokenOffset() <= offset) { cancelChecker.checkCanceled(); switch (token) { @@ -249,6 +250,13 @@ public CompletionList doComplete(DOMDocument xmlDocument, Position position, Sha } } break; + case CDATATagOpen: + break; + case CDATATagClose: + if (lastToken != TokenType.CDATATagOpen) { + break; + } + case CDATAContent: case Content: if (completionRequest.getXMLDocument().isDTD() || completionRequest.getXMLDocument().isWithinInternalDTD(offset)) { @@ -284,6 +292,7 @@ public CompletionList doComplete(DOMDocument xmlDocument, Position position, Sha } break; } + lastToken = token; token = scanner.scan(); } return completionResponse;