use of com.redhat.qute.services.QuteLanguageService in project quarkus-ls by redhat-developer.
the class QuteAssert method assertHover.
private static void assertHover(String value, String fileUri, String templateId, String projectUri, String templateBaseDir, String expectedHoverLabel, Range expectedHoverRange, SharedSettings sharedSettings) throws Exception {
int offset = value.indexOf("|");
value = value.substring(0, offset) + value.substring(offset + 1);
QuteProjectRegistry projectRegistry = new MockQuteProjectRegistry();
Template template = createTemplate(value, fileUri, projectUri, templateBaseDir, projectRegistry);
template.setTemplateId(templateId);
Position position = template.positionAt(offset);
QuteLanguageService languageService = new QuteLanguageService(new JavaDataModelCache(projectRegistry));
Hover hover = languageService.doHover(template, position, sharedSettings, () -> {
}).get();
if (expectedHoverLabel == null) {
assertNull(hover);
} else {
String actualHoverLabel = getHoverLabel(hover);
assertEquals(expectedHoverLabel, actualHoverLabel);
if (expectedHoverRange != null) {
assertEquals(expectedHoverRange, hover.getRange());
}
}
}
use of com.redhat.qute.services.QuteLanguageService in project quarkus-ls by redhat-developer.
the class QuteAssert method testDefinitionFor.
public static void testDefinitionFor(String value, String fileUri, String projectUri, String templateBaseDir, LocationLink... expected) throws Exception {
int offset = value.indexOf("|");
value = value.substring(0, offset) + value.substring(offset + 1);
QuteProjectRegistry projectRegistry = new MockQuteProjectRegistry();
Template template = createTemplate(value, fileUri, projectUri, templateBaseDir, projectRegistry);
Position position = template.positionAt(offset);
QuteLanguageService languageService = new QuteLanguageService(new JavaDataModelCache(projectRegistry));
List<? extends LocationLink> actual = languageService.findDefinition(template, position, () -> {
}).get();
assertLocationLink(actual, expected);
}
use of com.redhat.qute.services.QuteLanguageService in project quarkus-ls by redhat-developer.
the class QuteAssert method testDocumentSymbolsFor.
public static void testDocumentSymbolsFor(String value, String fileUri, String projectUri, String templateBaseDir, DocumentSymbol... expected) throws BadLocationException {
QuteProjectRegistry projectRegistry = new MockQuteProjectRegistry();
Template template = createTemplate(value, fileUri, projectUri, templateBaseDir, projectRegistry);
QuteLanguageService languageService = new QuteLanguageService(new JavaDataModelCache(projectRegistry));
List<DocumentSymbol> actual = languageService.findDocumentSymbols(template, () -> {
});
assertDocumentSymbols(actual, expected);
}
use of com.redhat.qute.services.QuteLanguageService in project quarkus-ls by redhat-developer.
the class QuteAssert method testDocumentLinkFor.
public static void testDocumentLinkFor(String value, String fileUri, String projectUri, String templateBaseDir, DocumentLink... expected) {
QuteProjectRegistry projectRegistry = new MockQuteProjectRegistry();
Template template = createTemplate(value, fileUri, projectUri, templateBaseDir, projectRegistry);
QuteLanguageService languageService = new QuteLanguageService(new JavaDataModelCache(projectRegistry));
List<DocumentLink> actual = languageService.findDocumentLinks(template);
assertDocumentLinks(actual, expected);
}
use of com.redhat.qute.services.QuteLanguageService in project quarkus-ls by redhat-developer.
the class QuteAssert method testReferencesFor.
public static void testReferencesFor(String value, String fileUri, String projectUri, String templateBaseDir, Location... expected) throws BadLocationException {
int offset = value.indexOf('|');
value = value.substring(0, offset) + value.substring(offset + 1);
QuteProjectRegistry projectRegistry = new MockQuteProjectRegistry();
Template template = createTemplate(value, fileUri, projectUri, templateBaseDir, projectRegistry);
QuteLanguageService languageService = new QuteLanguageService(new JavaDataModelCache(projectRegistry));
Position position = template.positionAt(offset);
List<? extends Location> actual = languageService.findReferences(template, position, new ReferenceContext(), () -> {
});
assertLocation(actual, expected);
}
Aggregations