use of org.graalvm.tools.lsp.server.types.TextDocumentContentChangeEvent in project graal by oracle.
the class ParsingTest method checkChange.
private TextDocumentSurrogate checkChange(URI uri, Range range, String change, String editorText) throws InterruptedException, ExecutionException {
TextDocumentContentChangeEvent event = TextDocumentContentChangeEvent.create(change).setRange(range).setRangeLength(change.length());
Future<TextDocumentSurrogate> future = truffleAdapter.processChangesAndParse(Arrays.asList(event), uri);
TextDocumentSurrogate surrogate = future.get();
assertEquals(editorText, surrogate.getEditorText());
assertSame(surrogate.getEditorText(), surrogate.getEditorText());
return surrogate;
}
use of org.graalvm.tools.lsp.server.types.TextDocumentContentChangeEvent in project graal by oracle.
the class CompletionTest method replace.
private void replace(URI uri, Range range, String replacement, String diagMessage) throws InterruptedException {
TextDocumentContentChangeEvent event = TextDocumentContentChangeEvent.create(replacement).setRange(range).setRangeLength(replacement.length());
Future<?> future = truffleAdapter.processChangesAndParse(Arrays.asList(event), uri);
try {
future.get();
assertNull(diagMessage);
} catch (ExecutionException e) {
assertFalse(diagMessage, diagMessage.isEmpty());
Collection<PublishDiagnosticsParams> diagnosticParamsCollection = ((DiagnosticsNotification) e.getCause()).getDiagnosticParamsCollection();
assertEquals(1, diagnosticParamsCollection.size());
String message = diagnosticParamsCollection.iterator().next().getDiagnostics().get(0).getMessage();
assertTrue(message, message.contains(diagMessage));
}
}
Aggregations