public static List<Diagnostic> toDiagnosticsArray(IOpenable openable, List<IProblem> problems) { List<Diagnostic> array = new ArrayList<>(problems.size()); for (IProblem problem : problems) { Diagnostic diag = new Diagnostic(); diag.setSource(JavaLanguageServerPlugin.SERVER_SOURCE_ID); diag.setMessage(problem.getMessage()); diag.setCode(Integer.toString(problem.getID())); diag.setSeverity(convertSeverity(problem)); diag.setRange(convertRange(openable, problem)); array.add(diag); } return array; }
private static Diagnostic toDiagnostic(Range range, IMarker marker) { if (marker == null || !marker.exists()) { return null; } Diagnostic d = new Diagnostic(); d.setSource(JavaLanguageServerPlugin.SERVER_SOURCE_ID); String message = marker.getAttribute(IMarker.MESSAGE, ""); if (Messages.ProjectConfigurationUpdateRequired.equals(message)) { message = PROJECT_CONFIGURATION_IS_NOT_UP_TO_DATE_WITH_POM_XML; } d.setMessage(message); d.setSeverity(convertSeverity(marker.getAttribute(IMarker.SEVERITY, -1))); d.setCode(String.valueOf(marker.getAttribute(IJavaModelMarker.ID, 0))); d.setRange(range); return d; }
private static Diagnostic toDiagnostic(IDocument document, IMarker marker) { if (marker == null || !marker.exists()) { return null; } Diagnostic d = new Diagnostic(); d.setSource(JavaLanguageServerPlugin.SERVER_SOURCE_ID); d.setMessage(marker.getAttribute(IMarker.MESSAGE, "")); d.setCode(String.valueOf(marker.getAttribute(IJavaModelMarker.ID, 0))); d.setSeverity(convertSeverity(marker.getAttribute(IMarker.SEVERITY, -1))); d.setRange(convertRange(document, marker)); return d; }
private Diagnostic toDiagnostic(final Issue issue) { Diagnostic _diagnostic = new Diagnostic(); final Procedure1<Diagnostic> _function = (Diagnostic it) -> { it.setCode(issue.getCode()); DiagnosticSeverity _switchResult = null; Severity _severity = issue.getSeverity();
Diagnostic clone(Diagnostic diagnostic) { if (diagnostic == null) { return null; } String code = diagnostic.getCode(); String message = diagnostic.getMessage(); Range range = diagnostic.getRange(); List<DiagnosticRelatedInformation> relatedInformation = diagnostic.getRelatedInformation(); DiagnosticSeverity severity = diagnostic.getSeverity(); String source = diagnostic.getSource(); Diagnostic cloned = new Diagnostic(); cloned.setCode(code); cloned.setMessage(message); cloned.setRange(clone(range)); cloned.setRelatedInformation(cloneDRI(relatedInformation)); cloned.setSeverity(severity); cloned.setSource(source); return cloned; }