use of org.eclipse.lsp4e.LSPEclipseUtils in project lsp4e by eclipse.
the class LSPDiagnosticsToMarkers method accept.
@Override
public void accept(PublishDiagnosticsParams diagnostics) {
try {
String uri = diagnostics.getUri();
IResource resource = LSPEclipseUtils.findResourceFor(uri);
if (resource != null && resource.exists()) {
updateMarkers(diagnostics, resource);
} else {
LSPEclipseUtils.findOpenEditorsFor(LSPEclipseUtils.toUri(uri)).stream().map(reference -> reference.getEditor(true)).filter(Objects::nonNull).map(LSPEclipseUtils::getTextViewer).filter(Objects::nonNull).filter(ISourceViewer.class::isInstance).map(ISourceViewer.class::cast).forEach(sourceViewer -> updateEditorAnnotations(sourceViewer, diagnostics));
}
} catch (CoreException ex) {
LanguageServerPlugin.logError(ex);
}
}
Aggregations