use of org.eclipse.lsp4j.PublishDiagnosticsParams in project eclipse.jdt.ls by eclipse.
the class DocumentLifeCycleHandlerTest method testDidOpenNotOnClasspath.
@Test
public void testDidOpenNotOnClasspath() throws Exception {
importProjects("eclipse/hello");
IProject project = WorkspaceHelper.getProject("hello");
URI uri = project.getFile("nopackage/Test2.java").getRawLocationURI();
ICompilationUnit cu = JDTUtils.resolveCompilationUnit(uri);
String source = FileUtils.readFileToString(FileUtils.toFile(uri.toURL()));
openDocument(cu, source, 1);
Job.getJobManager().join(DocumentLifeCycleHandler.DOCUMENT_LIFE_CYCLE_JOBS, monitor);
assertEquals(project, cu.getJavaProject().getProject());
assertEquals(source, cu.getSource());
List<PublishDiagnosticsParams> diagnosticReports = getClientRequests("publishDiagnostics");
assertEquals(1, diagnosticReports.size());
PublishDiagnosticsParams diagParam = diagnosticReports.get(0);
assertEquals(1, diagParam.getDiagnostics().size());
closeDocument(cu);
Job.getJobManager().join(DocumentLifeCycleHandler.DOCUMENT_LIFE_CYCLE_JOBS, monitor);
diagnosticReports = getClientRequests("publishDiagnostics");
assertEquals(2, diagnosticReports.size());
diagParam = diagnosticReports.get(1);
assertEquals(0, diagParam.getDiagnostics().size());
}
use of org.eclipse.lsp4j.PublishDiagnosticsParams in project xtext-core by eclipse.
the class LanguageServerImpl method publishDiagnostics.
private void publishDiagnostics(URI uri, Iterable<? extends Issue> issues) {
initialized.thenAccept((initParams) -> {
PublishDiagnosticsParams publishDiagnosticsParams = new PublishDiagnosticsParams();
publishDiagnosticsParams.setUri(uriExtensions.toUriString(uri));
publishDiagnosticsParams.setDiagnostics(toDiagnostics(issues));
client.publishDiagnostics(publishDiagnosticsParams);
});
}
Aggregations