Java Code Examples for org.eclipse.lsp4j.PublishDiagnosticsParams#setDiagnostics()

The following examples show how to use org.eclipse.lsp4j.PublishDiagnosticsParams#setDiagnostics() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProblemTracker.java    From vscode-as3mxml with Apache License 2.0 6 votes vote down vote up
public void releaseStale()
{
    //if any files have been removed, they will still appear in this set, so
    //clear the errors so that they don't persist
    for (URI uri : staleFilesWithProblems)
    {
        PublishDiagnosticsParams publish = new PublishDiagnosticsParams();
        publish.setDiagnostics(new ArrayList<>());
        publish.setUri(uri.toString());
        if (languageClient != null)
        {
            languageClient.publishDiagnostics(publish);
        }
    }
    staleFilesWithProblems.clear();
    HashSet<URI> temp = newFilesWithProblems;
    newFilesWithProblems = staleFilesWithProblems;
    staleFilesWithProblems = temp;
}
 
Example 2
Source File: RdfLintLanguageServer.java    From rdflint with MIT License 5 votes vote down vote up
@Override
public void didClose(DidCloseTextDocumentParams params) {
  // remove source from map
  sourceTextMap.remove(params.getTextDocument().getUri());

  // clear diagnostics
  PublishDiagnosticsParams diagnostics = new PublishDiagnosticsParams();
  diagnostics.setUri(params.getTextDocument().getUri());
  diagnostics.setDiagnostics(new LinkedList<>());
  this.client.publishDiagnostics(diagnostics);

  // diagnostics
  diagnostics(params.getTextDocument().getUri());
}
 
Example 3
Source File: IssueAcceptor.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/** Converts given issues to {@link Diagnostic}s and sends them to LSP client */
public void publishDiagnostics(URI uri, Iterable<? extends LSPIssue> issues) {
	if (client != null) {
		PublishDiagnosticsParams publishDiagnosticsParams = new PublishDiagnosticsParams();
		publishDiagnosticsParams.setUri(uriExtensions.toUriString(uri));
		List<Diagnostic> diags = toDiagnostics(issues);
		publishDiagnosticsParams.setDiagnostics(diags);
		client.publishDiagnostics(publishDiagnosticsParams);
	}
}
 
Example 4
Source File: ActionScriptServices.java    From vscode-as3mxml with Apache License 2.0 5 votes vote down vote up
private void clearProblemsForURI(URI uri)
{
    PublishDiagnosticsParams publish = new PublishDiagnosticsParams();
    ArrayList<Diagnostic> diagnostics = new ArrayList<>();
    publish.setDiagnostics(diagnostics);
    publish.setUri(uri.toString());
    if (languageClient != null)
    {
        languageClient.publishDiagnostics(publish);
    }
}