use of com.redhat.qute.settings.SharedSettings in project quarkus-ls by redhat-developer.
the class QuteCodeActionWithSettingsTest method withDisableValidationQuickFixUndefinedObject.
@Test
public void withDisableValidationQuickFixUndefinedObject() throws Exception {
String template = "{item}";
Diagnostic d = d(//
0, //
1, //
0, //
5, //
QuteErrorCode.UndefinedObject, //
"`item` cannot be resolved to an object.", DiagnosticSeverity.Warning);
d.setData(DiagnosticDataFactory.createUndefinedObjectData("item", false));
testDiagnosticsFor(template, d);
SharedSettings settings = createSharedSettings(QuteClientCommandConstants.COMMAND_CONFIGURATION_UPDATE);
testCodeActionsFor(//
template, //
d, //
settings, ca(d, c(//
"Disable Qute validation for the `qute-quickstart` project.", //
QuteClientCommandConstants.COMMAND_CONFIGURATION_UPDATE, //
"qute.validation.enabled", //
"test.qute", //
ConfigurationItemEditType.update, //
false, //
d)), ca(d, c(//
"Exclude this file from validation.", //
QuteClientCommandConstants.COMMAND_CONFIGURATION_UPDATE, //
"qute.validation.excluded", //
"test.qute", //
ConfigurationItemEditType.add, //
"test.qute", //
d)), ca(d, te(0, 0, 0, 0, //
"{@java.lang.String item}" + //
System.lineSeparator())), ca(d, c(//
"Ignore `UndefinedObject` problem.", //
QuteClientCommandConstants.COMMAND_CONFIGURATION_UPDATE, //
"qute.validation.undefinedObject.severity", //
"test.qute", //
ConfigurationItemEditType.update, //
"ignore", d)));
}
use of com.redhat.qute.settings.SharedSettings in project quarkus-ls by redhat-developer.
the class QuteGenerateTemplateContentCommandHandlerTest method generateItem.
@Test
public void generateItem() throws InterruptedException, ExecutionException, Exception {
QuteGenerateTemplateContentCommandHandler command = new QuteGenerateTemplateContentCommandHandler(createJavaDataModelCache());
ExecuteCommandParams params = new ExecuteCommandParams("", Arrays.asList(createItemInfo()));
String result = (String) //
command.executeCommand(//
params, //
new SharedSettings(), () -> {
}).get();
System.err.println(result);
}
use of com.redhat.qute.settings.SharedSettings in project quarkus-ls by redhat-developer.
the class QuteAssert method assertHover.
public static void assertHover(String value, String fileURI, String templateId, String expectedHoverLabel, Range expectedHoverRange) throws Exception {
SharedSettings sharedSettings = new SharedSettings();
HoverCapabilities capabilities = new HoverCapabilities(Arrays.asList(MarkupKind.MARKDOWN), false);
sharedSettings.getHoverSettings().setCapabilities(capabilities);
assertHover(value, fileURI, templateId, PROJECT_URI, TEMPLATE_BASE_DIR, expectedHoverLabel, expectedHoverRange, sharedSettings);
}
use of com.redhat.qute.settings.SharedSettings in project quarkus-ls by redhat-developer.
the class QuteAssert method testCodeLensFor.
private static void testCodeLensFor(String value, String fileUri, String templateId, String projectUri, String templateBaseDir, CodeLens... expected) throws Exception {
QuteProjectRegistry projectRegistry = new MockQuteProjectRegistry();
Template template = createTemplate(value, fileUri, projectUri, templateBaseDir, projectRegistry);
template.setTemplateId(templateId);
QuteLanguageService languageService = new QuteLanguageService(new JavaDataModelCache(projectRegistry));
SharedSettings sharedSettings = new SharedSettings();
CommandCapabilities commandCapabilities = new CommandCapabilities();
CommandKindCapabilities kinds = new CommandKindCapabilities(Arrays.asList(QuteClientCommandConstants.COMMAND_JAVA_DEFINITION));
commandCapabilities.setCommandKind(kinds);
sharedSettings.getCommandCapabilities().setCapabilities(commandCapabilities);
List<? extends CodeLens> actual = languageService.getCodeLens(template, sharedSettings, () -> {
}).get();
assertCodeLens(actual, expected);
}
use of com.redhat.qute.settings.SharedSettings in project quarkus-ls by redhat-developer.
the class QuteCodeActionWithSettingsTest method createSharedSettings.
private static SharedSettings createSharedSettings(String... commandIds) {
SharedSettings settings = new SharedSettings();
CommandCapabilities commandCapabilities = new CommandCapabilities();
CommandKindCapabilities kinds = new CommandKindCapabilities(commandIds != null ? Arrays.asList(commandIds) : Collections.emptyList());
commandCapabilities.setCommandKind(kinds);
settings.getCommandCapabilities().setCapabilities(commandCapabilities);
return settings;
}
Aggregations