use of org.eclipse.lsp4j.DidSaveTextDocumentParams in project sonarlint-core by SonarSource.
the class ServerMainTest method analyzeSimpleJsFileOnSave.
@Test
public void analyzeSimpleJsFileOnSave() throws Exception {
String uri = getUri("foo.js");
lsProxy.getTextDocumentService().didSave(new DidSaveTextDocumentParams(new TextDocumentIdentifier(uri), "function foo() {\n alert('toto');\n}"));
assertThat(waitForDiagnostics(uri)).extracting("range.start.line", "range.start.character", "range.end.line", "range.end.character", "code", "source", "message", "severity").containsExactly(tuple(1, 2, 1, 15, "javascript:S1442", "sonarlint", "Remove this usage of alert(...). (javascript:S1442)", DiagnosticSeverity.Information));
}
use of org.eclipse.lsp4j.DidSaveTextDocumentParams in project eclipse.jdt.ls by eclipse.
the class DocumentLifeCycleHandlerTest method saveDocument.
private void saveDocument(ICompilationUnit cu) throws Exception {
DidSaveTextDocumentParams saveParms = new DidSaveTextDocumentParams();
TextDocumentIdentifier textDocument = new TextDocumentIdentifier();
textDocument.setUri(JDTUtils.toURI(cu));
saveParms.setTextDocument(textDocument);
saveParms.setText(cu.getSource());
lifeCycleHandler.didSave(saveParms);
waitForBackgroundJobs();
}
Aggregations