use of org.eclipse.lsp4j.Diagnostic in project sts4 by spring-projects.
the class ApplicationPropertiesEditorTest method testDeprecatedPropertyQuickfix.
@Ignore
@Test
public void testDeprecatedPropertyQuickfix() throws Exception {
data("error.path", "java.lang.String", null, "Path of the error controller.");
deprecate("error.path", "server.error.path", null);
Editor editor = newEditor("# a comment\n" + "error.path=foo\n");
Diagnostic problem = editor.assertProblem("error.path");
CompletionItem fix = editor.assertFirstQuickfix(problem, "Change to 'server.error.path'");
editor.apply(fix);
editor.assertText("# a comment\n" + "server.error.path<*>=foo\n");
}
use of org.eclipse.lsp4j.Diagnostic in project sts4 by spring-projects.
the class ConcourseEditorTest method quickfixForOneOfMultipleMarkersOnSameRange.
@Test
public void quickfixForOneOfMultipleMarkersOnSameRange() throws Exception {
Editor editor = harness.newEditor("jobs:\n" + "- name: myjob\n" + " plan:\n" + " - task: foo\n" + " config:\n" + " inputs:\n" + " - name: foo");
List<Diagnostic> problems = editor.assertProblems("config|[image_resource, rootfs_uri, image] is required", "config|[platform, run] are required");
assertTrue(editor.getCodeActions(problems.get(0)).isEmpty());
CodeAction quickfix = editor.assertCodeAction(problems.get(1));
assertEquals("Add properties: [platform, run]", quickfix.getLabel());
quickfix.perform();
editor.assertText("jobs:\n" + "- name: myjob\n" + " plan:\n" + " - task: foo\n" + " config:\n" + " inputs:\n" + " - name: foo\n" + " platform: <*>\n" + " run:\n" + " path: ");
}
use of org.eclipse.lsp4j.Diagnostic in project sts4 by spring-projects.
the class ConcourseEditorTest method gitResourceFetchParameter.
@Test
public void gitResourceFetchParameter() throws Exception {
Editor editor = harness.newEditor("resources:\n" + " - name: cf-networking-dev\n" + " type: git\n" + " source:\n" + " uri: git@someplace.com:cloudfoundry-incubator/cf-networking-release.git\n" + " branch: develop\n" + " ignore_paths:\n" + " - docs\n" + " private_key: {{cf-networking-deploy-key}}\n" + "jobs:\n" + "- name: foo\n" + " plan:\n" + " - get: cf-networking-dev\n" + " params:\n" + " fetch: [master]\n" + " submodules: none\n");
Diagnostic p = editor.assertProblems("fetch|Deprecated").get(0);
assertEquals(DiagnosticSeverity.Warning, p.getSeverity());
}
use of org.eclipse.lsp4j.Diagnostic in project sts4 by spring-projects.
the class ConcourseEditorTest method concourse_3_0_rootfs_uri_prop.
@Test
public void concourse_3_0_rootfs_uri_prop() throws Exception {
Editor editor = harness.newEditor(LanguageId.CONCOURSE_TASK, "platform: linux\n" + "image: blah\n" + "run:\n" + " path: demo-repo/ci/tasks/run-tests.sh");
Diagnostic p = editor.assertProblems("image|renamed to 'rootfs_uri'").get(0);
assertEquals(DiagnosticSeverity.Warning, p.getSeverity());
editor = harness.newEditor(LanguageId.CONCOURSE_TASK, "platform: linux\n" + "image: blah\n" + "run:\n" + " path: demo-repo/ci/tasks/run-tests.sh");
editor.assertHoverContains("image", "renamed to `rootfs_uri`");
}
use of org.eclipse.lsp4j.Diagnostic in project sts4 by spring-projects.
the class Editor method assertProblem.
/**
* Get a problem that covers the given text in the editor. Throws exception
* if no matching problem is found.
*/
public Diagnostic assertProblem(String coveredText) throws Exception {
Editor editor = this;
List<Diagnostic> problems = editor.reconcile();
for (Diagnostic p : problems) {
String c = editor.getText(p.getRange());
if (c.equals(coveredText)) {
return p;
}
}
fail("No problem found covering the text '" + coveredText + "' in: \n" + problemSumary(editor, problems));
// unreachable but compiler doesn't know
return null;
}
Aggregations