use of org.springframework.ide.vscode.java.properties.parser.PropertiesAst.Key in project sts4 by spring-projects.
the class PropertiesAstTest method positionKey.
@Test
public void positionKey() throws Exception {
ParseResults results = parser.parse("# Comment\n" + "key = value\n" + "\t\n");
Node node = results.ast.findNode(10);
assertTrue(node instanceof Key);
assertTrue(node.getOffset() <= 10 && 10 <= node.getOffset() + node.getLength());
node = results.ast.findNode(12);
assertTrue(node instanceof Key);
assertTrue(node.getOffset() <= 12 && 12 <= node.getOffset() + node.getLength());
node = results.ast.findNode(13);
assertTrue(node instanceof Key);
assertTrue(node.getOffset() <= 13 && 13 <= node.getOffset() + node.getLength());
}
use of org.springframework.ide.vscode.java.properties.parser.PropertiesAst.Key in project sts4 by spring-projects.
the class PropertiesHoverCalculator method calculate.
Tuple2<Renderable, IRegion> calculate() {
ParseResults parseResults = parser.parse(doc.get());
Node node = parseResults.ast.findNode(offset);
if (node instanceof Value) {
return getValueHover((Value) node);
} else if (node instanceof Key) {
return getPropertyHover((Key) node);
}
return null;
}
use of org.springframework.ide.vscode.java.properties.parser.PropertiesAst.Key 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