diff --git a/org.eclipse.xtext.testing/src/org/eclipse/xtext/testing/AbstractLanguageServerTest.xtend b/org.eclipse.xtext.testing/src/org/eclipse/xtext/testing/AbstractLanguageServerTest.xtend index 19a16da65..186b99ed5 100644 --- a/org.eclipse.xtext.testing/src/org/eclipse/xtext/testing/AbstractLanguageServerTest.xtend +++ b/org.eclipse.xtext.testing/src/org/eclipse/xtext/testing/AbstractLanguageServerTest.xtend @@ -53,6 +53,7 @@ import org.eclipse.lsp4j.PublishDiagnosticsParams import org.eclipse.lsp4j.Range import org.eclipse.lsp4j.ReferenceContext import org.eclipse.lsp4j.ReferenceParams +import org.eclipse.lsp4j.ResourceOperation import org.eclipse.lsp4j.SemanticHighlightingInformation import org.eclipse.lsp4j.SemanticHighlightingParams import org.eclipse.lsp4j.SignatureHelp @@ -452,11 +453,24 @@ abstract class AbstractLanguageServerTest implements Endpoint { protected dispatch def String toExpectation(WorkspaceEdit it) ''' changes : - «FOR entry : changes.entrySet» - «URI.createURI(entry.key).lastSegment» : «entry.value.toExpectation» - «ENDFOR» + «IF changes !== null» + «FOR entry : changes.entrySet» + «URI.createURI(entry.key).lastSegment» : «entry.value.toExpectation» + «ENDFOR» + «ENDIF» documentChanges : - «documentChanges.toExpectation» + «IF !documentChanges.nullOrEmpty» + «FOR entry: documentChanges.filter[isLeft].map[getLeft]» + «entry.toExpectation» + «ENDFOR» + «FOR entry: documentChanges.filter[isRight].map[getRight]» + «entry.toExpectation» + «ENDFOR» + «ENDIF» + ''' + + protected dispatch def String toExpectation(ResourceOperation it) ''' + kind : «kind» ''' protected dispatch def String toExpectation(CodeAction it) ''' diff --git a/org.eclipse.xtext.testing/xtend-gen/org/eclipse/xtext/testing/AbstractLanguageServerTest.java b/org.eclipse.xtext.testing/xtend-gen/org/eclipse/xtext/testing/AbstractLanguageServerTest.java index ae811cd3e..d0fa63ebd 100644 --- a/org.eclipse.xtext.testing/xtend-gen/org/eclipse/xtext/testing/AbstractLanguageServerTest.java +++ b/org.eclipse.xtext.testing/xtend-gen/org/eclipse/xtext/testing/AbstractLanguageServerTest.java @@ -67,6 +67,7 @@ import org.eclipse.lsp4j.PublishDiagnosticsParams; import org.eclipse.lsp4j.Range; import org.eclipse.lsp4j.ReferenceContext; import org.eclipse.lsp4j.ReferenceParams; +import org.eclipse.lsp4j.ResourceOperation; import org.eclipse.lsp4j.SemanticHighlightingInformation; import org.eclipse.lsp4j.SemanticHighlightingParams; import org.eclipse.lsp4j.SignatureHelp; @@ -937,22 +938,69 @@ public abstract class AbstractLanguageServerTest implements Endpoint { _builder.append("changes :"); _builder.newLine(); { - Set>> _entrySet = it.getChanges().entrySet(); - for(final Map.Entry> entry : _entrySet) { - _builder.append("\t"); - String _lastSegment = org.eclipse.emf.common.util.URI.createURI(entry.getKey()).lastSegment(); - _builder.append(_lastSegment, "\t"); - _builder.append(" : "); - String _expectation = this.toExpectation(entry.getValue()); - _builder.append(_expectation, "\t"); - _builder.newLineIfNotEmpty(); + Map> _changes = it.getChanges(); + boolean _tripleNotEquals = (_changes != null); + if (_tripleNotEquals) { + { + Set>> _entrySet = it.getChanges().entrySet(); + for(final Map.Entry> entry : _entrySet) { + _builder.append("\t"); + String _lastSegment = org.eclipse.emf.common.util.URI.createURI(entry.getKey()).lastSegment(); + _builder.append(_lastSegment, "\t"); + _builder.append(" : "); + String _expectation = this.toExpectation(entry.getValue()); + _builder.append(_expectation, "\t"); + _builder.newLineIfNotEmpty(); + } + } } } _builder.append("documentChanges : "); _builder.newLine(); - _builder.append("\t"); - String _expectation_1 = this.toExpectation(it.getDocumentChanges()); - _builder.append(_expectation_1, "\t"); + { + boolean _isNullOrEmpty = IterableExtensions.isNullOrEmpty(it.getDocumentChanges()); + boolean _not = (!_isNullOrEmpty); + if (_not) { + { + final Function1, Boolean> _function = (Either it_1) -> { + return Boolean.valueOf(it_1.isLeft()); + }; + final Function1, TextDocumentEdit> _function_1 = (Either it_1) -> { + return it_1.getLeft(); + }; + Iterable _map = IterableExtensions., TextDocumentEdit>map(IterableExtensions.>filter(it.getDocumentChanges(), _function), _function_1); + for(final TextDocumentEdit entry_1 : _map) { + _builder.append("\t"); + String _expectation_1 = this.toExpectation(entry_1); + _builder.append(_expectation_1, "\t"); + _builder.newLineIfNotEmpty(); + } + } + { + final Function1, Boolean> _function_2 = (Either it_1) -> { + return Boolean.valueOf(it_1.isRight()); + }; + final Function1, ResourceOperation> _function_3 = (Either it_1) -> { + return it_1.getRight(); + }; + Iterable _map_1 = IterableExtensions., ResourceOperation>map(IterableExtensions.>filter(it.getDocumentChanges(), _function_2), _function_3); + for(final ResourceOperation entry_2 : _map_1) { + _builder.append("\t"); + String _expectation_2 = this.toExpectation(entry_2); + _builder.append(_expectation_2, "\t"); + _builder.newLineIfNotEmpty(); + } + } + } + } + return _builder.toString(); + } + + protected String _toExpectation(final ResourceOperation it) { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("kind : "); + String _kind = it.getKind(); + _builder.append(_kind); _builder.newLineIfNotEmpty(); return _builder.toString(); } @@ -1532,6 +1580,8 @@ public abstract class AbstractLanguageServerTest implements Endpoint { return _toExpectation((Position)it); } else if (it instanceof Range) { return _toExpectation((Range)it); + } else if (it instanceof ResourceOperation) { + return _toExpectation((ResourceOperation)it); } else if (it instanceof SignatureHelp) { return _toExpectation((SignatureHelp)it); } else if (it instanceof SymbolInformation) {