use of org.springframework.ide.vscode.java.properties.parser.PropertiesAst.EmptyLine in project sts4 by spring-projects.
the class PropertiesAstTest method positionEmptyLine.
@Test
public void positionEmptyLine() throws Exception {
ParseResults results = parser.parse("# Comment\n" + "key = value\n" + "\t\n");
Node node = results.ast.findNode(23);
assertTrue(node instanceof EmptyLine);
assertTrue(node.getOffset() <= 23 && 23 <= node.getOffset() + node.getLength());
node = results.ast.findNode(24);
assertTrue(node instanceof EmptyLine);
assertTrue(node.getOffset() <= 24 && 24 <= node.getOffset() + node.getLength());
}
use of org.springframework.ide.vscode.java.properties.parser.PropertiesAst.EmptyLine in project sts4 by spring-projects.
the class PropertiesCompletionProposalsCalculator method calculate.
/**
* Create completions proposals in the context of a properties text editor.
*/
public Collection<ICompletionProposal> calculate() throws BadLocationException {
ParseResults parseResults = parser.parse(doc.get());
Node node = parseResults.ast.findNode(offset);
if (node instanceof Value) {
return getValueCompletions((Value) node);
} else if (node instanceof Key || node instanceof EmptyLine || node == null) {
return getPropertyCompletions();
}
return Collections.emptyList();
}
Aggregations