public void clearDiagnostics() { JavaLanguageServerPlugin.logInfo("Clearing problems for " + this.uri.substring(this.uri.lastIndexOf('/'))); problems.clear(); PublishDiagnosticsParams $ = new PublishDiagnosticsParams(ResourceUtils.toClientUri(uri), Collections.emptyList()); this.connection.publishDiagnostics($); }
public URL getUrl(String formatterUrl) { URL url = null; try { url = new URL(ResourceUtils.toClientUri(formatterUrl)); } catch (MalformedURLException e1) { File file = findFile(formatterUrl); if (file != null && file.isFile()) { try { url = file.toURI().toURL(); } catch (MalformedURLException e) { JavaLanguageServerPlugin.logInfo("Invalid formatter:" + formatterUrl); } } } return url; }
private void cleanUpDiagnostics(String uri){ this.connection.publishDiagnostics(new PublishDiagnosticsParams(ResourceUtils.toClientUri(uri), Collections.emptyList())); }
/** * Creates a default location for the uri. * * @param classFile * @return location * @throws JavaModelException */ public static Location toLocation(String uri) { return new Location(ResourceUtils.toClientUri(uri), newRange()); }
@Override public void endReporting() { JavaLanguageServerPlugin.logInfo(problems.size() + " problems reported for " + this.uri.substring(this.uri.lastIndexOf('/'))); PublishDiagnosticsParams $ = new PublishDiagnosticsParams(ResourceUtils.toClientUri(uri), toDiagnosticsArray(this.cu, problems)); this.connection.publishDiagnostics($); }
/** * Creates location to the given offset and length for the compilation unit * * @param unit * @param offset * @param length * @return location or null * @throws JavaModelException */ public static Location toLocation(ICompilationUnit unit, int offset, int length) throws JavaModelException { return new Location(ResourceUtils.toClientUri(toURI(unit)), toRange(unit, offset, length)); }
if (!project.equals(projectsManager.getDefaultProject())) { String uri = JDTUtils.getFileURI(project); connection.publishDiagnostics(new PublishDiagnosticsParams(ResourceUtils.toClientUri(uri), Collections.emptyList()));
private CodeLens getCodeLens(String type, IJavaElement element, ITypeRoot typeRoot) throws JavaModelException { ISourceRange r = ((ISourceReference) element).getNameRange(); if (r == null) { return null; } CodeLens lens = new CodeLens(); final Range range = JDTUtils.toRange(typeRoot, r.getOffset(), r.getLength()); lens.setRange(range); String uri = ResourceUtils.toClientUri(JDTUtils.toUri(typeRoot)); lens.setData(Arrays.asList(uri, range.getStart(), type)); return lens; }
private void publishMarkers(IProject project, IMarker[] markers) throws CoreException { Range range = new Range(new Position(0, 0), new Position(0, 0)); List<IMarker> projectMarkers = new ArrayList<>(markers.length); String uri = JDTUtils.getFileURI(project); IFile pom = project.getFile("pom.xml"); List<IMarker> pomMarkers = new ArrayList<>(); for (IMarker marker : markers) { if (!marker.exists() || CheckMissingNaturesListener.MARKER_TYPE.equals(marker.getType())) { continue; } if (IMavenConstants.MARKER_CONFIGURATION_ID.equals(marker.getType())) { pomMarkers.add(marker); } else { projectMarkers.add(marker); } } List<Diagnostic> diagnostics = toDiagnosticArray(range, projectMarkers); String clientUri = ResourceUtils.toClientUri(uri); connection.publishDiagnostics(new PublishDiagnosticsParams(clientUri, diagnostics)); if (pom.exists()) { IDocument document = JsonRpcHelpers.toDocument(pom); diagnostics = toDiagnosticsArray(document, pom.findMarkers(null, true, IResource.DEPTH_ZERO)); List<Diagnostic> diagnosicts2 = toDiagnosticArray(range, pomMarkers); diagnostics.addAll(diagnosicts2); connection.publishDiagnostics(new PublishDiagnosticsParams(ResourceUtils.toClientUri(clientUri + "/pom.xml"), diagnostics)); } }
connection.publishDiagnostics(new PublishDiagnosticsParams(ResourceUtils.toClientUri(uri), diagnostics));
si.setContainerName(element.getParent().getElementName()); location.setUri(ResourceUtils.toClientUri(location.getUri())); si.setLocation(location); if (!symbols.contains(si)) {
this.connection.publishDiagnostics(new PublishDiagnosticsParams(ResourceUtils.toClientUri(uri), Collections.emptyList())); return false; this.connection.publishDiagnostics(new PublishDiagnosticsParams(ResourceUtils.toClientUri(uri), toDiagnosticsArray(document, markers)));