mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-16 00:38:56 +00:00
Merge pull request #213 from eclipse/kth_bug492072_xtendgen
[492072] Regenerated Xtend code
This commit is contained in:
commit
64420ce676
253 changed files with 3446 additions and 8851 deletions
|
@ -59,9 +59,7 @@ public class ContentAssistContextFactoryTest {
|
|||
_builder_1.newLine();
|
||||
_builder_1.append("}");
|
||||
_builder_1.newLine();
|
||||
String _string = _builder_1.toString();
|
||||
String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory);
|
||||
Assert.assertEquals(_string, _firstSetGrammarElementsToString);
|
||||
Assert.assertEquals(_builder_1.toString(), this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -128,9 +126,7 @@ public class ContentAssistContextFactoryTest {
|
|||
_builder_1.newLine();
|
||||
_builder_1.append("}");
|
||||
_builder_1.newLine();
|
||||
String _string = _builder_1.toString();
|
||||
String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory);
|
||||
Assert.assertEquals(_string, _firstSetGrammarElementsToString);
|
||||
Assert.assertEquals(_builder_1.toString(), this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -161,9 +157,7 @@ public class ContentAssistContextFactoryTest {
|
|||
_builder_1.newLine();
|
||||
_builder_1.append("}");
|
||||
_builder_1.newLine();
|
||||
String _string = _builder_1.toString();
|
||||
String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory);
|
||||
Assert.assertEquals(_string, _firstSetGrammarElementsToString);
|
||||
Assert.assertEquals(_builder_1.toString(), this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -190,9 +184,7 @@ public class ContentAssistContextFactoryTest {
|
|||
_builder_1.newLine();
|
||||
_builder_1.append("}");
|
||||
_builder_1.newLine();
|
||||
String _string = _builder_1.toString();
|
||||
String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory);
|
||||
Assert.assertEquals(_string, _firstSetGrammarElementsToString);
|
||||
Assert.assertEquals(_builder_1.toString(), this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -240,8 +232,6 @@ public class ContentAssistContextFactoryTest {
|
|||
_builder_1.newLine();
|
||||
_builder_1.append("}");
|
||||
_builder_1.newLine();
|
||||
String _string = _builder_1.toString();
|
||||
String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory);
|
||||
Assert.assertEquals(_string, _firstSetGrammarElementsToString);
|
||||
Assert.assertEquals(_builder_1.toString(), this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,11 +10,9 @@ package org.eclipse.xtext.ide.tests.editor.contentassist;
|
|||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.inject.Inject;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Executors;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.emf.ecore.EClass;
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.xtend.lib.annotations.Accessors;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
|
@ -67,15 +65,13 @@ public class ContentAssistContextTestHelper {
|
|||
final URI uri = URI.createURI(_plus);
|
||||
Resource _createResource = this.resFactory.createResource(uri);
|
||||
final XtextResource res = ((XtextResource) _createResource);
|
||||
XtextResourceSet _xtextResourceSet = new XtextResourceSet();
|
||||
EList<Resource> _resources = _xtextResourceSet.getResources();
|
||||
EList<Resource> _resources = new XtextResourceSet().getResources();
|
||||
_resources.add(res);
|
||||
if ((this.entryPoint != null)) {
|
||||
res.setEntryPoint(this.entryPoint);
|
||||
}
|
||||
StringInputStream _stringInputStream = new StringInputStream(doc);
|
||||
Map<Object, Object> _emptyMap = CollectionLiterals.<Object, Object>emptyMap();
|
||||
res.load(_stringInputStream, _emptyMap);
|
||||
res.load(_stringInputStream, CollectionLiterals.<Object, Object>emptyMap());
|
||||
this.validator.assertNoErrors(res);
|
||||
return res;
|
||||
} catch (Throwable _e) {
|
||||
|
@ -91,10 +87,7 @@ public class ContentAssistContextTestHelper {
|
|||
factory.setPool(Executors.newCachedThreadPool());
|
||||
TextRegion _textRegion = new TextRegion(0, 0);
|
||||
final ContentAssistContext[] ctxs = factory.create(doc, _textRegion, offset, res);
|
||||
GrammarElementTitleSwitch _grammarElementTitleSwitch = new GrammarElementTitleSwitch();
|
||||
GrammarElementTitleSwitch _showAssignments = _grammarElementTitleSwitch.showAssignments();
|
||||
GrammarElementTitleSwitch _showQualified = _showAssignments.showQualified();
|
||||
final GrammarElementTitleSwitch f = _showQualified.showRule();
|
||||
final GrammarElementTitleSwitch f = new GrammarElementTitleSwitch().showAssignments().showQualified().showRule();
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
{
|
||||
Iterable<Pair<Integer, ContentAssistContext>> _indexed = IterableExtensions.<ContentAssistContext>indexed(((Iterable<? extends ContentAssistContext>)Conversions.doWrapArray(ctxs)));
|
||||
|
@ -105,12 +98,10 @@ public class ContentAssistContextTestHelper {
|
|||
_builder.append(" {");
|
||||
_builder.newLineIfNotEmpty();
|
||||
{
|
||||
ContentAssistContext _value = ctx.getValue();
|
||||
ImmutableList<AbstractElement> _firstSetGrammarElements = _value.getFirstSetGrammarElements();
|
||||
ImmutableList<AbstractElement> _firstSetGrammarElements = ctx.getValue().getFirstSetGrammarElements();
|
||||
for(final AbstractElement ele : _firstSetGrammarElements) {
|
||||
_builder.append("\t");
|
||||
EClass _eClass = ele.eClass();
|
||||
String _name = _eClass.getName();
|
||||
String _name = ele.eClass().getName();
|
||||
_builder.append(_name, "\t");
|
||||
_builder.append(": ");
|
||||
String _apply = f.apply(ele);
|
||||
|
|
|
@ -65,9 +65,7 @@ public class PartialContentAssistTestLanguageContextFactoryTest {
|
|||
_builder_1.newLine();
|
||||
_builder_1.append("}");
|
||||
_builder_1.newLine();
|
||||
String _string = _builder_1.toString();
|
||||
String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory);
|
||||
Assert.assertEquals(_string, _firstSetGrammarElementsToString);
|
||||
Assert.assertEquals(_builder_1.toString(), this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -104,9 +102,7 @@ public class PartialContentAssistTestLanguageContextFactoryTest {
|
|||
_builder_1.newLine();
|
||||
_builder_1.append("}");
|
||||
_builder_1.newLine();
|
||||
String _string = _builder_1.toString();
|
||||
String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory);
|
||||
Assert.assertEquals(_string, _firstSetGrammarElementsToString);
|
||||
Assert.assertEquals(_builder_1.toString(), this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -131,9 +127,7 @@ public class PartialContentAssistTestLanguageContextFactoryTest {
|
|||
_builder_1.newLine();
|
||||
_builder_1.append("}");
|
||||
_builder_1.newLine();
|
||||
String _string = _builder_1.toString();
|
||||
String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory);
|
||||
Assert.assertEquals(_string, _firstSetGrammarElementsToString);
|
||||
Assert.assertEquals(_builder_1.toString(), this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -154,9 +148,7 @@ public class PartialContentAssistTestLanguageContextFactoryTest {
|
|||
_builder_1.newLine();
|
||||
_builder_1.append("}");
|
||||
_builder_1.newLine();
|
||||
String _string = _builder_1.toString();
|
||||
String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory);
|
||||
Assert.assertEquals(_string, _firstSetGrammarElementsToString);
|
||||
Assert.assertEquals(_builder_1.toString(), this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -183,8 +175,6 @@ public class PartialContentAssistTestLanguageContextFactoryTest {
|
|||
_builder_1.newLine();
|
||||
_builder_1.append("}");
|
||||
_builder_1.newLine();
|
||||
String _string = _builder_1.toString();
|
||||
String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory);
|
||||
Assert.assertEquals(_string, _firstSetGrammarElementsToString);
|
||||
Assert.assertEquals(_builder_1.toString(), this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,9 +53,10 @@ public class BuildOrderTest {
|
|||
it.setDependencies(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList()));
|
||||
};
|
||||
final ProjectDescription d = ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription_3, _function_3);
|
||||
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(d, c, b, a)), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a, b, c, d)), ((Procedure1<ProjectDescription>) (ProjectDescription it) -> {
|
||||
final Procedure1<ProjectDescription> _function_4 = (ProjectDescription it) -> {
|
||||
Assert.fail();
|
||||
})));
|
||||
};
|
||||
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(d, c, b, a)), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a, b, c, d)), _function_4));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -84,9 +85,10 @@ public class BuildOrderTest {
|
|||
it.setDependencies(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList()));
|
||||
};
|
||||
final ProjectDescription d = ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription_3, _function_3);
|
||||
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(d, c, b, a)), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a, b, c, d)), ((Procedure1<ProjectDescription>) (ProjectDescription it) -> {
|
||||
final Procedure1<ProjectDescription> _function_4 = (ProjectDescription it) -> {
|
||||
Assert.fail();
|
||||
})));
|
||||
};
|
||||
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(d, c, b, a)), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a, b, c, d)), _function_4));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -115,9 +117,10 @@ public class BuildOrderTest {
|
|||
it.setDependencies(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList()));
|
||||
};
|
||||
final ProjectDescription d = ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription_3, _function_3);
|
||||
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(d, c, b, a)), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a, b, c, d)), ((Procedure1<ProjectDescription>) (ProjectDescription it) -> {
|
||||
final Procedure1<ProjectDescription> _function_4 = (ProjectDescription it) -> {
|
||||
Assert.fail();
|
||||
})));
|
||||
};
|
||||
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(d, c, b, a)), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a, b, c, d)), _function_4));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -133,12 +136,14 @@ public class BuildOrderTest {
|
|||
it.setName("b");
|
||||
};
|
||||
final ProjectDescription b = ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription_1, _function_1);
|
||||
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a)), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a)), ((Procedure1<ProjectDescription>) (ProjectDescription it) -> {
|
||||
final Procedure1<ProjectDescription> _function_2 = (ProjectDescription it) -> {
|
||||
Assert.fail();
|
||||
})));
|
||||
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(b)), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(b)), ((Procedure1<ProjectDescription>) (ProjectDescription it) -> {
|
||||
};
|
||||
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a)), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a)), _function_2));
|
||||
final Procedure1<ProjectDescription> _function_3 = (ProjectDescription it) -> {
|
||||
Assert.fail();
|
||||
})));
|
||||
};
|
||||
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(b)), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(b)), _function_3));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -174,9 +179,10 @@ public class BuildOrderTest {
|
|||
};
|
||||
final ProjectDescription e = ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription_4, _function_4);
|
||||
final ArrayList<ProjectDescription> cyclic = CollectionLiterals.<ProjectDescription>newArrayList();
|
||||
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(e)), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a, b, c, d, e)), ((Procedure1<ProjectDescription>) (ProjectDescription it) -> {
|
||||
final Procedure1<ProjectDescription> _function_5 = (ProjectDescription it) -> {
|
||||
cyclic.add(it);
|
||||
})));
|
||||
};
|
||||
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(e)), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a, b, c, d, e)), _function_5));
|
||||
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(b, d, c, a)), cyclic);
|
||||
}
|
||||
|
||||
|
@ -189,9 +195,10 @@ public class BuildOrderTest {
|
|||
};
|
||||
final ProjectDescription a = ObjectExtensions.<ProjectDescription>operator_doubleArrow(_projectDescription, _function);
|
||||
final ArrayList<ProjectDescription> cyclic = CollectionLiterals.<ProjectDescription>newArrayList();
|
||||
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList()), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a)), ((Procedure1<ProjectDescription>) (ProjectDescription it) -> {
|
||||
final Procedure1<ProjectDescription> _function_1 = (ProjectDescription it) -> {
|
||||
cyclic.add(it);
|
||||
})));
|
||||
};
|
||||
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList()), new TopologicalSorter().sortByDependencies(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a)), _function_1));
|
||||
this.assertEquals(Collections.<ProjectDescription>unmodifiableList(CollectionLiterals.<ProjectDescription>newArrayList(a)), cyclic);
|
||||
}
|
||||
|
||||
|
@ -210,7 +217,6 @@ public class BuildOrderTest {
|
|||
final Function1<ProjectDescription, String> _function = (ProjectDescription it) -> {
|
||||
return it.getName();
|
||||
};
|
||||
List<String> _map = ListExtensions.<ProjectDescription, String>map(list, _function);
|
||||
return IterableExtensions.join(_map, ", ");
|
||||
return IterableExtensions.join(ListExtensions.<ProjectDescription, String>map(list, _function), ", ");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,11 +8,9 @@
|
|||
package org.eclipse.xtext.ide.tests.server;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.eclipse.lsp4j.ColoringInformation;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
import org.eclipse.xtext.ide.tests.server.AbstractTestLangLanguageServerTest;
|
||||
|
@ -85,25 +83,19 @@ public class ColoringTest extends AbstractTestLangLanguageServerTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("MyModel.");
|
||||
_builder.append(this.fileExtension);
|
||||
Path _resolve = _path.resolve(_builder.toString());
|
||||
final File file = _resolve.toFile();
|
||||
URI _uRI = file.toURI();
|
||||
final String uri = _uRI.toString();
|
||||
final File file = _path.resolve(_builder.toString()).toFile();
|
||||
final String uri = file.toURI().toString();
|
||||
this.open(uri, ColoringTest.MODEL);
|
||||
Map<String, List<? extends ColoringInformation>> _coloringParams = this.getColoringParams();
|
||||
Set<Map.Entry<String, List<? extends ColoringInformation>>> _entrySet = _coloringParams.entrySet();
|
||||
final Function1<Map.Entry<String, List<? extends ColoringInformation>>, String> _function = (Map.Entry<String, List<? extends ColoringInformation>> it) -> {
|
||||
String _key = it.getKey();
|
||||
String _key_1 = it.getKey();
|
||||
int _lastIndexOf = _key_1.lastIndexOf("/");
|
||||
int _lastIndexOf = it.getKey().lastIndexOf("/");
|
||||
int _plus = (_lastIndexOf + 1);
|
||||
return _key.substring(_plus);
|
||||
};
|
||||
final Function1<Map.Entry<String, List<? extends ColoringInformation>>, List<? extends ColoringInformation>> _function_1 = (Map.Entry<String, List<? extends ColoringInformation>> it) -> {
|
||||
return it.getValue();
|
||||
};
|
||||
Map<String, List<? extends ColoringInformation>> _map = IterableExtensions.<Map.Entry<String, List<? extends ColoringInformation>>, String, List<? extends ColoringInformation>>toMap(_entrySet, _function, _function_1);
|
||||
final String expectation = this.toExpectation(_map);
|
||||
final String expectation = this.toExpectation(IterableExtensions.<Map.Entry<String, List<? extends ColoringInformation>>, String, List<? extends ColoringInformation>>toMap(this.getColoringParams().entrySet(), _function, _function_1));
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
String _name = file.getName();
|
||||
_builder_1.append(_name);
|
||||
|
|
|
@ -53,8 +53,7 @@ public class DocumentHighlightTest extends AbstractTestLangLanguageServerTest {
|
|||
it.setModel(_builder.toString());
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("type A { op");
|
||||
int _length = _builder_1.length();
|
||||
it.setColumn(_length);
|
||||
it.setColumn(_builder_1.length());
|
||||
it.setExpectedDocumentHighlight("");
|
||||
};
|
||||
this.testDocumentHighlight(_function);
|
||||
|
@ -68,8 +67,7 @@ public class DocumentHighlightTest extends AbstractTestLangLanguageServerTest {
|
|||
it.setModel(_builder.toString());
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("type A { op foo(");
|
||||
int _length = _builder_1.length();
|
||||
it.setColumn(_length);
|
||||
it.setColumn(_builder_1.length());
|
||||
it.setExpectedDocumentHighlight("");
|
||||
};
|
||||
this.testDocumentHighlight(_function);
|
||||
|
@ -83,8 +81,7 @@ public class DocumentHighlightTest extends AbstractTestLangLanguageServerTest {
|
|||
it.setModel(_builder.toString());
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("type A { op fo");
|
||||
int _length = _builder_1.length();
|
||||
it.setColumn(_length);
|
||||
it.setColumn(_builder_1.length());
|
||||
it.setExpectedDocumentHighlight("W [[0, 12] .. [0, 15]]");
|
||||
};
|
||||
this.testDocumentHighlight(_function);
|
||||
|
@ -98,8 +95,7 @@ public class DocumentHighlightTest extends AbstractTestLangLanguageServerTest {
|
|||
it.setModel(_builder.toString());
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("type A { int fo");
|
||||
int _length = _builder_1.length();
|
||||
it.setColumn(_length);
|
||||
it.setColumn(_builder_1.length());
|
||||
it.setExpectedDocumentHighlight("W [[0, 13] .. [0, 16]]");
|
||||
};
|
||||
this.testDocumentHighlight(_function);
|
||||
|
@ -113,8 +109,7 @@ public class DocumentHighlightTest extends AbstractTestLangLanguageServerTest {
|
|||
it.setModel(_builder.toString());
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("type A { op fo");
|
||||
int _length = _builder_1.length();
|
||||
it.setColumn(_length);
|
||||
it.setColumn(_builder_1.length());
|
||||
it.setExpectedDocumentHighlight("W [[0, 12] .. [0, 15]]");
|
||||
};
|
||||
this.testDocumentHighlight(_function);
|
||||
|
@ -129,8 +124,7 @@ public class DocumentHighlightTest extends AbstractTestLangLanguageServerTest {
|
|||
it.setLine(0);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("type A { op foo() { } op bar() { fo");
|
||||
int _length = _builder_1.length();
|
||||
it.setColumn(_length);
|
||||
it.setColumn(_builder_1.length());
|
||||
it.setExpectedDocumentHighlight("W [[0, 12] .. [0, 15]] | R [[0, 33] .. [0, 36]]");
|
||||
};
|
||||
this.testDocumentHighlight(_function);
|
||||
|
@ -145,8 +139,7 @@ public class DocumentHighlightTest extends AbstractTestLangLanguageServerTest {
|
|||
it.setLine(0);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("type A { op fo");
|
||||
int _length = _builder_1.length();
|
||||
it.setColumn(_length);
|
||||
it.setColumn(_builder_1.length());
|
||||
it.setExpectedDocumentHighlight("W [[0, 12] .. [0, 15]] | R [[0, 33] .. [0, 36]]");
|
||||
};
|
||||
this.testDocumentHighlight(_function);
|
||||
|
@ -176,8 +169,7 @@ public class DocumentHighlightTest extends AbstractTestLangLanguageServerTest {
|
|||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("op fo");
|
||||
int _length = _builder_1.length();
|
||||
it.setColumn(_length);
|
||||
it.setColumn(_builder_1.length());
|
||||
it.setExpectedDocumentHighlight("W [[1, 4] .. [1, 7]] | R [[3, 2] .. [3, 5]]");
|
||||
};
|
||||
this.testDocumentHighlight(_function);
|
||||
|
@ -207,8 +199,7 @@ public class DocumentHighlightTest extends AbstractTestLangLanguageServerTest {
|
|||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append(" ");
|
||||
_builder_1.append("op fo");
|
||||
int _length = _builder_1.length();
|
||||
it.setColumn(_length);
|
||||
it.setColumn(_builder_1.length());
|
||||
it.setExpectedDocumentHighlight("W [[1, 7] .. [1, 10]] | R [[3, 8] .. [3, 11]]");
|
||||
};
|
||||
this.testDocumentHighlight(_function);
|
||||
|
|
|
@ -37,15 +37,10 @@ public class DocumentTest {
|
|||
String _normalize = this.normalize(_builder);
|
||||
Document _document = new Document(1, _normalize);
|
||||
final Procedure1<Document> _function = (Document it) -> {
|
||||
Position _position = this.position(0, 0);
|
||||
int _offSet = it.getOffSet(_position);
|
||||
Assert.assertEquals(0, _offSet);
|
||||
Position _position_1 = this.position(0, 11);
|
||||
int _offSet_1 = it.getOffSet(_position_1);
|
||||
Assert.assertEquals(11, _offSet_1);
|
||||
Assert.assertEquals(0, it.getOffSet(this.position(0, 0)));
|
||||
Assert.assertEquals(11, it.getOffSet(this.position(0, 11)));
|
||||
try {
|
||||
Position _position_2 = this.position(0, 12);
|
||||
it.getOffSet(_position_2);
|
||||
it.getOffSet(this.position(0, 12));
|
||||
Assert.fail();
|
||||
} catch (final Throwable _t) {
|
||||
if (_t instanceof IndexOutOfBoundsException) {
|
||||
|
@ -54,21 +49,11 @@ public class DocumentTest {
|
|||
throw Exceptions.sneakyThrow(_t);
|
||||
}
|
||||
}
|
||||
Position _position_3 = this.position(1, 0);
|
||||
int _offSet_2 = it.getOffSet(_position_3);
|
||||
Assert.assertEquals(12, _offSet_2);
|
||||
Position _position_4 = this.position(1, 1);
|
||||
int _offSet_3 = it.getOffSet(_position_4);
|
||||
Assert.assertEquals(13, _offSet_3);
|
||||
Position _position_5 = this.position(1, 2);
|
||||
int _offSet_4 = it.getOffSet(_position_5);
|
||||
Assert.assertEquals(14, _offSet_4);
|
||||
Position _position_6 = this.position(2, 0);
|
||||
int _offSet_5 = it.getOffSet(_position_6);
|
||||
Assert.assertEquals(16, _offSet_5);
|
||||
Position _position_7 = this.position(2, 3);
|
||||
int _offSet_6 = it.getOffSet(_position_7);
|
||||
Assert.assertEquals(19, _offSet_6);
|
||||
Assert.assertEquals(12, it.getOffSet(this.position(1, 0)));
|
||||
Assert.assertEquals(13, it.getOffSet(this.position(1, 1)));
|
||||
Assert.assertEquals(14, it.getOffSet(this.position(1, 2)));
|
||||
Assert.assertEquals(16, it.getOffSet(this.position(2, 0)));
|
||||
Assert.assertEquals(19, it.getOffSet(this.position(2, 3)));
|
||||
};
|
||||
ObjectExtensions.<Document>operator_doubleArrow(_document, _function);
|
||||
}
|
||||
|
@ -77,12 +62,9 @@ public class DocumentTest {
|
|||
public void testOffSet_empty() {
|
||||
Document _document = new Document(1, "");
|
||||
final Procedure1<Document> _function = (Document it) -> {
|
||||
Position _position = this.position(0, 0);
|
||||
int _offSet = it.getOffSet(_position);
|
||||
Assert.assertEquals(0, _offSet);
|
||||
Assert.assertEquals(0, it.getOffSet(this.position(0, 0)));
|
||||
try {
|
||||
Position _position_1 = this.position(0, 12);
|
||||
it.getOffSet(_position_1);
|
||||
it.getOffSet(this.position(0, 12));
|
||||
Assert.fail();
|
||||
} catch (final Throwable _t) {
|
||||
if (_t instanceof IndexOutOfBoundsException) {
|
||||
|
@ -112,14 +94,9 @@ public class DocumentTest {
|
|||
_builder_1.newLine();
|
||||
_builder_1.append("bar");
|
||||
_builder_1.newLine();
|
||||
String _normalize_1 = this.normalize(_builder_1);
|
||||
Position _position = this.position(1, 0);
|
||||
Position _position_1 = this.position(2, 0);
|
||||
TextEdit _change = this.change(_position, _position_1, "");
|
||||
Document _applyChanges = it.applyChanges(
|
||||
Collections.<TextEdit>unmodifiableList(CollectionLiterals.<TextEdit>newArrayList(_change)));
|
||||
String _contents = _applyChanges.getContents();
|
||||
Assert.assertEquals(_normalize_1, _contents);
|
||||
TextEdit _change = this.change(this.position(1, 0), this.position(2, 0), "");
|
||||
Assert.assertEquals(this.normalize(_builder_1), it.applyChanges(
|
||||
Collections.<TextEdit>unmodifiableList(CollectionLiterals.<TextEdit>newArrayList(_change))).getContents());
|
||||
};
|
||||
ObjectExtensions.<Document>operator_doubleArrow(_document, _function);
|
||||
}
|
||||
|
@ -143,14 +120,9 @@ public class DocumentTest {
|
|||
_builder_1.newLine();
|
||||
_builder_1.append("bar");
|
||||
_builder_1.newLine();
|
||||
String _normalize_1 = this.normalize(_builder_1);
|
||||
Position _position = this.position(1, 1);
|
||||
Position _position_1 = this.position(1, 3);
|
||||
TextEdit _change = this.change(_position, _position_1, "uture");
|
||||
Document _applyChanges = it.applyChanges(
|
||||
Collections.<TextEdit>unmodifiableList(CollectionLiterals.<TextEdit>newArrayList(_change)));
|
||||
String _contents = _applyChanges.getContents();
|
||||
Assert.assertEquals(_normalize_1, _contents);
|
||||
TextEdit _change = this.change(this.position(1, 1), this.position(1, 3), "uture");
|
||||
Assert.assertEquals(this.normalize(_builder_1), it.applyChanges(
|
||||
Collections.<TextEdit>unmodifiableList(CollectionLiterals.<TextEdit>newArrayList(_change))).getContents());
|
||||
};
|
||||
ObjectExtensions.<Document>operator_doubleArrow(_document, _function);
|
||||
}
|
||||
|
@ -166,13 +138,9 @@ public class DocumentTest {
|
|||
String _normalize = this.normalize(_builder);
|
||||
Document _document = new Document(1, _normalize);
|
||||
final Procedure1<Document> _function = (Document it) -> {
|
||||
Position _position = this.position(0, 0);
|
||||
Position _position_1 = this.position(2, 3);
|
||||
TextEdit _change = this.change(_position, _position_1, "");
|
||||
Document _applyChanges = it.applyChanges(
|
||||
Collections.<TextEdit>unmodifiableList(CollectionLiterals.<TextEdit>newArrayList(_change)));
|
||||
String _contents = _applyChanges.getContents();
|
||||
Assert.assertEquals("", _contents);
|
||||
TextEdit _change = this.change(this.position(0, 0), this.position(2, 3), "");
|
||||
Assert.assertEquals("", it.applyChanges(
|
||||
Collections.<TextEdit>unmodifiableList(CollectionLiterals.<TextEdit>newArrayList(_change))).getContents());
|
||||
};
|
||||
ObjectExtensions.<Document>operator_doubleArrow(_document, _function);
|
||||
}
|
||||
|
@ -189,10 +157,8 @@ public class DocumentTest {
|
|||
Document _document = new Document(1, _normalize);
|
||||
final Procedure1<Document> _function = (Document it) -> {
|
||||
TextEdit _change = this.change(null, null, " foo ");
|
||||
Document _applyChanges = it.applyChanges(
|
||||
Collections.<TextEdit>unmodifiableList(CollectionLiterals.<TextEdit>newArrayList(_change)));
|
||||
String _contents = _applyChanges.getContents();
|
||||
Assert.assertEquals(" foo ", _contents);
|
||||
Assert.assertEquals(" foo ", it.applyChanges(
|
||||
Collections.<TextEdit>unmodifiableList(CollectionLiterals.<TextEdit>newArrayList(_change))).getContents());
|
||||
};
|
||||
ObjectExtensions.<Document>operator_doubleArrow(_document, _function);
|
||||
}
|
||||
|
@ -215,8 +181,7 @@ public class DocumentTest {
|
|||
}
|
||||
|
||||
private String normalize(final CharSequence s) {
|
||||
String _string = s.toString();
|
||||
return _string.replaceAll("\r", "");
|
||||
return s.toString().replaceAll("\r", "");
|
||||
}
|
||||
|
||||
private Position position(final int l, final int c) {
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
package org.eclipse.xtext.ide.tests.server;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import org.eclipse.lsp4j.DidOpenTextDocumentParams;
|
||||
import org.eclipse.lsp4j.TextDocumentItem;
|
||||
import org.eclipse.lsp4j.jsonrpc.services.ServiceEndpoints;
|
||||
|
@ -63,16 +61,12 @@ public class LspExtensionTest extends AbstractTestLangLanguageServerTest {
|
|||
it.line = 1;
|
||||
};
|
||||
TestLangLSPExtension.TextOfLineParam _doubleArrow_1 = ObjectExtensions.<TestLangLSPExtension.TextOfLineParam>operator_doubleArrow(_textOfLineParam, _function_1);
|
||||
CompletableFuture<TestLangLSPExtension.TextOfLineResult> _textOfLine = ext.getTextOfLine(_doubleArrow_1);
|
||||
final TestLangLSPExtension.TextOfLineResult result = _textOfLine.get();
|
||||
final TestLangLSPExtension.TextOfLineResult result = ext.getTextOfLine(_doubleArrow_1).get();
|
||||
Assert.assertEquals("baz test", result.text);
|
||||
final Function1<Pair<String, Object>, Object> _function_2 = (Pair<String, Object> it) -> {
|
||||
return it.getValue();
|
||||
};
|
||||
List<Object> _map = ListExtensions.<Pair<String, Object>, Object>map(this.notifications, _function_2);
|
||||
Iterable<TestLangLSPExtension.BuildNotification> _filter = Iterables.<TestLangLSPExtension.BuildNotification>filter(_map, TestLangLSPExtension.BuildNotification.class);
|
||||
int _size = IterableExtensions.size(_filter);
|
||||
Assert.assertEquals(2, _size);
|
||||
Assert.assertEquals(2, IterableExtensions.size(Iterables.<TestLangLSPExtension.BuildNotification>filter(ListExtensions.<Pair<String, Object>, Object>map(this.notifications, _function_2), TestLangLSPExtension.BuildNotification.class)));
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import com.google.inject.AbstractModule;
|
|||
import com.google.inject.Guice;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Module;
|
||||
import com.google.inject.binder.AnnotatedBindingBuilder;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
|
@ -24,11 +23,9 @@ import org.eclipse.xtend2.lib.StringConcatenation;
|
|||
import org.eclipse.xtext.diagnostics.Diagnostic;
|
||||
import org.eclipse.xtext.ide.server.IWorkspaceConfigFactory;
|
||||
import org.eclipse.xtext.ide.server.MultiProjectWorkspaceConfigFactory;
|
||||
import org.eclipse.xtext.ide.server.ProjectManager;
|
||||
import org.eclipse.xtext.ide.server.ServerModule;
|
||||
import org.eclipse.xtext.ide.server.WorkspaceManager;
|
||||
import org.eclipse.xtext.ide.server.concurrent.RequestManager;
|
||||
import org.eclipse.xtext.resource.impl.ProjectDescription;
|
||||
import org.eclipse.xtext.util.CancelIndicator;
|
||||
import org.eclipse.xtext.util.Files;
|
||||
import org.eclipse.xtext.util.Modules2;
|
||||
|
@ -75,21 +72,16 @@ public class MultiProjectTest {
|
|||
_builder_1.append("}");
|
||||
_builder_1.newLine();
|
||||
final URI bar = this.createFile(this.project1, "Bar.testlang", _builder_1);
|
||||
List<URI> _emptyList = CollectionLiterals.<URI>emptyList();
|
||||
this.workspaceManager.doBuild(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(foo, bar)), _emptyList, CancelIndicator.NullImpl);
|
||||
this.workspaceManager.doBuild(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(foo, bar)), CollectionLiterals.<URI>emptyList(), CancelIndicator.NullImpl);
|
||||
Assert.assertEquals(2, this.diagnostics.size());
|
||||
Assert.assertEquals(1, this.diagnostics.get(foo).size());
|
||||
Assert.assertEquals(Diagnostic.LINKING_DIAGNOSTIC, IterableExtensions.<Issue>head(this.diagnostics.get(foo)).getCode());
|
||||
Assert.assertTrue(this.diagnostics.get(bar).isEmpty());
|
||||
this.diagnostics.clear();
|
||||
String _name = this.project0.getName();
|
||||
ProjectManager _projectManager = this.workspaceManager.getProjectManager(_name);
|
||||
ProjectDescription _projectDescription = _projectManager.getProjectDescription();
|
||||
List<String> _dependencies = _projectDescription.getDependencies();
|
||||
String _name_1 = this.project1.getName();
|
||||
_dependencies.add(_name_1);
|
||||
List<URI> _emptyList_1 = CollectionLiterals.<URI>emptyList();
|
||||
this.workspaceManager.doBuild(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(foo, bar)), _emptyList_1, CancelIndicator.NullImpl);
|
||||
List<String> _dependencies = this.workspaceManager.getProjectManager(this.project0.getName()).getProjectDescription().getDependencies();
|
||||
String _name = this.project1.getName();
|
||||
_dependencies.add(_name);
|
||||
this.workspaceManager.doBuild(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(foo, bar)), CollectionLiterals.<URI>emptyList(), CancelIndicator.NullImpl);
|
||||
Assert.assertEquals(2, this.diagnostics.size());
|
||||
Assert.assertTrue(this.diagnostics.get(foo).isEmpty());
|
||||
Assert.assertTrue(this.diagnostics.get(bar).isEmpty());
|
||||
|
@ -98,20 +90,18 @@ public class MultiProjectTest {
|
|||
@Before
|
||||
public void setup() {
|
||||
ServerModule _serverModule = new ServerModule();
|
||||
Module _mixin = Modules2.mixin(_serverModule, new AbstractModule() {
|
||||
final Injector injector = Guice.createInjector(Modules2.mixin(_serverModule, new AbstractModule() {
|
||||
@Override
|
||||
protected void configure() {
|
||||
AnnotatedBindingBuilder<IWorkspaceConfigFactory> _bind = this.<IWorkspaceConfigFactory>bind(IWorkspaceConfigFactory.class);
|
||||
_bind.to(MultiProjectWorkspaceConfigFactory.class);
|
||||
AnnotatedBindingBuilder<RequestManager> _bind_1 = this.<RequestManager>bind(RequestManager.class);
|
||||
_bind_1.toInstance(new RequestManager() {
|
||||
this.<IWorkspaceConfigFactory>bind(IWorkspaceConfigFactory.class).to(MultiProjectWorkspaceConfigFactory.class);
|
||||
AnnotatedBindingBuilder<RequestManager> _bind = this.<RequestManager>bind(RequestManager.class);
|
||||
_bind.toInstance(new RequestManager() {
|
||||
@Override
|
||||
public <V extends Object> CompletableFuture<V> runWrite(final Function1<? super CancelIndicator, ? extends V> writeRequest) {
|
||||
final CancelIndicator _function = () -> {
|
||||
return false;
|
||||
};
|
||||
V _apply = writeRequest.apply(_function);
|
||||
return CompletableFuture.<V>completedFuture(_apply);
|
||||
return CompletableFuture.<V>completedFuture(writeRequest.apply(_function));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -119,13 +109,11 @@ public class MultiProjectTest {
|
|||
final CancelIndicator _function = () -> {
|
||||
return false;
|
||||
};
|
||||
V _apply = readRequest.apply(_function);
|
||||
return CompletableFuture.<V>completedFuture(_apply);
|
||||
return CompletableFuture.<V>completedFuture(readRequest.apply(_function));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
final Injector injector = Guice.createInjector(_mixin);
|
||||
}));
|
||||
injector.injectMembers(this);
|
||||
final File workspaceRoot = this.getRoot("test-data");
|
||||
File _file = new File(workspaceRoot, "test-project0");
|
||||
|
@ -134,13 +122,10 @@ public class MultiProjectTest {
|
|||
this.project1 = _file_1;
|
||||
this.project0.mkdir();
|
||||
this.project1.mkdir();
|
||||
String _absolutePath = workspaceRoot.getAbsolutePath();
|
||||
URI _createFileURI = URI.createFileURI(_absolutePath);
|
||||
final Procedure2<URI, Iterable<Issue>> _function = (URI $0, Iterable<Issue> $1) -> {
|
||||
List<Issue> _list = IterableExtensions.<Issue>toList($1);
|
||||
this.diagnostics.put($0, _list);
|
||||
this.diagnostics.put($0, IterableExtensions.<Issue>toList($1));
|
||||
};
|
||||
this.workspaceManager.initialize(_createFileURI, _function, null);
|
||||
this.workspaceManager.initialize(URI.createFileURI(workspaceRoot.getAbsolutePath()), _function, null);
|
||||
}
|
||||
|
||||
protected File getRoot(final String path) {
|
||||
|
@ -165,8 +150,7 @@ public class MultiProjectTest {
|
|||
public URI createFile(final File root, final String path, final CharSequence contents) {
|
||||
try {
|
||||
final File file = new File(root, path);
|
||||
File _parentFile = file.getParentFile();
|
||||
_parentFile.mkdirs();
|
||||
file.getParentFile().mkdirs();
|
||||
file.createNewFile();
|
||||
FileWriter _fileWriter = new FileWriter(file);
|
||||
final Procedure1<FileWriter> _function = (FileWriter it) -> {
|
||||
|
@ -178,8 +162,7 @@ public class MultiProjectTest {
|
|||
}
|
||||
};
|
||||
ObjectExtensions.<FileWriter>operator_doubleArrow(_fileWriter, _function);
|
||||
String _absolutePath = file.getAbsolutePath();
|
||||
return URI.createFileURI(_absolutePath);
|
||||
return URI.createFileURI(file.getAbsolutePath());
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
package org.eclipse.xtext.ide.tests.server;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.eclipse.lsp4j.Diagnostic;
|
||||
import org.eclipse.lsp4j.DidChangeTextDocumentParams;
|
||||
import org.eclipse.lsp4j.DidChangeWatchedFilesParams;
|
||||
|
@ -46,11 +44,7 @@ public class OpenDocumentTest extends AbstractTestLangLanguageServerTest {
|
|||
_builder.newLine();
|
||||
final String firstFile = this.writeFile("MyType1.testlang", _builder);
|
||||
this.initialize();
|
||||
Map<String, List<Diagnostic>> _diagnostics = this.getDiagnostics();
|
||||
List<Diagnostic> _get = _diagnostics.get(firstFile);
|
||||
Diagnostic _head = IterableExtensions.<Diagnostic>head(_get);
|
||||
String _message = _head.getMessage();
|
||||
this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", _message);
|
||||
this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", IterableExtensions.<Diagnostic>head(this.getDiagnostics().get(firstFile)).getMessage());
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("type Foo {");
|
||||
_builder_1.newLine();
|
||||
|
@ -62,27 +56,16 @@ public class OpenDocumentTest extends AbstractTestLangLanguageServerTest {
|
|||
DidChangeWatchedFilesParams _didChangeWatchedFilesParams = new DidChangeWatchedFilesParams(
|
||||
Collections.<FileEvent>unmodifiableList(CollectionLiterals.<FileEvent>newArrayList(_fileEvent)));
|
||||
_workspaceService.didChangeWatchedFiles(_didChangeWatchedFilesParams);
|
||||
Map<String, List<Diagnostic>> _diagnostics_1 = this.getDiagnostics();
|
||||
List<Diagnostic> _get_1 = _diagnostics_1.get(firstFile);
|
||||
Diagnostic _head_1 = IterableExtensions.<Diagnostic>head(_get_1);
|
||||
String _message_1 = _head_1.getMessage();
|
||||
this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", _message_1);
|
||||
this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", IterableExtensions.<Diagnostic>head(this.getDiagnostics().get(firstFile)).getMessage());
|
||||
StringConcatenation _builder_2 = new StringConcatenation();
|
||||
_builder_2.append("type NonExisting {");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("}");
|
||||
_builder_2.newLine();
|
||||
this.open(path, _builder_2.toString());
|
||||
Map<String, List<Diagnostic>> _diagnostics_2 = this.getDiagnostics();
|
||||
List<Diagnostic> _get_2 = _diagnostics_2.get(firstFile);
|
||||
Diagnostic _head_2 = IterableExtensions.<Diagnostic>head(_get_2);
|
||||
Assert.assertNull(_head_2);
|
||||
Assert.assertNull(IterableExtensions.<Diagnostic>head(this.getDiagnostics().get(firstFile)));
|
||||
this.close(path);
|
||||
Map<String, List<Diagnostic>> _diagnostics_3 = this.getDiagnostics();
|
||||
List<Diagnostic> _get_3 = _diagnostics_3.get(firstFile);
|
||||
Diagnostic _head_3 = IterableExtensions.<Diagnostic>head(_get_3);
|
||||
String _message_2 = _head_3.getMessage();
|
||||
this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", _message_2);
|
||||
this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", IterableExtensions.<Diagnostic>head(this.getDiagnostics().get(firstFile)).getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -97,11 +80,7 @@ public class OpenDocumentTest extends AbstractTestLangLanguageServerTest {
|
|||
_builder.newLine();
|
||||
final String firstFile = this.writeFile("MyType1.testlang", _builder);
|
||||
this.initialize();
|
||||
Map<String, List<Diagnostic>> _diagnostics = this.getDiagnostics();
|
||||
List<Diagnostic> _get = _diagnostics.get(firstFile);
|
||||
Diagnostic _head = IterableExtensions.<Diagnostic>head(_get);
|
||||
String _message = _head.getMessage();
|
||||
this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", _message);
|
||||
this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", IterableExtensions.<Diagnostic>head(this.getDiagnostics().get(firstFile)).getMessage());
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("type Test {");
|
||||
_builder_1.newLine();
|
||||
|
@ -111,11 +90,7 @@ public class OpenDocumentTest extends AbstractTestLangLanguageServerTest {
|
|||
_builder_1.append("}");
|
||||
_builder_1.newLine();
|
||||
this.open(firstFile, _builder_1.toString());
|
||||
Map<String, List<Diagnostic>> _diagnostics_1 = this.getDiagnostics();
|
||||
List<Diagnostic> _get_1 = _diagnostics_1.get(firstFile);
|
||||
Diagnostic _head_1 = IterableExtensions.<Diagnostic>head(_get_1);
|
||||
String _message_1 = _head_1.getMessage();
|
||||
this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", _message_1);
|
||||
this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", IterableExtensions.<Diagnostic>head(this.getDiagnostics().get(firstFile)).getMessage());
|
||||
DidChangeTextDocumentParams _didChangeTextDocumentParams = new DidChangeTextDocumentParams();
|
||||
final Procedure1<DidChangeTextDocumentParams> _function = (DidChangeTextDocumentParams it) -> {
|
||||
VersionedTextDocumentIdentifier _versionedTextDocumentIdentifier = new VersionedTextDocumentIdentifier();
|
||||
|
@ -138,10 +113,7 @@ public class OpenDocumentTest extends AbstractTestLangLanguageServerTest {
|
|||
};
|
||||
DidChangeTextDocumentParams _doubleArrow = ObjectExtensions.<DidChangeTextDocumentParams>operator_doubleArrow(_didChangeTextDocumentParams, _function);
|
||||
this.languageServer.didChange(_doubleArrow);
|
||||
Map<String, List<Diagnostic>> _diagnostics_2 = this.getDiagnostics();
|
||||
List<Diagnostic> _get_2 = _diagnostics_2.get(firstFile);
|
||||
Diagnostic _head_2 = IterableExtensions.<Diagnostic>head(_get_2);
|
||||
Assert.assertNull(_head_2);
|
||||
Assert.assertNull(IterableExtensions.<Diagnostic>head(this.getDiagnostics().get(firstFile)));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -158,20 +130,11 @@ public class OpenDocumentTest extends AbstractTestLangLanguageServerTest {
|
|||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
this.open(referencingFileURI, _builder.toString());
|
||||
Map<String, List<Diagnostic>> _diagnostics = this.getDiagnostics();
|
||||
List<Diagnostic> _get = _diagnostics.get(referencingFileURI);
|
||||
boolean _isEmpty = _get.isEmpty();
|
||||
Assert.assertFalse(_isEmpty);
|
||||
Assert.assertFalse(this.getDiagnostics().get(referencingFileURI).isEmpty());
|
||||
this.open(fileURI, "type Foo {}");
|
||||
Map<String, List<Diagnostic>> _diagnostics_1 = this.getDiagnostics();
|
||||
List<Diagnostic> _get_1 = _diagnostics_1.get(referencingFileURI);
|
||||
boolean _isEmpty_1 = _get_1.isEmpty();
|
||||
Assert.assertTrue(_isEmpty_1);
|
||||
Assert.assertTrue(this.getDiagnostics().get(referencingFileURI).isEmpty());
|
||||
this.close(fileURI);
|
||||
Map<String, List<Diagnostic>> _diagnostics_2 = this.getDiagnostics();
|
||||
List<Diagnostic> _get_2 = _diagnostics_2.get(referencingFileURI);
|
||||
boolean _isEmpty_2 = _get_2.isEmpty();
|
||||
Assert.assertFalse(_isEmpty_2);
|
||||
Assert.assertFalse(this.getDiagnostics().get(referencingFileURI).isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -189,14 +152,8 @@ public class OpenDocumentTest extends AbstractTestLangLanguageServerTest {
|
|||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
this.open(referencingFileURI, _builder.toString());
|
||||
Map<String, List<Diagnostic>> _diagnostics = this.getDiagnostics();
|
||||
List<Diagnostic> _get = _diagnostics.get(referencingFileURI);
|
||||
boolean _isEmpty = _get.isEmpty();
|
||||
Assert.assertTrue(_isEmpty);
|
||||
Assert.assertTrue(this.getDiagnostics().get(referencingFileURI).isEmpty());
|
||||
this.close(fileURI);
|
||||
Map<String, List<Diagnostic>> _diagnostics_1 = this.getDiagnostics();
|
||||
List<Diagnostic> _get_1 = _diagnostics_1.get(referencingFileURI);
|
||||
boolean _isEmpty_1 = _get_1.isEmpty();
|
||||
Assert.assertFalse(_isEmpty_1);
|
||||
Assert.assertFalse(this.getDiagnostics().get(referencingFileURI).isEmpty());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,17 +7,12 @@
|
|||
*/
|
||||
package org.eclipse.xtext.ide.tests.server;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.eclipse.lsp4j.Diagnostic;
|
||||
import org.eclipse.lsp4j.DidChangeWatchedFilesParams;
|
||||
import org.eclipse.lsp4j.FileChangeType;
|
||||
import org.eclipse.lsp4j.FileEvent;
|
||||
import org.eclipse.lsp4j.Position;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
import org.eclipse.lsp4j.services.WorkspaceService;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
import org.eclipse.xtext.ide.tests.server.AbstractTestLangLanguageServerTest;
|
||||
|
@ -44,14 +39,7 @@ public class ServerTest extends AbstractTestLangLanguageServerTest {
|
|||
_builder.newLine();
|
||||
this.writeFile("MyType1.testlang", _builder);
|
||||
this.initialize();
|
||||
Map<String, List<Diagnostic>> _diagnostics = this.getDiagnostics();
|
||||
Set<Map.Entry<String, List<Diagnostic>>> _entrySet = _diagnostics.entrySet();
|
||||
String _join = IterableExtensions.join(_entrySet, ",");
|
||||
Map<String, List<Diagnostic>> _diagnostics_1 = this.getDiagnostics();
|
||||
Collection<List<Diagnostic>> _values = _diagnostics_1.values();
|
||||
List<Diagnostic> _head = IterableExtensions.<List<Diagnostic>>head(_values);
|
||||
boolean _isEmpty = _head.isEmpty();
|
||||
Assert.assertTrue(_join, _isEmpty);
|
||||
Assert.assertTrue(IterableExtensions.join(this.getDiagnostics().entrySet(), ","), IterableExtensions.<List<Diagnostic>>head(this.getDiagnostics().values()).isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -66,47 +54,16 @@ public class ServerTest extends AbstractTestLangLanguageServerTest {
|
|||
_builder.newLine();
|
||||
this.writeFile("MyType1.testlang", _builder);
|
||||
this.initialize();
|
||||
Map<String, List<Diagnostic>> _diagnostics = this.getDiagnostics();
|
||||
Collection<List<Diagnostic>> _values = _diagnostics.values();
|
||||
List<Diagnostic> _head = IterableExtensions.<List<Diagnostic>>head(_values);
|
||||
Diagnostic _head_1 = IterableExtensions.<Diagnostic>head(_head);
|
||||
Diagnostic _head = IterableExtensions.<Diagnostic>head(IterableExtensions.<List<Diagnostic>>head(this.getDiagnostics().values()));
|
||||
String _message = null;
|
||||
if (_head_1!=null) {
|
||||
_message=_head_1.getMessage();
|
||||
if (_head!=null) {
|
||||
_message=_head.getMessage();
|
||||
}
|
||||
this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", _message);
|
||||
Map<String, List<Diagnostic>> _diagnostics_1 = this.getDiagnostics();
|
||||
Collection<List<Diagnostic>> _values_1 = _diagnostics_1.values();
|
||||
List<Diagnostic> _head_2 = IterableExtensions.<List<Diagnostic>>head(_values_1);
|
||||
Diagnostic _head_3 = IterableExtensions.<Diagnostic>head(_head_2);
|
||||
Range _range = _head_3.getRange();
|
||||
Position _start = _range.getStart();
|
||||
int _line = _start.getLine();
|
||||
Assert.assertEquals(1, _line);
|
||||
Map<String, List<Diagnostic>> _diagnostics_2 = this.getDiagnostics();
|
||||
Collection<List<Diagnostic>> _values_2 = _diagnostics_2.values();
|
||||
List<Diagnostic> _head_4 = IterableExtensions.<List<Diagnostic>>head(_values_2);
|
||||
Diagnostic _head_5 = IterableExtensions.<Diagnostic>head(_head_4);
|
||||
Range _range_1 = _head_5.getRange();
|
||||
Position _start_1 = _range_1.getStart();
|
||||
int _character = _start_1.getCharacter();
|
||||
Assert.assertEquals(4, _character);
|
||||
Map<String, List<Diagnostic>> _diagnostics_3 = this.getDiagnostics();
|
||||
Collection<List<Diagnostic>> _values_3 = _diagnostics_3.values();
|
||||
List<Diagnostic> _head_6 = IterableExtensions.<List<Diagnostic>>head(_values_3);
|
||||
Diagnostic _head_7 = IterableExtensions.<Diagnostic>head(_head_6);
|
||||
Range _range_2 = _head_7.getRange();
|
||||
Position _end = _range_2.getEnd();
|
||||
int _line_1 = _end.getLine();
|
||||
Assert.assertEquals(1, _line_1);
|
||||
Map<String, List<Diagnostic>> _diagnostics_4 = this.getDiagnostics();
|
||||
Collection<List<Diagnostic>> _values_4 = _diagnostics_4.values();
|
||||
List<Diagnostic> _head_8 = IterableExtensions.<List<Diagnostic>>head(_values_4);
|
||||
Diagnostic _head_9 = IterableExtensions.<Diagnostic>head(_head_8);
|
||||
Range _range_3 = _head_9.getRange();
|
||||
Position _end_1 = _range_3.getEnd();
|
||||
int _character_1 = _end_1.getCharacter();
|
||||
Assert.assertEquals(15, _character_1);
|
||||
Assert.assertEquals(1, IterableExtensions.<Diagnostic>head(IterableExtensions.<List<Diagnostic>>head(this.getDiagnostics().values())).getRange().getStart().getLine());
|
||||
Assert.assertEquals(4, IterableExtensions.<Diagnostic>head(IterableExtensions.<List<Diagnostic>>head(this.getDiagnostics().values())).getRange().getStart().getCharacter());
|
||||
Assert.assertEquals(1, IterableExtensions.<Diagnostic>head(IterableExtensions.<List<Diagnostic>>head(this.getDiagnostics().values())).getRange().getEnd().getLine());
|
||||
Assert.assertEquals(15, IterableExtensions.<Diagnostic>head(IterableExtensions.<List<Diagnostic>>head(this.getDiagnostics().values())).getRange().getEnd().getCharacter());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -121,12 +78,7 @@ public class ServerTest extends AbstractTestLangLanguageServerTest {
|
|||
_builder.newLine();
|
||||
this.writeFile("MyType1.testlang", _builder);
|
||||
this.initialize();
|
||||
Map<String, List<Diagnostic>> _diagnostics = this.getDiagnostics();
|
||||
Collection<List<Diagnostic>> _values = _diagnostics.values();
|
||||
List<Diagnostic> _head = IterableExtensions.<List<Diagnostic>>head(_values);
|
||||
Diagnostic _head_1 = IterableExtensions.<Diagnostic>head(_head);
|
||||
String _message = _head_1.getMessage();
|
||||
this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", _message);
|
||||
this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", IterableExtensions.<Diagnostic>head(IterableExtensions.<List<Diagnostic>>head(this.getDiagnostics().values())).getMessage());
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("type NonExisting {");
|
||||
_builder_1.newLine();
|
||||
|
@ -137,18 +89,10 @@ public class ServerTest extends AbstractTestLangLanguageServerTest {
|
|||
FileEvent _fileEvent = new FileEvent(path, FileChangeType.Created);
|
||||
DidChangeWatchedFilesParams _didChangeWatchedFilesParams = new DidChangeWatchedFilesParams(Collections.<FileEvent>unmodifiableList(CollectionLiterals.<FileEvent>newArrayList(_fileEvent)));
|
||||
_workspaceService.didChangeWatchedFiles(_didChangeWatchedFilesParams);
|
||||
Map<String, List<Diagnostic>> _diagnostics_1 = this.getDiagnostics();
|
||||
List<Diagnostic> _get = _diagnostics_1.get(path);
|
||||
Assert.assertNotNull(_get);
|
||||
Map<String, List<Diagnostic>> _diagnostics_2 = this.getDiagnostics();
|
||||
Collection<List<Diagnostic>> _values_1 = _diagnostics_2.values();
|
||||
String _join = IterableExtensions.join(_values_1, ",");
|
||||
Map<String, List<Diagnostic>> _diagnostics_3 = this.getDiagnostics();
|
||||
Collection<List<Diagnostic>> _values_2 = _diagnostics_3.values();
|
||||
Assert.assertNotNull(this.getDiagnostics().get(path));
|
||||
final Function1<List<Diagnostic>, Boolean> _function = (List<Diagnostic> it) -> {
|
||||
return Boolean.valueOf(it.isEmpty());
|
||||
};
|
||||
boolean _forall = IterableExtensions.<List<Diagnostic>>forall(_values_2, _function);
|
||||
Assert.assertTrue(_join, _forall);
|
||||
Assert.assertTrue(IterableExtensions.join(this.getDiagnostics().values(), ","), IterableExtensions.<List<Diagnostic>>forall(this.getDiagnostics().values(), _function));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,8 +33,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
|
|||
it.setLine(0);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("type A { op foo(a: A) { } } type Main { op main() { foo(");
|
||||
int _length = _builder_1.length();
|
||||
it.setColumn(_length);
|
||||
it.setColumn(_builder_1.length());
|
||||
it.setExpectedSignatureHelp("A.foo(a: A): void | a: A");
|
||||
};
|
||||
this.testSignatureHelp(_function);
|
||||
|
@ -50,8 +49,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
|
|||
it.setLine(SignatureHelpTest.LINE_NUMBER);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("foo(");
|
||||
int _length = _builder_1.length();
|
||||
it.setColumn(_length);
|
||||
it.setColumn(_builder_1.length());
|
||||
it.setExpectedSignatureHelp("A.foo(): void | A.foo(a: A): string | B.foo(a: A, b: B): int | C.foo(a: A, b: B, c: C): void | <empty>");
|
||||
};
|
||||
this.testSignatureHelp(_function);
|
||||
|
@ -67,8 +65,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
|
|||
it.setLine(SignatureHelpTest.LINE_NUMBER);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("foo(1");
|
||||
int _length = _builder_1.length();
|
||||
it.setColumn(_length);
|
||||
it.setColumn(_builder_1.length());
|
||||
it.setExpectedSignatureHelp("A.foo(a: A): string | B.foo(a: A, b: B): int | C.foo(a: A, b: B, c: C): void | a: A");
|
||||
};
|
||||
this.testSignatureHelp(_function);
|
||||
|
@ -84,8 +81,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
|
|||
it.setLine(SignatureHelpTest.LINE_NUMBER);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("foo(1, 2");
|
||||
int _length = _builder_1.length();
|
||||
it.setColumn(_length);
|
||||
it.setColumn(_builder_1.length());
|
||||
it.setExpectedSignatureHelp("B.foo(a: A, b: B): int | C.foo(a: A, b: B, c: C): void | b: B");
|
||||
};
|
||||
this.testSignatureHelp(_function);
|
||||
|
@ -101,8 +97,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
|
|||
it.setLine(SignatureHelpTest.LINE_NUMBER);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("foo(1, 2, 3");
|
||||
int _length = _builder_1.length();
|
||||
it.setColumn(_length);
|
||||
it.setColumn(_builder_1.length());
|
||||
it.setExpectedSignatureHelp("C.foo(a: A, b: B, c: C): void | c: C");
|
||||
};
|
||||
this.testSignatureHelp(_function);
|
||||
|
@ -118,8 +113,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
|
|||
it.setLine(SignatureHelpTest.LINE_NUMBER);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("foo( 1");
|
||||
int _length = _builder_1.length();
|
||||
it.setColumn(_length);
|
||||
it.setColumn(_builder_1.length());
|
||||
it.setExpectedSignatureHelp("A.foo(a: A): string | B.foo(a: A, b: B): int | C.foo(a: A, b: B, c: C): void | a: A");
|
||||
};
|
||||
this.testSignatureHelp(_function);
|
||||
|
@ -135,8 +129,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
|
|||
it.setLine(SignatureHelpTest.LINE_NUMBER);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("foo(1 ");
|
||||
int _length = _builder_1.length();
|
||||
it.setColumn(_length);
|
||||
it.setColumn(_builder_1.length());
|
||||
it.setExpectedSignatureHelp("A.foo(a: A): string | B.foo(a: A, b: B): int | C.foo(a: A, b: B, c: C): void | a: A");
|
||||
};
|
||||
this.testSignatureHelp(_function);
|
||||
|
@ -152,8 +145,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
|
|||
it.setLine(SignatureHelpTest.LINE_NUMBER);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("foo( 1");
|
||||
int _length = _builder_1.length();
|
||||
it.setColumn(_length);
|
||||
it.setColumn(_builder_1.length());
|
||||
it.setExpectedSignatureHelp("B.foo(a: A, b: B): int | C.foo(a: A, b: B, c: C): void | a: A");
|
||||
};
|
||||
this.testSignatureHelp(_function);
|
||||
|
@ -169,8 +161,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
|
|||
it.setLine(SignatureHelpTest.LINE_NUMBER);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("foo( 1 ");
|
||||
int _length = _builder_1.length();
|
||||
it.setColumn(_length);
|
||||
it.setColumn(_builder_1.length());
|
||||
it.setExpectedSignatureHelp("B.foo(a: A, b: B): int | C.foo(a: A, b: B, c: C): void | a: A");
|
||||
};
|
||||
this.testSignatureHelp(_function);
|
||||
|
@ -186,8 +177,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
|
|||
it.setLine(SignatureHelpTest.LINE_NUMBER);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("foo( 1 ,");
|
||||
int _length = _builder_1.length();
|
||||
it.setColumn(_length);
|
||||
it.setColumn(_builder_1.length());
|
||||
it.setExpectedSignatureHelp("B.foo(a: A, b: B): int | C.foo(a: A, b: B, c: C): void | b: B");
|
||||
};
|
||||
this.testSignatureHelp(_function);
|
||||
|
@ -203,8 +193,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
|
|||
it.setLine(SignatureHelpTest.LINE_NUMBER);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("foo(1, 2,");
|
||||
int _length = _builder_1.length();
|
||||
it.setColumn(_length);
|
||||
it.setColumn(_builder_1.length());
|
||||
it.setExpectedSignatureHelp("C.foo(a: A, b: B, c: C): void | c: C");
|
||||
};
|
||||
this.testSignatureHelp(_function);
|
||||
|
@ -220,8 +209,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
|
|||
it.setLine(SignatureHelpTest.LINE_NUMBER);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("foo(1, 2,");
|
||||
int _length = _builder_1.length();
|
||||
it.setColumn(_length);
|
||||
it.setColumn(_builder_1.length());
|
||||
it.setExpectedSignatureHelp("C.foo(a: A, b: B, c: C): void | c: C");
|
||||
};
|
||||
this.testSignatureHelp(_function);
|
||||
|
@ -237,8 +225,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
|
|||
it.setLine(SignatureHelpTest.LINE_NUMBER);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("foo(1, /*,*/ 2,");
|
||||
int _length = _builder_1.length();
|
||||
it.setColumn(_length);
|
||||
it.setColumn(_builder_1.length());
|
||||
it.setExpectedSignatureHelp("C.foo(a: A, b: B, c: C): void | c: C");
|
||||
};
|
||||
this.testSignatureHelp(_function);
|
||||
|
@ -254,8 +241,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
|
|||
it.setLine(SignatureHelpTest.LINE_NUMBER);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("foo");
|
||||
int _length = _builder_1.length();
|
||||
it.setColumn(_length);
|
||||
it.setColumn(_builder_1.length());
|
||||
it.setExpectedSignatureHelp("<empty>");
|
||||
};
|
||||
this.testSignatureHelp(_function);
|
||||
|
@ -271,8 +257,7 @@ public class SignatureHelpTest extends AbstractTestLangLanguageServerTest {
|
|||
it.setLine(SignatureHelpTest.LINE_NUMBER);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("foo(1, 2)");
|
||||
int _length = _builder_1.length();
|
||||
it.setColumn(_length);
|
||||
it.setColumn(_builder_1.length());
|
||||
it.setExpectedSignatureHelp("<empty>");
|
||||
};
|
||||
this.testSignatureHelp(_function);
|
||||
|
|
|
@ -52,8 +52,7 @@ public class WorkspaceManagerTest {
|
|||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
final URI path = this.operator_mappedTo("MyType1.testlang", _builder);
|
||||
List<URI> _emptyList = CollectionLiterals.<URI>emptyList();
|
||||
this.workspaceManger.doBuild(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(path)), _emptyList, null);
|
||||
this.workspaceManger.doBuild(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(path)), CollectionLiterals.<URI>emptyList(), null);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("type Test {");
|
||||
_builder_1.newLine();
|
||||
|
@ -67,8 +66,7 @@ public class WorkspaceManagerTest {
|
|||
final Function2<Document, XtextResource, String> _function = (Document $0, XtextResource $1) -> {
|
||||
return $0.getContents();
|
||||
};
|
||||
String _doRead = this.workspaceManger.<String>doRead(path, _function);
|
||||
Assert.assertEquals(inMemContents, _doRead);
|
||||
Assert.assertEquals(inMemContents, this.workspaceManger.<String>doRead(path, _function));
|
||||
}
|
||||
|
||||
@Inject
|
||||
|
@ -92,15 +90,10 @@ public class WorkspaceManagerTest {
|
|||
Files.cleanFolder(this.root, null, true, false);
|
||||
}
|
||||
this.root.deleteOnExit();
|
||||
String _absolutePath = this.root.getAbsolutePath();
|
||||
URI _createFileURI = URI.createFileURI(_absolutePath);
|
||||
String _path = this.uriExtensions.toPath(_createFileURI);
|
||||
URI _uri = this.uriExtensions.toUri(_path);
|
||||
final Procedure2<URI, Iterable<Issue>> _function = (URI $0, Iterable<Issue> $1) -> {
|
||||
List<Issue> _list = IterableExtensions.<Issue>toList($1);
|
||||
this.diagnostics.put($0, _list);
|
||||
this.diagnostics.put($0, IterableExtensions.<Issue>toList($1));
|
||||
};
|
||||
this.workspaceManger.initialize(_uri, _function, null);
|
||||
this.workspaceManger.initialize(this.uriExtensions.toUri(this.uriExtensions.toPath(URI.createFileURI(this.root.getAbsolutePath()))), _function, null);
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
|
@ -113,8 +106,7 @@ public class WorkspaceManagerTest {
|
|||
public URI operator_mappedTo(final String path, final CharSequence contents) {
|
||||
try {
|
||||
final File file = new File(this.root, path);
|
||||
File _parentFile = file.getParentFile();
|
||||
_parentFile.mkdirs();
|
||||
file.getParentFile().mkdirs();
|
||||
file.createNewFile();
|
||||
FileWriter _fileWriter = new FileWriter(file);
|
||||
final Procedure1<FileWriter> _function = (FileWriter it) -> {
|
||||
|
@ -126,8 +118,7 @@ public class WorkspaceManagerTest {
|
|||
}
|
||||
};
|
||||
ObjectExtensions.<FileWriter>operator_doubleArrow(_fileWriter, _function);
|
||||
String _absolutePath = file.getAbsolutePath();
|
||||
return URI.createFileURI(_absolutePath);
|
||||
return URI.createFileURI(file.getAbsolutePath());
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ package org.eclipse.xtext.ide.tests.server.concurrent;
|
|||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Injector;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
@ -38,8 +37,7 @@ public class RequestManagerTest {
|
|||
AtomicInteger _atomicInteger = new AtomicInteger();
|
||||
this.sharedState = _atomicInteger;
|
||||
ServerModule _serverModule = new ServerModule();
|
||||
Injector _createInjector = Guice.createInjector(_serverModule);
|
||||
_createInjector.injectMembers(this);
|
||||
Guice.createInjector(_serverModule).injectMembers(this);
|
||||
}
|
||||
|
||||
@After
|
||||
|
@ -103,8 +101,7 @@ public class RequestManagerTest {
|
|||
final Function1<CancelIndicator, Integer> _function = (CancelIndicator it) -> {
|
||||
return Integer.valueOf(this.sharedState.incrementAndGet());
|
||||
};
|
||||
CompletableFuture<Integer> _runWrite = this.requestManager.<Integer>runWrite(_function);
|
||||
_runWrite.join();
|
||||
this.requestManager.<Integer>runWrite(_function).join();
|
||||
Assert.assertEquals(1, this.sharedState.get());
|
||||
}
|
||||
|
||||
|
@ -124,8 +121,7 @@ public class RequestManagerTest {
|
|||
}
|
||||
return _xifexpression;
|
||||
};
|
||||
CompletableFuture<Integer> _runWrite = this.requestManager.<Integer>runWrite(_function_1);
|
||||
_runWrite.join();
|
||||
this.requestManager.<Integer>runWrite(_function_1).join();
|
||||
Assert.assertEquals(2, this.sharedState.get());
|
||||
}
|
||||
|
||||
|
@ -143,8 +139,7 @@ public class RequestManagerTest {
|
|||
}
|
||||
return Integer.valueOf(_xblockexpression);
|
||||
};
|
||||
CompletableFuture<Integer> _runWrite = this.requestManager.<Integer>runWrite(_function_1);
|
||||
_runWrite.join();
|
||||
this.requestManager.<Integer>runWrite(_function_1).join();
|
||||
Assert.assertEquals(2, this.sharedState.get());
|
||||
}
|
||||
|
||||
|
@ -177,8 +172,7 @@ public class RequestManagerTest {
|
|||
} catch (final Throwable _t) {
|
||||
if (_t instanceof CancellationException) {
|
||||
final CancellationException e = (CancellationException)_t;
|
||||
int _get = this.sharedState.get();
|
||||
Assert.assertEquals(1, _get);
|
||||
Assert.assertEquals(1, this.sharedState.get());
|
||||
} else {
|
||||
throw Exceptions.sneakyThrow(_t);
|
||||
}
|
||||
|
@ -217,8 +211,7 @@ public class RequestManagerTest {
|
|||
} catch (final Throwable _t) {
|
||||
if (_t instanceof CancellationException) {
|
||||
final CancellationException e = (CancellationException)_t;
|
||||
int _get = this.sharedState.get();
|
||||
Assert.assertEquals(1, _get);
|
||||
Assert.assertEquals(1, this.sharedState.get());
|
||||
} else {
|
||||
throw Exceptions.sneakyThrow(_t);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import org.eclipse.xtext.ide.tests.testlanguage.PartialContentAssistTestLanguage
|
|||
@SuppressWarnings("all")
|
||||
public class PartialContentAssistTestLanguageStandaloneSetup extends PartialContentAssistTestLanguageStandaloneSetupGenerated {
|
||||
public static void doSetup() {
|
||||
PartialContentAssistTestLanguageStandaloneSetup _partialContentAssistTestLanguageStandaloneSetup = new PartialContentAssistTestLanguageStandaloneSetup();
|
||||
_partialContentAssistTestLanguageStandaloneSetup.createInjectorAndDoEMFRegistration();
|
||||
new PartialContentAssistTestLanguageStandaloneSetup().createInjectorAndDoEMFRegistration();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import org.eclipse.xtext.ide.tests.testlanguage.TestLanguageStandaloneSetupGener
|
|||
@SuppressWarnings("all")
|
||||
public class TestLanguageStandaloneSetup extends TestLanguageStandaloneSetupGenerated {
|
||||
public static void doSetup() {
|
||||
TestLanguageStandaloneSetup _testLanguageStandaloneSetup = new TestLanguageStandaloneSetup();
|
||||
_testLanguageStandaloneSetup.createInjectorAndDoEMFRegistration();
|
||||
new TestLanguageStandaloneSetup().createInjectorAndDoEMFRegistration();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import com.google.common.collect.ImmutableList;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import org.eclipse.emf.common.util.TreeIterator;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.util.EcoreUtil;
|
||||
import org.eclipse.lsp4j.ColoringInformation;
|
||||
|
@ -46,7 +45,6 @@ public class ColoringServiceImpl implements IColoringService {
|
|||
return CollectionLiterals.<ColoringInformation>emptyList();
|
||||
}
|
||||
final ImmutableList.Builder<ColoringInformation> builder = ImmutableList.<ColoringInformation>builder();
|
||||
TreeIterator<Object> _allContents = EcoreUtil.<Object>getAllContents(resource, true);
|
||||
final Procedure1<Object> _function = (Object it) -> {
|
||||
List<INode> _xifexpression = null;
|
||||
if ((it instanceof Property)) {
|
||||
|
@ -74,7 +72,7 @@ public class ColoringServiceImpl implements IColoringService {
|
|||
};
|
||||
nodes.forEach(_function_1);
|
||||
};
|
||||
IteratorExtensions.<Object>forEach(_allContents, _function);
|
||||
IteratorExtensions.<Object>forEach(EcoreUtil.<Object>getAllContents(resource, true), _function);
|
||||
return builder.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,14 +12,11 @@ import java.util.Arrays;
|
|||
import javax.inject.Inject;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.xtext.Keyword;
|
||||
import org.eclipse.xtext.formatting2.AbstractFormatter2;
|
||||
import org.eclipse.xtext.formatting2.IFormattableDocument;
|
||||
import org.eclipse.xtext.formatting2.IHiddenRegionFormatter;
|
||||
import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion;
|
||||
import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.services.TestLanguageGrammarAccess;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Member;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Model;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Property;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration;
|
||||
|
@ -44,40 +41,24 @@ public class TestLanguageFormatter extends AbstractFormatter2 {
|
|||
}
|
||||
|
||||
protected void _format(final TypeDeclaration type, @Extension final IFormattableDocument document) {
|
||||
ISemanticRegionsFinder _regionFor = this.textRegionExtensions.regionFor(type);
|
||||
TestLanguageGrammarAccess.TypeDeclarationElements _typeDeclarationAccess = this._testLanguageGrammarAccess.getTypeDeclarationAccess();
|
||||
Keyword _leftCurlyBracketKeyword_3 = _typeDeclarationAccess.getLeftCurlyBracketKeyword_3();
|
||||
ISemanticRegion _keyword = _regionFor.keyword(_leftCurlyBracketKeyword_3);
|
||||
final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> {
|
||||
it.newLine();
|
||||
};
|
||||
document.append(_keyword, _function);
|
||||
ISemanticRegionsFinder _regionFor_1 = this.textRegionExtensions.regionFor(type);
|
||||
TestLanguageGrammarAccess.TypeDeclarationElements _typeDeclarationAccess_1 = this._testLanguageGrammarAccess.getTypeDeclarationAccess();
|
||||
Keyword _rightCurlyBracketKeyword_5 = _typeDeclarationAccess_1.getRightCurlyBracketKeyword_5();
|
||||
ISemanticRegion _keyword_1 = _regionFor_1.keyword(_rightCurlyBracketKeyword_5);
|
||||
document.append(this.textRegionExtensions.regionFor(type).keyword(this._testLanguageGrammarAccess.getTypeDeclarationAccess().getLeftCurlyBracketKeyword_3()), _function);
|
||||
final Procedure1<IHiddenRegionFormatter> _function_1 = (IHiddenRegionFormatter it) -> {
|
||||
it.newLine();
|
||||
};
|
||||
ISemanticRegion _prepend = document.prepend(_keyword_1, _function_1);
|
||||
final Procedure1<IHiddenRegionFormatter> _function_2 = (IHiddenRegionFormatter it) -> {
|
||||
it.newLine();
|
||||
};
|
||||
document.append(_prepend, _function_2);
|
||||
ISemanticRegionsFinder _regionFor_2 = this.textRegionExtensions.regionFor(type);
|
||||
TestLanguageGrammarAccess.TypeDeclarationElements _typeDeclarationAccess_2 = this._testLanguageGrammarAccess.getTypeDeclarationAccess();
|
||||
Keyword _leftCurlyBracketKeyword_3_1 = _typeDeclarationAccess_2.getLeftCurlyBracketKeyword_3();
|
||||
ISemanticRegion _keyword_2 = _regionFor_2.keyword(_leftCurlyBracketKeyword_3_1);
|
||||
ISemanticRegionsFinder _regionFor_3 = this.textRegionExtensions.regionFor(type);
|
||||
TestLanguageGrammarAccess.TypeDeclarationElements _typeDeclarationAccess_3 = this._testLanguageGrammarAccess.getTypeDeclarationAccess();
|
||||
Keyword _rightCurlyBracketKeyword_5_1 = _typeDeclarationAccess_3.getRightCurlyBracketKeyword_5();
|
||||
ISemanticRegion _keyword_3 = _regionFor_3.keyword(_rightCurlyBracketKeyword_5_1);
|
||||
document.append(document.prepend(this.textRegionExtensions.regionFor(type).keyword(this._testLanguageGrammarAccess.getTypeDeclarationAccess().getRightCurlyBracketKeyword_5()), _function_1), _function_2);
|
||||
final Procedure1<IHiddenRegionFormatter> _function_3 = (IHiddenRegionFormatter it) -> {
|
||||
it.indent();
|
||||
};
|
||||
document.<ISemanticRegion, ISemanticRegion>interior(_keyword_2, _keyword_3, _function_3);
|
||||
EList<Member> _members = type.getMembers();
|
||||
Iterable<Property> _filter = Iterables.<Property>filter(_members, Property.class);
|
||||
document.<ISemanticRegion, ISemanticRegion>interior(
|
||||
this.textRegionExtensions.regionFor(type).keyword(this._testLanguageGrammarAccess.getTypeDeclarationAccess().getLeftCurlyBracketKeyword_3()),
|
||||
this.textRegionExtensions.regionFor(type).keyword(this._testLanguageGrammarAccess.getTypeDeclarationAccess().getRightCurlyBracketKeyword_5()), _function_3);
|
||||
Iterable<Property> _filter = Iterables.<Property>filter(type.getMembers(), Property.class);
|
||||
for (final Property property : _filter) {
|
||||
document.<Property>format(property);
|
||||
}
|
||||
|
|
|
@ -10,17 +10,12 @@ package org.eclipse.xtext.ide.tests.testlanguage.generator;
|
|||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Iterators;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.common.util.TreeIterator;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
import org.eclipse.xtext.generator.AbstractGenerator;
|
||||
import org.eclipse.xtext.generator.IFileSystemAccess2;
|
||||
import org.eclipse.xtext.generator.IGeneratorContext;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Member;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.PrimitiveType;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Property;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Type;
|
||||
|
@ -41,9 +36,7 @@ import org.eclipse.xtext.xbase.lib.StringExtensions;
|
|||
public class TestLanguageGenerator extends AbstractGenerator {
|
||||
@Override
|
||||
public void doGenerate(final Resource resource, final IFileSystemAccess2 fsa, final IGeneratorContext context) {
|
||||
TreeIterator<EObject> _allContents = resource.getAllContents();
|
||||
Iterator<TypeDeclaration> _filter = Iterators.<TypeDeclaration>filter(_allContents, TypeDeclaration.class);
|
||||
List<TypeDeclaration> _list = IteratorExtensions.<TypeDeclaration>toList(_filter);
|
||||
List<TypeDeclaration> _list = IteratorExtensions.<TypeDeclaration>toList(Iterators.<TypeDeclaration>filter(resource.getAllContents(), TypeDeclaration.class));
|
||||
for (final TypeDeclaration type : _list) {
|
||||
String _name = type.getName();
|
||||
String _plus = (_name + ".java");
|
||||
|
@ -54,13 +47,11 @@ public class TestLanguageGenerator extends AbstractGenerator {
|
|||
_builder.append(" {");
|
||||
_builder.newLineIfNotEmpty();
|
||||
{
|
||||
EList<Member> _members = type.getMembers();
|
||||
Iterable<Property> _filter_1 = Iterables.<Property>filter(_members, Property.class);
|
||||
for(final Property p : _filter_1) {
|
||||
Iterable<Property> _filter = Iterables.<Property>filter(type.getMembers(), Property.class);
|
||||
for(final Property p : _filter) {
|
||||
_builder.append("\t");
|
||||
_builder.append("private ");
|
||||
Type _type = p.getType();
|
||||
String _java = this.toJava(_type);
|
||||
String _java = this.toJava(p.getType());
|
||||
_builder.append(_java, "\t");
|
||||
_builder.append(" ");
|
||||
String _name_2 = p.getName();
|
||||
|
@ -71,26 +62,24 @@ public class TestLanguageGenerator extends AbstractGenerator {
|
|||
_builder.newLine();
|
||||
_builder.append("\t");
|
||||
_builder.append("public void set");
|
||||
String _name_3 = p.getName();
|
||||
String _firstUpper = StringExtensions.toFirstUpper(_name_3);
|
||||
String _firstUpper = StringExtensions.toFirstUpper(p.getName());
|
||||
_builder.append(_firstUpper, "\t");
|
||||
_builder.append("(");
|
||||
Type _type_1 = p.getType();
|
||||
String _java_1 = this.toJava(_type_1);
|
||||
String _java_1 = this.toJava(p.getType());
|
||||
_builder.append(_java_1, "\t");
|
||||
_builder.append(" ");
|
||||
String _name_4 = p.getName();
|
||||
_builder.append(_name_4, "\t");
|
||||
String _name_3 = p.getName();
|
||||
_builder.append(_name_3, "\t");
|
||||
_builder.append(") {");
|
||||
_builder.newLineIfNotEmpty();
|
||||
_builder.append("\t");
|
||||
_builder.append("\t");
|
||||
_builder.append("this.");
|
||||
String _name_4 = p.getName();
|
||||
_builder.append(_name_4, "\t\t");
|
||||
_builder.append(" = ");
|
||||
String _name_5 = p.getName();
|
||||
_builder.append(_name_5, "\t\t");
|
||||
_builder.append(" = ");
|
||||
String _name_6 = p.getName();
|
||||
_builder.append(_name_6, "\t\t");
|
||||
_builder.append(";");
|
||||
_builder.newLineIfNotEmpty();
|
||||
_builder.append("\t");
|
||||
|
@ -100,20 +89,18 @@ public class TestLanguageGenerator extends AbstractGenerator {
|
|||
_builder.newLine();
|
||||
_builder.append("\t");
|
||||
_builder.append("public ");
|
||||
Type _type_2 = p.getType();
|
||||
String _java_2 = this.toJava(_type_2);
|
||||
String _java_2 = this.toJava(p.getType());
|
||||
_builder.append(_java_2, "\t");
|
||||
_builder.append(" get");
|
||||
String _name_7 = p.getName();
|
||||
String _firstUpper_1 = StringExtensions.toFirstUpper(_name_7);
|
||||
String _firstUpper_1 = StringExtensions.toFirstUpper(p.getName());
|
||||
_builder.append(_firstUpper_1, "\t");
|
||||
_builder.append("() {");
|
||||
_builder.newLineIfNotEmpty();
|
||||
_builder.append("\t");
|
||||
_builder.append("\t");
|
||||
_builder.append("return this.");
|
||||
String _name_8 = p.getName();
|
||||
_builder.append(_name_8, "\t\t");
|
||||
String _name_6 = p.getName();
|
||||
_builder.append(_name_6, "\t\t");
|
||||
_builder.append(";");
|
||||
_builder.newLineIfNotEmpty();
|
||||
_builder.append("\t");
|
||||
|
@ -128,25 +115,20 @@ public class TestLanguageGenerator extends AbstractGenerator {
|
|||
}
|
||||
|
||||
protected String _toJava(final TypeReference type) {
|
||||
TypeDeclaration _typeRef = type.getTypeRef();
|
||||
String _name = _typeRef.getName();
|
||||
EList<String> _arrayDiemensions = type.getArrayDiemensions();
|
||||
String _name = type.getTypeRef().getName();
|
||||
final Function1<String, String> _function = (String it) -> {
|
||||
return "[]";
|
||||
};
|
||||
List<String> _map = ListExtensions.<String, String>map(_arrayDiemensions, _function);
|
||||
String _join = IterableExtensions.join(_map, "");
|
||||
String _join = IterableExtensions.join(ListExtensions.<String, String>map(type.getArrayDiemensions(), _function), "");
|
||||
return (_name + _join);
|
||||
}
|
||||
|
||||
protected String _toJava(final PrimitiveType type) {
|
||||
String _name = type.getName();
|
||||
EList<String> _arrayDiemensions = type.getArrayDiemensions();
|
||||
final Function1<String, String> _function = (String it) -> {
|
||||
return "[]";
|
||||
};
|
||||
List<String> _map = ListExtensions.<String, String>map(_arrayDiemensions, _function);
|
||||
String _join = IterableExtensions.join(_map, "");
|
||||
String _join = IterableExtensions.join(ListExtensions.<String, String>map(type.getArrayDiemensions(), _function), "");
|
||||
return (_name + _join);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Function;
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.lsp4j.Position;
|
||||
import org.eclipse.lsp4j.jsonrpc.Endpoint;
|
||||
import org.eclipse.lsp4j.jsonrpc.json.JsonRpcMethod;
|
||||
|
@ -23,7 +22,6 @@ import org.eclipse.lsp4j.jsonrpc.services.JsonRequest;
|
|||
import org.eclipse.lsp4j.jsonrpc.services.ServiceEndpoints;
|
||||
import org.eclipse.lsp4j.services.LanguageClient;
|
||||
import org.eclipse.xtend.lib.annotations.ToString;
|
||||
import org.eclipse.xtext.ide.server.Document;
|
||||
import org.eclipse.xtext.ide.server.ILanguageServerAccess;
|
||||
import org.eclipse.xtext.ide.server.ILanguageServerExtension;
|
||||
import org.eclipse.xtext.resource.IResourceDescription;
|
||||
|
@ -78,19 +76,14 @@ public interface TestLangLSPExtension extends ILanguageServerExtension {
|
|||
@Override
|
||||
public CompletableFuture<TestLangLSPExtension.TextOfLineResult> getTextOfLine(final TestLangLSPExtension.TextOfLineParam param) {
|
||||
final Function<ILanguageServerAccess.Context, TestLangLSPExtension.TextOfLineResult> _function = (ILanguageServerAccess.Context ctx) -> {
|
||||
Document _document = ctx.getDocument();
|
||||
Position _position = new Position(param.line, 0);
|
||||
final int start = _document.getOffSet(_position);
|
||||
Document _document_1 = ctx.getDocument();
|
||||
final int start = ctx.getDocument().getOffSet(_position);
|
||||
Position _position_1 = new Position((param.line + 1), 0);
|
||||
int _offSet = _document_1.getOffSet(_position_1);
|
||||
int _offSet = ctx.getDocument().getOffSet(_position_1);
|
||||
final int end = (_offSet - 1);
|
||||
TestLangLSPExtension.TextOfLineResult _textOfLineResult = new TestLangLSPExtension.TextOfLineResult();
|
||||
final Procedure1<TestLangLSPExtension.TextOfLineResult> _function_1 = (TestLangLSPExtension.TextOfLineResult it) -> {
|
||||
Document _document_2 = ctx.getDocument();
|
||||
String _contents = _document_2.getContents();
|
||||
String _substring = _contents.substring(start, end);
|
||||
it.text = _substring;
|
||||
it.text = ctx.getDocument().getContents().substring(start, end);
|
||||
};
|
||||
return ObjectExtensions.<TestLangLSPExtension.TextOfLineResult>operator_doubleArrow(_textOfLineResult, _function_1);
|
||||
};
|
||||
|
@ -102,8 +95,7 @@ public interface TestLangLSPExtension extends ILanguageServerExtension {
|
|||
this.access = access;
|
||||
this.access.addBuildListener(this);
|
||||
LanguageClient _languageClient = access.getLanguageClient();
|
||||
TestLangLSPExtension.CustomClient _serviceObject = ServiceEndpoints.<TestLangLSPExtension.CustomClient>toServiceObject(((Endpoint) _languageClient), TestLangLSPExtension.CustomClient.class);
|
||||
this.client = _serviceObject;
|
||||
this.client = ServiceEndpoints.<TestLangLSPExtension.CustomClient>toServiceObject(((Endpoint) _languageClient), TestLangLSPExtension.CustomClient.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -111,11 +103,9 @@ public interface TestLangLSPExtension extends ILanguageServerExtension {
|
|||
TestLangLSPExtension.BuildNotification _buildNotification = new TestLangLSPExtension.BuildNotification();
|
||||
final Procedure1<TestLangLSPExtension.BuildNotification> _function = (TestLangLSPExtension.BuildNotification it) -> {
|
||||
final Function1<IResourceDescription.Delta, String> _function_1 = (IResourceDescription.Delta it_1) -> {
|
||||
URI _uri = it_1.getUri();
|
||||
return _uri.toString();
|
||||
return it_1.getUri().toString();
|
||||
};
|
||||
List<String> _map = ListExtensions.<IResourceDescription.Delta, String>map(deltas, _function_1);
|
||||
String _join = IterableExtensions.join(_map, ", ");
|
||||
String _join = IterableExtensions.join(ListExtensions.<IResourceDescription.Delta, String>map(deltas, _function_1), ", ");
|
||||
String _plus = ("Built " + _join);
|
||||
it.message = _plus;
|
||||
};
|
||||
|
@ -126,11 +116,8 @@ public interface TestLangLSPExtension extends ILanguageServerExtension {
|
|||
@Override
|
||||
public Map<String, JsonRpcMethod> supportedMethods() {
|
||||
final HashMap<String, JsonRpcMethod> result = CollectionLiterals.<String, JsonRpcMethod>newHashMap();
|
||||
Class<? extends TestLangLSPExtension.Impl> _class = this.getClass();
|
||||
Map<String, JsonRpcMethod> _supportedMethods = ServiceEndpoints.getSupportedMethods(_class);
|
||||
result.putAll(_supportedMethods);
|
||||
Map<String, JsonRpcMethod> _supportedMethods_1 = ServiceEndpoints.getSupportedMethods(TestLangLSPExtension.CustomClient.class);
|
||||
result.putAll(_supportedMethods_1);
|
||||
result.putAll(ServiceEndpoints.getSupportedMethods(this.getClass()));
|
||||
result.putAll(ServiceEndpoints.getSupportedMethods(TestLangLSPExtension.CustomClient.class));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ package org.eclipse.xtext.ide.tests.testlanguage.ide;
|
|||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Module;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.TestLanguageRuntimeModule;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.TestLanguageStandaloneSetup;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.ide.TestLanguageIdeModule;
|
||||
|
@ -24,7 +23,6 @@ public class TestLanguageIdeSetup extends TestLanguageStandaloneSetup {
|
|||
public Injector createInjector() {
|
||||
TestLanguageRuntimeModule _testLanguageRuntimeModule = new TestLanguageRuntimeModule();
|
||||
TestLanguageIdeModule _testLanguageIdeModule = new TestLanguageIdeModule();
|
||||
Module _mixin = Modules2.mixin(_testLanguageRuntimeModule, _testLanguageIdeModule);
|
||||
return Guice.createInjector(_mixin);
|
||||
return Guice.createInjector(Modules2.mixin(_testLanguageRuntimeModule, _testLanguageIdeModule));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ import java.net.InetSocketAddress;
|
|||
import java.nio.channels.Channels;
|
||||
import java.nio.channels.ServerSocketChannel;
|
||||
import java.nio.channels.SocketChannel;
|
||||
import java.util.concurrent.Future;
|
||||
import org.eclipse.lsp4j.jsonrpc.Launcher;
|
||||
import org.eclipse.lsp4j.launch.LSPLauncher;
|
||||
import org.eclipse.lsp4j.services.LanguageClient;
|
||||
|
@ -42,8 +41,7 @@ public class SocketServerLauncher {
|
|||
OutputStream _newOutputStream = Channels.newOutputStream(socketChannel);
|
||||
PrintWriter _printWriter = new PrintWriter(System.out);
|
||||
final Launcher<LanguageClient> launcher = LSPLauncher.createServerLauncher(languageServer, _newInputStream, _newOutputStream, true, _printWriter);
|
||||
Future<?> _startListening = launcher.startListening();
|
||||
_startListening.get();
|
||||
launcher.startListening().get();
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ import java.util.List;
|
|||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.ecore.EClass;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.EReference;
|
||||
import org.eclipse.lsp4j.ParameterInformation;
|
||||
import org.eclipse.lsp4j.SignatureHelp;
|
||||
import org.eclipse.lsp4j.SignatureInformation;
|
||||
|
@ -32,15 +31,12 @@ import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TestLanguagePackage
|
|||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Type;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeReference;
|
||||
import org.eclipse.xtext.naming.QualifiedName;
|
||||
import org.eclipse.xtext.nodemodel.BidiIterable;
|
||||
import org.eclipse.xtext.nodemodel.ICompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
|
||||
import org.eclipse.xtext.resource.EObjectAtOffsetHelper;
|
||||
import org.eclipse.xtext.resource.IEObjectDescription;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.eclipse.xtext.scoping.IScope;
|
||||
import org.eclipse.xtext.scoping.IScopeProvider;
|
||||
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
|
||||
import org.eclipse.xtext.xbase.lib.Conversions;
|
||||
|
@ -70,26 +66,16 @@ public class SignatureHelpServiceImpl implements ISignatureHelpService {
|
|||
* based on the number of parameters first, then the parameter labels lexicographically.
|
||||
*/
|
||||
private final static Comparator<SignatureInformation> SIGNATURE_INFO_ORDERING = ((Comparator<SignatureInformation>) (SignatureInformation left, SignatureInformation right) -> {
|
||||
List<ParameterInformation> _parameters = left.getParameters();
|
||||
int _size = _parameters.size();
|
||||
List<ParameterInformation> _parameters_1 = right.getParameters();
|
||||
int _size_1 = _parameters_1.size();
|
||||
int _size = left.getParameters().size();
|
||||
int _size_1 = right.getParameters().size();
|
||||
int result = (_size - _size_1);
|
||||
if ((result == 0)) {
|
||||
int i = 0;
|
||||
List<ParameterInformation> _parameters_2 = left.getParameters();
|
||||
int size = _parameters_2.size();
|
||||
int size = left.getParameters().size();
|
||||
boolean _while = (i < size);
|
||||
while (_while) {
|
||||
{
|
||||
List<ParameterInformation> _parameters_3 = left.getParameters();
|
||||
ParameterInformation _get = _parameters_3.get(i);
|
||||
String _label = _get.getLabel();
|
||||
List<ParameterInformation> _parameters_4 = right.getParameters();
|
||||
ParameterInformation _get_1 = _parameters_4.get(i);
|
||||
String _label_1 = _get_1.getLabel();
|
||||
int _compareTo = _label.compareTo(_label_1);
|
||||
result = _compareTo;
|
||||
result = left.getParameters().get(i).getLabel().compareTo(right.getParameters().get(i).getLabel());
|
||||
if ((result != 0)) {
|
||||
return result;
|
||||
}
|
||||
|
@ -128,8 +114,7 @@ public class SignatureHelpServiceImpl implements ISignatureHelpService {
|
|||
|
||||
private SignatureHelp getSignatureHelp(final OperationCall call, final String operationName, final int offset) {
|
||||
final List<Integer> separatorIndices = CollectionLiterals.<Integer>newArrayList();
|
||||
ICompositeNode _node = NodeModelUtils.getNode(call);
|
||||
BidiIterable<INode> _children = _node.getChildren();
|
||||
BidiIterable<INode> _children = NodeModelUtils.getNode(call).getChildren();
|
||||
for (final INode node : _children) {
|
||||
{
|
||||
final String text = node.getText();
|
||||
|
@ -141,19 +126,16 @@ public class SignatureHelpServiceImpl implements ISignatureHelpService {
|
|||
} else {
|
||||
boolean _equals = Objects.equal(SignatureHelpServiceImpl.SEPARATOR_CHAR, text);
|
||||
if (_equals) {
|
||||
int _offset = node.getOffset();
|
||||
separatorIndices.add(Integer.valueOf(_offset));
|
||||
separatorIndices.add(Integer.valueOf(node.getOffset()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
EList<Integer> _params = call.getParams();
|
||||
final int paramCount = _params.size();
|
||||
final int paramCount = call.getParams().size();
|
||||
final int separatorCount = separatorIndices.size();
|
||||
if ((((separatorCount + 1) == paramCount) || (separatorCount == paramCount))) {
|
||||
EReference _operation_Params = this._testLanguagePackage.getOperation_Params();
|
||||
final List<INode> paramNodes = NodeModelUtils.findNodesForFeature(call, _operation_Params);
|
||||
final List<INode> paramNodes = NodeModelUtils.findNodesForFeature(call, this._testLanguagePackage.getOperation_Params());
|
||||
for (int i = 0; (i < separatorCount); i++) {
|
||||
{
|
||||
final INode paramNode = paramNodes.get(i);
|
||||
|
@ -186,13 +168,11 @@ public class SignatureHelpServiceImpl implements ISignatureHelpService {
|
|||
_xifexpression = _xifexpression_1;
|
||||
}
|
||||
final int currentParameter = _xifexpression;
|
||||
Iterable<Operation> _visibleOperationsWithName = this.getVisibleOperationsWithName(call, operationName);
|
||||
final Function1<Operation, Boolean> _function = (Operation it) -> {
|
||||
EList<Parameter> _params_1 = it.getParams();
|
||||
int _size = _params_1.size();
|
||||
int _size = it.getParams().size();
|
||||
return Boolean.valueOf((currentParameter <= _size));
|
||||
};
|
||||
final Iterable<Operation> visibleOperations = IterableExtensions.<Operation>filter(_visibleOperationsWithName, _function);
|
||||
final Iterable<Operation> visibleOperations = IterableExtensions.<Operation>filter(this.getVisibleOperationsWithName(call, operationName), _function);
|
||||
int _xifexpression_2 = (int) 0;
|
||||
boolean _contains_1 = separatorIndices.contains(Integer.valueOf(offset));
|
||||
if (_contains_1) {
|
||||
|
@ -206,16 +186,14 @@ public class SignatureHelpServiceImpl implements ISignatureHelpService {
|
|||
Integer _xblockexpression = null;
|
||||
{
|
||||
final Function1<Operation, Integer> _function_1 = (Operation it) -> {
|
||||
EList<Parameter> _params_1 = it.getParams();
|
||||
return Integer.valueOf(_params_1.size());
|
||||
return Integer.valueOf(it.getParams().size());
|
||||
};
|
||||
final Iterable<Integer> paramSize = IterableExtensions.<Operation, Integer>map(visibleOperations, _function_1);
|
||||
Integer _xifexpression_4 = null;
|
||||
if (((!IterableExtensions.<Integer>exists(paramSize, ((Function1<Integer, Boolean>) (Integer it) -> {
|
||||
return Boolean.valueOf(((it).intValue() == 0));
|
||||
}))) && IterableExtensions.<Operation>exists(visibleOperations, ((Function1<Operation, Boolean>) (Operation it) -> {
|
||||
EList<Parameter> _params_1 = it.getParams();
|
||||
boolean _isEmpty = _params_1.isEmpty();
|
||||
boolean _isEmpty = it.getParams().isEmpty();
|
||||
return Boolean.valueOf((!_isEmpty));
|
||||
})))) {
|
||||
_xifexpression_4 = Integer.valueOf(0);
|
||||
|
@ -236,9 +214,7 @@ public class SignatureHelpServiceImpl implements ISignatureHelpService {
|
|||
final Function1<Operation, SignatureInformation> _function_2 = (Operation operation) -> {
|
||||
SignatureInformation _signatureInformation = new SignatureInformation();
|
||||
final Procedure1<SignatureInformation> _function_3 = (SignatureInformation it_1) -> {
|
||||
String _label = this.getLabel(operation);
|
||||
it_1.setLabel(_label);
|
||||
EList<Parameter> _params_1 = operation.getParams();
|
||||
it_1.setLabel(this.getLabel(operation));
|
||||
final Function1<Parameter, ParameterInformation> _function_4 = (Parameter param) -> {
|
||||
ParameterInformation _parameterInformation = new ParameterInformation();
|
||||
final Procedure1<ParameterInformation> _function_5 = (ParameterInformation it_2) -> {
|
||||
|
@ -246,53 +222,39 @@ public class SignatureHelpServiceImpl implements ISignatureHelpService {
|
|||
String _name = param.getName();
|
||||
_builder.append(_name);
|
||||
_builder.append(": ");
|
||||
Type _type = param.getType();
|
||||
String _label_1 = this.getLabel(_type);
|
||||
_builder.append(_label_1);
|
||||
String _label = this.getLabel(param.getType());
|
||||
_builder.append(_label);
|
||||
it_2.setLabel(_builder.toString());
|
||||
};
|
||||
return ObjectExtensions.<ParameterInformation>operator_doubleArrow(_parameterInformation, _function_5);
|
||||
};
|
||||
List<ParameterInformation> _map = ListExtensions.<Parameter, ParameterInformation>map(_params_1, _function_4);
|
||||
it_1.setParameters(_map);
|
||||
it_1.setParameters(ListExtensions.<Parameter, ParameterInformation>map(operation.getParams(), _function_4));
|
||||
};
|
||||
return ObjectExtensions.<SignatureInformation>operator_doubleArrow(_signatureInformation, _function_3);
|
||||
};
|
||||
Iterable<SignatureInformation> _map = IterableExtensions.<Operation, SignatureInformation>map(visibleOperations, _function_2);
|
||||
List<SignatureInformation> _list = IterableExtensions.<SignatureInformation>toList(_map);
|
||||
List<SignatureInformation> _sortWith = IterableExtensions.<SignatureInformation>sortWith(_list, SignatureHelpServiceImpl.SIGNATURE_INFO_ORDERING);
|
||||
it.setSignatures(_sortWith);
|
||||
it.setSignatures(IterableExtensions.<SignatureInformation>sortWith(IterableExtensions.<SignatureInformation>toList(IterableExtensions.<Operation, SignatureInformation>map(visibleOperations, _function_2)), SignatureHelpServiceImpl.SIGNATURE_INFO_ORDERING));
|
||||
};
|
||||
return ObjectExtensions.<SignatureHelp>operator_doubleArrow(_signatureHelp, _function_1);
|
||||
}
|
||||
|
||||
private Iterable<Operation> getVisibleOperationsWithName(final EObject object, final String name) {
|
||||
EReference _operationCall_Operation = this._testLanguagePackage.getOperationCall_Operation();
|
||||
IScope _scope = this.scopeProvider.getScope(object, _operationCall_Operation);
|
||||
Iterable<IEObjectDescription> _allElements = _scope.getAllElements();
|
||||
final Function1<IEObjectDescription, Boolean> _function = (IEObjectDescription it) -> {
|
||||
EClass _eClass = it.getEClass();
|
||||
EClass _operation = this._testLanguagePackage.getOperation();
|
||||
return Boolean.valueOf(Objects.equal(_eClass, _operation));
|
||||
};
|
||||
Iterable<IEObjectDescription> _filter = IterableExtensions.<IEObjectDescription>filter(_allElements, _function);
|
||||
final Function1<IEObjectDescription, Boolean> _function_1 = (IEObjectDescription it) -> {
|
||||
QualifiedName _qualifiedName = it.getQualifiedName();
|
||||
String _lastSegment = _qualifiedName.getLastSegment();
|
||||
String _lastSegment = it.getQualifiedName().getLastSegment();
|
||||
return Boolean.valueOf(Objects.equal(_lastSegment, name));
|
||||
};
|
||||
Iterable<IEObjectDescription> _filter_1 = IterableExtensions.<IEObjectDescription>filter(_filter, _function_1);
|
||||
final Function1<IEObjectDescription, EObject> _function_2 = (IEObjectDescription it) -> {
|
||||
return it.getEObjectOrProxy();
|
||||
};
|
||||
Iterable<EObject> _map = IterableExtensions.<IEObjectDescription, EObject>map(_filter_1, _function_2);
|
||||
return Iterables.<Operation>filter(_map, Operation.class);
|
||||
return Iterables.<Operation>filter(IterableExtensions.<IEObjectDescription, EObject>map(IterableExtensions.<IEObjectDescription>filter(IterableExtensions.<IEObjectDescription>filter(this.scopeProvider.getScope(object, this._testLanguagePackage.getOperationCall_Operation()).getAllElements(), _function), _function_1), _function_2), Operation.class);
|
||||
}
|
||||
|
||||
private String getOperationName(final OperationCall call) {
|
||||
EReference _operationCall_Operation = this._testLanguagePackage.getOperationCall_Operation();
|
||||
List<INode> _findNodesForFeature = NodeModelUtils.findNodesForFeature(call, _operationCall_Operation);
|
||||
INode _head = IterableExtensions.<INode>head(_findNodesForFeature);
|
||||
INode _head = IterableExtensions.<INode>head(NodeModelUtils.findNodesForFeature(call, this._testLanguagePackage.getOperationCall_Operation()));
|
||||
String _text = null;
|
||||
if (_head!=null) {
|
||||
_text=_head.getText();
|
||||
|
@ -302,8 +264,7 @@ public class SignatureHelpServiceImpl implements ISignatureHelpService {
|
|||
|
||||
private String _getLabel(final Operation it) {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
TypeDeclaration _containerOfType = EcoreUtil2.<TypeDeclaration>getContainerOfType(it, TypeDeclaration.class);
|
||||
String _name = _containerOfType.getName();
|
||||
String _name = EcoreUtil2.<TypeDeclaration>getContainerOfType(it, TypeDeclaration.class).getName();
|
||||
_builder.append(_name);
|
||||
_builder.append(".");
|
||||
String _name_1 = it.getName();
|
||||
|
@ -321,8 +282,7 @@ public class SignatureHelpServiceImpl implements ISignatureHelpService {
|
|||
String _name_2 = p.getName();
|
||||
_builder.append(_name_2);
|
||||
_builder.append(": ");
|
||||
Type _type = p.getType();
|
||||
String _label = this.getLabel(_type);
|
||||
String _label = this.getLabel(p.getType());
|
||||
_builder.append(_label);
|
||||
}
|
||||
}
|
||||
|
@ -333,8 +293,7 @@ public class SignatureHelpServiceImpl implements ISignatureHelpService {
|
|||
if (_tripleEquals) {
|
||||
_builder.append("void");
|
||||
} else {
|
||||
Type _returnType_1 = it.getReturnType();
|
||||
String _label_1 = this.getLabel(_returnType_1);
|
||||
String _label_1 = this.getLabel(it.getReturnType());
|
||||
_builder.append(_label_1);
|
||||
}
|
||||
}
|
||||
|
@ -342,8 +301,7 @@ public class SignatureHelpServiceImpl implements ISignatureHelpService {
|
|||
}
|
||||
|
||||
private String _getLabel(final TypeReference it) {
|
||||
TypeDeclaration _typeRef = it.getTypeRef();
|
||||
return _typeRef.getName();
|
||||
return it.getTypeRef().getName();
|
||||
}
|
||||
|
||||
private String _getLabel(final PrimitiveType it) {
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
package org.eclipse.xtext.ide.tests.util;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.eclipse.lsp4j.DocumentHighlight;
|
||||
import org.eclipse.lsp4j.DocumentHighlightKind;
|
||||
|
@ -42,241 +41,61 @@ public class DocumentHighlightComparatorTest extends Assert {
|
|||
|
||||
@Test
|
||||
public void withoutNull() {
|
||||
Range _newRange = this.newRange(2, 2, 2, 2);
|
||||
DocumentHighlight _newHighlight = this.newHighlight(DocumentHighlightKind.Text, _newRange);
|
||||
Range _newRange_1 = this.newRange(1, 1, 1, 1);
|
||||
DocumentHighlight _newHighlight_1 = this.newHighlight(DocumentHighlightKind.Text, _newRange_1);
|
||||
Range _newRange_2 = this.newRange(2, 2, 2, 2);
|
||||
DocumentHighlight _newHighlight_2 = this.newHighlight(DocumentHighlightKind.Write, _newRange_2);
|
||||
Range _newRange_3 = this.newRange(1, 1, 1, 1);
|
||||
DocumentHighlight _newHighlight_3 = this.newHighlight(DocumentHighlightKind.Write, _newRange_3);
|
||||
Range _newRange_4 = this.newRange(2, 2, 2, 2);
|
||||
DocumentHighlight _newHighlight_4 = this.newHighlight(DocumentHighlightKind.Read, _newRange_4);
|
||||
Range _newRange_5 = this.newRange(1, 1, 1, 1);
|
||||
DocumentHighlight _newHighlight_5 = this.newHighlight(DocumentHighlightKind.Read, _newRange_5);
|
||||
ArrayList<DocumentHighlight> _newArrayList = CollectionLiterals.<DocumentHighlight>newArrayList(_newHighlight, _newHighlight_1, _newHighlight_2, _newHighlight_3, _newHighlight_4, _newHighlight_5);
|
||||
final List<? extends DocumentHighlight> input = this.sort(_newArrayList);
|
||||
DocumentHighlight _get = input.get(0);
|
||||
Range _range = _get.getRange();
|
||||
Position _start = _range.getStart();
|
||||
int _line = _start.getLine();
|
||||
Assert.assertEquals(1, _line);
|
||||
DocumentHighlight _get_1 = input.get(0);
|
||||
Range _range_1 = _get_1.getRange();
|
||||
Position _start_1 = _range_1.getStart();
|
||||
int _character = _start_1.getCharacter();
|
||||
Assert.assertEquals(1, _character);
|
||||
DocumentHighlight _get_2 = input.get(0);
|
||||
Range _range_2 = _get_2.getRange();
|
||||
Position _end = _range_2.getEnd();
|
||||
int _line_1 = _end.getLine();
|
||||
Assert.assertEquals(1, _line_1);
|
||||
DocumentHighlight _get_3 = input.get(0);
|
||||
Range _range_3 = _get_3.getRange();
|
||||
Position _end_1 = _range_3.getEnd();
|
||||
int _character_1 = _end_1.getCharacter();
|
||||
Assert.assertEquals(1, _character_1);
|
||||
DocumentHighlight _get_4 = input.get(0);
|
||||
DocumentHighlightKind _kind = _get_4.getKind();
|
||||
Assert.assertEquals(DocumentHighlightKind.Text, _kind);
|
||||
DocumentHighlight _get_5 = input.get(1);
|
||||
Range _range_4 = _get_5.getRange();
|
||||
Position _start_2 = _range_4.getStart();
|
||||
int _line_2 = _start_2.getLine();
|
||||
Assert.assertEquals(1, _line_2);
|
||||
DocumentHighlight _get_6 = input.get(1);
|
||||
Range _range_5 = _get_6.getRange();
|
||||
Position _start_3 = _range_5.getStart();
|
||||
int _character_2 = _start_3.getCharacter();
|
||||
Assert.assertEquals(1, _character_2);
|
||||
DocumentHighlight _get_7 = input.get(1);
|
||||
Range _range_6 = _get_7.getRange();
|
||||
Position _end_2 = _range_6.getEnd();
|
||||
int _line_3 = _end_2.getLine();
|
||||
Assert.assertEquals(1, _line_3);
|
||||
DocumentHighlight _get_8 = input.get(1);
|
||||
Range _range_7 = _get_8.getRange();
|
||||
Position _end_3 = _range_7.getEnd();
|
||||
int _character_3 = _end_3.getCharacter();
|
||||
Assert.assertEquals(1, _character_3);
|
||||
DocumentHighlight _get_9 = input.get(1);
|
||||
DocumentHighlightKind _kind_1 = _get_9.getKind();
|
||||
Assert.assertEquals(DocumentHighlightKind.Read, _kind_1);
|
||||
DocumentHighlight _get_10 = input.get(2);
|
||||
Range _range_8 = _get_10.getRange();
|
||||
Position _start_4 = _range_8.getStart();
|
||||
int _line_4 = _start_4.getLine();
|
||||
Assert.assertEquals(1, _line_4);
|
||||
DocumentHighlight _get_11 = input.get(2);
|
||||
Range _range_9 = _get_11.getRange();
|
||||
Position _start_5 = _range_9.getStart();
|
||||
int _character_4 = _start_5.getCharacter();
|
||||
Assert.assertEquals(1, _character_4);
|
||||
DocumentHighlight _get_12 = input.get(2);
|
||||
Range _range_10 = _get_12.getRange();
|
||||
Position _end_4 = _range_10.getEnd();
|
||||
int _line_5 = _end_4.getLine();
|
||||
Assert.assertEquals(1, _line_5);
|
||||
DocumentHighlight _get_13 = input.get(2);
|
||||
Range _range_11 = _get_13.getRange();
|
||||
Position _end_5 = _range_11.getEnd();
|
||||
int _character_5 = _end_5.getCharacter();
|
||||
Assert.assertEquals(1, _character_5);
|
||||
DocumentHighlight _get_14 = input.get(2);
|
||||
DocumentHighlightKind _kind_2 = _get_14.getKind();
|
||||
Assert.assertEquals(DocumentHighlightKind.Write, _kind_2);
|
||||
DocumentHighlight _get_15 = input.get(3);
|
||||
Range _range_12 = _get_15.getRange();
|
||||
Position _start_6 = _range_12.getStart();
|
||||
int _line_6 = _start_6.getLine();
|
||||
Assert.assertEquals(2, _line_6);
|
||||
DocumentHighlight _get_16 = input.get(3);
|
||||
Range _range_13 = _get_16.getRange();
|
||||
Position _start_7 = _range_13.getStart();
|
||||
int _character_6 = _start_7.getCharacter();
|
||||
Assert.assertEquals(2, _character_6);
|
||||
DocumentHighlight _get_17 = input.get(3);
|
||||
Range _range_14 = _get_17.getRange();
|
||||
Position _end_6 = _range_14.getEnd();
|
||||
int _line_7 = _end_6.getLine();
|
||||
Assert.assertEquals(2, _line_7);
|
||||
DocumentHighlight _get_18 = input.get(3);
|
||||
Range _range_15 = _get_18.getRange();
|
||||
Position _end_7 = _range_15.getEnd();
|
||||
int _character_7 = _end_7.getCharacter();
|
||||
Assert.assertEquals(2, _character_7);
|
||||
DocumentHighlight _get_19 = input.get(3);
|
||||
DocumentHighlightKind _kind_3 = _get_19.getKind();
|
||||
Assert.assertEquals(DocumentHighlightKind.Text, _kind_3);
|
||||
DocumentHighlight _get_20 = input.get(4);
|
||||
Range _range_16 = _get_20.getRange();
|
||||
Position _start_8 = _range_16.getStart();
|
||||
int _line_8 = _start_8.getLine();
|
||||
Assert.assertEquals(2, _line_8);
|
||||
DocumentHighlight _get_21 = input.get(4);
|
||||
Range _range_17 = _get_21.getRange();
|
||||
Position _start_9 = _range_17.getStart();
|
||||
int _character_8 = _start_9.getCharacter();
|
||||
Assert.assertEquals(2, _character_8);
|
||||
DocumentHighlight _get_22 = input.get(4);
|
||||
Range _range_18 = _get_22.getRange();
|
||||
Position _end_8 = _range_18.getEnd();
|
||||
int _line_9 = _end_8.getLine();
|
||||
Assert.assertEquals(2, _line_9);
|
||||
DocumentHighlight _get_23 = input.get(4);
|
||||
Range _range_19 = _get_23.getRange();
|
||||
Position _end_9 = _range_19.getEnd();
|
||||
int _character_9 = _end_9.getCharacter();
|
||||
Assert.assertEquals(2, _character_9);
|
||||
DocumentHighlight _get_24 = input.get(4);
|
||||
DocumentHighlightKind _kind_4 = _get_24.getKind();
|
||||
Assert.assertEquals(DocumentHighlightKind.Read, _kind_4);
|
||||
DocumentHighlight _get_25 = input.get(5);
|
||||
Range _range_20 = _get_25.getRange();
|
||||
Position _start_10 = _range_20.getStart();
|
||||
int _line_10 = _start_10.getLine();
|
||||
Assert.assertEquals(2, _line_10);
|
||||
DocumentHighlight _get_26 = input.get(5);
|
||||
Range _range_21 = _get_26.getRange();
|
||||
Position _start_11 = _range_21.getStart();
|
||||
int _character_10 = _start_11.getCharacter();
|
||||
Assert.assertEquals(2, _character_10);
|
||||
DocumentHighlight _get_27 = input.get(5);
|
||||
Range _range_22 = _get_27.getRange();
|
||||
Position _end_10 = _range_22.getEnd();
|
||||
int _line_11 = _end_10.getLine();
|
||||
Assert.assertEquals(2, _line_11);
|
||||
DocumentHighlight _get_28 = input.get(5);
|
||||
Range _range_23 = _get_28.getRange();
|
||||
Position _end_11 = _range_23.getEnd();
|
||||
int _character_11 = _end_11.getCharacter();
|
||||
Assert.assertEquals(2, _character_11);
|
||||
DocumentHighlight _get_29 = input.get(5);
|
||||
DocumentHighlightKind _kind_5 = _get_29.getKind();
|
||||
Assert.assertEquals(DocumentHighlightKind.Write, _kind_5);
|
||||
final List<? extends DocumentHighlight> input = this.sort(CollectionLiterals.<DocumentHighlight>newArrayList(this.newHighlight(DocumentHighlightKind.Text, this.newRange(2, 2, 2, 2)), this.newHighlight(DocumentHighlightKind.Text, this.newRange(1, 1, 1, 1)),
|
||||
this.newHighlight(DocumentHighlightKind.Write, this.newRange(2, 2, 2, 2)), this.newHighlight(DocumentHighlightKind.Write, this.newRange(1, 1, 1, 1)),
|
||||
this.newHighlight(DocumentHighlightKind.Read, this.newRange(2, 2, 2, 2)), this.newHighlight(DocumentHighlightKind.Read, this.newRange(1, 1, 1, 1))));
|
||||
Assert.assertEquals(1, input.get(0).getRange().getStart().getLine());
|
||||
Assert.assertEquals(1, input.get(0).getRange().getStart().getCharacter());
|
||||
Assert.assertEquals(1, input.get(0).getRange().getEnd().getLine());
|
||||
Assert.assertEquals(1, input.get(0).getRange().getEnd().getCharacter());
|
||||
Assert.assertEquals(DocumentHighlightKind.Text, input.get(0).getKind());
|
||||
Assert.assertEquals(1, input.get(1).getRange().getStart().getLine());
|
||||
Assert.assertEquals(1, input.get(1).getRange().getStart().getCharacter());
|
||||
Assert.assertEquals(1, input.get(1).getRange().getEnd().getLine());
|
||||
Assert.assertEquals(1, input.get(1).getRange().getEnd().getCharacter());
|
||||
Assert.assertEquals(DocumentHighlightKind.Read, input.get(1).getKind());
|
||||
Assert.assertEquals(1, input.get(2).getRange().getStart().getLine());
|
||||
Assert.assertEquals(1, input.get(2).getRange().getStart().getCharacter());
|
||||
Assert.assertEquals(1, input.get(2).getRange().getEnd().getLine());
|
||||
Assert.assertEquals(1, input.get(2).getRange().getEnd().getCharacter());
|
||||
Assert.assertEquals(DocumentHighlightKind.Write, input.get(2).getKind());
|
||||
Assert.assertEquals(2, input.get(3).getRange().getStart().getLine());
|
||||
Assert.assertEquals(2, input.get(3).getRange().getStart().getCharacter());
|
||||
Assert.assertEquals(2, input.get(3).getRange().getEnd().getLine());
|
||||
Assert.assertEquals(2, input.get(3).getRange().getEnd().getCharacter());
|
||||
Assert.assertEquals(DocumentHighlightKind.Text, input.get(3).getKind());
|
||||
Assert.assertEquals(2, input.get(4).getRange().getStart().getLine());
|
||||
Assert.assertEquals(2, input.get(4).getRange().getStart().getCharacter());
|
||||
Assert.assertEquals(2, input.get(4).getRange().getEnd().getLine());
|
||||
Assert.assertEquals(2, input.get(4).getRange().getEnd().getCharacter());
|
||||
Assert.assertEquals(DocumentHighlightKind.Read, input.get(4).getKind());
|
||||
Assert.assertEquals(2, input.get(5).getRange().getStart().getLine());
|
||||
Assert.assertEquals(2, input.get(5).getRange().getStart().getCharacter());
|
||||
Assert.assertEquals(2, input.get(5).getRange().getEnd().getLine());
|
||||
Assert.assertEquals(2, input.get(5).getRange().getEnd().getCharacter());
|
||||
Assert.assertEquals(DocumentHighlightKind.Write, input.get(5).getKind());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withNull() {
|
||||
Range _newRange = this.newRange(1, 1, 1, 1);
|
||||
DocumentHighlight _newHighlight = this.newHighlight(DocumentHighlightKind.Text, _newRange);
|
||||
Range _newRange_1 = this.newRange(1, 1, 1, 1);
|
||||
DocumentHighlight _newHighlight_1 = this.newHighlight(DocumentHighlightKind.Write, _newRange_1);
|
||||
Range _newRange_2 = this.newRange(1, 1, 1, 1);
|
||||
DocumentHighlight _newHighlight_2 = this.newHighlight(DocumentHighlightKind.Read, _newRange_2);
|
||||
ArrayList<DocumentHighlight> _newArrayList = CollectionLiterals.<DocumentHighlight>newArrayList(null, _newHighlight, _newHighlight_1, _newHighlight_2);
|
||||
final List<? extends DocumentHighlight> input = this.sort(_newArrayList);
|
||||
DocumentHighlight _get = input.get(0);
|
||||
Range _range = _get.getRange();
|
||||
Position _start = _range.getStart();
|
||||
int _line = _start.getLine();
|
||||
Assert.assertEquals(1, _line);
|
||||
DocumentHighlight _get_1 = input.get(0);
|
||||
Range _range_1 = _get_1.getRange();
|
||||
Position _start_1 = _range_1.getStart();
|
||||
int _character = _start_1.getCharacter();
|
||||
Assert.assertEquals(1, _character);
|
||||
DocumentHighlight _get_2 = input.get(0);
|
||||
Range _range_2 = _get_2.getRange();
|
||||
Position _end = _range_2.getEnd();
|
||||
int _line_1 = _end.getLine();
|
||||
Assert.assertEquals(1, _line_1);
|
||||
DocumentHighlight _get_3 = input.get(0);
|
||||
Range _range_3 = _get_3.getRange();
|
||||
Position _end_1 = _range_3.getEnd();
|
||||
int _character_1 = _end_1.getCharacter();
|
||||
Assert.assertEquals(1, _character_1);
|
||||
DocumentHighlight _get_4 = input.get(0);
|
||||
DocumentHighlightKind _kind = _get_4.getKind();
|
||||
Assert.assertEquals(DocumentHighlightKind.Text, _kind);
|
||||
DocumentHighlight _get_5 = input.get(1);
|
||||
Range _range_4 = _get_5.getRange();
|
||||
Position _start_2 = _range_4.getStart();
|
||||
int _line_2 = _start_2.getLine();
|
||||
Assert.assertEquals(1, _line_2);
|
||||
DocumentHighlight _get_6 = input.get(1);
|
||||
Range _range_5 = _get_6.getRange();
|
||||
Position _start_3 = _range_5.getStart();
|
||||
int _character_2 = _start_3.getCharacter();
|
||||
Assert.assertEquals(1, _character_2);
|
||||
DocumentHighlight _get_7 = input.get(1);
|
||||
Range _range_6 = _get_7.getRange();
|
||||
Position _end_2 = _range_6.getEnd();
|
||||
int _line_3 = _end_2.getLine();
|
||||
Assert.assertEquals(1, _line_3);
|
||||
DocumentHighlight _get_8 = input.get(1);
|
||||
Range _range_7 = _get_8.getRange();
|
||||
Position _end_3 = _range_7.getEnd();
|
||||
int _character_3 = _end_3.getCharacter();
|
||||
Assert.assertEquals(1, _character_3);
|
||||
DocumentHighlight _get_9 = input.get(1);
|
||||
DocumentHighlightKind _kind_1 = _get_9.getKind();
|
||||
Assert.assertEquals(DocumentHighlightKind.Read, _kind_1);
|
||||
DocumentHighlight _get_10 = input.get(2);
|
||||
Range _range_8 = _get_10.getRange();
|
||||
Position _start_4 = _range_8.getStart();
|
||||
int _line_4 = _start_4.getLine();
|
||||
Assert.assertEquals(1, _line_4);
|
||||
DocumentHighlight _get_11 = input.get(2);
|
||||
Range _range_9 = _get_11.getRange();
|
||||
Position _start_5 = _range_9.getStart();
|
||||
int _character_4 = _start_5.getCharacter();
|
||||
Assert.assertEquals(1, _character_4);
|
||||
DocumentHighlight _get_12 = input.get(2);
|
||||
Range _range_10 = _get_12.getRange();
|
||||
Position _end_4 = _range_10.getEnd();
|
||||
int _line_5 = _end_4.getLine();
|
||||
Assert.assertEquals(1, _line_5);
|
||||
DocumentHighlight _get_13 = input.get(2);
|
||||
Range _range_11 = _get_13.getRange();
|
||||
Position _end_5 = _range_11.getEnd();
|
||||
int _character_5 = _end_5.getCharacter();
|
||||
Assert.assertEquals(1, _character_5);
|
||||
DocumentHighlight _get_14 = input.get(2);
|
||||
DocumentHighlightKind _kind_2 = _get_14.getKind();
|
||||
Assert.assertEquals(DocumentHighlightKind.Write, _kind_2);
|
||||
DocumentHighlight _last = IterableExtensions.last(input);
|
||||
Assert.assertNull(_last);
|
||||
final List<? extends DocumentHighlight> input = this.sort(CollectionLiterals.<DocumentHighlight>newArrayList(null, this.newHighlight(DocumentHighlightKind.Text, this.newRange(1, 1, 1, 1)),
|
||||
this.newHighlight(DocumentHighlightKind.Write, this.newRange(1, 1, 1, 1)), this.newHighlight(DocumentHighlightKind.Read, this.newRange(1, 1, 1, 1))));
|
||||
Assert.assertEquals(1, input.get(0).getRange().getStart().getLine());
|
||||
Assert.assertEquals(1, input.get(0).getRange().getStart().getCharacter());
|
||||
Assert.assertEquals(1, input.get(0).getRange().getEnd().getLine());
|
||||
Assert.assertEquals(1, input.get(0).getRange().getEnd().getCharacter());
|
||||
Assert.assertEquals(DocumentHighlightKind.Text, input.get(0).getKind());
|
||||
Assert.assertEquals(1, input.get(1).getRange().getStart().getLine());
|
||||
Assert.assertEquals(1, input.get(1).getRange().getStart().getCharacter());
|
||||
Assert.assertEquals(1, input.get(1).getRange().getEnd().getLine());
|
||||
Assert.assertEquals(1, input.get(1).getRange().getEnd().getCharacter());
|
||||
Assert.assertEquals(DocumentHighlightKind.Read, input.get(1).getKind());
|
||||
Assert.assertEquals(1, input.get(2).getRange().getStart().getLine());
|
||||
Assert.assertEquals(1, input.get(2).getRange().getStart().getCharacter());
|
||||
Assert.assertEquals(1, input.get(2).getRange().getEnd().getLine());
|
||||
Assert.assertEquals(1, input.get(2).getRange().getEnd().getCharacter());
|
||||
Assert.assertEquals(DocumentHighlightKind.Write, input.get(2).getKind());
|
||||
Assert.assertNull(IterableExtensions.last(input));
|
||||
}
|
||||
|
||||
private DocumentHighlight newHighlight(final DocumentHighlightKind kind, final Range range) {
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
*/
|
||||
package org.eclipse.xtext.ide.tests.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.inject.Inject;
|
||||
import org.eclipse.lsp4j.Position;
|
||||
|
@ -39,54 +38,27 @@ public class PositionComparatorTest extends Assert {
|
|||
Position _position_1 = new Position(2, 1);
|
||||
Position _position_2 = new Position(1, 2);
|
||||
Position _position_3 = new Position(1, 1);
|
||||
ArrayList<Position> _newArrayList = CollectionLiterals.<Position>newArrayList(_position, _position_1, _position_2, _position_3);
|
||||
final List<? extends Position> input = this.sort(_newArrayList);
|
||||
Position _get = input.get(0);
|
||||
int _line = _get.getLine();
|
||||
Assert.assertEquals(1, _line);
|
||||
Position _get_1 = input.get(0);
|
||||
int _character = _get_1.getCharacter();
|
||||
Assert.assertEquals(1, _character);
|
||||
Position _get_2 = input.get(1);
|
||||
int _line_1 = _get_2.getLine();
|
||||
Assert.assertEquals(1, _line_1);
|
||||
Position _get_3 = input.get(1);
|
||||
int _character_1 = _get_3.getCharacter();
|
||||
Assert.assertEquals(2, _character_1);
|
||||
Position _get_4 = input.get(2);
|
||||
int _line_2 = _get_4.getLine();
|
||||
Assert.assertEquals(2, _line_2);
|
||||
Position _get_5 = input.get(2);
|
||||
int _character_2 = _get_5.getCharacter();
|
||||
Assert.assertEquals(1, _character_2);
|
||||
Position _get_6 = input.get(3);
|
||||
int _line_3 = _get_6.getLine();
|
||||
Assert.assertEquals(2, _line_3);
|
||||
Position _get_7 = input.get(3);
|
||||
int _character_3 = _get_7.getCharacter();
|
||||
Assert.assertEquals(2, _character_3);
|
||||
final List<? extends Position> input = this.sort(CollectionLiterals.<Position>newArrayList(_position, _position_1, _position_2, _position_3));
|
||||
Assert.assertEquals(1, input.get(0).getLine());
|
||||
Assert.assertEquals(1, input.get(0).getCharacter());
|
||||
Assert.assertEquals(1, input.get(1).getLine());
|
||||
Assert.assertEquals(2, input.get(1).getCharacter());
|
||||
Assert.assertEquals(2, input.get(2).getLine());
|
||||
Assert.assertEquals(1, input.get(2).getCharacter());
|
||||
Assert.assertEquals(2, input.get(3).getLine());
|
||||
Assert.assertEquals(2, input.get(3).getCharacter());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withNull() {
|
||||
Position _position = new Position(2, 2);
|
||||
Position _position_1 = new Position(1, 1);
|
||||
ArrayList<Position> _newArrayList = CollectionLiterals.<Position>newArrayList(_position, null, _position_1);
|
||||
final List<? extends Position> input = this.sort(_newArrayList);
|
||||
Position _get = input.get(0);
|
||||
int _line = _get.getLine();
|
||||
Assert.assertEquals(1, _line);
|
||||
Position _get_1 = input.get(0);
|
||||
int _character = _get_1.getCharacter();
|
||||
Assert.assertEquals(1, _character);
|
||||
Position _get_2 = input.get(1);
|
||||
int _line_1 = _get_2.getLine();
|
||||
Assert.assertEquals(2, _line_1);
|
||||
Position _get_3 = input.get(1);
|
||||
int _character_1 = _get_3.getCharacter();
|
||||
Assert.assertEquals(2, _character_1);
|
||||
Position _last = IterableExtensions.last(input);
|
||||
Assert.assertNull(_last);
|
||||
final List<? extends Position> input = this.sort(CollectionLiterals.<Position>newArrayList(_position, null, _position_1));
|
||||
Assert.assertEquals(1, input.get(0).getLine());
|
||||
Assert.assertEquals(1, input.get(0).getCharacter());
|
||||
Assert.assertEquals(2, input.get(1).getLine());
|
||||
Assert.assertEquals(2, input.get(1).getCharacter());
|
||||
Assert.assertNull(IterableExtensions.last(input));
|
||||
}
|
||||
|
||||
private List<? extends Position> sort(final List<? extends Position> toSort) {
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
package org.eclipse.xtext.ide.tests.util;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.eclipse.lsp4j.Position;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
|
@ -36,135 +35,42 @@ public class RangeComparatorTest extends Assert {
|
|||
|
||||
@Test
|
||||
public void withoutNull() {
|
||||
Range _newRange = this.newRange(1, 2, 1, 2);
|
||||
Range _newRange_1 = this.newRange(1, 1, 2, 1);
|
||||
Range _newRange_2 = this.newRange(1, 1, 1, 2);
|
||||
Range _newRange_3 = this.newRange(1, 1, 1, 1);
|
||||
Range _newRange_4 = this.newRange(2, 2, 2, 3);
|
||||
ArrayList<Range> _newArrayList = CollectionLiterals.<Range>newArrayList(_newRange, _newRange_1, _newRange_2, _newRange_3, _newRange_4);
|
||||
final List<? extends Range> input = this.sort(_newArrayList);
|
||||
Range _get = input.get(0);
|
||||
Position _start = _get.getStart();
|
||||
int _line = _start.getLine();
|
||||
Assert.assertEquals(1, _line);
|
||||
Range _get_1 = input.get(0);
|
||||
Position _start_1 = _get_1.getStart();
|
||||
int _character = _start_1.getCharacter();
|
||||
Assert.assertEquals(1, _character);
|
||||
Range _get_2 = input.get(0);
|
||||
Position _end = _get_2.getEnd();
|
||||
int _line_1 = _end.getLine();
|
||||
Assert.assertEquals(1, _line_1);
|
||||
Range _get_3 = input.get(0);
|
||||
Position _end_1 = _get_3.getEnd();
|
||||
int _character_1 = _end_1.getCharacter();
|
||||
Assert.assertEquals(1, _character_1);
|
||||
Range _get_4 = input.get(1);
|
||||
Position _start_2 = _get_4.getStart();
|
||||
int _line_2 = _start_2.getLine();
|
||||
Assert.assertEquals(1, _line_2);
|
||||
Range _get_5 = input.get(1);
|
||||
Position _start_3 = _get_5.getStart();
|
||||
int _character_2 = _start_3.getCharacter();
|
||||
Assert.assertEquals(1, _character_2);
|
||||
Range _get_6 = input.get(1);
|
||||
Position _end_2 = _get_6.getEnd();
|
||||
int _line_3 = _end_2.getLine();
|
||||
Assert.assertEquals(1, _line_3);
|
||||
Range _get_7 = input.get(1);
|
||||
Position _end_3 = _get_7.getEnd();
|
||||
int _character_3 = _end_3.getCharacter();
|
||||
Assert.assertEquals(2, _character_3);
|
||||
Range _get_8 = input.get(2);
|
||||
Position _start_4 = _get_8.getStart();
|
||||
int _line_4 = _start_4.getLine();
|
||||
Assert.assertEquals(1, _line_4);
|
||||
Range _get_9 = input.get(2);
|
||||
Position _start_5 = _get_9.getStart();
|
||||
int _character_4 = _start_5.getCharacter();
|
||||
Assert.assertEquals(1, _character_4);
|
||||
Range _get_10 = input.get(2);
|
||||
Position _end_4 = _get_10.getEnd();
|
||||
int _line_5 = _end_4.getLine();
|
||||
Assert.assertEquals(2, _line_5);
|
||||
Range _get_11 = input.get(2);
|
||||
Position _end_5 = _get_11.getEnd();
|
||||
int _character_5 = _end_5.getCharacter();
|
||||
Assert.assertEquals(1, _character_5);
|
||||
Range _get_12 = input.get(3);
|
||||
Position _start_6 = _get_12.getStart();
|
||||
int _line_6 = _start_6.getLine();
|
||||
Assert.assertEquals(1, _line_6);
|
||||
Range _get_13 = input.get(3);
|
||||
Position _start_7 = _get_13.getStart();
|
||||
int _character_6 = _start_7.getCharacter();
|
||||
Assert.assertEquals(2, _character_6);
|
||||
Range _get_14 = input.get(3);
|
||||
Position _end_6 = _get_14.getEnd();
|
||||
int _line_7 = _end_6.getLine();
|
||||
Assert.assertEquals(1, _line_7);
|
||||
Range _get_15 = input.get(3);
|
||||
Position _end_7 = _get_15.getEnd();
|
||||
int _character_7 = _end_7.getCharacter();
|
||||
Assert.assertEquals(2, _character_7);
|
||||
Range _get_16 = input.get(4);
|
||||
Position _start_8 = _get_16.getStart();
|
||||
int _line_8 = _start_8.getLine();
|
||||
Assert.assertEquals(2, _line_8);
|
||||
Range _get_17 = input.get(4);
|
||||
Position _start_9 = _get_17.getStart();
|
||||
int _character_8 = _start_9.getCharacter();
|
||||
Assert.assertEquals(2, _character_8);
|
||||
Range _get_18 = input.get(4);
|
||||
Position _end_8 = _get_18.getEnd();
|
||||
int _line_9 = _end_8.getLine();
|
||||
Assert.assertEquals(2, _line_9);
|
||||
Range _get_19 = input.get(4);
|
||||
Position _end_9 = _get_19.getEnd();
|
||||
int _character_9 = _end_9.getCharacter();
|
||||
Assert.assertEquals(3, _character_9);
|
||||
final List<? extends Range> input = this.sort(CollectionLiterals.<Range>newArrayList(this.newRange(1, 2, 1, 2), this.newRange(1, 1, 2, 1), this.newRange(1, 1, 1, 2), this.newRange(1, 1, 1, 1),
|
||||
this.newRange(2, 2, 2, 3)));
|
||||
Assert.assertEquals(1, input.get(0).getStart().getLine());
|
||||
Assert.assertEquals(1, input.get(0).getStart().getCharacter());
|
||||
Assert.assertEquals(1, input.get(0).getEnd().getLine());
|
||||
Assert.assertEquals(1, input.get(0).getEnd().getCharacter());
|
||||
Assert.assertEquals(1, input.get(1).getStart().getLine());
|
||||
Assert.assertEquals(1, input.get(1).getStart().getCharacter());
|
||||
Assert.assertEquals(1, input.get(1).getEnd().getLine());
|
||||
Assert.assertEquals(2, input.get(1).getEnd().getCharacter());
|
||||
Assert.assertEquals(1, input.get(2).getStart().getLine());
|
||||
Assert.assertEquals(1, input.get(2).getStart().getCharacter());
|
||||
Assert.assertEquals(2, input.get(2).getEnd().getLine());
|
||||
Assert.assertEquals(1, input.get(2).getEnd().getCharacter());
|
||||
Assert.assertEquals(1, input.get(3).getStart().getLine());
|
||||
Assert.assertEquals(2, input.get(3).getStart().getCharacter());
|
||||
Assert.assertEquals(1, input.get(3).getEnd().getLine());
|
||||
Assert.assertEquals(2, input.get(3).getEnd().getCharacter());
|
||||
Assert.assertEquals(2, input.get(4).getStart().getLine());
|
||||
Assert.assertEquals(2, input.get(4).getStart().getCharacter());
|
||||
Assert.assertEquals(2, input.get(4).getEnd().getLine());
|
||||
Assert.assertEquals(3, input.get(4).getEnd().getCharacter());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withNull() {
|
||||
Range _newRange = this.newRange(2, 2, 2, 3);
|
||||
Range _newRange_1 = this.newRange(1, 1, 1, 1);
|
||||
ArrayList<Range> _newArrayList = CollectionLiterals.<Range>newArrayList(_newRange, null, _newRange_1);
|
||||
final List<? extends Range> input = this.sort(_newArrayList);
|
||||
Range _get = input.get(0);
|
||||
Position _start = _get.getStart();
|
||||
int _line = _start.getLine();
|
||||
Assert.assertEquals(1, _line);
|
||||
Range _get_1 = input.get(0);
|
||||
Position _start_1 = _get_1.getStart();
|
||||
int _character = _start_1.getCharacter();
|
||||
Assert.assertEquals(1, _character);
|
||||
Range _get_2 = input.get(0);
|
||||
Position _end = _get_2.getEnd();
|
||||
int _line_1 = _end.getLine();
|
||||
Assert.assertEquals(1, _line_1);
|
||||
Range _get_3 = input.get(0);
|
||||
Position _end_1 = _get_3.getEnd();
|
||||
int _character_1 = _end_1.getCharacter();
|
||||
Assert.assertEquals(1, _character_1);
|
||||
Range _get_4 = input.get(1);
|
||||
Position _start_2 = _get_4.getStart();
|
||||
int _line_2 = _start_2.getLine();
|
||||
Assert.assertEquals(2, _line_2);
|
||||
Range _get_5 = input.get(1);
|
||||
Position _start_3 = _get_5.getStart();
|
||||
int _character_2 = _start_3.getCharacter();
|
||||
Assert.assertEquals(2, _character_2);
|
||||
Range _get_6 = input.get(1);
|
||||
Position _end_2 = _get_6.getEnd();
|
||||
int _line_3 = _end_2.getLine();
|
||||
Assert.assertEquals(2, _line_3);
|
||||
Range _get_7 = input.get(1);
|
||||
Position _end_3 = _get_7.getEnd();
|
||||
int _character_3 = _end_3.getCharacter();
|
||||
Assert.assertEquals(3, _character_3);
|
||||
Range _last = IterableExtensions.last(input);
|
||||
Assert.assertNull(_last);
|
||||
final List<? extends Range> input = this.sort(CollectionLiterals.<Range>newArrayList(this.newRange(2, 2, 2, 3), null, this.newRange(1, 1, 1, 1)));
|
||||
Assert.assertEquals(1, input.get(0).getStart().getLine());
|
||||
Assert.assertEquals(1, input.get(0).getStart().getCharacter());
|
||||
Assert.assertEquals(1, input.get(0).getEnd().getLine());
|
||||
Assert.assertEquals(1, input.get(0).getEnd().getCharacter());
|
||||
Assert.assertEquals(2, input.get(1).getStart().getLine());
|
||||
Assert.assertEquals(2, input.get(1).getStart().getCharacter());
|
||||
Assert.assertEquals(2, input.get(1).getEnd().getLine());
|
||||
Assert.assertEquals(3, input.get(1).getEnd().getCharacter());
|
||||
Assert.assertNull(IterableExtensions.last(input));
|
||||
}
|
||||
|
||||
private Range newRange(final int startLine, final int startChar, final int endLine, final int endChar) {
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
package org.eclipse.xtext.ide;
|
||||
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.binder.AnnotatedBindingBuilder;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import org.eclipse.xtext.ide.ExecutorServiceProvider;
|
||||
import org.eclipse.xtext.service.AbstractGenericModule;
|
||||
|
@ -19,7 +18,6 @@ import org.eclipse.xtext.service.AbstractGenericModule;
|
|||
@SuppressWarnings("all")
|
||||
public class DefaultIdeModule extends AbstractGenericModule {
|
||||
public void configureExecutorService(final Binder binder) {
|
||||
AnnotatedBindingBuilder<ExecutorService> _bind = binder.<ExecutorService>bind(ExecutorService.class);
|
||||
_bind.toProvider(ExecutorServiceProvider.class);
|
||||
binder.<ExecutorService>bind(ExecutorService.class).toProvider(ExecutorServiceProvider.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
package org.eclipse.xtext.ide.editor.contentassist;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.eclipse.xtend.lib.annotations.Data;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
|
@ -19,7 +18,6 @@ import org.eclipse.xtext.ide.editor.contentassist.IIdeContentProposalAcceptor;
|
|||
import org.eclipse.xtext.ide.editor.contentassist.IdeContentProposalCreator;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.IdeContentProposalPriorities;
|
||||
import org.eclipse.xtext.nodemodel.ICompositeNode;
|
||||
import org.eclipse.xtext.util.ITextRegion;
|
||||
import org.eclipse.xtext.util.TextRegion;
|
||||
import org.eclipse.xtext.xbase.lib.Pure;
|
||||
import org.eclipse.xtext.xbase.lib.util.ToStringBuilder;
|
||||
|
@ -115,19 +113,16 @@ public abstract class AbstractIdeTemplateProposalProvider {
|
|||
protected String getStringRepresentation(final Object object) {
|
||||
if ((object instanceof AbstractIdeTemplateProposalProvider.Variable)) {
|
||||
final String varName = ((AbstractIdeTemplateProposalProvider.Variable)object).name;
|
||||
ITextRegion _replaceRegion = this.context.getReplaceRegion();
|
||||
int _offset = _replaceRegion.getOffset();
|
||||
int _offset = this.context.getReplaceRegion().getOffset();
|
||||
int _currentOffset = this.getCurrentOffset();
|
||||
final int offset = (_offset + _currentOffset);
|
||||
ArrayList<TextRegion> _editPositions = this.entry.getEditPositions();
|
||||
int _length = varName.length();
|
||||
TextRegion _textRegion = new TextRegion(offset, _length);
|
||||
_editPositions.add(_textRegion);
|
||||
this.entry.getEditPositions().add(_textRegion);
|
||||
return varName;
|
||||
} else {
|
||||
if ((object instanceof AbstractIdeTemplateProposalProvider.Cursor)) {
|
||||
ITextRegion _replaceRegion_1 = this.context.getReplaceRegion();
|
||||
int _offset_1 = _replaceRegion_1.getOffset();
|
||||
int _offset_1 = this.context.getReplaceRegion().getOffset();
|
||||
int _currentOffset_1 = this.getCurrentOffset();
|
||||
final int offset_1 = (_offset_1 + _currentOffset_1);
|
||||
this.entry.setEscapePosition(Integer.valueOf(offset_1));
|
||||
|
@ -179,15 +174,12 @@ public abstract class AbstractIdeTemplateProposalProvider {
|
|||
if (_canAcceptProposal) {
|
||||
entry.setLabel(name);
|
||||
entry.setDescription(description);
|
||||
int _defaultPriority = this.proposalPriorities.getDefaultPriority(entry);
|
||||
acceptor.accept(entry, _defaultPriority);
|
||||
acceptor.accept(entry, this.proposalPriorities.getDefaultPriority(entry));
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean canAcceptProposal(final ContentAssistEntry entry, final ContentAssistContext context) {
|
||||
String _proposal = entry.getProposal();
|
||||
String _prefix = entry.getPrefix();
|
||||
return this.proposalCreator.isValidProposal(_proposal, _prefix, context);
|
||||
return this.proposalCreator.isValidProposal(entry.getProposal(), entry.getPrefix(), context);
|
||||
}
|
||||
|
||||
protected ContentAssistEntry createProposal(final StringConcatenationClient template, final ContentAssistContext context, final boolean adaptIndentation) {
|
||||
|
@ -223,14 +215,12 @@ public abstract class AbstractIdeTemplateProposalProvider {
|
|||
}
|
||||
final String text = _text;
|
||||
if (((text != null) && (text.length() >= context.getOffset()))) {
|
||||
ITextRegion _replaceRegion = context.getReplaceRegion();
|
||||
int lineStart = _replaceRegion.getOffset();
|
||||
int lineStart = context.getReplaceRegion().getOffset();
|
||||
int indentEnd = lineStart;
|
||||
while (((lineStart > 0) && (text.charAt((lineStart - 1)) != "\n".charAt(0)))) {
|
||||
{
|
||||
lineStart--;
|
||||
char _charAt = text.charAt(lineStart);
|
||||
boolean _isWhitespace = Character.isWhitespace(_charAt);
|
||||
boolean _isWhitespace = Character.isWhitespace(text.charAt(lineStart));
|
||||
boolean _not = (!_isWhitespace);
|
||||
if (_not) {
|
||||
indentEnd = lineStart;
|
||||
|
|
|
@ -60,9 +60,7 @@ public class FQNPrefixMatcher implements IPrefixMatcher {
|
|||
return false;
|
||||
}
|
||||
for (int i = 0; (i < splitPrefix.size()); i++) {
|
||||
String _get = splitName.get(i);
|
||||
String _get_1 = splitPrefix.get(i);
|
||||
boolean _isCandidateMatchingPrefix_1 = this.delegate.isCandidateMatchingPrefix(_get, _get_1);
|
||||
boolean _isCandidateMatchingPrefix_1 = this.delegate.isCandidateMatchingPrefix(splitName.get(i), splitPrefix.get(i));
|
||||
boolean _not = (!_isCandidateMatchingPrefix_1);
|
||||
if (_not) {
|
||||
return false;
|
||||
|
|
|
@ -25,8 +25,7 @@ public interface IPrefixMatcher {
|
|||
public static class IgnoreCase implements IPrefixMatcher {
|
||||
@Override
|
||||
public boolean isCandidateMatchingPrefix(final String name, final String prefix) {
|
||||
int _length = prefix.length();
|
||||
return name.regionMatches(true, 0, prefix, 0, _length);
|
||||
return name.regionMatches(true, 0, prefix, 0, prefix.length());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,31 +45,25 @@ public class IdeContentProposalAcceptor implements IIdeContentProposalAcceptor,
|
|||
|
||||
@Override
|
||||
public int compare(final Pair<Integer, ContentAssistEntry> p1, final Pair<Integer, ContentAssistEntry> p2) {
|
||||
Integer _key = p2.getKey();
|
||||
Integer _key_1 = p1.getKey();
|
||||
final int prioResult = _key.compareTo(_key_1);
|
||||
final int prioResult = p2.getKey().compareTo(p1.getKey());
|
||||
if ((prioResult != 0)) {
|
||||
return prioResult;
|
||||
}
|
||||
String _elvis = null;
|
||||
ContentAssistEntry _value = p1.getValue();
|
||||
String _label = _value.getLabel();
|
||||
String _label = p1.getValue().getLabel();
|
||||
if (_label != null) {
|
||||
_elvis = _label;
|
||||
} else {
|
||||
ContentAssistEntry _value_1 = p1.getValue();
|
||||
String _proposal = _value_1.getProposal();
|
||||
String _proposal = p1.getValue().getProposal();
|
||||
_elvis = _proposal;
|
||||
}
|
||||
final String s1 = _elvis;
|
||||
String _elvis_1 = null;
|
||||
ContentAssistEntry _value_2 = p2.getValue();
|
||||
String _label_1 = _value_2.getLabel();
|
||||
String _label_1 = p2.getValue().getLabel();
|
||||
if (_label_1 != null) {
|
||||
_elvis_1 = _label_1;
|
||||
} else {
|
||||
ContentAssistEntry _value_3 = p2.getValue();
|
||||
String _proposal_1 = _value_3.getProposal();
|
||||
String _proposal_1 = p2.getValue().getProposal();
|
||||
_elvis_1 = _proposal_1;
|
||||
}
|
||||
final String s2 = _elvis_1;
|
||||
|
|
|
@ -35,17 +35,15 @@ public class IdeContentProposalPriorities {
|
|||
return priority;
|
||||
}
|
||||
int adjustedPriority = priority;
|
||||
String _proposal = entry.getProposal();
|
||||
char _charAt = _proposal.charAt(0);
|
||||
boolean _isLetter = Character.isLetter(_charAt);
|
||||
boolean _isLetter = Character.isLetter(entry.getProposal().charAt(0));
|
||||
boolean _not = (!_isLetter);
|
||||
if (_not) {
|
||||
int _adjustedPriority = adjustedPriority;
|
||||
adjustedPriority = (_adjustedPriority - 30);
|
||||
}
|
||||
String _proposal_1 = entry.getProposal();
|
||||
String _proposal = entry.getProposal();
|
||||
String _prefix = entry.getPrefix();
|
||||
boolean _equals = Objects.equal(_proposal_1, _prefix);
|
||||
boolean _equals = Objects.equal(_proposal, _prefix);
|
||||
if (_equals) {
|
||||
int _adjustedPriority_1 = adjustedPriority;
|
||||
adjustedPriority = (_adjustedPriority_1 - 20);
|
||||
|
|
|
@ -146,8 +146,7 @@ public class IdeContentProposalProvider {
|
|||
it.setDescription(rule.getName());
|
||||
};
|
||||
final ContentAssistEntry entry = this.proposalCreator.createProposal(proposal, context, _function);
|
||||
int _defaultPriority = this.proposalPriorities.getDefaultPriority(entry);
|
||||
acceptor.accept(entry, _defaultPriority);
|
||||
acceptor.accept(entry, this.proposalPriorities.getDefaultPriority(entry));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -156,13 +155,10 @@ public class IdeContentProposalProvider {
|
|||
protected void _createProposals(final Keyword keyword, final ContentAssistContext context, final IIdeContentProposalAcceptor acceptor) {
|
||||
boolean _filterKeyword = this.filterKeyword(keyword, context);
|
||||
if (_filterKeyword) {
|
||||
String _value = keyword.getValue();
|
||||
final ContentAssistEntry entry = this.proposalCreator.createProposal(_value, context);
|
||||
final ContentAssistEntry entry = this.proposalCreator.createProposal(keyword.getValue(), context);
|
||||
if ((entry != null)) {
|
||||
entry.setKind(ContentAssistEntry.KIND_KEYWORD);
|
||||
String _value_1 = keyword.getValue();
|
||||
int _keywordPriority = this.proposalPriorities.getKeywordPriority(_value_1, entry);
|
||||
acceptor.accept(entry, _keywordPriority);
|
||||
acceptor.accept(entry, this.proposalPriorities.getKeywordPriority(keyword.getValue(), entry));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -181,8 +177,8 @@ public class IdeContentProposalProvider {
|
|||
final EObject currentModel = context.getCurrentModel();
|
||||
if (((ereference != null) && (currentModel != null))) {
|
||||
final IScope scope = this.scopeProvider.getScope(currentModel, ereference);
|
||||
Predicate<IEObjectDescription> _crossrefFilter = this.getCrossrefFilter(reference, context);
|
||||
this.crossrefProposalProvider.lookupCrossReference(scope, reference, context, acceptor, _crossrefFilter);
|
||||
this.crossrefProposalProvider.lookupCrossReference(scope, reference, context, acceptor,
|
||||
this.getCrossrefFilter(reference, context));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ import org.eclipse.xtext.ide.editor.contentassist.IIdeContentProposalAcceptor;
|
|||
import org.eclipse.xtext.ide.editor.contentassist.IdeContentProposalCreator;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.IdeContentProposalPriorities;
|
||||
import org.eclipse.xtext.naming.IQualifiedNameConverter;
|
||||
import org.eclipse.xtext.naming.QualifiedName;
|
||||
import org.eclipse.xtext.resource.IEObjectDescription;
|
||||
import org.eclipse.xtext.scoping.IScope;
|
||||
import org.eclipse.xtext.xbase.lib.Exceptions;
|
||||
|
@ -59,8 +58,7 @@ public class IdeCrossrefProposalProvider {
|
|||
boolean _apply = filter.apply(candidate);
|
||||
if (_apply) {
|
||||
final ContentAssistEntry entry = this.createProposal(candidate, crossReference, context);
|
||||
int _crossRefPriority = this.proposalPriorities.getCrossRefPriority(candidate, entry);
|
||||
acceptor.accept(entry, _crossRefPriority);
|
||||
acceptor.accept(entry, this.proposalPriorities.getCrossRefPriority(candidate, entry));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -79,18 +77,16 @@ public class IdeCrossrefProposalProvider {
|
|||
}
|
||||
|
||||
protected ContentAssistEntry createProposal(final IEObjectDescription candidate, final CrossReference crossRef, final ContentAssistContext context) {
|
||||
QualifiedName _name = candidate.getName();
|
||||
String _string = this.qualifiedNameConverter.toString(_name);
|
||||
final Procedure1<ContentAssistEntry> _function = (ContentAssistEntry it) -> {
|
||||
it.setSource(candidate);
|
||||
EClass _eClass = candidate.getEClass();
|
||||
String _name_1 = null;
|
||||
String _name = null;
|
||||
if (_eClass!=null) {
|
||||
_name_1=_eClass.getName();
|
||||
_name=_eClass.getName();
|
||||
}
|
||||
it.setDescription(_name_1);
|
||||
it.setDescription(_name);
|
||||
};
|
||||
return this.proposalCreator.createProposal(_string, context, _function);
|
||||
return this.proposalCreator.createProposal(this.qualifiedNameConverter.toString(candidate.getName()), context, _function);
|
||||
}
|
||||
|
||||
@Pure
|
||||
|
|
|
@ -59,36 +59,30 @@ public abstract class AbstractHierarchyBuilder implements IHierarchyBuilder {
|
|||
private IResourceServiceProvider.Registry resourceServiceProviderRegistry;
|
||||
|
||||
protected <R extends Object> R readOnly(final URI objectURI, final IUnitOfWork<R, EObject> work) {
|
||||
IReferenceFinder.IResourceAccess _resourceAccess = this.getResourceAccess();
|
||||
final IUnitOfWork<R, ResourceSet> _function = (ResourceSet resourceSet) -> {
|
||||
final EObject targetObject = resourceSet.getEObject(objectURI, true);
|
||||
return work.exec(targetObject);
|
||||
};
|
||||
return _resourceAccess.<R>readOnly(objectURI, _function);
|
||||
return this.getResourceAccess().<R>readOnly(objectURI, _function);
|
||||
}
|
||||
|
||||
protected IEObjectDescription getDescription(final URI objectURI) {
|
||||
IResourceDescriptions _indexData = this.getIndexData();
|
||||
URI _trimFragment = objectURI.trimFragment();
|
||||
final IResourceDescription resourceDescription = _indexData.getResourceDescription(_trimFragment);
|
||||
final IResourceDescription resourceDescription = this.getIndexData().getResourceDescription(objectURI.trimFragment());
|
||||
if ((resourceDescription == null)) {
|
||||
return null;
|
||||
}
|
||||
Iterable<IEObjectDescription> _exportedObjects = resourceDescription.getExportedObjects();
|
||||
final Function1<IEObjectDescription, Boolean> _function = (IEObjectDescription it) -> {
|
||||
URI _eObjectURI = it.getEObjectURI();
|
||||
return Boolean.valueOf(Objects.equal(_eObjectURI, objectURI));
|
||||
};
|
||||
return IterableExtensions.<IEObjectDescription>findFirst(_exportedObjects, _function);
|
||||
return IterableExtensions.<IEObjectDescription>findFirst(resourceDescription.getExportedObjects(), _function);
|
||||
}
|
||||
|
||||
protected IEObjectDescription getDescription(final EObject object) {
|
||||
if ((object == null)) {
|
||||
return null;
|
||||
}
|
||||
IResourceDescriptions _indexData = this.getIndexData();
|
||||
Iterable<IEObjectDescription> _exportedObjectsByObject = _indexData.getExportedObjectsByObject(object);
|
||||
return IterableExtensions.<IEObjectDescription>head(_exportedObjectsByObject);
|
||||
return IterableExtensions.<IEObjectDescription>head(this.getIndexData().getExportedObjectsByObject(object));
|
||||
}
|
||||
|
||||
protected boolean isAssignable(final EClass superType, final EClassifier type) {
|
||||
|
|
|
@ -11,29 +11,24 @@ import java.util.Collection;
|
|||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import javax.inject.Provider;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.EReference;
|
||||
import org.eclipse.emf.ecore.util.EcoreUtil;
|
||||
import org.eclipse.xtend.lib.annotations.Accessors;
|
||||
import org.eclipse.xtext.findReferences.IReferenceFinder;
|
||||
import org.eclipse.xtext.findReferences.ReferenceAcceptor;
|
||||
import org.eclipse.xtext.findReferences.TargetURICollector;
|
||||
import org.eclipse.xtext.findReferences.TargetURIs;
|
||||
import org.eclipse.xtext.ide.editor.hierarchy.AbstractHierarchyBuilder;
|
||||
import org.eclipse.xtext.ide.editor.hierarchy.DefaultHierarchyNode;
|
||||
import org.eclipse.xtext.ide.editor.hierarchy.DefaultHierarchyNodeReference;
|
||||
import org.eclipse.xtext.ide.editor.hierarchy.ICallHierarchyBuilder;
|
||||
import org.eclipse.xtext.ide.editor.hierarchy.IHierarchyNode;
|
||||
import org.eclipse.xtext.ide.editor.hierarchy.IHierarchyNodeLocationProvider;
|
||||
import org.eclipse.xtext.ide.editor.hierarchy.IHierarchyNodeReference;
|
||||
import org.eclipse.xtext.nodemodel.ICompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
|
||||
import org.eclipse.xtext.resource.IEObjectDescription;
|
||||
import org.eclipse.xtext.resource.IReferenceDescription;
|
||||
import org.eclipse.xtext.resource.IResourceDescriptions;
|
||||
import org.eclipse.xtext.resource.IResourceServiceProvider;
|
||||
import org.eclipse.xtext.util.IAcceptor;
|
||||
import org.eclipse.xtext.util.ITextRegionWithLineInformation;
|
||||
|
@ -105,7 +100,6 @@ public class DefaultCallHierarchyBuilder extends AbstractHierarchyBuilder implem
|
|||
final IUnitOfWork<Object, EObject> _function = (EObject sourceDeclaration) -> {
|
||||
Object _xblockexpression = null;
|
||||
{
|
||||
IReferenceFinder _referenceFinder = this.getReferenceFinder();
|
||||
IResourceServiceProvider.Registry _resourceServiceProviderRegistry = this.getResourceServiceProviderRegistry();
|
||||
final IAcceptor<IReferenceDescription> _function_1 = (IReferenceDescription reference) -> {
|
||||
boolean _filterReference = this.filterReference(reference);
|
||||
|
@ -119,7 +113,7 @@ public class DefaultCallHierarchyBuilder extends AbstractHierarchyBuilder implem
|
|||
}
|
||||
};
|
||||
ReferenceAcceptor _referenceAcceptor = new ReferenceAcceptor(_resourceServiceProviderRegistry, _function_1);
|
||||
_referenceFinder.findAllReferences(sourceDeclaration, _referenceAcceptor, monitor);
|
||||
this.getReferenceFinder().findAllReferences(sourceDeclaration, _referenceAcceptor, monitor);
|
||||
_xblockexpression = null;
|
||||
}
|
||||
return _xblockexpression;
|
||||
|
@ -129,9 +123,6 @@ public class DefaultCallHierarchyBuilder extends AbstractHierarchyBuilder implem
|
|||
|
||||
protected void findSourceDeclarations(final URI targetDeclarationURI, final IProgressMonitor monitor, final Procedure2<? super IEObjectDescription, ? super IReferenceDescription> acceptor) {
|
||||
final TargetURIs targetURIs = this.collectTargetURIs(targetDeclarationURI);
|
||||
IReferenceFinder _referenceFinder = this.getReferenceFinder();
|
||||
IReferenceFinder.IResourceAccess _resourceAccess = this.getResourceAccess();
|
||||
IResourceDescriptions _indexData = this.getIndexData();
|
||||
IResourceServiceProvider.Registry _resourceServiceProviderRegistry = this.getResourceServiceProviderRegistry();
|
||||
final IAcceptor<IReferenceDescription> _function = (IReferenceDescription reference) -> {
|
||||
boolean _filterReference = this.filterReference(reference);
|
||||
|
@ -145,12 +136,13 @@ public class DefaultCallHierarchyBuilder extends AbstractHierarchyBuilder implem
|
|||
}
|
||||
};
|
||||
ReferenceAcceptor _referenceAcceptor = new ReferenceAcceptor(_resourceServiceProviderRegistry, _function);
|
||||
_referenceFinder.findAllReferences(targetURIs, _resourceAccess, _indexData, _referenceAcceptor, monitor);
|
||||
this.getReferenceFinder().findAllReferences(targetURIs,
|
||||
this.getResourceAccess(),
|
||||
this.getIndexData(), _referenceAcceptor, monitor);
|
||||
}
|
||||
|
||||
protected TargetURIs collectTargetURIs(final URI targetURI) {
|
||||
Provider<TargetURIs> _targetURIProvider = this.getTargetURIProvider();
|
||||
final TargetURIs targetURIs = _targetURIProvider.get();
|
||||
final TargetURIs targetURIs = this.getTargetURIProvider().get();
|
||||
if ((targetURI == null)) {
|
||||
return targetURIs;
|
||||
}
|
||||
|
@ -158,8 +150,7 @@ public class DefaultCallHierarchyBuilder extends AbstractHierarchyBuilder implem
|
|||
if ((targetObject == null)) {
|
||||
return targetURIs;
|
||||
}
|
||||
TargetURICollector _targetURICollector = this.getTargetURICollector();
|
||||
_targetURICollector.add(targetObject, targetURIs);
|
||||
this.getTargetURICollector().add(targetObject, targetURIs);
|
||||
return targetURIs;
|
||||
};
|
||||
return this.<TargetURIs>readOnly(targetURI, _function);
|
||||
|
@ -174,13 +165,11 @@ public class DefaultCallHierarchyBuilder extends AbstractHierarchyBuilder implem
|
|||
}
|
||||
|
||||
protected IEObjectDescription findTargetDeclaration(final IReferenceDescription reference) {
|
||||
URI _targetEObjectUri = reference.getTargetEObjectUri();
|
||||
return this.findDeclaration(_targetEObjectUri);
|
||||
return this.findDeclaration(reference.getTargetEObjectUri());
|
||||
}
|
||||
|
||||
protected IEObjectDescription findSourceDeclaration(final IReferenceDescription reference) {
|
||||
URI _containerEObjectURI = reference.getContainerEObjectURI();
|
||||
return this.findDeclaration(_containerEObjectURI);
|
||||
return this.findDeclaration(reference.getContainerEObjectURI());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -210,12 +199,10 @@ public class DefaultCallHierarchyBuilder extends AbstractHierarchyBuilder implem
|
|||
if ((declaration == null)) {
|
||||
return null;
|
||||
}
|
||||
URI _eObjectURI = declaration.getEObjectURI();
|
||||
IHierarchyNode childNode = children.get(_eObjectURI);
|
||||
IHierarchyNode childNode = children.get(declaration.getEObjectURI());
|
||||
if ((childNode == null)) {
|
||||
childNode = this.createChild(declaration, parent);
|
||||
URI _eObjectURI_1 = declaration.getEObjectURI();
|
||||
children.put(_eObjectURI_1, childNode);
|
||||
children.put(declaration.getEObjectURI(), childNode);
|
||||
}
|
||||
return childNode;
|
||||
}
|
||||
|
@ -224,11 +211,8 @@ public class DefaultCallHierarchyBuilder extends AbstractHierarchyBuilder implem
|
|||
* @return a hierarchy node reference for the given reference; cannot be <code>null</code>
|
||||
*/
|
||||
protected IHierarchyNodeReference createNodeReference(final IReferenceDescription reference) {
|
||||
URI _sourceEObjectUri = reference.getSourceEObjectUri();
|
||||
final IUnitOfWork<DefaultHierarchyNodeReference, EObject> _function = (EObject sourceObject) -> {
|
||||
EReference _eReference = reference.getEReference();
|
||||
int _indexInList = reference.getIndexInList();
|
||||
final ITextRegionWithLineInformation textRegion = this.getTextRegion(sourceObject, _eReference, _indexInList);
|
||||
final ITextRegionWithLineInformation textRegion = this.getTextRegion(sourceObject, reference.getEReference(), reference.getIndexInList());
|
||||
final String text = this.getText(sourceObject, textRegion);
|
||||
return new DefaultHierarchyNodeReference(text, textRegion, reference);
|
||||
};
|
||||
|
@ -236,26 +220,21 @@ public class DefaultCallHierarchyBuilder extends AbstractHierarchyBuilder implem
|
|||
}
|
||||
|
||||
protected ITextRegionWithLineInformation getTextRegion(final EObject obj, final EReference reference, final int indexInList) {
|
||||
IHierarchyNodeLocationProvider _hierarchyNodeLocationProvider = this.getHierarchyNodeLocationProvider();
|
||||
return _hierarchyNodeLocationProvider.getTextRegion(obj, reference, indexInList);
|
||||
return this.getHierarchyNodeLocationProvider().getTextRegion(obj, reference, indexInList);
|
||||
}
|
||||
|
||||
protected String getText(final EObject obj, final ITextRegionWithLineInformation textRegion) {
|
||||
if (((obj == null) || (textRegion == ITextRegionWithLineInformation.EMPTY_REGION))) {
|
||||
return "";
|
||||
}
|
||||
EObject _rootContainer = EcoreUtil.getRootContainer(obj);
|
||||
final ICompositeNode node = NodeModelUtils.getNode(_rootContainer);
|
||||
final ICompositeNode node = NodeModelUtils.getNode(EcoreUtil.getRootContainer(obj));
|
||||
if ((node == null)) {
|
||||
return "";
|
||||
}
|
||||
int _offset = textRegion.getOffset();
|
||||
int _length = textRegion.getLength();
|
||||
final int endOffset = (_offset + _length);
|
||||
ICompositeNode _rootNode = node.getRootNode();
|
||||
String _text = _rootNode.getText();
|
||||
int _offset_1 = textRegion.getOffset();
|
||||
return _text.substring(_offset_1, endOffset);
|
||||
return node.getRootNode().getText().substring(textRegion.getOffset(), endOffset);
|
||||
}
|
||||
|
||||
@Pure
|
||||
|
|
|
@ -64,8 +64,7 @@ public class DefaultHierarchyNode implements IHierarchyNode {
|
|||
IHierarchyNode node = this.parent;
|
||||
while ((node != null)) {
|
||||
{
|
||||
IEObjectDescription _element = node.getElement();
|
||||
URI _eObjectURI = _element.getEObjectURI();
|
||||
URI _eObjectURI = node.getElement().getEObjectURI();
|
||||
URI _eObjectURI_1 = this.element.getEObjectURI();
|
||||
boolean _equals = Objects.equal(_eObjectURI, _eObjectURI_1);
|
||||
if (_equals) {
|
||||
|
|
|
@ -17,7 +17,6 @@ import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
|
|||
import org.eclipse.xtext.resource.ILocationInFileProvider;
|
||||
import org.eclipse.xtext.util.ITextRegion;
|
||||
import org.eclipse.xtext.util.ITextRegionWithLineInformation;
|
||||
import org.eclipse.xtext.util.LineAndColumn;
|
||||
import org.eclipse.xtext.util.TextRegionWithLineInformation;
|
||||
|
||||
/**
|
||||
|
@ -61,18 +60,15 @@ public class DefaultHierarchyNodeLocationProvider implements IHierarchyNodeLocat
|
|||
int _length = textRegion.getLength();
|
||||
return new TextRegionWithLineInformation(_offset, _length, 0, 0);
|
||||
}
|
||||
int _offset_1 = textRegion.getOffset();
|
||||
LineAndColumn _lineAndColumn = NodeModelUtils.getLineAndColumn(node, _offset_1);
|
||||
int _line = _lineAndColumn.getLine();
|
||||
int _line = NodeModelUtils.getLineAndColumn(node, textRegion.getOffset()).getLine();
|
||||
final int startLine = (_line - 1);
|
||||
int _offset_2 = textRegion.getOffset();
|
||||
int _offset_1 = textRegion.getOffset();
|
||||
int _length_1 = textRegion.getLength();
|
||||
int _plus = (_offset_2 + _length_1);
|
||||
LineAndColumn _lineAndColumn_1 = NodeModelUtils.getLineAndColumn(node, _plus);
|
||||
int _line_1 = _lineAndColumn_1.getLine();
|
||||
int _plus = (_offset_1 + _length_1);
|
||||
int _line_1 = NodeModelUtils.getLineAndColumn(node, _plus).getLine();
|
||||
final int endLine = (_line_1 - 1);
|
||||
int _offset_3 = textRegion.getOffset();
|
||||
int _offset_2 = textRegion.getOffset();
|
||||
int _length_2 = textRegion.getLength();
|
||||
return new TextRegionWithLineInformation(_offset_3, _length_2, startLine, endLine);
|
||||
return new TextRegionWithLineInformation(_offset_2, _length_2, startLine, endLine);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,8 +39,7 @@ public abstract class TokenTypeToStringMapper {
|
|||
if (_greaterEqualsThan) {
|
||||
Integer _key_1 = entry.getKey();
|
||||
int _minus = ((_key_1).intValue() - Token.MIN_TOKEN_TYPE);
|
||||
String _calculateId = this.calculateId(entry.getValue(), (entry.getKey()).intValue());
|
||||
this.mappedValues[_minus] = _calculateId;
|
||||
this.mappedValues[_minus] = this.calculateId(entry.getValue(), (entry.getKey()).intValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ package org.eclipse.xtext.ide.editor.syntaxcoloring;
|
|||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.inject.Singleton;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import org.eclipse.xtext.ide.editor.syntaxcoloring.AbstractAntlrTokenToAttributeIdMapper;
|
||||
import org.eclipse.xtext.ide.editor.syntaxcoloring.HighlightingStyles;
|
||||
|
@ -29,15 +28,13 @@ public class DefaultAntlrTokenToAttributeIdMapper extends AbstractAntlrTokenToAt
|
|||
protected String calculateId(final String tokenName, final int tokenType) {
|
||||
String _switchResult = null;
|
||||
boolean _matched = false;
|
||||
Matcher _matcher = DefaultAntlrTokenToAttributeIdMapper.PUNCTUATION.matcher(tokenName);
|
||||
boolean _matches = _matcher.matches();
|
||||
boolean _matches = DefaultAntlrTokenToAttributeIdMapper.PUNCTUATION.matcher(tokenName).matches();
|
||||
if (_matches) {
|
||||
_matched=true;
|
||||
_switchResult = HighlightingStyles.PUNCTUATION_ID;
|
||||
}
|
||||
if (!_matched) {
|
||||
Matcher _matcher_1 = DefaultAntlrTokenToAttributeIdMapper.QUOTED.matcher(tokenName);
|
||||
boolean _matches_1 = _matcher_1.matches();
|
||||
boolean _matches_1 = DefaultAntlrTokenToAttributeIdMapper.QUOTED.matcher(tokenName).matches();
|
||||
if (_matches_1) {
|
||||
_matched=true;
|
||||
_switchResult = HighlightingStyles.KEYWORD_ID;
|
||||
|
|
|
@ -10,10 +10,7 @@ package org.eclipse.xtext.ide.editor.syntaxcoloring;
|
|||
import com.google.common.base.Objects;
|
||||
import com.google.inject.ImplementedBy;
|
||||
import com.google.inject.Inject;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
import org.eclipse.xtext.Grammar;
|
||||
import org.eclipse.xtext.GrammarUtil;
|
||||
import org.eclipse.xtext.IGrammarAccess;
|
||||
import org.eclipse.xtext.Keyword;
|
||||
|
@ -50,8 +47,7 @@ public interface IEditorHighlightingConfigurationProvider {
|
|||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("match: \"\\\\b(?:");
|
||||
Iterable<String> _keywords = this.getKeywords();
|
||||
String _join = IterableExtensions.join(_keywords, "|");
|
||||
String _join = IterableExtensions.join(this.getKeywords(), "|");
|
||||
_builder.append(_join, " ");
|
||||
_builder.append(")\\\\b\", ");
|
||||
_builder.newLineIfNotEmpty();
|
||||
|
@ -107,20 +103,13 @@ public interface IEditorHighlightingConfigurationProvider {
|
|||
}
|
||||
|
||||
public Iterable<String> getKeywords() {
|
||||
Grammar _grammar = this.grammarAccess.getGrammar();
|
||||
List<Keyword> _containedKeywords = GrammarUtil.containedKeywords(_grammar);
|
||||
final Function1<Keyword, Boolean> _function = (Keyword it) -> {
|
||||
String _value = it.getValue();
|
||||
char _charAt = _value.charAt(0);
|
||||
return Boolean.valueOf(Character.isLetter(_charAt));
|
||||
return Boolean.valueOf(Character.isLetter(it.getValue().charAt(0)));
|
||||
};
|
||||
Iterable<Keyword> _filter = IterableExtensions.<Keyword>filter(_containedKeywords, _function);
|
||||
final Function1<Keyword, String> _function_1 = (Keyword it) -> {
|
||||
return it.getValue();
|
||||
};
|
||||
Iterable<String> _map = IterableExtensions.<Keyword, String>map(_filter, _function_1);
|
||||
Set<String> _set = IterableExtensions.<String>toSet(_map);
|
||||
return IterableExtensions.<String>sort(_set);
|
||||
return IterableExtensions.<String>sort(IterableExtensions.<String>toSet(IterableExtensions.<Keyword, String>map(IterableExtensions.<Keyword>filter(GrammarUtil.containedKeywords(this.grammarAccess.getGrammar()), _function), _function_1)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ package org.eclipse.xtext.ide.labels;
|
|||
import com.google.common.collect.Iterables;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.ecore.EClass;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.xtext.ide.labels.AlternativeImageDescription;
|
||||
|
@ -30,11 +29,10 @@ public class EClassImageDescriptionProvider implements IImageDescriptionProvider
|
|||
if (element instanceof EClass) {
|
||||
_matched=true;
|
||||
String _name = ((EClass)element).getName();
|
||||
EList<EClass> _eAllSuperTypes = ((EClass)element).getEAllSuperTypes();
|
||||
final Function1<EClass, String> _function = (EClass it) -> {
|
||||
return it.getName();
|
||||
};
|
||||
List<String> _map = ListExtensions.<EClass, String>map(_eAllSuperTypes, _function);
|
||||
List<String> _map = ListExtensions.<EClass, String>map(((EClass)element).getEAllSuperTypes(), _function);
|
||||
Iterable<String> _plus = Iterables.<String>concat(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList(_name)), _map);
|
||||
String _imageID = IImageDescription.DEFAULT.getImageID();
|
||||
Iterable<String> _plus_1 = Iterables.<String>concat(_plus, Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList(_imageID)));
|
||||
|
@ -43,15 +41,13 @@ public class EClassImageDescriptionProvider implements IImageDescriptionProvider
|
|||
if (!_matched) {
|
||||
if (element instanceof EObject) {
|
||||
_matched=true;
|
||||
EClass _eClass = ((EObject)element).eClass();
|
||||
_switchResult = this.getImageDescription(_eClass);
|
||||
_switchResult = this.getImageDescription(((EObject)element).eClass());
|
||||
}
|
||||
}
|
||||
if (!_matched) {
|
||||
if (element instanceof IEObjectDescription) {
|
||||
_matched=true;
|
||||
EClass _eClass = ((IEObjectDescription)element).getEClass();
|
||||
_switchResult = this.getImageDescription(_eClass);
|
||||
_switchResult = this.getImageDescription(((IEObjectDescription)element).getEClass());
|
||||
}
|
||||
}
|
||||
if (!_matched) {
|
||||
|
|
|
@ -9,7 +9,6 @@ package org.eclipse.xtext.ide.labels;
|
|||
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.xtext.ide.labels.INameLabelProvider;
|
||||
import org.eclipse.xtext.naming.QualifiedName;
|
||||
import org.eclipse.xtext.resource.IEObjectDescription;
|
||||
import org.eclipse.xtext.util.SimpleAttributeResolver;
|
||||
|
||||
|
@ -26,8 +25,7 @@ public class SimpleNameLabelProvider implements INameLabelProvider {
|
|||
if (!_matched) {
|
||||
if (element instanceof IEObjectDescription) {
|
||||
_matched=true;
|
||||
QualifiedName _name = ((IEObjectDescription)element).getName();
|
||||
_switchResult = _name.getLastSegment();
|
||||
_switchResult = ((IEObjectDescription)element).getName().getLastSegment();
|
||||
}
|
||||
}
|
||||
if (!_matched) {
|
||||
|
|
|
@ -135,11 +135,8 @@ public class BuildManager {
|
|||
final ArrayList<IResourceDescription.Delta> result = CollectionLiterals.<IResourceDescription.Delta>newArrayList();
|
||||
for (final ProjectDescription description : sortedDescriptions) {
|
||||
{
|
||||
String _name = description.getName();
|
||||
ProjectManager _projectManager = this.workspaceManager.getProjectManager(_name);
|
||||
final IncrementalBuilder.Result partialresult = _projectManager.doInitialBuild(indicator);
|
||||
List<IResourceDescription.Delta> _affectedResources = partialresult.getAffectedResources();
|
||||
result.addAll(_affectedResources);
|
||||
final IncrementalBuilder.Result partialresult = this.workspaceManager.getProjectManager(description.getName()).doInitialBuild(indicator);
|
||||
result.addAll(partialresult.getAffectedResources());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -150,16 +147,14 @@ public class BuildManager {
|
|||
final HashMultimap<ProjectDescription, URI> project2dirty = HashMultimap.<ProjectDescription, URI>create();
|
||||
for (final URI dirty : allDirty) {
|
||||
{
|
||||
ProjectManager _projectManager = this.workspaceManager.getProjectManager(dirty);
|
||||
final ProjectDescription projectManager = _projectManager.getProjectDescription();
|
||||
final ProjectDescription projectManager = this.workspaceManager.getProjectManager(dirty).getProjectDescription();
|
||||
project2dirty.put(projectManager, dirty);
|
||||
}
|
||||
}
|
||||
final HashMultimap<ProjectDescription, URI> project2deleted = HashMultimap.<ProjectDescription, URI>create();
|
||||
for (final URI deleted : this.deletedFiles) {
|
||||
{
|
||||
ProjectManager _projectManager = this.workspaceManager.getProjectManager(deleted);
|
||||
final ProjectDescription projectManager = _projectManager.getProjectDescription();
|
||||
final ProjectDescription projectManager = this.workspaceManager.getProjectManager(deleted).getProjectDescription();
|
||||
project2deleted.put(projectManager, deleted);
|
||||
}
|
||||
}
|
||||
|
@ -170,37 +165,25 @@ public class BuildManager {
|
|||
final ArrayList<IResourceDescription.Delta> result = CollectionLiterals.<IResourceDescription.Delta>newArrayList();
|
||||
for (final ProjectDescription it : sortedDescriptions) {
|
||||
{
|
||||
String _name = it.getName();
|
||||
final ProjectManager projectManager = this.workspaceManager.getProjectManager(_name);
|
||||
Set<URI> _get = project2dirty.get(it);
|
||||
List<URI> _list = IterableExtensions.<URI>toList(_get);
|
||||
Set<URI> _get_1 = project2deleted.get(it);
|
||||
List<URI> _list_1 = IterableExtensions.<URI>toList(_get_1);
|
||||
final IncrementalBuilder.Result partialResult = projectManager.doBuild(_list, _list_1, cancelIndicator);
|
||||
List<IResourceDescription.Delta> _affectedResources = partialResult.getAffectedResources();
|
||||
final ProjectManager projectManager = this.workspaceManager.getProjectManager(it.getName());
|
||||
final IncrementalBuilder.Result partialResult = projectManager.doBuild(IterableExtensions.<URI>toList(project2dirty.get(it)), IterableExtensions.<URI>toList(project2deleted.get(it)), cancelIndicator);
|
||||
final Function1<IResourceDescription.Delta, URI> _function = (IResourceDescription.Delta it_1) -> {
|
||||
return it_1.getUri();
|
||||
};
|
||||
List<URI> _map = ListExtensions.<IResourceDescription.Delta, URI>map(_affectedResources, _function);
|
||||
allDirty.addAll(_map);
|
||||
allDirty.addAll(ListExtensions.<IResourceDescription.Delta, URI>map(partialResult.getAffectedResources(), _function));
|
||||
Iterables.removeAll(this.dirtyFiles, this.dirtyFiles);
|
||||
Iterables.removeAll(this.deletedFiles, this.deletedFiles);
|
||||
List<IResourceDescription.Delta> _affectedResources_1 = partialResult.getAffectedResources();
|
||||
result.addAll(_affectedResources_1);
|
||||
result.addAll(partialResult.getAffectedResources());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected List<ProjectDescription> sortByDependencies(final Iterable<ProjectDescription> projectDescriptions) {
|
||||
TopologicalSorter _get = this.sorterProvider.get();
|
||||
List<ProjectDescription> _list = IterableExtensions.<ProjectDescription>toList(projectDescriptions);
|
||||
final Procedure1<ProjectDescription> _function = (ProjectDescription it) -> {
|
||||
String _name = it.getName();
|
||||
ProjectManager _projectManager = this.workspaceManager.getProjectManager(_name);
|
||||
this.reportDependencyCycle(_projectManager);
|
||||
this.reportDependencyCycle(this.workspaceManager.getProjectManager(it.getName()));
|
||||
};
|
||||
return _get.sortByDependencies(_list, _function);
|
||||
return this.sorterProvider.get().sortByDependencies(IterableExtensions.<ProjectDescription>toList(projectDescriptions), _function);
|
||||
}
|
||||
|
||||
protected void reportDependencyCycle(final ProjectManager manager) {
|
||||
|
|
|
@ -86,18 +86,13 @@ public class Document {
|
|||
Range _range = change.getRange();
|
||||
boolean _tripleEquals = (_range == null);
|
||||
if (_tripleEquals) {
|
||||
String _newText = change.getNewText();
|
||||
newContent = _newText;
|
||||
newContent = change.getNewText();
|
||||
} else {
|
||||
Range _range_1 = change.getRange();
|
||||
Position _start = _range_1.getStart();
|
||||
final int start = this.getOffSet(_start);
|
||||
Range _range_2 = change.getRange();
|
||||
Position _end = _range_2.getEnd();
|
||||
final int end = this.getOffSet(_end);
|
||||
final int start = this.getOffSet(change.getRange().getStart());
|
||||
final int end = this.getOffSet(change.getRange().getEnd());
|
||||
String _substring = newContent.substring(0, start);
|
||||
String _newText_1 = change.getNewText();
|
||||
String _plus = (_substring + _newText_1);
|
||||
String _newText = change.getNewText();
|
||||
String _plus = (_substring + _newText);
|
||||
String _substring_1 = newContent.substring(end);
|
||||
String _plus_1 = (_plus + _substring_1);
|
||||
newContent = _plus_1;
|
||||
|
|
|
@ -9,7 +9,6 @@ package org.eclipse.xtext.ide.server;
|
|||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.EStructuralFeature;
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
|
@ -19,7 +18,6 @@ import org.eclipse.lsp4j.Range;
|
|||
import org.eclipse.xtext.ide.server.UriExtensions;
|
||||
import org.eclipse.xtext.nodemodel.ICompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
|
||||
import org.eclipse.xtext.parser.IParseResult;
|
||||
import org.eclipse.xtext.resource.ILocationInFileProvider;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.eclipse.xtext.util.ITextRegion;
|
||||
|
@ -42,8 +40,7 @@ public class DocumentExtensions {
|
|||
|
||||
public Position newPosition(final Resource resource, final int offset) {
|
||||
if ((resource instanceof XtextResource)) {
|
||||
IParseResult _parseResult = ((XtextResource)resource).getParseResult();
|
||||
final ICompositeNode rootNode = _parseResult.getRootNode();
|
||||
final ICompositeNode rootNode = ((XtextResource)resource).getParseResult().getRootNode();
|
||||
final LineAndColumn lineAndColumn = NodeModelUtils.getLineAndColumn(rootNode, offset);
|
||||
int _line = lineAndColumn.getLine();
|
||||
int _minus = (_line - 1);
|
||||
|
@ -73,11 +70,8 @@ public class DocumentExtensions {
|
|||
|
||||
public Location newLocation(final Resource resource, final ITextRegion textRegion) {
|
||||
final Location location = new Location();
|
||||
URI _uRI = resource.getURI();
|
||||
String _path = this._uriExtensions.toPath(_uRI);
|
||||
location.setUri(_path);
|
||||
Range _newRange = this.newRange(resource, textRegion);
|
||||
location.setRange(_newRange);
|
||||
location.setUri(this._uriExtensions.toPath(resource.getURI()));
|
||||
location.setRange(this.newRange(resource, textRegion));
|
||||
return location;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,6 @@ import org.eclipse.lsp4j.Location;
|
|||
import org.eclipse.lsp4j.Position;
|
||||
import org.eclipse.lsp4j.PublishDiagnosticsParams;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
import org.eclipse.lsp4j.ReferenceContext;
|
||||
import org.eclipse.lsp4j.ReferenceParams;
|
||||
import org.eclipse.lsp4j.RenameParams;
|
||||
import org.eclipse.lsp4j.ServerCapabilities;
|
||||
|
@ -64,12 +63,9 @@ import org.eclipse.lsp4j.SignatureHelp;
|
|||
import org.eclipse.lsp4j.SignatureHelpOptions;
|
||||
import org.eclipse.lsp4j.SymbolInformation;
|
||||
import org.eclipse.lsp4j.TextDocumentContentChangeEvent;
|
||||
import org.eclipse.lsp4j.TextDocumentIdentifier;
|
||||
import org.eclipse.lsp4j.TextDocumentItem;
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams;
|
||||
import org.eclipse.lsp4j.TextDocumentSyncKind;
|
||||
import org.eclipse.lsp4j.TextEdit;
|
||||
import org.eclipse.lsp4j.VersionedTextDocumentIdentifier;
|
||||
import org.eclipse.lsp4j.WorkspaceEdit;
|
||||
import org.eclipse.lsp4j.WorkspaceSymbolParams;
|
||||
import org.eclipse.lsp4j.jsonrpc.Endpoint;
|
||||
|
@ -133,8 +129,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
@Override
|
||||
public boolean isCanceled() {
|
||||
if (((this.canceledSince == null) && this.delegate.isCanceled())) {
|
||||
long _currentTimeMillis = System.currentTimeMillis();
|
||||
this.canceledSince = Long.valueOf(_currentTimeMillis);
|
||||
this.canceledSince = Long.valueOf(System.currentTimeMillis());
|
||||
return false;
|
||||
}
|
||||
return ((this.canceledSince != null) && (System.currentTimeMillis() > ((this.canceledSince).longValue() + 1000)));
|
||||
|
@ -181,8 +176,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
if (_tripleEquals) {
|
||||
throw new IllegalArgumentException("Bad initialization request. rootPath must not be null.");
|
||||
}
|
||||
Map<String, Object> _extensionToFactoryMap = this.languagesRegistry.getExtensionToFactoryMap();
|
||||
boolean _isEmpty = _extensionToFactoryMap.isEmpty();
|
||||
boolean _isEmpty = this.languagesRegistry.getExtensionToFactoryMap().isEmpty();
|
||||
if (_isEmpty) {
|
||||
throw new IllegalStateException("No Xtext languages have been registered. Please make sure you have added the languages\'s setup class in \'/META-INF/services/org.eclipse.xtext.ISetup\'");
|
||||
}
|
||||
|
@ -212,10 +206,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
ServerCapabilities _doubleArrow = ObjectExtensions.<ServerCapabilities>operator_doubleArrow(_serverCapabilities, _function);
|
||||
result.setCapabilities(_doubleArrow);
|
||||
final Function1<CancelIndicator, Object> _function_1 = (CancelIndicator cancelIndicator) -> {
|
||||
String _rootPath_1 = params.getRootPath();
|
||||
URI _createFileURI = URI.createFileURI(_rootPath_1);
|
||||
String _path = this._uriExtensions.toPath(_createFileURI);
|
||||
final URI rootURI = this._uriExtensions.toUri(_path);
|
||||
final URI rootURI = this._uriExtensions.toUri(this._uriExtensions.toPath(URI.createFileURI(params.getRootPath())));
|
||||
final Procedure2<URI, Iterable<Issue>> _function_2 = (URI $0, Iterable<Issue> $1) -> {
|
||||
this.publishDiagnostics($0, $1);
|
||||
};
|
||||
|
@ -254,14 +245,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
@Override
|
||||
public void didOpen(final DidOpenTextDocumentParams params) {
|
||||
final Function1<CancelIndicator, Object> _function = (CancelIndicator cancelIndicator) -> {
|
||||
TextDocumentItem _textDocument = params.getTextDocument();
|
||||
String _uri = _textDocument.getUri();
|
||||
URI _uri_1 = this._uriExtensions.toUri(_uri);
|
||||
TextDocumentItem _textDocument_1 = params.getTextDocument();
|
||||
int _version = _textDocument_1.getVersion();
|
||||
TextDocumentItem _textDocument_2 = params.getTextDocument();
|
||||
String _text = _textDocument_2.getText();
|
||||
this.workspaceManager.didOpen(_uri_1, _version, _text, cancelIndicator);
|
||||
this.workspaceManager.didOpen(this._uriExtensions.toUri(params.getTextDocument().getUri()), params.getTextDocument().getVersion(), params.getTextDocument().getText(), cancelIndicator);
|
||||
return null;
|
||||
};
|
||||
this.requestManager.<Object>runWrite(_function);
|
||||
|
@ -270,19 +254,12 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
@Override
|
||||
public void didChange(final DidChangeTextDocumentParams params) {
|
||||
final Function1<CancelIndicator, Object> _function = (CancelIndicator cancelIndicator) -> {
|
||||
VersionedTextDocumentIdentifier _textDocument = params.getTextDocument();
|
||||
String _uri = _textDocument.getUri();
|
||||
URI _uri_1 = this._uriExtensions.toUri(_uri);
|
||||
VersionedTextDocumentIdentifier _textDocument_1 = params.getTextDocument();
|
||||
int _version = _textDocument_1.getVersion();
|
||||
List<TextDocumentContentChangeEvent> _contentChanges = params.getContentChanges();
|
||||
final Function1<TextDocumentContentChangeEvent, TextEdit> _function_1 = (TextDocumentContentChangeEvent event) -> {
|
||||
Range _range = event.getRange();
|
||||
String _text = event.getText();
|
||||
return new TextEdit(_range, _text);
|
||||
};
|
||||
List<TextEdit> _map = ListExtensions.<TextDocumentContentChangeEvent, TextEdit>map(_contentChanges, _function_1);
|
||||
this.workspaceManager.didChange(_uri_1, _version, _map, cancelIndicator);
|
||||
this.workspaceManager.didChange(this._uriExtensions.toUri(params.getTextDocument().getUri()), params.getTextDocument().getVersion(), ListExtensions.<TextDocumentContentChangeEvent, TextEdit>map(params.getContentChanges(), _function_1), cancelIndicator);
|
||||
return null;
|
||||
};
|
||||
this.requestManager.<Object>runWrite(_function);
|
||||
|
@ -291,10 +268,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
@Override
|
||||
public void didClose(final DidCloseTextDocumentParams params) {
|
||||
final Function1<CancelIndicator, Object> _function = (CancelIndicator cancelIndicator) -> {
|
||||
TextDocumentIdentifier _textDocument = params.getTextDocument();
|
||||
String _uri = _textDocument.getUri();
|
||||
URI _uri_1 = this._uriExtensions.toUri(_uri);
|
||||
this.workspaceManager.didClose(_uri_1, cancelIndicator);
|
||||
this.workspaceManager.didClose(this._uriExtensions.toUri(params.getTextDocument().getUri()), cancelIndicator);
|
||||
return null;
|
||||
};
|
||||
this.requestManager.<Object>runWrite(_function);
|
||||
|
@ -314,13 +288,11 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
FileChangeType _type = fileEvent.getType();
|
||||
boolean _tripleEquals = (_type == FileChangeType.Deleted);
|
||||
if (_tripleEquals) {
|
||||
String _uri = fileEvent.getUri();
|
||||
URI _uri_1 = this._uriExtensions.toUri(_uri);
|
||||
deletedFiles.add(_uri_1);
|
||||
URI _uri = this._uriExtensions.toUri(fileEvent.getUri());
|
||||
deletedFiles.add(_uri);
|
||||
} else {
|
||||
String _uri_2 = fileEvent.getUri();
|
||||
URI _uri_3 = this._uriExtensions.toUri(_uri_2);
|
||||
dirtyFiles.add(_uri_3);
|
||||
URI _uri_1 = this._uriExtensions.toUri(fileEvent.getUri());
|
||||
dirtyFiles.add(_uri_1);
|
||||
}
|
||||
}
|
||||
this.workspaceManager.doBuild(dirtyFiles, deletedFiles, cancelIndicator);
|
||||
|
@ -345,14 +317,11 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
private void publishDiagnostics(final URI uri, final Iterable<? extends Issue> issues) {
|
||||
PublishDiagnosticsParams _publishDiagnosticsParams = new PublishDiagnosticsParams();
|
||||
final Procedure1<PublishDiagnosticsParams> _function = (PublishDiagnosticsParams it) -> {
|
||||
String _path = this._uriExtensions.toPath(uri);
|
||||
it.setUri(_path);
|
||||
it.setUri(this._uriExtensions.toPath(uri));
|
||||
final Function1<Issue, Diagnostic> _function_1 = (Issue it_1) -> {
|
||||
return this.toDiagnostic(it_1);
|
||||
};
|
||||
Iterable<Diagnostic> _map = IterableExtensions.map(issues, _function_1);
|
||||
List<Diagnostic> _list = IterableExtensions.<Diagnostic>toList(_map);
|
||||
it.setDiagnostics(_list);
|
||||
it.setDiagnostics(IterableExtensions.<Diagnostic>toList(IterableExtensions.map(issues, _function_1)));
|
||||
};
|
||||
final PublishDiagnosticsParams diagnostics = ObjectExtensions.<PublishDiagnosticsParams>operator_doubleArrow(_publishDiagnosticsParams, _function);
|
||||
this.client.publishDiagnostics(diagnostics);
|
||||
|
@ -361,8 +330,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
private Diagnostic toDiagnostic(final Issue issue) {
|
||||
Diagnostic _diagnostic = new Diagnostic();
|
||||
final Procedure1<Diagnostic> _function = (Diagnostic it) -> {
|
||||
String _code = issue.getCode();
|
||||
it.setCode(_code);
|
||||
it.setCode(issue.getCode());
|
||||
DiagnosticSeverity _switchResult = null;
|
||||
Severity _severity = issue.getSeverity();
|
||||
if (_severity != null) {
|
||||
|
@ -384,8 +352,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
_switchResult = DiagnosticSeverity.Hint;
|
||||
}
|
||||
it.setSeverity(_switchResult);
|
||||
String _message = issue.getMessage();
|
||||
it.setMessage(_message);
|
||||
it.setMessage(issue.getMessage());
|
||||
Integer _elvis = null;
|
||||
Integer _lineNumber = issue.getLineNumber();
|
||||
if (_lineNumber != null) {
|
||||
|
@ -422,9 +389,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
public CompletableFuture<CompletionList> completion(final TextDocumentPositionParams params) {
|
||||
final Function1<CancelIndicator, CompletionList> _function = (CancelIndicator origialCancelIndicator) -> {
|
||||
final LanguageServerImpl.BufferedCancelIndicator cancelIndicator = new LanguageServerImpl.BufferedCancelIndicator(origialCancelIndicator);
|
||||
TextDocumentIdentifier _textDocument = params.getTextDocument();
|
||||
String _uri = _textDocument.getUri();
|
||||
final URI uri = this._uriExtensions.toUri(_uri);
|
||||
final URI uri = this._uriExtensions.toUri(params.getTextDocument().getUri());
|
||||
final IResourceServiceProvider resourceServiceProvider = this.languagesRegistry.getResourceServiceProvider(uri);
|
||||
ContentAssistService _get = null;
|
||||
if (resourceServiceProvider!=null) {
|
||||
|
@ -446,9 +411,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
@Override
|
||||
public CompletableFuture<List<? extends Location>> definition(final TextDocumentPositionParams params) {
|
||||
final Function1<CancelIndicator, List<? extends Location>> _function = (CancelIndicator cancelIndicator) -> {
|
||||
TextDocumentIdentifier _textDocument = params.getTextDocument();
|
||||
String _uri = _textDocument.getUri();
|
||||
final URI uri = this._uriExtensions.toUri(_uri);
|
||||
final URI uri = this._uriExtensions.toUri(params.getTextDocument().getUri());
|
||||
final IResourceServiceProvider resourceServiceProvider = this.languagesRegistry.getResourceServiceProvider(uri);
|
||||
DocumentSymbolService _get = null;
|
||||
if (resourceServiceProvider!=null) {
|
||||
|
@ -459,8 +422,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
return CollectionLiterals.<Location>emptyList();
|
||||
}
|
||||
final Function2<Document, XtextResource, List<? extends Location>> _function_1 = (Document document, XtextResource resource) -> {
|
||||
Position _position = params.getPosition();
|
||||
final int offset = document.getOffSet(_position);
|
||||
final int offset = document.getOffSet(params.getPosition());
|
||||
return documentSymbolService.getDefinitions(resource, offset, this.resourceAccess, cancelIndicator);
|
||||
};
|
||||
final List<? extends Location> definitions = this.workspaceManager.<List<? extends Location>>doRead(uri, _function_1);
|
||||
|
@ -472,9 +434,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
@Override
|
||||
public CompletableFuture<List<? extends Location>> references(final ReferenceParams params) {
|
||||
final Function1<CancelIndicator, List<? extends Location>> _function = (CancelIndicator cancelIndicator) -> {
|
||||
TextDocumentIdentifier _textDocument = params.getTextDocument();
|
||||
String _uri = _textDocument.getUri();
|
||||
final URI uri = this._uriExtensions.toUri(_uri);
|
||||
final URI uri = this._uriExtensions.toUri(params.getTextDocument().getUri());
|
||||
final IResourceServiceProvider resourceServiceProvider = this.languagesRegistry.getResourceServiceProvider(uri);
|
||||
DocumentSymbolService _get = null;
|
||||
if (resourceServiceProvider!=null) {
|
||||
|
@ -485,11 +445,9 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
return CollectionLiterals.<Location>emptyList();
|
||||
}
|
||||
final Function2<Document, XtextResource, List<Location>> _function_1 = (Document document, XtextResource resource) -> {
|
||||
Position _position = params.getPosition();
|
||||
final int offset = document.getOffSet(_position);
|
||||
final int offset = document.getOffSet(params.getPosition());
|
||||
List<? extends Location> _xifexpression = null;
|
||||
ReferenceContext _context = params.getContext();
|
||||
boolean _isIncludeDeclaration = _context.isIncludeDeclaration();
|
||||
boolean _isIncludeDeclaration = params.getContext().isIncludeDeclaration();
|
||||
if (_isIncludeDeclaration) {
|
||||
_xifexpression = documentSymbolService.getDefinitions(resource, offset, this.resourceAccess, cancelIndicator);
|
||||
} else {
|
||||
|
@ -509,9 +467,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
@Override
|
||||
public CompletableFuture<List<? extends SymbolInformation>> documentSymbol(final DocumentSymbolParams params) {
|
||||
final Function1<CancelIndicator, List<? extends SymbolInformation>> _function = (CancelIndicator cancelIndicator) -> {
|
||||
TextDocumentIdentifier _textDocument = params.getTextDocument();
|
||||
String _uri = _textDocument.getUri();
|
||||
final URI uri = this._uriExtensions.toUri(_uri);
|
||||
final URI uri = this._uriExtensions.toUri(params.getTextDocument().getUri());
|
||||
final IResourceServiceProvider resourceServiceProvider = this.languagesRegistry.getResourceServiceProvider(uri);
|
||||
DocumentSymbolService _get = null;
|
||||
if (resourceServiceProvider!=null) {
|
||||
|
@ -533,8 +489,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
public CompletableFuture<List<? extends SymbolInformation>> symbol(final WorkspaceSymbolParams params) {
|
||||
final Function1<CancelIndicator, List<? extends SymbolInformation>> _function = (CancelIndicator cancelIndicator) -> {
|
||||
final IResourceDescriptions indexData = this.workspaceManager.getIndex();
|
||||
String _query = params.getQuery();
|
||||
return this.workspaceSymbolService.getSymbols(_query, this.resourceAccess, indexData, cancelIndicator);
|
||||
return this.workspaceSymbolService.getSymbols(params.getQuery(), this.resourceAccess, indexData, cancelIndicator);
|
||||
};
|
||||
return this.requestManager.<List<? extends SymbolInformation>>runRead(_function);
|
||||
}
|
||||
|
@ -542,9 +497,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
@Override
|
||||
public CompletableFuture<Hover> hover(final TextDocumentPositionParams params) {
|
||||
final Function1<CancelIndicator, Hover> _function = (CancelIndicator cancelIndicator) -> {
|
||||
TextDocumentIdentifier _textDocument = params.getTextDocument();
|
||||
String _uri = _textDocument.getUri();
|
||||
final URI uri = this._uriExtensions.toUri(_uri);
|
||||
final URI uri = this._uriExtensions.toUri(params.getTextDocument().getUri());
|
||||
final IResourceServiceProvider resourceServiceProvider = this.languagesRegistry.getResourceServiceProvider(uri);
|
||||
HoverService _get = null;
|
||||
if (resourceServiceProvider!=null) {
|
||||
|
@ -556,8 +509,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
return new Hover(_emptyList, null);
|
||||
}
|
||||
final Function2<Document, XtextResource, Hover> _function_1 = (Document document, XtextResource resource) -> {
|
||||
Position _position = params.getPosition();
|
||||
final int offset = document.getOffSet(_position);
|
||||
final int offset = document.getOffSet(params.getPosition());
|
||||
return hoverService.hover(resource, offset);
|
||||
};
|
||||
return this.workspaceManager.<Hover>doRead(uri, _function_1);
|
||||
|
@ -573,9 +525,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
@Override
|
||||
public CompletableFuture<SignatureHelp> signatureHelp(final TextDocumentPositionParams position) {
|
||||
final Function1<CancelIndicator, SignatureHelp> _function = (CancelIndicator cancelIndicator) -> {
|
||||
TextDocumentIdentifier _textDocument = position.getTextDocument();
|
||||
String _uri = _textDocument.getUri();
|
||||
final URI uri = this._uriExtensions.toUri(_uri);
|
||||
final URI uri = this._uriExtensions.toUri(position.getTextDocument().getUri());
|
||||
final IResourceServiceProvider serviceProvider = this.languagesRegistry.getResourceServiceProvider(uri);
|
||||
ISignatureHelpService _get = null;
|
||||
if (serviceProvider!=null) {
|
||||
|
@ -586,8 +536,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
return new SignatureHelp();
|
||||
}
|
||||
final Function2<Document, XtextResource, SignatureHelp> _function_1 = (Document doc, XtextResource resource) -> {
|
||||
Position _position = position.getPosition();
|
||||
final int offset = doc.getOffSet(_position);
|
||||
final int offset = doc.getOffSet(position.getPosition());
|
||||
return helper.getSignatureHelp(resource, offset);
|
||||
};
|
||||
return this.workspaceManager.<SignatureHelp>doRead(uri, _function_1);
|
||||
|
@ -598,9 +547,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
@Override
|
||||
public CompletableFuture<List<? extends DocumentHighlight>> documentHighlight(final TextDocumentPositionParams position) {
|
||||
final Function1<CancelIndicator, List<? extends DocumentHighlight>> _function = (CancelIndicator cancelIndicator) -> {
|
||||
TextDocumentIdentifier _textDocument = position.getTextDocument();
|
||||
String _uri = _textDocument.getUri();
|
||||
final URI uri = this._uriExtensions.toUri(_uri);
|
||||
final URI uri = this._uriExtensions.toUri(position.getTextDocument().getUri());
|
||||
final IResourceServiceProvider serviceProvider = this.languagesRegistry.getResourceServiceProvider(uri);
|
||||
IDocumentHighlightService _get = null;
|
||||
if (serviceProvider!=null) {
|
||||
|
@ -611,8 +558,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
return CollectionLiterals.<DocumentHighlight>emptyList();
|
||||
}
|
||||
final Function2<Document, XtextResource, List<? extends DocumentHighlight>> _function_1 = (Document doc, XtextResource resource) -> {
|
||||
Position _position = position.getPosition();
|
||||
final int offset = doc.getOffSet(_position);
|
||||
final int offset = doc.getOffSet(position.getPosition());
|
||||
return service.getDocumentHighlights(resource, offset);
|
||||
};
|
||||
return this.workspaceManager.<List<? extends DocumentHighlight>>doRead(uri, _function_1);
|
||||
|
@ -638,9 +584,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
@Override
|
||||
public CompletableFuture<List<? extends TextEdit>> formatting(final DocumentFormattingParams params) {
|
||||
final Function1<CancelIndicator, List<? extends TextEdit>> _function = (CancelIndicator cancelIndicator) -> {
|
||||
TextDocumentIdentifier _textDocument = params.getTextDocument();
|
||||
String _uri = _textDocument.getUri();
|
||||
final URI uri = this._uriExtensions.toUri(_uri);
|
||||
final URI uri = this._uriExtensions.toUri(params.getTextDocument().getUri());
|
||||
final IResourceServiceProvider resourceServiceProvider = this.languagesRegistry.getResourceServiceProvider(uri);
|
||||
FormattingService _get = null;
|
||||
if (resourceServiceProvider!=null) {
|
||||
|
@ -652,8 +596,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
}
|
||||
final Function2<Document, XtextResource, List<TextEdit>> _function_1 = (Document document, XtextResource resource) -> {
|
||||
final int offset = 0;
|
||||
String _contents = document.getContents();
|
||||
final int length = _contents.length();
|
||||
final int length = document.getContents().length();
|
||||
if (((length == 0) || resource.getContents().isEmpty())) {
|
||||
return CollectionLiterals.<TextEdit>emptyList();
|
||||
}
|
||||
|
@ -667,9 +610,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
@Override
|
||||
public CompletableFuture<List<? extends TextEdit>> rangeFormatting(final DocumentRangeFormattingParams params) {
|
||||
final Function1<CancelIndicator, List<? extends TextEdit>> _function = (CancelIndicator cancelIndicator) -> {
|
||||
TextDocumentIdentifier _textDocument = params.getTextDocument();
|
||||
String _uri = _textDocument.getUri();
|
||||
final URI uri = this._uriExtensions.toUri(_uri);
|
||||
final URI uri = this._uriExtensions.toUri(params.getTextDocument().getUri());
|
||||
final IResourceServiceProvider resourceServiceProvider = this.languagesRegistry.getResourceServiceProvider(uri);
|
||||
FormattingService _get = null;
|
||||
if (resourceServiceProvider!=null) {
|
||||
|
@ -680,12 +621,8 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
return Collections.<TextEdit>emptyList();
|
||||
}
|
||||
final Function2<Document, XtextResource, List<TextEdit>> _function_1 = (Document document, XtextResource resource) -> {
|
||||
Range _range = params.getRange();
|
||||
Position _start = _range.getStart();
|
||||
final int offset = document.getOffSet(_start);
|
||||
Range _range_1 = params.getRange();
|
||||
Position _end = _range_1.getEnd();
|
||||
int _offSet = document.getOffSet(_end);
|
||||
final int offset = document.getOffSet(params.getRange().getStart());
|
||||
int _offSet = document.getOffSet(params.getRange().getEnd());
|
||||
final int length = (_offSet - offset);
|
||||
return formatterService.format(resource, document, offset, length);
|
||||
};
|
||||
|
@ -759,14 +696,9 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
}
|
||||
synchronized (this.extensionProviders) {
|
||||
final LinkedHashMap<String, JsonRpcMethod> supportedMethods = CollectionLiterals.<String, JsonRpcMethod>newLinkedHashMap();
|
||||
Class<? extends LanguageServerImpl> _class = this.getClass();
|
||||
Map<String, JsonRpcMethod> _supportedMethods = ServiceEndpoints.getSupportedMethods(_class);
|
||||
supportedMethods.putAll(_supportedMethods);
|
||||
supportedMethods.putAll(ServiceEndpoints.getSupportedMethods(this.getClass()));
|
||||
final LinkedHashMap<String, JsonRpcMethod> extensions = CollectionLiterals.<String, JsonRpcMethod>newLinkedHashMap();
|
||||
Map<String, Object> _extensionToFactoryMap = this.languagesRegistry.getExtensionToFactoryMap();
|
||||
Collection<Object> _values = _extensionToFactoryMap.values();
|
||||
Set<Object> _set = IterableExtensions.<Object>toSet(_values);
|
||||
Iterable<IResourceServiceProvider> _filter = Iterables.<IResourceServiceProvider>filter(_set, IResourceServiceProvider.class);
|
||||
Iterable<IResourceServiceProvider> _filter = Iterables.<IResourceServiceProvider>filter(IterableExtensions.<Object>toSet(this.languagesRegistry.getExtensionToFactoryMap().values()), IResourceServiceProvider.class);
|
||||
for (final IResourceServiceProvider resourceServiceProvider : _filter) {
|
||||
{
|
||||
final ILanguageServerExtension ext = resourceServiceProvider.<ILanguageServerExtension>get(ILanguageServerExtension.class);
|
||||
|
@ -776,41 +708,33 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
if ((ext instanceof JsonRpcMethodProvider)) {
|
||||
_xifexpression = ((JsonRpcMethodProvider)ext).supportedMethods();
|
||||
} else {
|
||||
Class<? extends ILanguageServerExtension> _class_1 = ext.getClass();
|
||||
_xifexpression = ServiceEndpoints.getSupportedMethods(_class_1);
|
||||
_xifexpression = ServiceEndpoints.getSupportedMethods(ext.getClass());
|
||||
}
|
||||
final Map<String, JsonRpcMethod> supportedExtensions = _xifexpression;
|
||||
Set<Map.Entry<String, JsonRpcMethod>> _entrySet = supportedExtensions.entrySet();
|
||||
for (final Map.Entry<String, JsonRpcMethod> entry : _entrySet) {
|
||||
String _key = entry.getKey();
|
||||
boolean _containsKey = supportedMethods.containsKey(_key);
|
||||
boolean _containsKey = supportedMethods.containsKey(entry.getKey());
|
||||
if (_containsKey) {
|
||||
String _key_1 = entry.getKey();
|
||||
String _plus = ("The json rpc method \'" + _key_1);
|
||||
String _key = entry.getKey();
|
||||
String _plus = ("The json rpc method \'" + _key);
|
||||
String _plus_1 = (_plus + "\' can not be an extension as it is already defined in the LSP standard.");
|
||||
LanguageServerImpl.LOG.error(_plus_1);
|
||||
} else {
|
||||
String _key_2 = entry.getKey();
|
||||
JsonRpcMethod _value = entry.getValue();
|
||||
final JsonRpcMethod existing = extensions.put(_key_2, _value);
|
||||
final JsonRpcMethod existing = extensions.put(entry.getKey(), entry.getValue());
|
||||
if (((existing != null) && (!Objects.equal(existing, entry.getValue())))) {
|
||||
String _key_3 = entry.getKey();
|
||||
String _plus_2 = ("An incompatible LSP extension \'" + _key_3);
|
||||
String _key_1 = entry.getKey();
|
||||
String _plus_2 = ("An incompatible LSP extension \'" + _key_1);
|
||||
String _plus_3 = (_plus_2 + "\' has already been registered. Using 1 ignoring 2. \n1 : ");
|
||||
String _plus_4 = (_plus_3 + existing);
|
||||
String _plus_5 = (_plus_4 + " \n2 : ");
|
||||
JsonRpcMethod _value_1 = entry.getValue();
|
||||
String _plus_6 = (_plus_5 + _value_1);
|
||||
JsonRpcMethod _value = entry.getValue();
|
||||
String _plus_6 = (_plus_5 + _value);
|
||||
LanguageServerImpl.LOG.error(_plus_6);
|
||||
String _key_4 = entry.getKey();
|
||||
extensions.put(_key_4, existing);
|
||||
extensions.put(entry.getKey(), existing);
|
||||
} else {
|
||||
final Endpoint endpoint = ServiceEndpoints.toEndpoint(ext);
|
||||
String _key_5 = entry.getKey();
|
||||
this.extensionProviders.put(_key_5, endpoint);
|
||||
String _key_6 = entry.getKey();
|
||||
JsonRpcMethod _value_2 = entry.getValue();
|
||||
supportedMethods.put(_key_6, _value_2);
|
||||
this.extensionProviders.put(entry.getKey(), endpoint);
|
||||
supportedMethods.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -826,14 +750,12 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
@Override
|
||||
public <T extends Object> CompletableFuture<T> doRead(final String uri, final Function<ILanguageServerAccess.Context, T> function) {
|
||||
final Function1<CancelIndicator, T> _function = (CancelIndicator cancelIndicator) -> {
|
||||
URI _uri = LanguageServerImpl.this._uriExtensions.toUri(uri);
|
||||
final Function2<Document, XtextResource, T> _function_1 = (Document document, XtextResource resource) -> {
|
||||
URI _uRI = resource.getURI();
|
||||
boolean _isDocumentOpen = LanguageServerImpl.this.workspaceManager.isDocumentOpen(_uRI);
|
||||
boolean _isDocumentOpen = LanguageServerImpl.this.workspaceManager.isDocumentOpen(resource.getURI());
|
||||
final ILanguageServerAccess.Context ctx = new ILanguageServerAccess.Context(resource, document, _isDocumentOpen, cancelIndicator);
|
||||
return function.apply(ctx);
|
||||
};
|
||||
return LanguageServerImpl.this.workspaceManager.<T>doRead(_uri, _function_1);
|
||||
return LanguageServerImpl.this.workspaceManager.<T>doRead(LanguageServerImpl.this._uriExtensions.toUri(uri), _function_1);
|
||||
};
|
||||
return LanguageServerImpl.this.requestManager.<T>runRead(_function);
|
||||
}
|
||||
|
@ -856,12 +778,9 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
IResourceDescription _new = it.getNew();
|
||||
return Boolean.valueOf((_new != null));
|
||||
};
|
||||
Iterable<IResourceDescription.Delta> _filter = IterableExtensions.<IResourceDescription.Delta>filter(deltas, _function);
|
||||
final Function1<IResourceDescription.Delta, String> _function_1 = (IResourceDescription.Delta it) -> {
|
||||
URI _uri = it.getUri();
|
||||
return _uri.toString();
|
||||
return it.getUri().toString();
|
||||
};
|
||||
Iterable<String> _map = IterableExtensions.<IResourceDescription.Delta, String>map(_filter, _function_1);
|
||||
final Consumer<String> _function_2 = (String it) -> {
|
||||
final Function<ILanguageServerAccess.Context, Void> _function_3 = (ILanguageServerAccess.Context ctx) -> {
|
||||
boolean _isDocumentOpen = ctx.isDocumentOpen();
|
||||
|
@ -870,8 +789,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
if ((_resource instanceof XtextResource)) {
|
||||
Resource _resource_1 = ctx.getResource();
|
||||
final XtextResource resource = ((XtextResource) _resource_1);
|
||||
URI _uRI = resource.getURI();
|
||||
final IResourceServiceProvider serviceProvider = this.languagesRegistry.getResourceServiceProvider(_uRI);
|
||||
final IResourceServiceProvider serviceProvider = this.languagesRegistry.getResourceServiceProvider(resource.getURI());
|
||||
IColoringService _get = null;
|
||||
if (serviceProvider!=null) {
|
||||
_get=serviceProvider.<IColoringService>get(IColoringService.class);
|
||||
|
@ -883,8 +801,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
boolean _isNullOrEmpty = IterableExtensions.isNullOrEmpty(coloringInfos);
|
||||
boolean _not = (!_isNullOrEmpty);
|
||||
if (_not) {
|
||||
URI _uRI_1 = resource.getURI();
|
||||
final String uri = _uRI_1.toString();
|
||||
final String uri = resource.getURI().toString();
|
||||
ColoringParams _coloringParams = new ColoringParams(uri, coloringInfos);
|
||||
((LanguageClientExtensions)this.client).updateColoring(_coloringParams);
|
||||
}
|
||||
|
@ -896,7 +813,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
};
|
||||
this.access.<Void>doRead(it, _function_3);
|
||||
};
|
||||
_map.forEach(_function_2);
|
||||
IterableExtensions.<IResourceDescription.Delta, String>map(IterableExtensions.<IResourceDescription.Delta>filter(deltas, _function), _function_1).forEach(_function_2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,17 +37,14 @@ public class MultiProjectWorkspaceConfig implements IWorkspaceConfig {
|
|||
|
||||
@Override
|
||||
public IProjectConfig findProjectContaining(final URI member) {
|
||||
Collection<IProjectConfig> _values = this.name2config.values();
|
||||
final Function1<IProjectConfig, Boolean> _function = (IProjectConfig it) -> {
|
||||
ISourceFolder _findSourceFolderContaining = it.findSourceFolderContaining(member);
|
||||
return Boolean.valueOf((_findSourceFolderContaining != null));
|
||||
};
|
||||
Iterable<IProjectConfig> _filter = IterableExtensions.<IProjectConfig>filter(_values, _function);
|
||||
final Function1<IProjectConfig, Integer> _function_1 = (IProjectConfig it) -> {
|
||||
URI _path = it.getPath();
|
||||
return Integer.valueOf(_path.segmentCount());
|
||||
return Integer.valueOf(it.getPath().segmentCount());
|
||||
};
|
||||
return IterableExtensions.<IProjectConfig, Integer>maxBy(_filter, _function_1);
|
||||
return IterableExtensions.<IProjectConfig, Integer>maxBy(IterableExtensions.<IProjectConfig>filter(this.name2config.values(), _function), _function_1);
|
||||
}
|
||||
|
||||
public MultiProjectWorkspaceConfig(final Map<String, IProjectConfig> name2config) {
|
||||
|
|
|
@ -37,19 +37,16 @@ public class MultiProjectWorkspaceConfigFactory implements IWorkspaceConfigFacto
|
|||
final HashMap<String, IProjectConfig> name2config = CollectionLiterals.<String, IProjectConfig>newHashMap();
|
||||
final MultiProjectWorkspaceConfig result = new MultiProjectWorkspaceConfig(name2config);
|
||||
final IAcceptor<IProjectConfig> _function = (IProjectConfig it) -> {
|
||||
String _name = it.getName();
|
||||
name2config.put(_name, it);
|
||||
name2config.put(it.getName(), it);
|
||||
};
|
||||
final IAcceptor<IProjectConfig> acceptor = _function;
|
||||
File[] _listFiles = baseFile.listFiles();
|
||||
final Function1<File, Boolean> _function_1 = (File it) -> {
|
||||
return Boolean.valueOf(it.isDirectory());
|
||||
};
|
||||
Iterable<File> _filter = IterableExtensions.<File>filter(((Iterable<File>)Conversions.doWrapArray(_listFiles)), _function_1);
|
||||
final Consumer<File> _function_2 = (File it) -> {
|
||||
this.addProjectConfigs(URI.createFileURI(it.getAbsolutePath()), result, acceptor);
|
||||
};
|
||||
_filter.forEach(_function_2);
|
||||
IterableExtensions.<File>filter(((Iterable<File>)Conversions.doWrapArray(baseFile.listFiles())), _function_1).forEach(_function_2);
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -13,7 +13,6 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
|
@ -96,15 +95,13 @@ public class ProjectManager {
|
|||
|
||||
public IncrementalBuilder.Result doInitialBuild(final CancelIndicator cancelIndicator) {
|
||||
final ArrayList<URI> uris = CollectionLiterals.<URI>newArrayList();
|
||||
Set<? extends ISourceFolder> _sourceFolders = this.projectConfig.getSourceFolders();
|
||||
final Consumer<ISourceFolder> _function = (ISourceFolder it) -> {
|
||||
URI _path = it.getPath();
|
||||
final IAcceptor<URI> _function_1 = (URI it_1) -> {
|
||||
uris.add(it_1);
|
||||
};
|
||||
this.fileSystemScanner.scan(_path, _function_1);
|
||||
this.fileSystemScanner.scan(it.getPath(), _function_1);
|
||||
};
|
||||
_sourceFolders.forEach(_function);
|
||||
this.projectConfig.getSourceFolders().forEach(_function);
|
||||
return this.doBuild(uris, CollectionLiterals.<URI>emptyList(), cancelIndicator);
|
||||
}
|
||||
|
||||
|
@ -116,10 +113,7 @@ public class ProjectManager {
|
|||
final IncrementalBuilder.Result result = this.incrementalBuilder.build(request, _function);
|
||||
this.indexState = result.getIndexState();
|
||||
this.resourceSet = request.getResourceSet();
|
||||
Map<String, ResourceDescriptionsData> _get = this.indexProvider.get();
|
||||
String _name = this.projectDescription.getName();
|
||||
ResourceDescriptionsData _resourceDescriptions = this.indexState.getResourceDescriptions();
|
||||
_get.put(_name, _resourceDescriptions);
|
||||
this.indexProvider.get().put(this.projectDescription.getName(), this.indexState.getResourceDescriptions());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -127,10 +121,8 @@ public class ProjectManager {
|
|||
BuildRequest _buildRequest = new BuildRequest();
|
||||
final Procedure1<BuildRequest> _function = (BuildRequest it) -> {
|
||||
it.setBaseDir(this.baseDir);
|
||||
ResourceDescriptionsData _resourceDescriptions = this.indexState.getResourceDescriptions();
|
||||
ResourceDescriptionsData _copy = _resourceDescriptions.copy();
|
||||
Source2GeneratedMapping _fileMappings = this.indexState.getFileMappings();
|
||||
Source2GeneratedMapping _copy_1 = _fileMappings.copy();
|
||||
ResourceDescriptionsData _copy = this.indexState.getResourceDescriptions().copy();
|
||||
Source2GeneratedMapping _copy_1 = this.indexState.getFileMappings().copy();
|
||||
IndexState _indexState = new IndexState(_copy, _copy_1);
|
||||
it.setState(_indexState);
|
||||
it.setResourceSet(this.createFreshResourceSet(it.getState().getResourceDescriptions()));
|
||||
|
@ -153,8 +145,7 @@ public class ProjectManager {
|
|||
ProjectConfigAdapter.install(it, this.projectConfig);
|
||||
Map<String, ResourceDescriptionsData> _get_1 = this.indexProvider.get();
|
||||
final ChunkedResourceDescriptions index = new ChunkedResourceDescriptions(_get_1, it);
|
||||
String _name = this.projectDescription.getName();
|
||||
index.setContainer(_name, newIndex);
|
||||
index.setContainer(this.projectDescription.getName(), newIndex);
|
||||
this.externalContentSupport.configureResourceSet(it, this.openedDocumentsContentProvider);
|
||||
};
|
||||
return ObjectExtensions.<XtextResourceSet>operator_doubleArrow(_get, _function);
|
||||
|
|
|
@ -10,7 +10,6 @@ package org.eclipse.xtext.ide.server;
|
|||
import com.google.common.base.Objects;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Injector;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.FileOutputStream;
|
||||
|
@ -38,15 +37,15 @@ public class ServerLauncher {
|
|||
private static boolean IS_DEBUG = false;
|
||||
|
||||
public static void main(final String[] args) {
|
||||
ServerLauncher.IS_DEBUG = IterableExtensions.<String>exists(((Iterable<String>)Conversions.doWrapArray(args)), ((Function1<String, Boolean>) (String it) -> {
|
||||
final Function1<String, Boolean> _function = (String it) -> {
|
||||
return Boolean.valueOf(Objects.equal(it, "debug"));
|
||||
}));
|
||||
};
|
||||
ServerLauncher.IS_DEBUG = IterableExtensions.<String>exists(((Iterable<String>)Conversions.doWrapArray(args)), _function);
|
||||
final InputStream stdin = System.in;
|
||||
final PrintStream stdout = System.out;
|
||||
ServerLauncher.redirectStandardStreams();
|
||||
ServerModule _serverModule = new ServerModule();
|
||||
Injector _createInjector = Guice.createInjector(_serverModule);
|
||||
final ServerLauncher launcher = _createInjector.<ServerLauncher>getInstance(ServerLauncher.class);
|
||||
final ServerLauncher launcher = Guice.createInjector(_serverModule).<ServerLauncher>getInstance(ServerLauncher.class);
|
||||
launcher.start(stdin, stdout);
|
||||
}
|
||||
|
||||
|
@ -58,8 +57,7 @@ public class ServerLauncher {
|
|||
System.err.println("Starting Xtext Language Server.");
|
||||
PrintWriter _printWriter = new PrintWriter(System.out);
|
||||
final Launcher<LanguageClient> launcher = Launcher.<LanguageClient>createLauncher(this.languageServer, LanguageClient.class, in, out, true, _printWriter);
|
||||
LanguageClient _remoteProxy = launcher.getRemoteProxy();
|
||||
this.languageServer.connect(_remoteProxy);
|
||||
this.languageServer.connect(launcher.getRemoteProxy());
|
||||
final Future<?> future = launcher.startListening();
|
||||
System.err.println("started.");
|
||||
while ((!future.isDone())) {
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
package org.eclipse.xtext.ide.server;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.binder.AnnotatedBindingBuilder;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import org.eclipse.lsp4j.services.LanguageServer;
|
||||
import org.eclipse.xtext.ide.ExecutorServiceProvider;
|
||||
|
@ -31,18 +29,11 @@ import org.eclipse.xtext.resource.containers.ProjectDescriptionBasedContainerMan
|
|||
public class ServerModule extends AbstractModule {
|
||||
@Override
|
||||
protected void configure() {
|
||||
Binder _binder = this.binder();
|
||||
AnnotatedBindingBuilder<ExecutorService> _bind = _binder.<ExecutorService>bind(ExecutorService.class);
|
||||
_bind.toProvider(ExecutorServiceProvider.class);
|
||||
AnnotatedBindingBuilder<LanguageServer> _bind_1 = this.<LanguageServer>bind(LanguageServer.class);
|
||||
_bind_1.to(LanguageServerImpl.class);
|
||||
AnnotatedBindingBuilder<IResourceServiceProvider.Registry> _bind_2 = this.<IResourceServiceProvider.Registry>bind(IResourceServiceProvider.Registry.class);
|
||||
_bind_2.toProvider(ResourceServiceProviderServiceLoader.class);
|
||||
AnnotatedBindingBuilder<IWorkspaceConfigFactory> _bind_3 = this.<IWorkspaceConfigFactory>bind(IWorkspaceConfigFactory.class);
|
||||
_bind_3.to(ProjectWorkspaceConfigFactory.class);
|
||||
AnnotatedBindingBuilder<IProjectDescriptionFactory> _bind_4 = this.<IProjectDescriptionFactory>bind(IProjectDescriptionFactory.class);
|
||||
_bind_4.to(DefaultProjectDescriptionFactory.class);
|
||||
AnnotatedBindingBuilder<IContainer.Manager> _bind_5 = this.<IContainer.Manager>bind(IContainer.Manager.class);
|
||||
_bind_5.to(ProjectDescriptionBasedContainerManager.class);
|
||||
this.binder().<ExecutorService>bind(ExecutorService.class).toProvider(ExecutorServiceProvider.class);
|
||||
this.<LanguageServer>bind(LanguageServer.class).to(LanguageServerImpl.class);
|
||||
this.<IResourceServiceProvider.Registry>bind(IResourceServiceProvider.Registry.class).toProvider(ResourceServiceProviderServiceLoader.class);
|
||||
this.<IWorkspaceConfigFactory>bind(IWorkspaceConfigFactory.class).to(ProjectWorkspaceConfigFactory.class);
|
||||
this.<IProjectDescriptionFactory>bind(IProjectDescriptionFactory.class).to(DefaultProjectDescriptionFactory.class);
|
||||
this.<IContainer.Manager>bind(IContainer.Manager.class).to(ProjectDescriptionBasedContainerManager.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
*/
|
||||
package org.eclipse.xtext.ide.server;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -59,17 +58,18 @@ public class TopologicalSorter {
|
|||
cyclicAcceptor.apply(t);
|
||||
}
|
||||
};
|
||||
this.name2entry = IterableExtensions.<String, TopologicalSorter.Entry>toMap(IterableExtensions.<ProjectDescription, TopologicalSorter.Entry>map(descriptions, ((Function1<ProjectDescription, TopologicalSorter.Entry>) (ProjectDescription it) -> {
|
||||
final Function1<ProjectDescription, TopologicalSorter.Entry> _function = (ProjectDescription it) -> {
|
||||
return new TopologicalSorter.Entry(it);
|
||||
})), ((Function1<TopologicalSorter.Entry, String>) (TopologicalSorter.Entry it) -> {
|
||||
};
|
||||
final Function1<TopologicalSorter.Entry, String> _function_1 = (TopologicalSorter.Entry it) -> {
|
||||
return it.description.getName();
|
||||
}));
|
||||
};
|
||||
this.name2entry = IterableExtensions.<String, TopologicalSorter.Entry>toMap(IterableExtensions.<ProjectDescription, TopologicalSorter.Entry>map(descriptions, _function), _function_1);
|
||||
this.result = CollectionLiterals.<ProjectDescription>newLinkedHashSet();
|
||||
Collection<TopologicalSorter.Entry> _values = this.name2entry.values();
|
||||
final Consumer<TopologicalSorter.Entry> _function = (TopologicalSorter.Entry it) -> {
|
||||
final Consumer<TopologicalSorter.Entry> _function_2 = (TopologicalSorter.Entry it) -> {
|
||||
this.visit(it);
|
||||
};
|
||||
_values.forEach(_function);
|
||||
this.name2entry.values().forEach(_function_2);
|
||||
_xblockexpression = IterableExtensions.<ProjectDescription>toList(this.result);
|
||||
}
|
||||
return _xblockexpression;
|
||||
|
|
|
@ -20,20 +20,15 @@ import org.eclipse.emf.common.util.URI;
|
|||
@SuppressWarnings("all")
|
||||
public class UriExtensions {
|
||||
public URI toUri(final String pathWithScheme) {
|
||||
java.net.URI _create = java.net.URI.create(pathWithScheme);
|
||||
String _path = this.toPath(_create);
|
||||
return URI.createURI(_path);
|
||||
return URI.createURI(this.toPath(java.net.URI.create(pathWithScheme)));
|
||||
}
|
||||
|
||||
public String toPath(final URI uri) {
|
||||
String _string = uri.toString();
|
||||
java.net.URI _create = java.net.URI.create(_string);
|
||||
return this.toPath(_create);
|
||||
return this.toPath(java.net.URI.create(uri.toString()));
|
||||
}
|
||||
|
||||
public String toPath(final java.net.URI uri) {
|
||||
final Path path = Paths.get(uri);
|
||||
java.net.URI _uri = path.toUri();
|
||||
return _uri.toString();
|
||||
return path.toUri().toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.util.function.Consumer;
|
|||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.emf.ecore.resource.URIConverter;
|
||||
import org.eclipse.lsp4j.TextEdit;
|
||||
import org.eclipse.xtext.ide.server.BuildManager;
|
||||
import org.eclipse.xtext.ide.server.Document;
|
||||
|
@ -28,13 +27,10 @@ import org.eclipse.xtext.ide.server.ILanguageServerAccess;
|
|||
import org.eclipse.xtext.ide.server.IProjectDescriptionFactory;
|
||||
import org.eclipse.xtext.ide.server.IWorkspaceConfigFactory;
|
||||
import org.eclipse.xtext.ide.server.ProjectManager;
|
||||
import org.eclipse.xtext.nodemodel.ICompositeNode;
|
||||
import org.eclipse.xtext.parser.IParseResult;
|
||||
import org.eclipse.xtext.resource.IExternalContentSupport;
|
||||
import org.eclipse.xtext.resource.IResourceDescription;
|
||||
import org.eclipse.xtext.resource.IResourceDescriptions;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.eclipse.xtext.resource.XtextResourceSet;
|
||||
import org.eclipse.xtext.resource.impl.ChunkedResourceDescriptions;
|
||||
import org.eclipse.xtext.resource.impl.ProjectDescription;
|
||||
import org.eclipse.xtext.resource.impl.ResourceDescriptionsData;
|
||||
|
@ -118,18 +114,13 @@ public class WorkspaceManager {
|
|||
}
|
||||
|
||||
protected void refreshWorkspaceConfig(final CancelIndicator cancelIndicator) {
|
||||
IWorkspaceConfig _workspaceConfig = this.workspaceConfigFactory.getWorkspaceConfig(this.baseDir);
|
||||
this.workspaceConfig = _workspaceConfig;
|
||||
this.workspaceConfig = this.workspaceConfigFactory.getWorkspaceConfig(this.baseDir);
|
||||
final ArrayList<ProjectDescription> newProjects = CollectionLiterals.<ProjectDescription>newArrayList();
|
||||
Set<String> _keySet = this.projectName2ProjectManager.keySet();
|
||||
final HashSet<Set<String>> remainingProjectNames = CollectionLiterals.<Set<String>>newHashSet(_keySet);
|
||||
Set<? extends IProjectConfig> _projects = this.workspaceConfig.getProjects();
|
||||
final HashSet<Set<String>> remainingProjectNames = CollectionLiterals.<Set<String>>newHashSet(this.projectName2ProjectManager.keySet());
|
||||
final Consumer<IProjectConfig> _function = (IProjectConfig projectConfig) -> {
|
||||
String _name = projectConfig.getName();
|
||||
boolean _containsKey = this.projectName2ProjectManager.containsKey(_name);
|
||||
boolean _containsKey = this.projectName2ProjectManager.containsKey(projectConfig.getName());
|
||||
if (_containsKey) {
|
||||
String _name_1 = projectConfig.getName();
|
||||
remainingProjectNames.remove(_name_1);
|
||||
remainingProjectNames.remove(projectConfig.getName());
|
||||
} else {
|
||||
final ProjectManager projectManager = this.projectManagerProvider.get();
|
||||
final ProjectDescription projectDescription = this.projectDescriptionFactory.getProjectDescription(projectConfig);
|
||||
|
@ -137,12 +128,11 @@ public class WorkspaceManager {
|
|||
return this.fullIndex;
|
||||
};
|
||||
projectManager.initialize(projectDescription, projectConfig, this.issueAcceptor, this.openedDocumentsContentProvider, _function_1, cancelIndicator);
|
||||
String _name_2 = projectDescription.getName();
|
||||
this.projectName2ProjectManager.put(_name_2, projectManager);
|
||||
this.projectName2ProjectManager.put(projectDescription.getName(), projectManager);
|
||||
newProjects.add(projectDescription);
|
||||
}
|
||||
};
|
||||
_projects.forEach(_function);
|
||||
this.workspaceConfig.getProjects().forEach(_function);
|
||||
for (final Set<String> deletedProject : remainingProjectNames) {
|
||||
{
|
||||
this.projectName2ProjectManager.remove(deletedProject);
|
||||
|
@ -180,8 +170,7 @@ public class WorkspaceManager {
|
|||
|
||||
public ProjectManager getProjectManager(final URI uri) {
|
||||
final IProjectConfig projectConfig = this.workspaceConfig.findProjectContaining(uri);
|
||||
String _name = projectConfig.getName();
|
||||
return this.projectName2ProjectManager.get(_name);
|
||||
return this.projectName2ProjectManager.get(projectConfig.getName());
|
||||
}
|
||||
|
||||
public ProjectManager getProjectManager(final String projectName) {
|
||||
|
@ -201,10 +190,8 @@ public class WorkspaceManager {
|
|||
return;
|
||||
}
|
||||
final Document contents = this.openDocuments.get(uri);
|
||||
Document _applyChanges = contents.applyChanges(changes);
|
||||
this.openDocuments.put(uri, _applyChanges);
|
||||
ArrayList<URI> _newArrayList = CollectionLiterals.<URI>newArrayList();
|
||||
this.doBuild(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(uri)), _newArrayList, cancelIndicator);
|
||||
this.openDocuments.put(uri, contents.applyChanges(changes));
|
||||
this.doBuild(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(uri)), CollectionLiterals.<URI>newArrayList(), cancelIndicator);
|
||||
}
|
||||
|
||||
public List<IResourceDescription.Delta> didOpen(final URI uri, final int version, final String contents, final CancelIndicator cancelIndicator) {
|
||||
|
@ -212,8 +199,7 @@ public class WorkspaceManager {
|
|||
{
|
||||
Document _document = new Document(version, contents);
|
||||
this.openDocuments.put(uri, _document);
|
||||
ArrayList<URI> _newArrayList = CollectionLiterals.<URI>newArrayList();
|
||||
_xblockexpression = this.doBuild(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(uri)), _newArrayList, cancelIndicator);
|
||||
_xblockexpression = this.doBuild(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(uri)), CollectionLiterals.<URI>newArrayList(), cancelIndicator);
|
||||
}
|
||||
return _xblockexpression;
|
||||
}
|
||||
|
@ -225,11 +211,9 @@ public class WorkspaceManager {
|
|||
List<IResourceDescription.Delta> _xifexpression = null;
|
||||
boolean _exists = this.exists(uri);
|
||||
if (_exists) {
|
||||
ArrayList<URI> _newArrayList = CollectionLiterals.<URI>newArrayList();
|
||||
_xifexpression = this.doBuild(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(uri)), _newArrayList, cancelIndicator);
|
||||
_xifexpression = this.doBuild(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(uri)), CollectionLiterals.<URI>newArrayList(), cancelIndicator);
|
||||
} else {
|
||||
ArrayList<URI> _newArrayList_1 = CollectionLiterals.<URI>newArrayList();
|
||||
_xifexpression = this.doBuild(_newArrayList_1, Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(uri)), cancelIndicator);
|
||||
_xifexpression = this.doBuild(CollectionLiterals.<URI>newArrayList(), Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(uri)), cancelIndicator);
|
||||
}
|
||||
_xblockexpression = _xifexpression;
|
||||
}
|
||||
|
@ -237,10 +221,7 @@ public class WorkspaceManager {
|
|||
}
|
||||
|
||||
protected boolean exists(final URI uri) {
|
||||
ProjectManager _projectManager = this.getProjectManager(uri);
|
||||
XtextResourceSet _resourceSet = _projectManager.getResourceSet();
|
||||
URIConverter _uRIConverter = _resourceSet.getURIConverter();
|
||||
return _uRIConverter.exists(uri, null);
|
||||
return this.getProjectManager(uri).getResourceSet().getURIConverter().exists(uri, null);
|
||||
}
|
||||
|
||||
public <T extends Object> T doRead(final URI uri, final Function2<? super Document, ? super XtextResource, ? extends T> work) {
|
||||
|
@ -255,14 +236,11 @@ public class WorkspaceManager {
|
|||
|
||||
protected Document getDocument(final XtextResource resource) {
|
||||
Document _elvis = null;
|
||||
URI _uRI = resource.getURI();
|
||||
Document _get = this.openDocuments.get(_uRI);
|
||||
Document _get = this.openDocuments.get(resource.getURI());
|
||||
if (_get != null) {
|
||||
_elvis = _get;
|
||||
} else {
|
||||
IParseResult _parseResult = resource.getParseResult();
|
||||
ICompositeNode _rootNode = _parseResult.getRootNode();
|
||||
String _text = _rootNode.getText();
|
||||
String _text = resource.getParseResult().getRootNode().getText();
|
||||
Document _document = new Document(1, _text);
|
||||
_elvis = _document;
|
||||
}
|
||||
|
|
|
@ -66,13 +66,11 @@ public class ContentAssistService {
|
|||
final CompletionList result = new CompletionList();
|
||||
result.setIsIncomplete(true);
|
||||
final IdeContentProposalAcceptor acceptor = this.proposalAcceptorProvider.get();
|
||||
Position _position = params.getPosition();
|
||||
final int caretOffset = document.getOffSet(_position);
|
||||
final int caretOffset = document.getOffSet(params.getPosition());
|
||||
final Position caretPosition = params.getPosition();
|
||||
final TextRegion position = new TextRegion(caretOffset, 0);
|
||||
try {
|
||||
String _contents = document.getContents();
|
||||
this.createProposals(_contents, position, caretOffset, resource, acceptor);
|
||||
this.createProposals(document.getContents(), position, caretOffset, resource, acceptor);
|
||||
} catch (final Throwable _t) {
|
||||
if (_t instanceof Throwable) {
|
||||
final Throwable t = (Throwable)_t;
|
||||
|
@ -85,16 +83,13 @@ public class ContentAssistService {
|
|||
throw Exceptions.sneakyThrow(_t);
|
||||
}
|
||||
}
|
||||
Iterable<ContentAssistEntry> _entries = acceptor.getEntries();
|
||||
final Procedure2<ContentAssistEntry, Integer> _function = (ContentAssistEntry it, Integer idx) -> {
|
||||
final CompletionItem item = this.toCompletionItem(it, caretOffset, caretPosition, document);
|
||||
String _string = Integer.toString((idx).intValue());
|
||||
String _padStart = Strings.padStart(_string, 5, '0');
|
||||
item.setSortText(_padStart);
|
||||
item.setSortText(Strings.padStart(Integer.toString((idx).intValue()), 5, '0'));
|
||||
List<CompletionItem> _items = result.getItems();
|
||||
_items.add(item);
|
||||
};
|
||||
IterableExtensions.<ContentAssistEntry>forEach(_entries, _function);
|
||||
IterableExtensions.<ContentAssistEntry>forEach(acceptor.getEntries(), _function);
|
||||
return result;
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
|
@ -124,10 +119,8 @@ public class ContentAssistService {
|
|||
_elvis = _proposal;
|
||||
}
|
||||
completionItem.setLabel(_elvis);
|
||||
String _description = entry.getDescription();
|
||||
completionItem.setDetail(_description);
|
||||
String _documentation = entry.getDocumentation();
|
||||
completionItem.setDocumentation(_documentation);
|
||||
completionItem.setDetail(entry.getDescription());
|
||||
completionItem.setDocumentation(entry.getDocumentation());
|
||||
String _elvis_1 = null;
|
||||
String _prefix = entry.getPrefix();
|
||||
if (_prefix != null) {
|
||||
|
@ -142,8 +135,7 @@ public class ContentAssistService {
|
|||
String _proposal_1 = entry.getProposal();
|
||||
TextEdit _textEdit = new TextEdit(_range, _proposal_1);
|
||||
completionItem.setTextEdit(_textEdit);
|
||||
CompletionItemKind _translateKind = this.translateKind(entry);
|
||||
completionItem.setKind(_translateKind);
|
||||
completionItem.setKind(this.translateKind(entry));
|
||||
return completionItem;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,7 @@ public class WorkspaceResourceAccess implements IReferenceFinder.IResourceAccess
|
|||
public <R extends Object> R readOnly(final URI targetURI, final IUnitOfWork<R, ResourceSet> work) {
|
||||
final Function2<Document, XtextResource, R> _function = (Document document, XtextResource resource) -> {
|
||||
try {
|
||||
ResourceSet _resourceSet = resource.getResourceSet();
|
||||
return work.exec(_resourceSet);
|
||||
return work.exec(resource.getResourceSet());
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import com.google.inject.Inject;
|
|||
import com.google.inject.Provider;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.eclipse.lsp4j.Position;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
import org.eclipse.lsp4j.TextEdit;
|
||||
import org.eclipse.xtext.formatting2.FormatterRequest;
|
||||
|
@ -53,13 +52,9 @@ public class FormattingService {
|
|||
TextRegion _textRegion = new TextRegion(offset, length);
|
||||
final List<ITextReplacement> replacements = this.format2(resource, _textRegion, null);
|
||||
final Function1<ITextReplacement, TextEdit> _function = (ITextReplacement r) -> {
|
||||
String _replacementText = r.getReplacementText();
|
||||
int _offset = r.getOffset();
|
||||
int _length = r.getLength();
|
||||
return this.toTextEdit(document, _replacementText, _offset, _length);
|
||||
return this.toTextEdit(document, r.getReplacementText(), r.getOffset(), r.getLength());
|
||||
};
|
||||
List<TextEdit> _map = ListExtensions.<ITextReplacement, TextEdit>map(replacements, _function);
|
||||
return IterableExtensions.<TextEdit>toList(_map);
|
||||
return IterableExtensions.<TextEdit>toList(ListExtensions.<ITextReplacement, TextEdit>map(replacements, _function));
|
||||
} else {
|
||||
return CollectionLiterals.<TextEdit>newArrayList();
|
||||
}
|
||||
|
@ -71,10 +66,8 @@ public class FormattingService {
|
|||
it.setNewText(formattedText);
|
||||
Range _range = new Range();
|
||||
final Procedure1<Range> _function_1 = (Range it_1) -> {
|
||||
Position _position = document.getPosition(startOffset);
|
||||
it_1.setStart(_position);
|
||||
Position _position_1 = document.getPosition((startOffset + length));
|
||||
it_1.setEnd(_position_1);
|
||||
it_1.setStart(document.getPosition(startOffset));
|
||||
it_1.setEnd(document.getPosition((startOffset + length)));
|
||||
};
|
||||
Range _doubleArrow = ObjectExtensions.<Range>operator_doubleArrow(_range, _function_1);
|
||||
it.setRange(_doubleArrow);
|
||||
|
@ -92,8 +85,7 @@ public class FormattingService {
|
|||
if ((preferences != null)) {
|
||||
request.setPreferences(preferences);
|
||||
}
|
||||
TextRegionAccessBuilder _forNodeModel = this.regionBuilder.forNodeModel(resource);
|
||||
final ITextRegionAccess regionAccess = _forNodeModel.create();
|
||||
final ITextRegionAccess regionAccess = this.regionBuilder.forNodeModel(resource).create();
|
||||
request.setTextRegionAccess(regionAccess);
|
||||
final IFormatter2 formatter2 = this.formatter2Provider.get();
|
||||
final List<ITextReplacement> replacements = formatter2.format(request);
|
||||
|
|
|
@ -16,7 +16,6 @@ import org.eclipse.lsp4j.Hover;
|
|||
import org.eclipse.lsp4j.Range;
|
||||
import org.eclipse.xtext.documentation.IEObjectDocumentationProvider;
|
||||
import org.eclipse.xtext.ide.server.DocumentExtensions;
|
||||
import org.eclipse.xtext.nodemodel.ICompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.ILeafNode;
|
||||
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
|
||||
import org.eclipse.xtext.parser.IParseResult;
|
||||
|
@ -82,8 +81,7 @@ public class HoverService {
|
|||
final Function1<String, String> _function_1 = (String it) -> {
|
||||
return it;
|
||||
};
|
||||
List<String> _map = ListExtensions.map(contents, _function_1);
|
||||
b.setContents(_map);
|
||||
b.setContents(ListExtensions.map(contents, _function_1));
|
||||
};
|
||||
return ObjectExtensions.<Hover>operator_doubleArrow(_hover, _function);
|
||||
}
|
||||
|
@ -111,12 +109,9 @@ public class HoverService {
|
|||
if (_not) {
|
||||
final IParseResult parseResult = resource.getParseResult();
|
||||
if ((parseResult != null)) {
|
||||
ICompositeNode _rootNode = parseResult.getRootNode();
|
||||
ILeafNode leafNode = NodeModelUtils.findLeafNodeAtOffset(_rootNode, offset);
|
||||
ILeafNode leafNode = NodeModelUtils.findLeafNodeAtOffset(parseResult.getRootNode(), offset);
|
||||
if ((((leafNode != null) && leafNode.isHidden()) && (leafNode.getOffset() == offset))) {
|
||||
ICompositeNode _rootNode_1 = parseResult.getRootNode();
|
||||
ILeafNode _findLeafNodeAtOffset = NodeModelUtils.findLeafNodeAtOffset(_rootNode_1, (offset - 1));
|
||||
leafNode = _findLeafNodeAtOffset;
|
||||
leafNode = NodeModelUtils.findLeafNodeAtOffset(parseResult.getRootNode(), (offset - 1));
|
||||
}
|
||||
if ((leafNode != null)) {
|
||||
final ITextRegion leafRegion = leafNode.getTextRegion();
|
||||
|
|
|
@ -11,7 +11,6 @@ import com.google.inject.Inject;
|
|||
import com.google.inject.Provider;
|
||||
import com.google.inject.Singleton;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
@ -19,7 +18,6 @@ import org.eclipse.emf.common.util.TreeIterator;
|
|||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.emf.ecore.EClass;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.EReference;
|
||||
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||
import org.eclipse.emf.ecore.util.EcoreUtil;
|
||||
import org.eclipse.lsp4j.Location;
|
||||
|
@ -111,14 +109,11 @@ public class DocumentSymbolService {
|
|||
final ArrayList<Location> locations = CollectionLiterals.<Location>newArrayList();
|
||||
final TargetURIs targetURIs = this.collectTargetURIs(element);
|
||||
final IAcceptor<IReferenceDescription> _function = (IReferenceDescription reference) -> {
|
||||
URI _sourceEObjectUri = reference.getSourceEObjectUri();
|
||||
final Procedure1<EObject> _function_1 = (EObject obj) -> {
|
||||
EReference _eReference = reference.getEReference();
|
||||
int _indexInList = reference.getIndexInList();
|
||||
Location _newLocation = this._documentExtensions.newLocation(obj, _eReference, _indexInList);
|
||||
Location _newLocation = this._documentExtensions.newLocation(obj, reference.getEReference(), reference.getIndexInList());
|
||||
locations.add(_newLocation);
|
||||
};
|
||||
this.doRead(resourceAccess, _sourceEObjectUri, _function_1);
|
||||
this.doRead(resourceAccess, reference.getSourceEObjectUri(), _function_1);
|
||||
};
|
||||
ReferenceAcceptor _referenceAcceptor = new ReferenceAcceptor(this.resourceServiceProviderRegistry, _function);
|
||||
CancelIndicatorProgressMonitor _cancelIndicatorProgressMonitor = new CancelIndicatorProgressMonitor(cancelIndicator);
|
||||
|
@ -153,8 +148,7 @@ public class DocumentSymbolService {
|
|||
}
|
||||
}
|
||||
}
|
||||
Collection<SymbolInformation> _values = symbols.values();
|
||||
return IterableExtensions.<SymbolInformation>toList(_values);
|
||||
return IterableExtensions.<SymbolInformation>toList(symbols.values());
|
||||
}
|
||||
|
||||
protected EObject getContainer(final EObject obj) {
|
||||
|
@ -168,21 +162,17 @@ public class DocumentSymbolService {
|
|||
}
|
||||
final SymbolInformation symbol = new SymbolInformation();
|
||||
symbol.setName(symbolName);
|
||||
SymbolKind _symbolKind = this.getSymbolKind(object);
|
||||
symbol.setKind(_symbolKind);
|
||||
Location _newLocation = this._documentExtensions.newLocation(object);
|
||||
symbol.setLocation(_newLocation);
|
||||
symbol.setKind(this.getSymbolKind(object));
|
||||
symbol.setLocation(this._documentExtensions.newLocation(object));
|
||||
return symbol;
|
||||
}
|
||||
|
||||
protected String getSymbolName(final EObject object) {
|
||||
QualifiedName _fullyQualifiedName = this._iQualifiedNameProvider.getFullyQualifiedName(object);
|
||||
return this.getSymbolName(_fullyQualifiedName);
|
||||
return this.getSymbolName(this._iQualifiedNameProvider.getFullyQualifiedName(object));
|
||||
}
|
||||
|
||||
protected SymbolKind getSymbolKind(final EObject object) {
|
||||
EClass _eClass = object.eClass();
|
||||
return this.getSymbolKind(_eClass);
|
||||
return this.getSymbolKind(object.eClass());
|
||||
}
|
||||
|
||||
public List<? extends SymbolInformation> getSymbols(final IResourceDescription resourceDescription, final String query, final IReferenceFinder.IResourceAccess resourceAccess, final CancelIndicator cancelIndicator) {
|
||||
|
@ -196,12 +186,10 @@ public class DocumentSymbolService {
|
|||
final SymbolInformation symbol = this.createSymbol(description);
|
||||
if ((symbol != null)) {
|
||||
symbols.add(symbol);
|
||||
URI _eObjectURI = description.getEObjectURI();
|
||||
final Procedure1<EObject> _function = (EObject obj) -> {
|
||||
Location _newLocation = this._documentExtensions.newLocation(obj);
|
||||
symbol.setLocation(_newLocation);
|
||||
symbol.setLocation(this._documentExtensions.newLocation(obj));
|
||||
};
|
||||
this.doRead(resourceAccess, _eObjectURI, _function);
|
||||
this.doRead(resourceAccess, description.getEObjectURI(), _function);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -210,11 +198,7 @@ public class DocumentSymbolService {
|
|||
}
|
||||
|
||||
protected boolean filter(final IEObjectDescription description, final String query) {
|
||||
QualifiedName _qualifiedName = description.getQualifiedName();
|
||||
QualifiedName _lowerCase = _qualifiedName.toLowerCase();
|
||||
String _string = _lowerCase.toString();
|
||||
String _lowerCase_1 = query.toLowerCase();
|
||||
return _string.contains(_lowerCase_1);
|
||||
return description.getQualifiedName().toLowerCase().toString().contains(query.toLowerCase());
|
||||
}
|
||||
|
||||
protected SymbolInformation createSymbol(final IEObjectDescription description) {
|
||||
|
@ -224,19 +208,16 @@ public class DocumentSymbolService {
|
|||
}
|
||||
final SymbolInformation symbol = new SymbolInformation();
|
||||
symbol.setName(symbolName);
|
||||
SymbolKind _symbolKind = this.getSymbolKind(description);
|
||||
symbol.setKind(_symbolKind);
|
||||
symbol.setKind(this.getSymbolKind(description));
|
||||
return symbol;
|
||||
}
|
||||
|
||||
protected String getSymbolName(final IEObjectDescription description) {
|
||||
QualifiedName _qualifiedName = description.getQualifiedName();
|
||||
return this.getSymbolName(_qualifiedName);
|
||||
return this.getSymbolName(description.getQualifiedName());
|
||||
}
|
||||
|
||||
protected SymbolKind getSymbolKind(final IEObjectDescription description) {
|
||||
EClass _eClass = description.getEClass();
|
||||
return this.getSymbolKind(_eClass);
|
||||
return this.getSymbolKind(description.getEClass());
|
||||
}
|
||||
|
||||
protected String getSymbolName(final QualifiedName qualifiedName) {
|
||||
|
|
|
@ -12,7 +12,6 @@ import com.google.inject.Inject;
|
|||
import com.google.inject.Singleton;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.lsp4j.SymbolInformation;
|
||||
import org.eclipse.xtext.findReferences.IReferenceFinder;
|
||||
import org.eclipse.xtext.ide.server.symbol.DocumentSymbolService;
|
||||
|
@ -44,8 +43,7 @@ public class WorkspaceSymbolService {
|
|||
for (final IResourceDescription resourceDescription : _allResourceDescriptions) {
|
||||
{
|
||||
this.operationCanceledManager.checkCanceled(cancelIndicator);
|
||||
URI _uRI = resourceDescription.getURI();
|
||||
final IResourceServiceProvider resourceServiceProvider = this._registry.getResourceServiceProvider(_uRI);
|
||||
final IResourceServiceProvider resourceServiceProvider = this._registry.getResourceServiceProvider(resourceDescription.getURI());
|
||||
DocumentSymbolService _get = null;
|
||||
if (resourceServiceProvider!=null) {
|
||||
_get=resourceServiceProvider.<DocumentSymbolService>get(DocumentSymbolService.class);
|
||||
|
|
|
@ -20,12 +20,10 @@ import java.io.FileWriter;
|
|||
import java.net.URI;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Consumer;
|
||||
import org.eclipse.lsp4j.ColoringInformation;
|
||||
|
@ -47,7 +45,6 @@ import org.eclipse.lsp4j.Hover;
|
|||
import org.eclipse.lsp4j.InitializeParams;
|
||||
import org.eclipse.lsp4j.InitializeResult;
|
||||
import org.eclipse.lsp4j.Location;
|
||||
import org.eclipse.lsp4j.ParameterInformation;
|
||||
import org.eclipse.lsp4j.Position;
|
||||
import org.eclipse.lsp4j.PublishDiagnosticsParams;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
|
@ -56,7 +53,6 @@ import org.eclipse.lsp4j.ReferenceParams;
|
|||
import org.eclipse.lsp4j.SignatureHelp;
|
||||
import org.eclipse.lsp4j.SignatureInformation;
|
||||
import org.eclipse.lsp4j.SymbolInformation;
|
||||
import org.eclipse.lsp4j.SymbolKind;
|
||||
import org.eclipse.lsp4j.TextDocumentIdentifier;
|
||||
import org.eclipse.lsp4j.TextDocumentItem;
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams;
|
||||
|
@ -128,8 +124,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
final CancelIndicator _function = () -> {
|
||||
return false;
|
||||
};
|
||||
V _apply = writeRequest.apply(_function);
|
||||
return CompletableFuture.<V>completedFuture(_apply);
|
||||
return CompletableFuture.<V>completedFuture(writeRequest.apply(_function));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -137,27 +132,22 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
final CancelIndicator _function = () -> {
|
||||
return false;
|
||||
};
|
||||
V _apply = readRequest.apply(_function);
|
||||
return CompletableFuture.<V>completedFuture(_apply);
|
||||
return CompletableFuture.<V>completedFuture(readRequest.apply(_function));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
final Injector injector = Guice.createInjector(module);
|
||||
injector.injectMembers(this);
|
||||
Map<String, Object> _extensionToFactoryMap = this.resourceServerProviderRegistry.getExtensionToFactoryMap();
|
||||
final Object resourceServiceProvider = _extensionToFactoryMap.get(this.fileExtension);
|
||||
final Object resourceServiceProvider = this.resourceServerProviderRegistry.getExtensionToFactoryMap().get(this.fileExtension);
|
||||
if ((resourceServiceProvider instanceof IResourceServiceProvider)) {
|
||||
LanguageInfo _get = ((IResourceServiceProvider)resourceServiceProvider).<LanguageInfo>get(LanguageInfo.class);
|
||||
this.languageInfo = _get;
|
||||
this.languageInfo = ((IResourceServiceProvider)resourceServiceProvider).<LanguageInfo>get(LanguageInfo.class);
|
||||
}
|
||||
LanguageClientExtensions _serviceObject = ServiceEndpoints.<LanguageClientExtensions>toServiceObject(this, LanguageClientExtensions.class);
|
||||
this.languageServer.connect(_serviceObject);
|
||||
this.languageServer.connect(ServiceEndpoints.<LanguageClientExtensions>toServiceObject(this, LanguageClientExtensions.class));
|
||||
this.languageServer.supportedMethods();
|
||||
File _file = new File("");
|
||||
File _absoluteFile = _file.getAbsoluteFile();
|
||||
File _file_1 = new File(_absoluteFile, "/test-data/test-project");
|
||||
this.root = _file_1;
|
||||
File _absoluteFile = new File("").getAbsoluteFile();
|
||||
File _file = new File(_absoluteFile, "/test-data/test-project");
|
||||
this.root = _file;
|
||||
boolean _mkdirs = this.root.mkdirs();
|
||||
boolean _not = (!_mkdirs);
|
||||
if (_not) {
|
||||
|
@ -186,9 +176,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
protected LanguageInfo languageInfo;
|
||||
|
||||
protected Path getTestRootPath() {
|
||||
Path _path = this.root.toPath();
|
||||
Path _absolutePath = _path.toAbsolutePath();
|
||||
return _absolutePath.normalize();
|
||||
return this.root.toPath().toAbsolutePath().normalize();
|
||||
}
|
||||
|
||||
protected Path relativize(final String uri) {
|
||||
|
@ -197,8 +185,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
{
|
||||
URI _uRI = new URI(uri);
|
||||
final Path path = Paths.get(_uRI);
|
||||
Path _testRootPath = this.getTestRootPath();
|
||||
_xblockexpression = _testRootPath.relativize(path);
|
||||
_xblockexpression = this.getTestRootPath().relativize(path);
|
||||
}
|
||||
return _xblockexpression;
|
||||
} catch (Throwable _e) {
|
||||
|
@ -215,24 +202,20 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
InitializeParams _initializeParams = new InitializeParams();
|
||||
final Procedure1<InitializeParams> _function = (InitializeParams it) -> {
|
||||
it.setProcessId(Integer.valueOf(1));
|
||||
Path _testRootPath = this.getTestRootPath();
|
||||
String _string = _testRootPath.toString();
|
||||
it.setRootPath(_string);
|
||||
it.setRootPath(this.getTestRootPath().toString());
|
||||
};
|
||||
final InitializeParams params = ObjectExtensions.<InitializeParams>operator_doubleArrow(_initializeParams, _function);
|
||||
if (initializer!=null) {
|
||||
initializer.apply(((InitializeParams) params));
|
||||
}
|
||||
CompletableFuture<InitializeResult> _initialize = this.languageServer.initialize(params);
|
||||
return _initialize.get();
|
||||
return this.languageServer.initialize(params).get();
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void open(final String fileUri, final String model) {
|
||||
String _languageName = this.languageInfo.getLanguageName();
|
||||
this.open(fileUri, _languageName, model);
|
||||
this.open(fileUri, this.languageInfo.getLanguageName(), model);
|
||||
}
|
||||
|
||||
protected void open(final String fileUri, final String langaugeId, final String model) {
|
||||
|
@ -284,16 +267,12 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
public String writeFile(final String path, final CharSequence contents) {
|
||||
try {
|
||||
final File file = new File(this.root, path);
|
||||
File _parentFile = file.getParentFile();
|
||||
_parentFile.mkdirs();
|
||||
file.getParentFile().mkdirs();
|
||||
file.createNewFile();
|
||||
final FileWriter writer = new FileWriter(file);
|
||||
String _string = contents.toString();
|
||||
writer.write(_string);
|
||||
writer.write(contents.toString());
|
||||
writer.close();
|
||||
URI _uRI = file.toURI();
|
||||
URI _normalize = _uRI.normalize();
|
||||
return this._uriExtensions.toPath(_normalize);
|
||||
return this._uriExtensions.toPath(file.toURI().normalize());
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
|
@ -301,9 +280,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
|
||||
public String getVirtualFile(final String path) {
|
||||
final File file = new File(this.root, path);
|
||||
URI _uRI = file.toURI();
|
||||
URI _normalize = _uRI.normalize();
|
||||
return this._uriExtensions.toPath(_normalize);
|
||||
return this._uriExtensions.toPath(file.toURI().normalize());
|
||||
}
|
||||
|
||||
protected String _toExpectation(final List<?> elements) {
|
||||
|
@ -334,12 +311,10 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
|
||||
protected String _toExpectation(final Location it) {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
String _uri = it.getUri();
|
||||
Path _relativize = this.relativize(_uri);
|
||||
Path _relativize = this.relativize(it.getUri());
|
||||
_builder.append(_relativize);
|
||||
_builder.append(" ");
|
||||
Range _range = it.getRange();
|
||||
String _expectation = this.toExpectation(_range);
|
||||
String _expectation = this.toExpectation(it.getRange());
|
||||
_builder.append(_expectation);
|
||||
return _builder.toString();
|
||||
}
|
||||
|
@ -347,12 +322,10 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
protected String _toExpectation(final Range it) {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("[");
|
||||
Position _start = it.getStart();
|
||||
String _expectation = this.toExpectation(_start);
|
||||
String _expectation = this.toExpectation(it.getStart());
|
||||
_builder.append(_expectation);
|
||||
_builder.append(" .. ");
|
||||
Position _end = it.getEnd();
|
||||
String _expectation_1 = this.toExpectation(_end);
|
||||
String _expectation_1 = this.toExpectation(it.getEnd());
|
||||
_builder.append(_expectation_1);
|
||||
_builder.append("]");
|
||||
return _builder.toString();
|
||||
|
@ -379,25 +352,22 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
_builder.newLineIfNotEmpty();
|
||||
_builder.append(" ");
|
||||
_builder.append("kind: ");
|
||||
SymbolKind _kind = it.getKind();
|
||||
int _value = _kind.getValue();
|
||||
int _value = it.getKind().getValue();
|
||||
_builder.append(_value, " ");
|
||||
_builder.newLineIfNotEmpty();
|
||||
_builder.append(" ");
|
||||
_builder.append("location: ");
|
||||
Location _location = it.getLocation();
|
||||
String _expectation = this.toExpectation(_location);
|
||||
String _expectation = this.toExpectation(it.getLocation());
|
||||
_builder.append(_expectation, " ");
|
||||
_builder.newLineIfNotEmpty();
|
||||
{
|
||||
String _containerName = it.getContainerName();
|
||||
boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(_containerName);
|
||||
boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(it.getContainerName());
|
||||
boolean _not = (!_isNullOrEmpty);
|
||||
if (_not) {
|
||||
_builder.append(" ");
|
||||
_builder.append("container: \"");
|
||||
String _containerName_1 = it.getContainerName();
|
||||
_builder.append(_containerName_1, " ");
|
||||
String _containerName = it.getContainerName();
|
||||
_builder.append(_containerName, " ");
|
||||
_builder.append("\"");
|
||||
_builder.newLineIfNotEmpty();
|
||||
}
|
||||
|
@ -412,13 +382,12 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
String _label = it.getLabel();
|
||||
_builder.append(_label);
|
||||
{
|
||||
String _detail = it.getDetail();
|
||||
boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(_detail);
|
||||
boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(it.getDetail());
|
||||
boolean _not = (!_isNullOrEmpty);
|
||||
if (_not) {
|
||||
_builder.append(" (");
|
||||
String _detail_1 = it.getDetail();
|
||||
_builder.append(_detail_1);
|
||||
String _detail = it.getDetail();
|
||||
_builder.append(_detail);
|
||||
_builder.append(")");
|
||||
}
|
||||
}
|
||||
|
@ -427,8 +396,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
boolean _tripleNotEquals = (_textEdit != null);
|
||||
if (_tripleNotEquals) {
|
||||
_builder.append(" -> ");
|
||||
TextEdit _textEdit_1 = it.getTextEdit();
|
||||
String _expectation = this.toExpectation(_textEdit_1);
|
||||
String _expectation = this.toExpectation(it.getTextEdit());
|
||||
_builder.append(_expectation);
|
||||
} else {
|
||||
if (((it.getInsertText() != null) && (!Objects.equal(it.getInsertText(), it.getLabel())))) {
|
||||
|
@ -447,8 +415,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
String _newText = it.getNewText();
|
||||
_builder.append(_newText);
|
||||
_builder.append(" ");
|
||||
Range _range = it.getRange();
|
||||
String _expectation = this.toExpectation(_range);
|
||||
String _expectation = this.toExpectation(it.getRange());
|
||||
_builder.append(_expectation);
|
||||
_builder.newLineIfNotEmpty();
|
||||
return _builder.toString();
|
||||
|
@ -456,8 +423,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
|
||||
protected String _toExpectation(final Hover it) {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
Range _range = it.getRange();
|
||||
String _expectation = this.toExpectation(_range);
|
||||
String _expectation = this.toExpectation(it.getRange());
|
||||
_builder.append(_expectation);
|
||||
_builder.newLineIfNotEmpty();
|
||||
{
|
||||
|
@ -474,8 +440,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
protected String _toExpectation(final SignatureHelp it) {
|
||||
String _xblockexpression = null;
|
||||
{
|
||||
List<SignatureInformation> _signatures = it.getSignatures();
|
||||
int _size = _signatures.size();
|
||||
int _size = it.getSignatures().size();
|
||||
boolean _tripleEquals = (_size == 0);
|
||||
if (_tripleEquals) {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
|
@ -483,34 +448,26 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
Integer _activeSignature = it.getActiveSignature();
|
||||
_builder.append(_activeSignature);
|
||||
_builder.append(".");
|
||||
Integer _activeSignature_1 = it.getActiveSignature();
|
||||
Assert.assertNull(_builder.toString(), _activeSignature_1);
|
||||
Assert.assertNull(_builder.toString(),
|
||||
it.getActiveSignature());
|
||||
return "<empty>";
|
||||
}
|
||||
Integer _activeSignature_2 = it.getActiveSignature();
|
||||
Assert.assertNotNull("Active signature index must not be null when signatures are available.", _activeSignature_2);
|
||||
Assert.assertNotNull("Active signature index must not be null when signatures are available.", it.getActiveSignature());
|
||||
String _xifexpression = null;
|
||||
Integer _activeParameter = it.getActiveParameter();
|
||||
boolean _tripleEquals_1 = (_activeParameter == null);
|
||||
if (_tripleEquals_1) {
|
||||
_xifexpression = "<empty>";
|
||||
} else {
|
||||
List<SignatureInformation> _signatures_1 = it.getSignatures();
|
||||
Integer _activeSignature_3 = it.getActiveSignature();
|
||||
SignatureInformation _get = _signatures_1.get((_activeSignature_3).intValue());
|
||||
List<ParameterInformation> _parameters = _get.getParameters();
|
||||
Integer _activeParameter_1 = it.getActiveParameter();
|
||||
ParameterInformation _get_1 = _parameters.get((_activeParameter_1).intValue());
|
||||
_xifexpression = _get_1.getLabel();
|
||||
_xifexpression = it.getSignatures().get((it.getActiveSignature()).intValue()).getParameters().get(
|
||||
(it.getActiveParameter()).intValue()).getLabel();
|
||||
}
|
||||
final String param = _xifexpression;
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
List<SignatureInformation> _signatures_2 = it.getSignatures();
|
||||
final Function1<SignatureInformation, String> _function = (SignatureInformation it_1) -> {
|
||||
return it_1.getLabel();
|
||||
};
|
||||
List<String> _map = ListExtensions.<SignatureInformation, String>map(_signatures_2, _function);
|
||||
String _join = IterableExtensions.join(_map, " | ");
|
||||
String _join = IterableExtensions.join(ListExtensions.<SignatureInformation, String>map(it.getSignatures(), _function), " | ");
|
||||
_builder_1.append(_join);
|
||||
_builder_1.append(" | ");
|
||||
_builder_1.append(param);
|
||||
|
@ -529,8 +486,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
if (_tripleEquals) {
|
||||
_builder.append("[NaN, NaN]:[NaN, NaN]");
|
||||
} else {
|
||||
Range _range_1 = it.getRange();
|
||||
String _expectation = this.toExpectation(_range_1);
|
||||
String _expectation = this.toExpectation(it.getRange());
|
||||
_builder.append(_expectation);
|
||||
}
|
||||
}
|
||||
|
@ -542,8 +498,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
if (_tripleEquals_1) {
|
||||
_builder_1.append("NaN");
|
||||
} else {
|
||||
DocumentHighlightKind _kind_1 = it.getKind();
|
||||
String _expectation_1 = this.toExpectation(_kind_1);
|
||||
String _expectation_1 = this.toExpectation(it.getKind());
|
||||
_builder_1.append(_expectation_1);
|
||||
}
|
||||
}
|
||||
|
@ -555,52 +510,42 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
}
|
||||
|
||||
protected String _toExpectation(final DocumentHighlightKind kind) {
|
||||
String _string = kind.toString();
|
||||
String _substring = _string.substring(0, 1);
|
||||
return _substring.toUpperCase();
|
||||
return kind.toString().substring(0, 1).toUpperCase();
|
||||
}
|
||||
|
||||
protected String _toExpectation(final Map<Object, Object> it) {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
Set<Map.Entry<Object, Object>> _entrySet = it.entrySet();
|
||||
final Consumer<Map.Entry<Object, Object>> _function = (Map.Entry<Object, Object> it_1) -> {
|
||||
int _length = sb.length();
|
||||
boolean _greaterThan = (_length > 0);
|
||||
if (_greaterThan) {
|
||||
sb.append("\n");
|
||||
}
|
||||
Object _key = it_1.getKey();
|
||||
String _expectation = this.toExpectation(_key);
|
||||
sb.append(_expectation);
|
||||
sb.append(this.toExpectation(it_1.getKey()));
|
||||
sb.append(" ->");
|
||||
Object _value = it_1.getValue();
|
||||
if ((_value instanceof Iterable<?>)) {
|
||||
Object _value_1 = it_1.getValue();
|
||||
final Consumer<Object> _function_1 = (Object it_2) -> {
|
||||
sb.append("\n * ");
|
||||
String _expectation_1 = this.toExpectation(it_2);
|
||||
sb.append(_expectation_1);
|
||||
sb.append(this.toExpectation(it_2));
|
||||
};
|
||||
((Iterable<?>) _value_1).forEach(_function_1);
|
||||
} else {
|
||||
sb.append(" ");
|
||||
Object _value_2 = it_1.getValue();
|
||||
String _expectation_1 = this.toExpectation(_value_2);
|
||||
sb.append(_expectation_1);
|
||||
sb.append(this.toExpectation(it_1.getValue()));
|
||||
}
|
||||
};
|
||||
_entrySet.forEach(_function);
|
||||
it.entrySet().forEach(_function);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
protected String _toExpectation(final ColoringInformation it) {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
Range _range = it.getRange();
|
||||
String _expectation = this.toExpectation(_range);
|
||||
String _expectation = this.toExpectation(it.getRange());
|
||||
_builder.append(_expectation);
|
||||
_builder.append(" -> [");
|
||||
List<Integer> _styles = it.getStyles();
|
||||
String _join = IterableExtensions.join(_styles, ", ");
|
||||
String _join = IterableExtensions.join(it.getStyles(), ", ");
|
||||
_builder.append(_join);
|
||||
_builder.append("]");
|
||||
return _builder.toString();
|
||||
|
@ -612,8 +557,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
final TestCompletionConfiguration configuration = new TestCompletionConfiguration();
|
||||
configuration.setFilePath(("MyModel." + this.fileExtension));
|
||||
configurator.apply(configuration);
|
||||
FileInfo _initializeContext = this.initializeContext(configuration);
|
||||
final String filePath = _initializeContext.getUri();
|
||||
final String filePath = this.initializeContext(configuration).getUri();
|
||||
TextDocumentPositionParams _textDocumentPositionParams = new TextDocumentPositionParams();
|
||||
final Procedure1<TextDocumentPositionParams> _function = (TextDocumentPositionParams it) -> {
|
||||
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(filePath);
|
||||
|
@ -626,24 +570,17 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
TextDocumentPositionParams _doubleArrow = ObjectExtensions.<TextDocumentPositionParams>operator_doubleArrow(_textDocumentPositionParams, _function);
|
||||
final CompletableFuture<CompletionList> completionItems = this.languageServer.completion(_doubleArrow);
|
||||
final CompletionList list = completionItems.get();
|
||||
List<CompletionItem> _items = list.getItems();
|
||||
List<CompletionItem> _items_1 = list.getItems();
|
||||
final Function1<CompletionItem, String> _function_1 = (CompletionItem it) -> {
|
||||
return it.getSortText();
|
||||
};
|
||||
List<CompletionItem> _sortBy = IterableExtensions.<CompletionItem, String>sortBy(_items_1, _function_1);
|
||||
List<CompletionItem> _list = IterableExtensions.<CompletionItem>toList(_sortBy);
|
||||
Assert.assertEquals(_items, _list);
|
||||
Assert.assertEquals(list.getItems(), IterableExtensions.<CompletionItem>toList(IterableExtensions.<CompletionItem, String>sortBy(list.getItems(), _function_1)));
|
||||
Procedure1<? super CompletionList> _assertCompletionList = configuration.getAssertCompletionList();
|
||||
boolean _tripleNotEquals = (_assertCompletionList != null);
|
||||
if (_tripleNotEquals) {
|
||||
Procedure1<? super CompletionList> _assertCompletionList_1 = configuration.getAssertCompletionList();
|
||||
_assertCompletionList_1.apply(list);
|
||||
configuration.getAssertCompletionList().apply(list);
|
||||
} else {
|
||||
List<CompletionItem> _items_2 = list.getItems();
|
||||
final String actualCompletionItems = this.toExpectation(_items_2);
|
||||
String _expectedCompletionItems = configuration.getExpectedCompletionItems();
|
||||
this.assertEquals(_expectedCompletionItems, actualCompletionItems);
|
||||
final String actualCompletionItems = this.toExpectation(list.getItems());
|
||||
this.assertEquals(configuration.getExpectedCompletionItems(), actualCompletionItems);
|
||||
}
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
|
@ -652,41 +589,27 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
|
||||
protected FileInfo initializeContext(final TextDocumentConfiguration configuration) {
|
||||
this.initialize();
|
||||
Map<String, CharSequence> _filesInScope = configuration.getFilesInScope();
|
||||
boolean _isEmpty = _filesInScope.isEmpty();
|
||||
boolean _isEmpty = configuration.getFilesInScope().isEmpty();
|
||||
boolean _not = (!_isEmpty);
|
||||
if (_not) {
|
||||
Map<String, CharSequence> _filesInScope_1 = configuration.getFilesInScope();
|
||||
Set<Map.Entry<String, CharSequence>> _entrySet = _filesInScope_1.entrySet();
|
||||
final Function1<Map.Entry<String, CharSequence>, String> _function = (Map.Entry<String, CharSequence> it) -> {
|
||||
String _key = it.getKey();
|
||||
CharSequence _value = it.getValue();
|
||||
String _string = _value.toString();
|
||||
return this.writeFile(_key, _string);
|
||||
return this.writeFile(it.getKey(), it.getValue().toString());
|
||||
};
|
||||
final Iterable<String> createdFiles = IterableExtensions.<Map.Entry<String, CharSequence>, String>map(_entrySet, _function);
|
||||
final Iterable<String> createdFiles = IterableExtensions.<Map.Entry<String, CharSequence>, String>map(configuration.getFilesInScope().entrySet(), _function);
|
||||
this.didCreateWatchedFiles(((String[])Conversions.unwrapArray(createdFiles, String.class)));
|
||||
String _model = configuration.getModel();
|
||||
boolean _tripleEquals = (_model == null);
|
||||
if (_tripleEquals) {
|
||||
String _head = IterableExtensions.<String>head(createdFiles);
|
||||
Map<String, CharSequence> _filesInScope_2 = configuration.getFilesInScope();
|
||||
Set<Map.Entry<String, CharSequence>> _entrySet_1 = _filesInScope_2.entrySet();
|
||||
Map.Entry<String, CharSequence> _head_1 = IterableExtensions.<Map.Entry<String, CharSequence>>head(_entrySet_1);
|
||||
CharSequence _value = _head_1.getValue();
|
||||
String _string = _value.toString();
|
||||
String _string = IterableExtensions.<Map.Entry<String, CharSequence>>head(configuration.getFilesInScope().entrySet()).getValue().toString();
|
||||
return new FileInfo(_head, _string);
|
||||
}
|
||||
}
|
||||
Assert.assertNotNull(configuration.getModel());
|
||||
final String filePath = this.writeFile(configuration.getFilePath(), configuration.getModel());
|
||||
this.open(filePath, configuration.getModel());
|
||||
String _model_1 = configuration.getModel();
|
||||
Assert.assertNotNull(_model_1);
|
||||
String _filePath = configuration.getFilePath();
|
||||
String _model_2 = configuration.getModel();
|
||||
final String filePath = this.writeFile(_filePath, _model_2);
|
||||
String _model_3 = configuration.getModel();
|
||||
this.open(filePath, _model_3);
|
||||
String _model_4 = configuration.getModel();
|
||||
return new FileInfo(filePath, _model_4);
|
||||
return new FileInfo(filePath, _model_1);
|
||||
}
|
||||
|
||||
protected void testDefinition(final Procedure1<? super DefinitionTestConfiguration> configurator) {
|
||||
|
@ -695,8 +618,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
final DefinitionTestConfiguration configuration = new DefinitionTestConfiguration();
|
||||
configuration.setFilePath(("MyModel." + this.fileExtension));
|
||||
configurator.apply(configuration);
|
||||
FileInfo _initializeContext = this.initializeContext(configuration);
|
||||
final String fileUri = _initializeContext.getUri();
|
||||
final String fileUri = this.initializeContext(configuration).getUri();
|
||||
TextDocumentPositionParams _textDocumentPositionParams = new TextDocumentPositionParams();
|
||||
final Procedure1<TextDocumentPositionParams> _function = (TextDocumentPositionParams it) -> {
|
||||
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(fileUri);
|
||||
|
@ -712,12 +634,10 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
Procedure1<? super List<? extends Location>> _assertDefinitions = configuration.getAssertDefinitions();
|
||||
boolean _tripleNotEquals = (_assertDefinitions != null);
|
||||
if (_tripleNotEquals) {
|
||||
Procedure1<? super List<? extends Location>> _assertDefinitions_1 = configuration.getAssertDefinitions();
|
||||
_assertDefinitions_1.apply(definitions);
|
||||
configuration.getAssertDefinitions().apply(definitions);
|
||||
} else {
|
||||
final String actualDefinitions = this.toExpectation(definitions);
|
||||
String _expectedDefinitions = configuration.getExpectedDefinitions();
|
||||
this.assertEquals(_expectedDefinitions, actualDefinitions);
|
||||
this.assertEquals(configuration.getExpectedDefinitions(), actualDefinitions);
|
||||
}
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
|
@ -730,8 +650,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
final HoverTestConfiguration configuration = new HoverTestConfiguration();
|
||||
configuration.setFilePath(("MyModel." + this.fileExtension));
|
||||
configurator.apply(configuration);
|
||||
FileInfo _initializeContext = this.initializeContext(configuration);
|
||||
final String fileUri = _initializeContext.getUri();
|
||||
final String fileUri = this.initializeContext(configuration).getUri();
|
||||
TextDocumentPositionParams _textDocumentPositionParams = new TextDocumentPositionParams();
|
||||
final Procedure1<TextDocumentPositionParams> _function = (TextDocumentPositionParams it) -> {
|
||||
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(fileUri);
|
||||
|
@ -747,12 +666,10 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
Procedure1<? super Hover> _assertHover = configuration.getAssertHover();
|
||||
boolean _tripleNotEquals = (_assertHover != null);
|
||||
if (_tripleNotEquals) {
|
||||
Procedure1<? super Hover> _assertHover_1 = configuration.getAssertHover();
|
||||
_assertHover_1.apply(hover);
|
||||
configuration.getAssertHover().apply(hover);
|
||||
} else {
|
||||
final String actualHover = this.toExpectation(hover);
|
||||
String _expectedHover = configuration.getExpectedHover();
|
||||
this.assertEquals(_expectedHover, actualHover);
|
||||
this.assertEquals(configuration.getExpectedHover(), actualHover);
|
||||
}
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
|
@ -765,8 +682,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
final SignatureHelpConfiguration configuration = new SignatureHelpConfiguration();
|
||||
configuration.setFilePath(("MyModel." + this.fileExtension));
|
||||
configurator.apply(configuration);
|
||||
FileInfo _initializeContext = this.initializeContext(configuration);
|
||||
final String fileUri = _initializeContext.getUri();
|
||||
final String fileUri = this.initializeContext(configuration).getUri();
|
||||
TextDocumentPositionParams _textDocumentPositionParams = new TextDocumentPositionParams();
|
||||
final Procedure1<TextDocumentPositionParams> _function = (TextDocumentPositionParams it) -> {
|
||||
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(fileUri);
|
||||
|
@ -782,14 +698,10 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
Procedure1<? super SignatureHelp> _assertSignatureHelp = configuration.getAssertSignatureHelp();
|
||||
boolean _tripleNotEquals = (_assertSignatureHelp != null);
|
||||
if (_tripleNotEquals) {
|
||||
Procedure1<? super SignatureHelp> _assertSignatureHelp_1 = configuration.getAssertSignatureHelp();
|
||||
_assertSignatureHelp_1.apply(signatureHelp);
|
||||
configuration.getAssertSignatureHelp().apply(signatureHelp);
|
||||
} else {
|
||||
final String actualSignatureHelp = this.toExpectation(signatureHelp);
|
||||
String _expectedSignatureHelp = configuration.getExpectedSignatureHelp();
|
||||
String _trim = _expectedSignatureHelp.trim();
|
||||
String _trim_1 = actualSignatureHelp.trim();
|
||||
this.assertEquals(_trim, _trim_1);
|
||||
this.assertEquals(configuration.getExpectedSignatureHelp().trim(), actualSignatureHelp.trim());
|
||||
}
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
|
@ -808,8 +720,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
@Extension
|
||||
final DocumentHighlightConfiguration configuration = ObjectExtensions.<DocumentHighlightConfiguration>operator_doubleArrow(_documentHighlightConfiguration, _function);
|
||||
configurator.apply(configuration);
|
||||
FileInfo _initializeContext = this.initializeContext(configuration);
|
||||
final String fileUri = _initializeContext.getUri();
|
||||
final String fileUri = this.initializeContext(configuration).getUri();
|
||||
TextDocumentPositionParams _textDocumentPositionParams = new TextDocumentPositionParams();
|
||||
final Procedure1<TextDocumentPositionParams> _function_1 = (TextDocumentPositionParams it) -> {
|
||||
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(fileUri);
|
||||
|
@ -821,14 +732,11 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
};
|
||||
TextDocumentPositionParams _doubleArrow = ObjectExtensions.<TextDocumentPositionParams>operator_doubleArrow(_textDocumentPositionParams, _function_1);
|
||||
final CompletableFuture<List<? extends DocumentHighlight>> highlights = this.languageServer.documentHighlight(_doubleArrow);
|
||||
List<? extends DocumentHighlight> _get = highlights.get();
|
||||
final Function1<DocumentHighlight, String> _function_2 = (DocumentHighlight it) -> {
|
||||
return this.toExpectation(it);
|
||||
};
|
||||
List<String> _map = ListExtensions.map(_get, _function_2);
|
||||
final String actualDocumentHighlight = IterableExtensions.join(_map, " | ");
|
||||
String _expectedDocumentHighlight = configuration.getExpectedDocumentHighlight();
|
||||
this.assertEquals(_expectedDocumentHighlight, actualDocumentHighlight);
|
||||
final String actualDocumentHighlight = IterableExtensions.join(ListExtensions.map(highlights.get(), _function_2), " | ");
|
||||
this.assertEquals(configuration.getExpectedDocumentHighlight(), actualDocumentHighlight);
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
|
@ -840,8 +748,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
final DocumentSymbolConfiguraiton configuration = new DocumentSymbolConfiguraiton();
|
||||
configuration.setFilePath(("MyModel." + this.fileExtension));
|
||||
configurator.apply(configuration);
|
||||
FileInfo _initializeContext = this.initializeContext(configuration);
|
||||
final String fileUri = _initializeContext.getUri();
|
||||
final String fileUri = this.initializeContext(configuration).getUri();
|
||||
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(fileUri);
|
||||
DocumentSymbolParams _documentSymbolParams = new DocumentSymbolParams(_textDocumentIdentifier);
|
||||
final CompletableFuture<List<? extends SymbolInformation>> symbolsFuture = this.languageServer.documentSymbol(_documentSymbolParams);
|
||||
|
@ -849,12 +756,10 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
Procedure1<? super List<? extends SymbolInformation>> _assertSymbols = configuration.getAssertSymbols();
|
||||
boolean _tripleNotEquals = (_assertSymbols != null);
|
||||
if (_tripleNotEquals) {
|
||||
Procedure1<? super List<? extends SymbolInformation>> _assertSymbols_1 = configuration.getAssertSymbols();
|
||||
_assertSymbols_1.apply(symbols);
|
||||
configuration.getAssertSymbols().apply(symbols);
|
||||
} else {
|
||||
final String actualSymbols = this.toExpectation(symbols);
|
||||
String _expectedSymbols = configuration.getExpectedSymbols();
|
||||
this.assertEquals(_expectedSymbols, actualSymbols);
|
||||
this.assertEquals(configuration.getExpectedSymbols(), actualSymbols);
|
||||
}
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
|
@ -870,17 +775,14 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
this.initializeContext(configuration);
|
||||
String _query = configuration.getQuery();
|
||||
WorkspaceSymbolParams _workspaceSymbolParams = new WorkspaceSymbolParams(_query);
|
||||
CompletableFuture<List<? extends SymbolInformation>> _symbol = this.languageServer.symbol(_workspaceSymbolParams);
|
||||
final List<? extends SymbolInformation> symbols = _symbol.get();
|
||||
final List<? extends SymbolInformation> symbols = this.languageServer.symbol(_workspaceSymbolParams).get();
|
||||
Procedure1<? super List<? extends SymbolInformation>> _assertSymbols = configuration.getAssertSymbols();
|
||||
boolean _tripleNotEquals = (_assertSymbols != null);
|
||||
if (_tripleNotEquals) {
|
||||
Procedure1<? super List<? extends SymbolInformation>> _assertSymbols_1 = configuration.getAssertSymbols();
|
||||
_assertSymbols_1.apply(symbols);
|
||||
configuration.getAssertSymbols().apply(symbols);
|
||||
} else {
|
||||
final String actualSymbols = this.toExpectation(symbols);
|
||||
String _expectedSymbols = configuration.getExpectedSymbols();
|
||||
this.assertEquals(_expectedSymbols, actualSymbols);
|
||||
this.assertEquals(configuration.getExpectedSymbols(), actualSymbols);
|
||||
}
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
|
@ -893,8 +795,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
final ReferenceTestConfiguration configuration = new ReferenceTestConfiguration();
|
||||
configuration.setFilePath(("MyModel." + this.fileExtension));
|
||||
configurator.apply(configuration);
|
||||
FileInfo _initializeContext = this.initializeContext(configuration);
|
||||
final String fileUri = _initializeContext.getUri();
|
||||
final String fileUri = this.initializeContext(configuration).getUri();
|
||||
ReferenceParams _referenceParams = new ReferenceParams();
|
||||
final Procedure1<ReferenceParams> _function = (ReferenceParams it) -> {
|
||||
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(fileUri);
|
||||
|
@ -913,12 +814,10 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
Procedure1<? super List<? extends Location>> _assertReferences = configuration.getAssertReferences();
|
||||
boolean _tripleNotEquals = (_assertReferences != null);
|
||||
if (_tripleNotEquals) {
|
||||
Procedure1<? super List<? extends Location>> _assertReferences_1 = configuration.getAssertReferences();
|
||||
_assertReferences_1.apply(references);
|
||||
configuration.getAssertReferences().apply(references);
|
||||
} else {
|
||||
final String actualReferences = this.toExpectation(references);
|
||||
String _expectedReferences = configuration.getExpectedReferences();
|
||||
this.assertEquals(_expectedReferences, actualReferences);
|
||||
this.assertEquals(configuration.getExpectedReferences(), actualReferences);
|
||||
}
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
|
@ -926,9 +825,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
}
|
||||
|
||||
public void assertEquals(final String expected, final String actual) {
|
||||
String _replace = expected.replace("\t", " ");
|
||||
String _replace_1 = actual.replace("\t", " ");
|
||||
Assert.assertEquals(_replace, _replace_1);
|
||||
Assert.assertEquals(expected.replace("\t", " "), actual.replace("\t", " "));
|
||||
}
|
||||
|
||||
protected void testFormatting(final Procedure1<? super FormattingConfiguration> configurator) {
|
||||
|
@ -947,14 +844,8 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
DocumentFormattingParams _doubleArrow = ObjectExtensions.<DocumentFormattingParams>operator_doubleArrow(_documentFormattingParams, _function);
|
||||
final CompletableFuture<List<? extends TextEdit>> changes = this.languageServer.formatting(_doubleArrow);
|
||||
String _contents = fileInfo.getContents();
|
||||
Document _document = new Document(1, _contents);
|
||||
List<? extends TextEdit> _get = changes.get();
|
||||
ArrayList<TextEdit> _newArrayList = CollectionLiterals.<TextEdit>newArrayList(((TextEdit[])Conversions.unwrapArray(_get, TextEdit.class)));
|
||||
List<TextEdit> _reverse = ListExtensions.<TextEdit>reverse(_newArrayList);
|
||||
final Document result = _document.applyChanges(_reverse);
|
||||
String _expectedText = configuration.getExpectedText();
|
||||
String _contents_1 = result.getContents();
|
||||
this.assertEquals(_expectedText, _contents_1);
|
||||
final Document result = new Document(1, _contents).applyChanges(ListExtensions.<TextEdit>reverse(CollectionLiterals.<TextEdit>newArrayList(((TextEdit[])Conversions.unwrapArray(changes.get(), TextEdit.class)))));
|
||||
this.assertEquals(configuration.getExpectedText(), result.getContents());
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
|
@ -972,20 +863,13 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
String _uri = fileInfo.getUri();
|
||||
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(_uri);
|
||||
it.setTextDocument(_textDocumentIdentifier);
|
||||
Range _range = configuration.getRange();
|
||||
it.setRange(_range);
|
||||
it.setRange(configuration.getRange());
|
||||
};
|
||||
DocumentRangeFormattingParams _doubleArrow = ObjectExtensions.<DocumentRangeFormattingParams>operator_doubleArrow(_documentRangeFormattingParams, _function);
|
||||
final CompletableFuture<List<? extends TextEdit>> changes = this.languageServer.rangeFormatting(_doubleArrow);
|
||||
String _contents = fileInfo.getContents();
|
||||
Document _document = new Document(1, _contents);
|
||||
List<? extends TextEdit> _get = changes.get();
|
||||
ArrayList<TextEdit> _newArrayList = CollectionLiterals.<TextEdit>newArrayList(((TextEdit[])Conversions.unwrapArray(_get, TextEdit.class)));
|
||||
List<TextEdit> _reverse = ListExtensions.<TextEdit>reverse(_newArrayList);
|
||||
final Document result = _document.applyChanges(_reverse);
|
||||
String _expectedText = configuration.getExpectedText();
|
||||
String _contents_1 = result.getContents();
|
||||
this.assertEquals(_expectedText, _contents_1);
|
||||
final Document result = new Document(1, _contents).applyChanges(ListExtensions.<TextEdit>reverse(CollectionLiterals.<TextEdit>newArrayList(((TextEdit[])Conversions.unwrapArray(changes.get(), TextEdit.class)))));
|
||||
this.assertEquals(configuration.getExpectedText(), result.getContents());
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
|
@ -1007,12 +891,9 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
final Function1<Pair<String, Object>, Object> _function = (Pair<String, Object> it) -> {
|
||||
return it.getValue();
|
||||
};
|
||||
List<Object> _map = ListExtensions.<Pair<String, Object>, Object>map(this.notifications, _function);
|
||||
Iterable<PublishDiagnosticsParams> _filter = Iterables.<PublishDiagnosticsParams>filter(_map, PublishDiagnosticsParams.class);
|
||||
Iterable<PublishDiagnosticsParams> _filter = Iterables.<PublishDiagnosticsParams>filter(ListExtensions.<Pair<String, Object>, Object>map(this.notifications, _function), PublishDiagnosticsParams.class);
|
||||
for (final PublishDiagnosticsParams diagnostic : _filter) {
|
||||
String _uri = diagnostic.getUri();
|
||||
List<Diagnostic> _diagnostics = diagnostic.getDiagnostics();
|
||||
result.put(_uri, _diagnostics);
|
||||
result.put(diagnostic.getUri(), diagnostic.getDiagnostics());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -1021,15 +902,13 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
final Function1<Pair<String, Object>, Object> _function = (Pair<String, Object> it) -> {
|
||||
return it.getValue();
|
||||
};
|
||||
List<Object> _map = ListExtensions.<Pair<String, Object>, Object>map(this.notifications, _function);
|
||||
Iterable<ColoringParams> _filter = Iterables.<ColoringParams>filter(_map, ColoringParams.class);
|
||||
final Function1<ColoringParams, String> _function_1 = (ColoringParams it) -> {
|
||||
return it.getUri();
|
||||
};
|
||||
final Function1<ColoringParams, List<? extends ColoringInformation>> _function_2 = (ColoringParams it) -> {
|
||||
return it.getInfos();
|
||||
};
|
||||
return IterableExtensions.<ColoringParams, String, List<? extends ColoringInformation>>toMap(_filter, _function_1, _function_2);
|
||||
return IterableExtensions.<ColoringParams, String, List<? extends ColoringInformation>>toMap(Iterables.<ColoringParams>filter(ListExtensions.<Pair<String, Object>, Object>map(this.notifications, _function), ColoringParams.class), _function_1, _function_2);
|
||||
}
|
||||
|
||||
protected String toExpectation(final Object it) {
|
||||
|
|
|
@ -15,7 +15,6 @@ import com.google.inject.Inject;
|
|||
import com.google.inject.Provider;
|
||||
import com.google.inject.name.Named;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -23,7 +22,6 @@ import java.util.Set;
|
|||
import org.eclipse.emf.common.notify.Adapter;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.emf.ecore.resource.URIConverter;
|
||||
import org.eclipse.emf.ecore.resource.URIHandler;
|
||||
import org.eclipse.xtext.Constants;
|
||||
import org.eclipse.xtext.build.BuildRequest;
|
||||
|
@ -94,12 +92,9 @@ public abstract class AbstractIncrementalBuilderTest {
|
|||
protected List<Issue> clean() {
|
||||
List<Issue> _xblockexpression = null;
|
||||
{
|
||||
ArrayListMultimap<URI, URI> _create = ArrayListMultimap.<URI, URI>create();
|
||||
this.generated = _create;
|
||||
ArrayList<URI> _newArrayList = CollectionLiterals.<URI>newArrayList();
|
||||
this.deleted = _newArrayList;
|
||||
ArrayList<Issue> _newArrayList_1 = CollectionLiterals.<Issue>newArrayList();
|
||||
_xblockexpression = this.issues = _newArrayList_1;
|
||||
this.generated = ArrayListMultimap.<URI, URI>create();
|
||||
this.deleted = CollectionLiterals.<URI>newArrayList();
|
||||
_xblockexpression = this.issues = CollectionLiterals.<Issue>newArrayList();
|
||||
}
|
||||
return _xblockexpression;
|
||||
}
|
||||
|
@ -107,23 +102,18 @@ public abstract class AbstractIncrementalBuilderTest {
|
|||
protected IndexState build(final BuildRequest buildRequest) {
|
||||
this.clean();
|
||||
final Function1<URI, IResourceServiceProvider> _function = (URI it) -> {
|
||||
IResourceServiceProvider.Registry _languages = this.getLanguages();
|
||||
return _languages.getResourceServiceProvider(it);
|
||||
return this.getLanguages().getResourceServiceProvider(it);
|
||||
};
|
||||
IncrementalBuilder.Result _build = this.incrementalBuilder.build(buildRequest, _function);
|
||||
IndexState _indexState = _build.getIndexState();
|
||||
this.indexState = _indexState;
|
||||
this.indexState = this.incrementalBuilder.build(buildRequest, _function).getIndexState();
|
||||
return this.indexState;
|
||||
}
|
||||
|
||||
protected void withOutputConfig(final BuildRequest it, final Procedure1<? super OutputConfiguration> init) {
|
||||
Set<OutputConfiguration> _outputConfigurations = this.configurationProvider.getOutputConfigurations();
|
||||
final OutputConfiguration config = IterableExtensions.<OutputConfiguration>head(_outputConfigurations);
|
||||
final OutputConfiguration config = IterableExtensions.<OutputConfiguration>head(this.configurationProvider.getOutputConfigurations());
|
||||
init.apply(config);
|
||||
Pair<String, Set<OutputConfiguration>> _mappedTo = Pair.<String, Set<OutputConfiguration>>of(this.languageName, Collections.<OutputConfiguration>unmodifiableSet(CollectionLiterals.<OutputConfiguration>newHashSet(config)));
|
||||
final OutputConfigurationAdapter adapter = new OutputConfigurationAdapter(Collections.<String, Set<OutputConfiguration>>unmodifiableMap(CollectionLiterals.<String, Set<OutputConfiguration>>newHashMap(_mappedTo)));
|
||||
XtextResourceSet _resourceSet = it.getResourceSet();
|
||||
EList<Adapter> _eAdapters = _resourceSet.eAdapters();
|
||||
EList<Adapter> _eAdapters = it.getResourceSet().eAdapters();
|
||||
_eAdapters.add(adapter);
|
||||
}
|
||||
|
||||
|
@ -132,20 +122,14 @@ public abstract class AbstractIncrementalBuilderTest {
|
|||
protected BuildRequest newBuildRequest(final Procedure1<? super BuildRequest> init) {
|
||||
BuildRequest _buildRequest = new BuildRequest();
|
||||
final Procedure1<BuildRequest> _function = (BuildRequest it) -> {
|
||||
ResourceDescriptionsData _resourceDescriptions = this.indexState.getResourceDescriptions();
|
||||
final ResourceDescriptionsData newIndex = _resourceDescriptions.copy();
|
||||
URI _uri = this.uri("");
|
||||
it.setBaseDir(_uri);
|
||||
final ResourceDescriptionsData newIndex = this.indexState.getResourceDescriptions().copy();
|
||||
it.setBaseDir(this.uri(""));
|
||||
XtextResourceSet _get = this.resourceSetProvider.get();
|
||||
final Procedure1<XtextResourceSet> _function_1 = (XtextResourceSet it_1) -> {
|
||||
URIConverter _uRIConverter = it_1.getURIConverter();
|
||||
EList<URIHandler> _uRIHandlers = _uRIConverter.getURIHandlers();
|
||||
_uRIHandlers.clear();
|
||||
URIConverter _uRIConverter_1 = it_1.getURIConverter();
|
||||
EList<URIHandler> _uRIHandlers_1 = _uRIConverter_1.getURIHandlers();
|
||||
_uRIHandlers_1.add(this.inMemoryURIHandler);
|
||||
ClassLoader _classLoader = AbstractIncrementalBuilderTest.class.getClassLoader();
|
||||
it_1.setClasspathURIContext(_classLoader);
|
||||
it_1.getURIConverter().getURIHandlers().clear();
|
||||
EList<URIHandler> _uRIHandlers = it_1.getURIConverter().getURIHandlers();
|
||||
_uRIHandlers.add(this.inMemoryURIHandler);
|
||||
it_1.setClasspathURIContext(AbstractIncrementalBuilderTest.class.getClassLoader());
|
||||
ProjectDescription _projectDescription = new ProjectDescription();
|
||||
final Procedure1<ProjectDescription> _function_2 = (ProjectDescription it_2) -> {
|
||||
it_2.setName("test-project");
|
||||
|
@ -154,8 +138,7 @@ public abstract class AbstractIncrementalBuilderTest {
|
|||
projectDescription.attachToEmfObject(it_1);
|
||||
Map<String, ResourceDescriptionsData> _emptyMap = CollectionLiterals.<String, ResourceDescriptionsData>emptyMap();
|
||||
final ChunkedResourceDescriptions index = new ChunkedResourceDescriptions(_emptyMap, it_1);
|
||||
String _name = projectDescription.getName();
|
||||
index.setContainer(_name, newIndex);
|
||||
index.setContainer(projectDescription.getName(), newIndex);
|
||||
};
|
||||
XtextResourceSet _doubleArrow = ObjectExtensions.<XtextResourceSet>operator_doubleArrow(_get, _function_1);
|
||||
it.setResourceSet(_doubleArrow);
|
||||
|
@ -174,8 +157,7 @@ public abstract class AbstractIncrementalBuilderTest {
|
|||
this.generated.put(source, target);
|
||||
};
|
||||
it.setAfterGenerateFile(_function_4);
|
||||
Source2GeneratedMapping _fileMappings = this.indexState.getFileMappings();
|
||||
Source2GeneratedMapping _copy = _fileMappings.copy();
|
||||
Source2GeneratedMapping _copy = this.indexState.getFileMappings().copy();
|
||||
IndexState _indexState = new IndexState(newIndex, _copy);
|
||||
it.setState(_indexState);
|
||||
};
|
||||
|
@ -186,8 +168,7 @@ public abstract class AbstractIncrementalBuilderTest {
|
|||
|
||||
protected URI delete(final URI uri) {
|
||||
try {
|
||||
Map<Object, Object> _emptyMap = CollectionLiterals.<Object, Object>emptyMap();
|
||||
this.inMemoryURIHandler.delete(uri, _emptyMap);
|
||||
this.inMemoryURIHandler.delete(uri, CollectionLiterals.<Object, Object>emptyMap());
|
||||
return uri;
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
|
@ -201,12 +182,10 @@ public abstract class AbstractIncrementalBuilderTest {
|
|||
protected URI operator_minus(final String path, final String content) {
|
||||
try {
|
||||
final URI uri = this.uri(path);
|
||||
Map<Object, Object> _emptyMap = CollectionLiterals.<Object, Object>emptyMap();
|
||||
OutputStream _createOutputStream = this.inMemoryURIHandler.createOutputStream(uri, _emptyMap);
|
||||
OutputStream _createOutputStream = this.inMemoryURIHandler.createOutputStream(uri, CollectionLiterals.<Object, Object>emptyMap());
|
||||
final Procedure1<OutputStream> _function = (OutputStream it) -> {
|
||||
try {
|
||||
byte[] _bytes = content.getBytes();
|
||||
it.write(_bytes);
|
||||
it.write(content.getBytes());
|
||||
it.close();
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
|
@ -222,8 +201,7 @@ public abstract class AbstractIncrementalBuilderTest {
|
|||
protected boolean containsSuffix(final Iterable<? extends URI> uris, final String... suffixes) {
|
||||
final Function1<String, Boolean> _function = (String suffix) -> {
|
||||
final Function1<URI, Boolean> _function_1 = (URI uri) -> {
|
||||
String _string = uri.toString();
|
||||
return Boolean.valueOf(_string.endsWith(suffix));
|
||||
return Boolean.valueOf(uri.toString().endsWith(suffix));
|
||||
};
|
||||
return Boolean.valueOf(IterableExtensions.exists(uris, _function_1));
|
||||
};
|
||||
|
|
|
@ -13,7 +13,6 @@ import com.google.common.primitives.Longs;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
@ -360,8 +359,7 @@ public class LoggingTester {
|
|||
logger.addAppender(appender);
|
||||
logger.setLevel(level);
|
||||
action.run();
|
||||
List<LoggingTester.LogEntry> _list = IterableExtensions.<LoggingTester.LogEntry>toList(appender.events);
|
||||
final List<LoggingTester.LogEntry> events = IterableExtensions.<LoggingTester.LogEntry>sortWith(_list, LoggingTester.TEMPORAL_ORDER);
|
||||
final List<LoggingTester.LogEntry> events = IterableExtensions.<LoggingTester.LogEntry>sortWith(IterableExtensions.<LoggingTester.LogEntry>toList(appender.events), LoggingTester.TEMPORAL_ORDER);
|
||||
return new LoggingTester.LogCapture(events);
|
||||
} finally {
|
||||
logger.removeAppender(appender);
|
||||
|
@ -378,9 +376,7 @@ public class LoggingTester {
|
|||
{
|
||||
final ArrayList<Appender> appenders = CollectionLiterals.<Appender>newArrayList();
|
||||
for (Category current = logger; (current != null); current = current.getParent()) {
|
||||
Enumeration _allAppenders = current.getAllAppenders();
|
||||
ArrayList<Appender> _list = Collections.<Appender>list(_allAppenders);
|
||||
appenders.addAll(_list);
|
||||
appenders.addAll(Collections.<Appender>list(current.getAllAppenders()));
|
||||
}
|
||||
_xblockexpression = appenders;
|
||||
}
|
||||
|
@ -392,15 +388,13 @@ public class LoggingTester {
|
|||
boolean _equals = Objects.equal(_filter, filter);
|
||||
if (_equals) {
|
||||
appender.clearFilters();
|
||||
Filter _next = filter.getNext();
|
||||
appender.addFilter(_next);
|
||||
appender.addFilter(filter.getNext());
|
||||
} else {
|
||||
for (Filter current = appender.getFilter(); (current != null); current = current.getNext()) {
|
||||
Filter _next_1 = current.getNext();
|
||||
boolean _equals_1 = Objects.equal(_next_1, filter);
|
||||
Filter _next = current.getNext();
|
||||
boolean _equals_1 = Objects.equal(_next, filter);
|
||||
if (_equals_1) {
|
||||
Filter _next_2 = filter.getNext();
|
||||
current.setNext(_next_2);
|
||||
current.setNext(filter.getNext());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,14 +104,12 @@ public class InMemoryURIHandler implements URIHandler {
|
|||
|
||||
@Override
|
||||
public InputStream createInputStream(final URI uri, final Map<?, ?> options) throws IOException {
|
||||
InMemoryURIHandler.InMemFile _inMemoryFile = this.getInMemoryFile(uri);
|
||||
return _inMemoryFile.createInputStream();
|
||||
return this.getInMemoryFile(uri).createInputStream();
|
||||
}
|
||||
|
||||
@Override
|
||||
public OutputStream createOutputStream(final URI uri, final Map<?, ?> options) throws IOException {
|
||||
InMemoryURIHandler.InMemFile _inMemoryFile = this.getInMemoryFile(uri);
|
||||
return _inMemoryFile.createOutputstream();
|
||||
return this.getInMemoryFile(uri).createOutputstream();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -122,8 +120,7 @@ public class InMemoryURIHandler implements URIHandler {
|
|||
|
||||
@Override
|
||||
public boolean exists(final URI uri, final Map<?, ?> options) {
|
||||
InMemoryURIHandler.InMemFile _inMemoryFile = this.getInMemoryFile(uri);
|
||||
return _inMemoryFile.exists;
|
||||
return this.getInMemoryFile(uri).exists;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,11 +8,9 @@
|
|||
package org.eclipse.xtext.tests;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import org.eclipse.xtext.Grammar;
|
||||
import org.eclipse.xtext.scoping.impl.ImportUriGlobalScopeProvider;
|
||||
import org.eclipse.xtext.scoping.impl.SimpleLocalScopeProvider;
|
||||
import org.eclipse.xtext.xbase.lib.Extension;
|
||||
import org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage;
|
||||
import org.eclipse.xtext.xtext.generator.model.TypeReference;
|
||||
import org.eclipse.xtext.xtext.generator.scoping.ImportNamespacesScopingFragment2;
|
||||
import org.eclipse.xtext.xtext.generator.xbase.XbaseUsageDetector;
|
||||
|
@ -26,9 +24,7 @@ public class ImportURIScopingFragment2 extends ImportNamespacesScopingFragment2
|
|||
@Override
|
||||
public TypeReference getDelegateScopeProvider() {
|
||||
TypeReference _xifexpression = null;
|
||||
IXtextGeneratorLanguage _language = this.getLanguage();
|
||||
Grammar _grammar = _language.getGrammar();
|
||||
boolean _inheritsXbase = this._xbaseUsageDetector.inheritsXbase(_grammar);
|
||||
boolean _inheritsXbase = this._xbaseUsageDetector.inheritsXbase(this.getLanguage().getGrammar());
|
||||
if (_inheritsXbase) {
|
||||
_xifexpression = TypeReference.typeRef("org.eclipse.xtext.xbase.scoping.XImportSectionNamespaceScopeProvider");
|
||||
} else {
|
||||
|
|
|
@ -39,11 +39,7 @@ public class TestsEMFGeneratorFragment extends EMFGeneratorFragment2 {
|
|||
} else {
|
||||
String _javaModelDirectory = this.getJavaModelDirectory();
|
||||
String _plus = (_javaModelDirectory + "/");
|
||||
String _name = grammar.getName();
|
||||
String _name_1 = grammar.getName();
|
||||
int _lastIndexOf = _name_1.lastIndexOf(".");
|
||||
String _substring = _name.substring(0, _lastIndexOf);
|
||||
String _replace = _substring.replace(".", "/");
|
||||
String _replace = grammar.getName().substring(0, grammar.getName().lastIndexOf(".")).replace(".", "/");
|
||||
String _plus_1 = (_plus + _replace);
|
||||
String _plus_2 = (_plus_1 + "/");
|
||||
String _modelName = this.getModelName(grammar);
|
||||
|
@ -63,11 +59,7 @@ public class TestsEMFGeneratorFragment extends EMFGeneratorFragment2 {
|
|||
} else {
|
||||
String _javaModelDirectory = this.getJavaModelDirectory();
|
||||
String _plus = (_javaModelDirectory + "/");
|
||||
String _name = grammar.getName();
|
||||
String _name_1 = grammar.getName();
|
||||
int _lastIndexOf = _name_1.lastIndexOf(".");
|
||||
String _substring = _name.substring(0, _lastIndexOf);
|
||||
String _replace = _substring.replace(".", "/");
|
||||
String _replace = grammar.getName().substring(0, grammar.getName().lastIndexOf(".")).replace(".", "/");
|
||||
String _plus_1 = (_plus + _replace);
|
||||
String _plus_2 = (_plus_1 + "/");
|
||||
String _modelName = this.getModelName(grammar);
|
||||
|
|
|
@ -9,8 +9,6 @@ package org.eclipse.xtext;
|
|||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.ecore.EClass;
|
||||
import org.eclipse.emf.ecore.EClassifier;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.EReference;
|
||||
|
@ -29,7 +27,6 @@ import org.eclipse.xtext.ReferencedMetamodel;
|
|||
import org.eclipse.xtext.XtextStandaloneSetup;
|
||||
import org.eclipse.xtext.linking.LangATestLanguageStandaloneSetup;
|
||||
import org.eclipse.xtext.linking.langATestLanguage.Main;
|
||||
import org.eclipse.xtext.linking.langATestLanguage.Type;
|
||||
import org.eclipse.xtext.linking.services.LangATestLanguageGrammarAccess;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.eclipse.xtext.tests.AbstractXtextTests;
|
||||
|
@ -63,11 +60,9 @@ public class GrammarUtilTest extends AbstractXtextTests {
|
|||
_builder.newLine();
|
||||
String model = _builder.toString();
|
||||
final XtextResource r = this.getResourceFromString(model);
|
||||
EList<EObject> _contents = r.getContents();
|
||||
EObject _get = _contents.get(0);
|
||||
EObject _get = r.getContents().get(0);
|
||||
final Grammar grammar = ((Grammar) _get);
|
||||
EList<AbstractRule> _rules = grammar.getRules();
|
||||
final AbstractRule rule = IterableExtensions.<AbstractRule>head(_rules);
|
||||
final AbstractRule rule = IterableExtensions.<AbstractRule>head(grammar.getRules());
|
||||
final AbstractElement fragmentCall = rule.getAlternatives();
|
||||
final EClassifier currentType = GrammarUtil.findCurrentType(fragmentCall);
|
||||
Assert.assertEquals("Rule", currentType.getName());
|
||||
|
@ -90,11 +85,9 @@ public class GrammarUtilTest extends AbstractXtextTests {
|
|||
_builder.newLine();
|
||||
String model = _builder.toString();
|
||||
final XtextResource r = this.getResourceFromString(model);
|
||||
EList<EObject> _contents = r.getContents();
|
||||
EObject _get = _contents.get(0);
|
||||
EObject _get = r.getContents().get(0);
|
||||
final Grammar grammar = ((Grammar) _get);
|
||||
EList<AbstractRule> _rules = grammar.getRules();
|
||||
final AbstractRule rule = IterableExtensions.<AbstractRule>head(_rules);
|
||||
final AbstractRule rule = IterableExtensions.<AbstractRule>head(grammar.getRules());
|
||||
final AbstractElement fragmentCall = rule.getAlternatives();
|
||||
final EClassifier currentType = GrammarUtil.findCurrentType(fragmentCall);
|
||||
Assert.assertEquals("SubRule", currentType.getName());
|
||||
|
@ -119,11 +112,9 @@ public class GrammarUtilTest extends AbstractXtextTests {
|
|||
_builder.newLine();
|
||||
String model = _builder.toString();
|
||||
final XtextResource r = this.getResourceFromString(model);
|
||||
EList<EObject> _contents = r.getContents();
|
||||
EObject _get = _contents.get(0);
|
||||
EObject _get = r.getContents().get(0);
|
||||
final Grammar grammar = ((Grammar) _get);
|
||||
EList<AbstractRule> _rules = grammar.getRules();
|
||||
final AbstractRule rule = IterableExtensions.<AbstractRule>head(_rules);
|
||||
final AbstractRule rule = IterableExtensions.<AbstractRule>head(grammar.getRules());
|
||||
final AbstractElement fragmentCall = rule.getAlternatives();
|
||||
final EClassifier currentType = GrammarUtil.findCurrentType(fragmentCall);
|
||||
Assert.assertEquals("SubRule", currentType.getName());
|
||||
|
@ -148,11 +139,9 @@ public class GrammarUtilTest extends AbstractXtextTests {
|
|||
_builder.newLine();
|
||||
String model = _builder.toString();
|
||||
final XtextResource r = this.getResourceFromString(model);
|
||||
EList<EObject> _contents = r.getContents();
|
||||
EObject _get = _contents.get(0);
|
||||
EObject _get = r.getContents().get(0);
|
||||
final Grammar grammar = ((Grammar) _get);
|
||||
EList<AbstractRule> _rules = grammar.getRules();
|
||||
final AbstractRule rule = IterableExtensions.<AbstractRule>head(_rules);
|
||||
final AbstractRule rule = IterableExtensions.<AbstractRule>head(grammar.getRules());
|
||||
final AbstractElement fragmentCall = rule.getAlternatives();
|
||||
final EClassifier currentType = GrammarUtil.findCurrentType(fragmentCall);
|
||||
Assert.assertEquals("Rule", currentType.getName());
|
||||
|
@ -180,11 +169,9 @@ public class GrammarUtilTest extends AbstractXtextTests {
|
|||
_builder.newLine();
|
||||
String model = _builder.toString();
|
||||
final XtextResource r = this.getResourceFromString(model);
|
||||
EList<EObject> _contents = r.getContents();
|
||||
EObject _get = _contents.get(0);
|
||||
EObject _get = r.getContents().get(0);
|
||||
final Grammar grammar = ((Grammar) _get);
|
||||
EList<AbstractRule> _rules = grammar.getRules();
|
||||
final AbstractRule rule = IterableExtensions.<AbstractRule>head(_rules);
|
||||
final AbstractRule rule = IterableExtensions.<AbstractRule>head(grammar.getRules());
|
||||
final AbstractElement fragmentCall = rule.getAlternatives();
|
||||
final EClassifier currentType = GrammarUtil.findCurrentType(fragmentCall);
|
||||
Assert.assertEquals("Rule", currentType.getName());
|
||||
|
@ -212,14 +199,11 @@ public class GrammarUtilTest extends AbstractXtextTests {
|
|||
_builder.newLine();
|
||||
String model = _builder.toString();
|
||||
final XtextResource r = this.getResourceFromString(model);
|
||||
EList<EObject> _contents = r.getContents();
|
||||
EObject _get = _contents.get(0);
|
||||
EObject _get = r.getContents().get(0);
|
||||
final Grammar grammar = ((Grammar) _get);
|
||||
EList<AbstractRule> _rules = grammar.getRules();
|
||||
final AbstractRule rule = IterableExtensions.<AbstractRule>last(_rules);
|
||||
final AbstractRule rule = IterableExtensions.<AbstractRule>last(grammar.getRules());
|
||||
AbstractElement _alternatives = rule.getAlternatives();
|
||||
EList<AbstractElement> _elements = ((Group) _alternatives).getElements();
|
||||
final AbstractElement fragmentCall = IterableExtensions.<AbstractElement>last(_elements);
|
||||
final AbstractElement fragmentCall = IterableExtensions.<AbstractElement>last(((Group) _alternatives).getElements());
|
||||
final EClassifier currentType = GrammarUtil.findCurrentType(fragmentCall);
|
||||
Assert.assertEquals("Rule", currentType.getName());
|
||||
}
|
||||
|
@ -241,15 +225,15 @@ public class GrammarUtilTest extends AbstractXtextTests {
|
|||
_builder.newLine();
|
||||
String model = _builder.toString();
|
||||
final XtextResource r = this.getResourceFromString(model);
|
||||
EList<EObject> _contents = r.getContents();
|
||||
EObject _get = _contents.get(0);
|
||||
EObject _get = r.getContents().get(0);
|
||||
final Grammar grammar = ((Grammar) _get);
|
||||
final List<AbstractRule> allRules = GrammarUtil.allRules(grammar);
|
||||
final Function1<AbstractRule, String> _function = (AbstractRule it) -> {
|
||||
return it.getName();
|
||||
};
|
||||
Assert.assertEquals(
|
||||
Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("Rule", "STRING", "ID", "INT", "STRING", "ML_COMMENT", "SL_COMMENT", "WS", "ANY_OTHER")).toString(),
|
||||
ListExtensions.<AbstractRule, String>map(allRules, ((Function1<AbstractRule, String>) (AbstractRule it) -> {
|
||||
return it.getName();
|
||||
})).toString());
|
||||
ListExtensions.<AbstractRule, String>map(allRules, _function).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -269,8 +253,7 @@ public class GrammarUtilTest extends AbstractXtextTests {
|
|||
_builder.newLine();
|
||||
String model = _builder.toString();
|
||||
XtextResource r = this.getResourceFromString(model);
|
||||
EList<EObject> _contents = r.getContents();
|
||||
EObject _get = _contents.get(0);
|
||||
EObject _get = r.getContents().get(0);
|
||||
Grammar grammar = ((Grammar) _get);
|
||||
Assert.assertEquals(grammar, GrammarUtil.findRuleForName(grammar, "Rule").eContainer());
|
||||
Assert.assertNull(GrammarUtil.findRuleForName(grammar, "org.eclipse.xtext.common.Terminals.Rule"));
|
||||
|
@ -293,8 +276,7 @@ public class GrammarUtilTest extends AbstractXtextTests {
|
|||
_builder.newLine();
|
||||
String model = _builder.toString();
|
||||
Resource r = this.getResourceFromString(model);
|
||||
EList<EObject> _contents = r.getContents();
|
||||
EObject _get = _contents.get(0);
|
||||
EObject _get = r.getContents().get(0);
|
||||
Grammar g = ((Grammar) _get);
|
||||
List<AbstractMetamodelDeclaration> decls = GrammarUtil.allMetamodelDeclarations(g);
|
||||
Assert.assertEquals(2, decls.size());
|
||||
|
@ -323,8 +305,7 @@ public class GrammarUtilTest extends AbstractXtextTests {
|
|||
_builder.newLine();
|
||||
String model = _builder.toString();
|
||||
Resource r = this.getResourceFromString(model);
|
||||
EList<EObject> _contents = r.getContents();
|
||||
EObject _get = _contents.get(0);
|
||||
EObject _get = r.getContents().get(0);
|
||||
Grammar g = ((Grammar) _get);
|
||||
List<AbstractMetamodelDeclaration> decls = GrammarUtil.allMetamodelDeclarations(g);
|
||||
Assert.assertEquals(3, decls.size());
|
||||
|
@ -342,8 +323,7 @@ public class GrammarUtilTest extends AbstractXtextTests {
|
|||
Assert.assertNotNull(decl.getEPackage());
|
||||
Assert.assertEquals("http://www.eclipse.org/emf/2002/Ecore", decl.getEPackage().getNsURI());
|
||||
Assert.assertEquals("ecore", decl.getAlias());
|
||||
EList<AbstractRule> _rules = g.getRules();
|
||||
AbstractRule abstractRule = _rules.get(0);
|
||||
AbstractRule abstractRule = g.getRules().get(0);
|
||||
Assert.assertSame(decls.get(1), abstractRule.getType().getMetamodel());
|
||||
}
|
||||
|
||||
|
@ -361,8 +341,7 @@ public class GrammarUtilTest extends AbstractXtextTests {
|
|||
_builder.newLine();
|
||||
String model = _builder.toString();
|
||||
Resource r = this.getResourceFromString(model);
|
||||
EList<EObject> _contents = r.getContents();
|
||||
EObject _get = _contents.get(0);
|
||||
EObject _get = r.getContents().get(0);
|
||||
Grammar g = ((Grammar) _get);
|
||||
List<AbstractMetamodelDeclaration> decls = GrammarUtil.allMetamodelDeclarations(g);
|
||||
Assert.assertEquals(3, decls.size());
|
||||
|
@ -381,8 +360,7 @@ public class GrammarUtilTest extends AbstractXtextTests {
|
|||
Assert.assertNotNull(decl.getEPackage());
|
||||
Assert.assertEquals("http://www.eclipse.org/emf/2002/Ecore", decl.getEPackage().getNsURI());
|
||||
Assert.assertEquals("ecore", decl.getAlias());
|
||||
EList<AbstractRule> _rules = g.getRules();
|
||||
AbstractRule abstractRule = _rules.get(0);
|
||||
AbstractRule abstractRule = g.getRules().get(0);
|
||||
Assert.assertSame(decls.get(0), abstractRule.getType().getMetamodel());
|
||||
}
|
||||
|
||||
|
@ -390,17 +368,13 @@ public class GrammarUtilTest extends AbstractXtextTests {
|
|||
public void testGetReference() throws Exception {
|
||||
this.with(LangATestLanguageStandaloneSetup.class);
|
||||
XtextResource resource = this.getResourceFromStringAndExpect("type A extends B", 1);
|
||||
LangATestLanguageGrammarAccess _get = this.<LangATestLanguageGrammarAccess>get(LangATestLanguageGrammarAccess.class);
|
||||
LangATestLanguageGrammarAccess.TypeElements _typeAccess = _get.getTypeAccess();
|
||||
Assignment asExtends = _typeAccess.getExtendsAssignment_2_1();
|
||||
Assignment asExtends = this.<LangATestLanguageGrammarAccess>get(LangATestLanguageGrammarAccess.class).getTypeAccess().getExtendsAssignment_2_1();
|
||||
AbstractElement _terminal = asExtends.getTerminal();
|
||||
CrossReference xref = ((CrossReference) _terminal);
|
||||
EObject _model = this.getModel(resource);
|
||||
Main model = ((Main) _model);
|
||||
EList<Type> _types = model.getTypes();
|
||||
EObject typeA = _types.get(0);
|
||||
EClass _eClass = typeA.eClass();
|
||||
EReference ref = GrammarUtil.getReference(xref, _eClass);
|
||||
EObject typeA = model.getTypes().get(0);
|
||||
EReference ref = GrammarUtil.getReference(xref, typeA.eClass());
|
||||
Assert.assertNotNull(ref);
|
||||
Assert.assertEquals("extends", ref.getName());
|
||||
Assert.assertFalse(ref.isMany());
|
||||
|
|
|
@ -8,21 +8,16 @@
|
|||
package org.eclipse.xtext.build;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import org.eclipse.core.runtime.OperationCanceledException;
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
import org.eclipse.xtext.build.BuildRequest;
|
||||
import org.eclipse.xtext.build.IndexState;
|
||||
import org.eclipse.xtext.build.Source2GeneratedMapping;
|
||||
import org.eclipse.xtext.generator.OutputConfiguration;
|
||||
import org.eclipse.xtext.index.IndexTestLanguageInjectorProvider;
|
||||
import org.eclipse.xtext.resource.IResourceDescription;
|
||||
import org.eclipse.xtext.resource.IResourceServiceProvider;
|
||||
import org.eclipse.xtext.resource.impl.ResourceDescriptionsData;
|
||||
import org.eclipse.xtext.testing.InjectWith;
|
||||
import org.eclipse.xtext.testing.XtextRunner;
|
||||
import org.eclipse.xtext.testing.builder.AbstractIncrementalBuilderTest;
|
||||
|
@ -96,38 +91,23 @@ public class IncrementalBuilderTest extends AbstractIncrementalBuilderTest {
|
|||
};
|
||||
final BuildRequest buildRequest = this.newBuildRequest(_function);
|
||||
this.build(buildRequest);
|
||||
String _string = this.issues.toString();
|
||||
boolean _isEmpty = this.issues.isEmpty();
|
||||
Assert.assertTrue(_string, _isEmpty);
|
||||
int _size = this.generated.size();
|
||||
Assert.assertEquals(2, _size);
|
||||
Collection<URI> _values = this.generated.values();
|
||||
boolean _containsSuffix = this.containsSuffix(_values, "src-gen/B.txt");
|
||||
Assert.assertTrue(_containsSuffix);
|
||||
Collection<URI> _values_1 = this.generated.values();
|
||||
boolean _containsSuffix_1 = this.containsSuffix(_values_1, "src-gen/A.txt");
|
||||
Assert.assertTrue(_containsSuffix_1);
|
||||
Assert.assertTrue(this.issues.toString(), this.issues.isEmpty());
|
||||
Assert.assertEquals(2, this.generated.size());
|
||||
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/B.txt"));
|
||||
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/A.txt"));
|
||||
final Procedure1<BuildRequest> _function_1 = (BuildRequest it) -> {
|
||||
final Procedure1<OutputConfiguration> _function_2 = (OutputConfiguration it_1) -> {
|
||||
it_1.setCleanUpDerivedResources(false);
|
||||
};
|
||||
this.withOutputConfig(it, _function_2);
|
||||
URI _uri = this.uri("src/A.indextestlanguage");
|
||||
URI _delete = this.delete(_uri);
|
||||
URI _delete = this.delete(this.uri("src/A.indextestlanguage"));
|
||||
it.setDeletedFiles(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(_delete)));
|
||||
};
|
||||
this.newBuildRequest(_function_1);
|
||||
String _string_1 = this.issues.toString();
|
||||
boolean _isEmpty_1 = this.issues.isEmpty();
|
||||
Assert.assertTrue(_string_1, _isEmpty_1);
|
||||
int _size_1 = this.generated.size();
|
||||
Assert.assertEquals(2, _size_1);
|
||||
Collection<URI> _values_2 = this.generated.values();
|
||||
boolean _containsSuffix_2 = this.containsSuffix(_values_2, "src-gen/B.txt");
|
||||
Assert.assertTrue(_containsSuffix_2);
|
||||
Collection<URI> _values_3 = this.generated.values();
|
||||
boolean _containsSuffix_3 = this.containsSuffix(_values_3, "src-gen/A.txt");
|
||||
Assert.assertTrue(_containsSuffix_3);
|
||||
Assert.assertTrue(this.issues.toString(), this.issues.isEmpty());
|
||||
Assert.assertEquals(2, this.generated.size());
|
||||
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/B.txt"));
|
||||
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/A.txt"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -154,17 +134,10 @@ public class IncrementalBuilderTest extends AbstractIncrementalBuilderTest {
|
|||
};
|
||||
final BuildRequest buildRequest = this.newBuildRequest(_function);
|
||||
this.build(buildRequest);
|
||||
String _string = this.issues.toString();
|
||||
boolean _isEmpty = this.issues.isEmpty();
|
||||
Assert.assertTrue(_string, _isEmpty);
|
||||
int _size = this.generated.size();
|
||||
Assert.assertEquals(2, _size);
|
||||
Collection<URI> _values = this.generated.values();
|
||||
boolean _containsSuffix = this.containsSuffix(_values, "src-gen/B.txt");
|
||||
Assert.assertTrue(_containsSuffix);
|
||||
Collection<URI> _values_1 = this.generated.values();
|
||||
boolean _containsSuffix_1 = this.containsSuffix(_values_1, "src-gen/A.txt");
|
||||
Assert.assertTrue(_containsSuffix_1);
|
||||
Assert.assertTrue(this.issues.toString(), this.issues.isEmpty());
|
||||
Assert.assertEquals(2, this.generated.size());
|
||||
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/B.txt"));
|
||||
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/A.txt"));
|
||||
final Procedure1<BuildRequest> _function_1 = (BuildRequest it) -> {
|
||||
final Procedure1<OutputConfiguration> _function_2 = (OutputConfiguration it_1) -> {
|
||||
it_1.setOverrideExistingResources(false);
|
||||
|
@ -212,17 +185,10 @@ public class IncrementalBuilderTest extends AbstractIncrementalBuilderTest {
|
|||
};
|
||||
final BuildRequest buildRequest = this.newBuildRequest(_function);
|
||||
this.build(buildRequest);
|
||||
String _string = this.issues.toString();
|
||||
boolean _isEmpty = this.issues.isEmpty();
|
||||
Assert.assertTrue(_string, _isEmpty);
|
||||
int _size = this.generated.size();
|
||||
Assert.assertEquals(2, _size);
|
||||
Collection<URI> _values = this.generated.values();
|
||||
boolean _containsSuffix = this.containsSuffix(_values, "src-gen/B.txt");
|
||||
Assert.assertTrue(_containsSuffix);
|
||||
Collection<URI> _values_1 = this.generated.values();
|
||||
boolean _containsSuffix_1 = this.containsSuffix(_values_1, "src-gen/A.txt");
|
||||
Assert.assertTrue(_containsSuffix_1);
|
||||
Assert.assertTrue(this.issues.toString(), this.issues.isEmpty());
|
||||
Assert.assertEquals(2, this.generated.size());
|
||||
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/B.txt"));
|
||||
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/A.txt"));
|
||||
}
|
||||
|
||||
@Test(expected = OperationCanceledException.class)
|
||||
|
@ -283,10 +249,7 @@ public class IncrementalBuilderTest extends AbstractIncrementalBuilderTest {
|
|||
};
|
||||
final BuildRequest buildRequest = this.newBuildRequest(_function);
|
||||
final IndexState result = this.build(buildRequest);
|
||||
ResourceDescriptionsData _resourceDescriptions = result.getResourceDescriptions();
|
||||
Iterable<IResourceDescription> _allResourceDescriptions = _resourceDescriptions.getAllResourceDescriptions();
|
||||
int _size = IterableExtensions.size(_allResourceDescriptions);
|
||||
Assert.assertEquals(1, _size);
|
||||
Assert.assertEquals(1, IterableExtensions.size(result.getResourceDescriptions().getAllResourceDescriptions()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -314,29 +277,21 @@ public class IncrementalBuilderTest extends AbstractIncrementalBuilderTest {
|
|||
"src/B.indextestlanguage", _builder_1.toString());
|
||||
it.setDirtyFiles(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(_minus, _minus_1)));
|
||||
};
|
||||
BuildRequest _newBuildRequest = this.newBuildRequest(_function);
|
||||
this.build(_newBuildRequest);
|
||||
this.build(this.newBuildRequest(_function));
|
||||
final AtomicBoolean validateCalled = new AtomicBoolean(false);
|
||||
final Procedure1<BuildRequest> _function_1 = (BuildRequest it) -> {
|
||||
URI _uri = this.uri("src/B.indextestlanguage");
|
||||
it.setDeletedFiles(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(_uri)));
|
||||
final BuildRequest.IPostValidationCallback _function_2 = (URI uri, Iterable<Issue> issues) -> {
|
||||
URI _uri_1 = this.uri("src/A.indextestlanguage");
|
||||
Assert.assertEquals(_uri_1, uri);
|
||||
String _string = issues.toString();
|
||||
Issue _head = IterableExtensions.<Issue>head(issues);
|
||||
String _message = _head.getMessage();
|
||||
boolean _contains = _message.contains("Couldn\'t resolve reference to Type \'foo.B\'");
|
||||
Assert.assertTrue(_string, _contains);
|
||||
Assert.assertEquals(this.uri("src/A.indextestlanguage"), uri);
|
||||
Assert.assertTrue(issues.toString(), IterableExtensions.<Issue>head(issues).getMessage().contains("Couldn\'t resolve reference to Type \'foo.B\'"));
|
||||
validateCalled.set(true);
|
||||
return false;
|
||||
};
|
||||
it.setAfterValidate(_function_2);
|
||||
};
|
||||
BuildRequest _newBuildRequest_1 = this.newBuildRequest(_function_1);
|
||||
this.build(_newBuildRequest_1);
|
||||
boolean _get = validateCalled.get();
|
||||
Assert.assertTrue(_get);
|
||||
this.build(this.newBuildRequest(_function_1));
|
||||
Assert.assertTrue(validateCalled.get());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -364,19 +319,11 @@ public class IncrementalBuilderTest extends AbstractIncrementalBuilderTest {
|
|||
"src/B.indextestlanguage", _builder_1.toString());
|
||||
it.setDirtyFiles(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(_minus, _minus_1)));
|
||||
};
|
||||
BuildRequest _newBuildRequest = this.newBuildRequest(_function);
|
||||
this.build(_newBuildRequest);
|
||||
String _string = this.issues.toString();
|
||||
boolean _isEmpty = this.issues.isEmpty();
|
||||
Assert.assertTrue(_string, _isEmpty);
|
||||
int _size = this.generated.size();
|
||||
Assert.assertEquals(2, _size);
|
||||
Collection<URI> _values = this.generated.values();
|
||||
boolean _containsSuffix = this.containsSuffix(_values, "src-gen/B.txt");
|
||||
Assert.assertTrue(_containsSuffix);
|
||||
Collection<URI> _values_1 = this.generated.values();
|
||||
boolean _containsSuffix_1 = this.containsSuffix(_values_1, "src-gen/A.txt");
|
||||
Assert.assertTrue(_containsSuffix_1);
|
||||
this.build(this.newBuildRequest(_function));
|
||||
Assert.assertTrue(this.issues.toString(), this.issues.isEmpty());
|
||||
Assert.assertEquals(2, this.generated.size());
|
||||
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/B.txt"));
|
||||
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/A.txt"));
|
||||
final Procedure1<BuildRequest> _function_1 = (BuildRequest it) -> {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("foo {");
|
||||
|
@ -390,19 +337,11 @@ public class IncrementalBuilderTest extends AbstractIncrementalBuilderTest {
|
|||
"src/A.indextestlanguage", _builder.toString());
|
||||
it.setDirtyFiles(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(_minus)));
|
||||
};
|
||||
BuildRequest _newBuildRequest_1 = this.newBuildRequest(_function_1);
|
||||
this.build(_newBuildRequest_1);
|
||||
String _string_1 = this.issues.toString();
|
||||
boolean _isEmpty_1 = this.issues.isEmpty();
|
||||
Assert.assertTrue(_string_1, _isEmpty_1);
|
||||
int _size_1 = this.generated.size();
|
||||
Assert.assertEquals(1, _size_1);
|
||||
Collection<URI> _values_2 = this.generated.values();
|
||||
boolean _containsSuffix_2 = this.containsSuffix(_values_2, "src-gen/B.txt");
|
||||
Assert.assertFalse(_containsSuffix_2);
|
||||
Collection<URI> _values_3 = this.generated.values();
|
||||
boolean _containsSuffix_3 = this.containsSuffix(_values_3, "src-gen/A.txt");
|
||||
Assert.assertTrue(_containsSuffix_3);
|
||||
this.build(this.newBuildRequest(_function_1));
|
||||
Assert.assertTrue(this.issues.toString(), this.issues.isEmpty());
|
||||
Assert.assertEquals(1, this.generated.size());
|
||||
Assert.assertFalse(this.containsSuffix(this.generated.values(), "src-gen/B.txt"));
|
||||
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/A.txt"));
|
||||
final Procedure1<BuildRequest> _function_2 = (BuildRequest it) -> {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("foo {");
|
||||
|
@ -416,28 +355,14 @@ public class IncrementalBuilderTest extends AbstractIncrementalBuilderTest {
|
|||
"src/A.indextestlanguage", _builder.toString());
|
||||
it.setDirtyFiles(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(_minus)));
|
||||
};
|
||||
BuildRequest _newBuildRequest_2 = this.newBuildRequest(_function_2);
|
||||
this.build(_newBuildRequest_2);
|
||||
String _string_2 = this.issues.toString();
|
||||
int _size_2 = this.issues.size();
|
||||
Assert.assertEquals(_string_2, 1, _size_2);
|
||||
int _size_3 = this.generated.size();
|
||||
Assert.assertEquals(1, _size_3);
|
||||
Collection<URI> _values_4 = this.generated.values();
|
||||
boolean _containsSuffix_4 = this.containsSuffix(_values_4, "src-gen/B.txt");
|
||||
Assert.assertFalse(_containsSuffix_4);
|
||||
Collection<URI> _values_5 = this.generated.values();
|
||||
boolean _containsSuffix_5 = this.containsSuffix(_values_5, "src-gen/X.txt");
|
||||
Assert.assertTrue(_containsSuffix_5);
|
||||
Source2GeneratedMapping _fileMappings = this.indexState.getFileMappings();
|
||||
URI _uri = this.uri("src/A.indextestlanguage");
|
||||
List<URI> _generated = _fileMappings.getGenerated(_uri);
|
||||
int _size_4 = _generated.size();
|
||||
Assert.assertEquals(1, _size_4);
|
||||
int _size_5 = this.deleted.size();
|
||||
Assert.assertEquals(1, _size_5);
|
||||
boolean _containsSuffix_6 = this.containsSuffix(this.deleted, "src-gen/A.txt");
|
||||
Assert.assertTrue(_containsSuffix_6);
|
||||
this.build(this.newBuildRequest(_function_2));
|
||||
Assert.assertEquals(this.issues.toString(), 1, this.issues.size());
|
||||
Assert.assertEquals(1, this.generated.size());
|
||||
Assert.assertFalse(this.containsSuffix(this.generated.values(), "src-gen/B.txt"));
|
||||
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/X.txt"));
|
||||
Assert.assertEquals(1, this.indexState.getFileMappings().getGenerated(this.uri("src/A.indextestlanguage")).size());
|
||||
Assert.assertEquals(1, this.deleted.size());
|
||||
Assert.assertTrue(this.containsSuffix(this.deleted, "src-gen/A.txt"));
|
||||
final Procedure1<BuildRequest> _function_3 = (BuildRequest it) -> {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("foo {");
|
||||
|
@ -451,36 +376,20 @@ public class IncrementalBuilderTest extends AbstractIncrementalBuilderTest {
|
|||
"src/A.indextestlanguage", _builder.toString());
|
||||
it.setDirtyFiles(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(_minus)));
|
||||
};
|
||||
BuildRequest _newBuildRequest_3 = this.newBuildRequest(_function_3);
|
||||
this.build(_newBuildRequest_3);
|
||||
String _string_3 = this.issues.toString();
|
||||
boolean _isEmpty_2 = this.issues.isEmpty();
|
||||
Assert.assertTrue(_string_3, _isEmpty_2);
|
||||
int _size_6 = this.generated.size();
|
||||
Assert.assertEquals(2, _size_6);
|
||||
Collection<URI> _values_6 = this.generated.values();
|
||||
boolean _containsSuffix_7 = this.containsSuffix(_values_6, "src-gen/B.txt");
|
||||
Assert.assertTrue(_containsSuffix_7);
|
||||
Collection<URI> _values_7 = this.generated.values();
|
||||
boolean _containsSuffix_8 = this.containsSuffix(_values_7, "src-gen/A.txt");
|
||||
Assert.assertTrue(_containsSuffix_8);
|
||||
boolean _containsSuffix_9 = this.containsSuffix(this.deleted, "src-gen/X.txt");
|
||||
Assert.assertTrue(_containsSuffix_9);
|
||||
this.build(this.newBuildRequest(_function_3));
|
||||
Assert.assertTrue(this.issues.toString(), this.issues.isEmpty());
|
||||
Assert.assertEquals(2, this.generated.size());
|
||||
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/B.txt"));
|
||||
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/A.txt"));
|
||||
Assert.assertTrue(this.containsSuffix(this.deleted, "src-gen/X.txt"));
|
||||
final Procedure1<BuildRequest> _function_4 = (BuildRequest it) -> {
|
||||
URI _uri_1 = this.uri("src/A.indextestlanguage");
|
||||
URI _delete = this.delete(_uri_1);
|
||||
URI _delete = this.delete(this.uri("src/A.indextestlanguage"));
|
||||
it.setDeletedFiles(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(_delete)));
|
||||
};
|
||||
BuildRequest _newBuildRequest_4 = this.newBuildRequest(_function_4);
|
||||
this.build(_newBuildRequest_4);
|
||||
String _string_4 = this.issues.toString();
|
||||
int _size_7 = this.issues.size();
|
||||
Assert.assertEquals(_string_4, 1, _size_7);
|
||||
int _size_8 = this.generated.size();
|
||||
Assert.assertEquals(0, _size_8);
|
||||
int _size_9 = this.deleted.size();
|
||||
Assert.assertEquals(1, _size_9);
|
||||
boolean _containsSuffix_10 = this.containsSuffix(this.deleted, "src-gen/A.txt");
|
||||
Assert.assertTrue(_containsSuffix_10);
|
||||
this.build(this.newBuildRequest(_function_4));
|
||||
Assert.assertEquals(this.issues.toString(), 1, this.issues.size());
|
||||
Assert.assertEquals(0, this.generated.size());
|
||||
Assert.assertEquals(1, this.deleted.size());
|
||||
Assert.assertTrue(this.containsSuffix(this.deleted, "src-gen/A.txt"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,12 +9,10 @@ package org.eclipse.xtext.filesystem;
|
|||
|
||||
import com.google.common.base.StandardSystemProperty;
|
||||
import com.google.inject.Inject;
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
|
@ -58,21 +56,16 @@ public class URIBasedFileSystemAccessTest {
|
|||
@Before
|
||||
public void before() {
|
||||
try {
|
||||
String _value = StandardSystemProperty.JAVA_IO_TMPDIR.value();
|
||||
final Path tmpPath = Paths.get(_value);
|
||||
final Path tmpPath = Paths.get(StandardSystemProperty.JAVA_IO_TMPDIR.value());
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("tempFolder_");
|
||||
UUID _randomUUID = UUID.randomUUID();
|
||||
_builder.append(_randomUUID);
|
||||
final Path output = Files.createTempDirectory(tmpPath, _builder.toString());
|
||||
Path _resolve = output.resolve(URIBasedFileSystemAccessTest.EXISTING_RESOURCE_NAME);
|
||||
final Path resource = Files.createFile(_resolve);
|
||||
File _file = resource.toFile();
|
||||
_file.deleteOnExit();
|
||||
File _file_1 = output.toFile();
|
||||
_file_1.deleteOnExit();
|
||||
Set<OutputConfiguration> _outputConfigurations = this.configProvider.getOutputConfigurations();
|
||||
final OutputConfiguration config = IterableExtensions.<OutputConfiguration>head(_outputConfigurations);
|
||||
final Path resource = Files.createFile(output.resolve(URIBasedFileSystemAccessTest.EXISTING_RESOURCE_NAME));
|
||||
resource.toFile().deleteOnExit();
|
||||
output.toFile().deleteOnExit();
|
||||
final OutputConfiguration config = IterableExtensions.<OutputConfiguration>head(this.configProvider.getOutputConfigurations());
|
||||
config.setOutputDirectory(output.toString());
|
||||
Pair<String, OutputConfiguration> _mappedTo = Pair.<String, OutputConfiguration>of(IFileSystemAccess.DEFAULT_OUTPUT, config);
|
||||
this.fsa.setOutputConfigurations(Collections.<String, OutputConfiguration>unmodifiableMap(CollectionLiterals.<String, OutputConfiguration>newHashMap(_mappedTo)));
|
||||
|
|
|
@ -9,13 +9,10 @@ package org.eclipse.xtext.formatting2.internal;
|
|||
|
||||
import com.google.inject.Inject;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
import org.eclipse.xtext.TerminalRule;
|
||||
import org.eclipse.xtext.formatting2.FormatterPreferenceKeys;
|
||||
import org.eclipse.xtext.formatting2.FormatterRequest;
|
||||
import org.eclipse.xtext.formatting2.IFormattableDocument;
|
||||
import org.eclipse.xtext.formatting2.IFormattableSubDocument;
|
||||
import org.eclipse.xtext.formatting2.IHiddenRegionFormatter;
|
||||
|
@ -28,7 +25,6 @@ import org.eclipse.xtext.formatting2.internal.formattertestlanguage.KWList;
|
|||
import org.eclipse.xtext.formatting2.internal.services.FormatterTestLanguageGrammarAccess;
|
||||
import org.eclipse.xtext.formatting2.internal.tests.FormatterTestLanguageInjectorProvider;
|
||||
import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion;
|
||||
import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder;
|
||||
import org.eclipse.xtext.formatting2.regionaccess.ITextRegionExtensions;
|
||||
import org.eclipse.xtext.preferences.MapBasedPreferenceValues;
|
||||
import org.eclipse.xtext.testing.InjectWith;
|
||||
|
@ -65,12 +61,10 @@ public class FormattableDocumentTest {
|
|||
final GenericFormatter<IDList> _function_1 = new GenericFormatter<IDList>() {
|
||||
@Override
|
||||
protected void format(final IDList model, @Extension final ITextRegionExtensions regions, @Extension final IFormattableDocument document) {
|
||||
ISemanticRegionsFinder _regionFor = regions.regionFor(model);
|
||||
ISemanticRegion _keyword = _regionFor.keyword("idlist");
|
||||
final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it_1) -> {
|
||||
it_1.oneSpace();
|
||||
};
|
||||
document.append(_keyword, _function);
|
||||
document.append(regions.regionFor(model).keyword("idlist"), _function);
|
||||
}
|
||||
};
|
||||
it.setFormatter(_function_1);
|
||||
|
@ -96,9 +90,6 @@ public class FormattableDocumentTest {
|
|||
final GenericFormatter<IDList> _function_2 = new GenericFormatter<IDList>() {
|
||||
@Override
|
||||
protected void format(final IDList model, @Extension final ITextRegionExtensions regions, @Extension final IFormattableDocument document) {
|
||||
ISemanticRegionsFinder _regionFor = regions.regionFor(model);
|
||||
TerminalRule _iDRule = FormattableDocumentTest.this._formatterTestLanguageGrammarAccess.getIDRule();
|
||||
List<ISemanticRegion> _ruleCallsTo = _regionFor.ruleCallsTo(_iDRule);
|
||||
final Consumer<ISemanticRegion> _function = (ISemanticRegion it_1) -> {
|
||||
final Procedure1<IHiddenRegionFormatter> _function_1 = (IHiddenRegionFormatter it_2) -> {
|
||||
it_2.autowrap();
|
||||
|
@ -106,7 +97,7 @@ public class FormattableDocumentTest {
|
|||
};
|
||||
document.prepend(it_1, _function_1);
|
||||
};
|
||||
_ruleCallsTo.forEach(_function);
|
||||
regions.regionFor(model).ruleCallsTo(FormattableDocumentTest.this._formatterTestLanguageGrammarAccess.getIDRule()).forEach(_function);
|
||||
}
|
||||
};
|
||||
it.setFormatter(_function_2);
|
||||
|
@ -138,19 +129,15 @@ public class FormattableDocumentTest {
|
|||
final GenericFormatter<KWList> _function_2 = new GenericFormatter<KWList>() {
|
||||
@Override
|
||||
protected void format(final KWList model, @Extension final ITextRegionExtensions regions, @Extension final IFormattableDocument document) {
|
||||
ISemanticRegionsFinder _regionFor = regions.regionFor(model);
|
||||
ISemanticRegion _keyword = _regionFor.keyword("kwlist");
|
||||
final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it_1) -> {
|
||||
it_1.autowrap();
|
||||
it_1.oneSpace();
|
||||
};
|
||||
document.append(_keyword, _function);
|
||||
ISemanticRegionsFinder _regionFor_1 = regions.regionFor(model);
|
||||
ISemanticRegion _keyword_1 = _regionFor_1.keyword("kw4");
|
||||
document.append(regions.regionFor(model).keyword("kwlist"), _function);
|
||||
final Procedure1<IHiddenRegionFormatter> _function_1 = (IHiddenRegionFormatter it_1) -> {
|
||||
it_1.oneSpace();
|
||||
};
|
||||
document.append(_keyword_1, _function_1);
|
||||
document.append(regions.regionFor(model).keyword("kw4"), _function_1);
|
||||
}
|
||||
};
|
||||
it.setFormatter(_function_2);
|
||||
|
@ -178,25 +165,19 @@ public class FormattableDocumentTest {
|
|||
final GenericFormatter<KWList> _function_2 = new GenericFormatter<KWList>() {
|
||||
@Override
|
||||
protected void format(final KWList model, @Extension final ITextRegionExtensions regions, @Extension final IFormattableDocument document) {
|
||||
ISemanticRegionsFinder _regionFor = regions.regionFor(model);
|
||||
ISemanticRegion _keyword = _regionFor.keyword("kwlist");
|
||||
final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it_1) -> {
|
||||
it_1.autowrap();
|
||||
it_1.oneSpace();
|
||||
};
|
||||
document.append(_keyword, _function);
|
||||
ISemanticRegionsFinder _regionFor_1 = regions.regionFor(model);
|
||||
ISemanticRegion _keyword_1 = _regionFor_1.keyword("kw1");
|
||||
document.append(regions.regionFor(model).keyword("kwlist"), _function);
|
||||
final Procedure1<IHiddenRegionFormatter> _function_1 = (IHiddenRegionFormatter it_1) -> {
|
||||
it_1.newLine();
|
||||
};
|
||||
document.append(_keyword_1, _function_1);
|
||||
ISemanticRegionsFinder _regionFor_2 = regions.regionFor(model);
|
||||
ISemanticRegion _keyword_2 = _regionFor_2.keyword("kw4");
|
||||
document.append(regions.regionFor(model).keyword("kw1"), _function_1);
|
||||
final Procedure1<IHiddenRegionFormatter> _function_2 = (IHiddenRegionFormatter it_1) -> {
|
||||
it_1.oneSpace();
|
||||
};
|
||||
document.append(_keyword_2, _function_2);
|
||||
document.append(regions.regionFor(model).keyword("kw4"), _function_2);
|
||||
}
|
||||
};
|
||||
it.setFormatter(_function_2);
|
||||
|
@ -224,41 +205,31 @@ public class FormattableDocumentTest {
|
|||
final GenericFormatter<KWList> _function_2 = new GenericFormatter<KWList>() {
|
||||
@Override
|
||||
protected void format(final KWList model, @Extension final ITextRegionExtensions regions, @Extension final IFormattableDocument document) {
|
||||
ISemanticRegionsFinder _regionFor = regions.regionFor(model);
|
||||
ISemanticRegion _keyword = _regionFor.keyword("kwlist");
|
||||
final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it_1) -> {
|
||||
it_1.autowrap(6);
|
||||
it_1.oneSpace();
|
||||
};
|
||||
document.append(_keyword, _function);
|
||||
ISemanticRegionsFinder _regionFor_1 = regions.regionFor(model);
|
||||
ISemanticRegion _keyword_1 = _regionFor_1.keyword("kw1");
|
||||
document.append(regions.regionFor(model).keyword("kwlist"), _function);
|
||||
final Procedure1<IHiddenRegionFormatter> _function_1 = (IHiddenRegionFormatter it_1) -> {
|
||||
it_1.autowrap();
|
||||
it_1.oneSpace();
|
||||
};
|
||||
document.append(_keyword_1, _function_1);
|
||||
ISemanticRegionsFinder _regionFor_2 = regions.regionFor(model);
|
||||
ISemanticRegion _keyword_2 = _regionFor_2.keyword("kw2");
|
||||
document.append(regions.regionFor(model).keyword("kw1"), _function_1);
|
||||
final Procedure1<IHiddenRegionFormatter> _function_2 = (IHiddenRegionFormatter it_1) -> {
|
||||
it_1.autowrap();
|
||||
it_1.oneSpace();
|
||||
};
|
||||
document.append(_keyword_2, _function_2);
|
||||
ISemanticRegionsFinder _regionFor_3 = regions.regionFor(model);
|
||||
ISemanticRegion _keyword_3 = _regionFor_3.keyword("kw3");
|
||||
document.append(regions.regionFor(model).keyword("kw2"), _function_2);
|
||||
final Procedure1<IHiddenRegionFormatter> _function_3 = (IHiddenRegionFormatter it_1) -> {
|
||||
it_1.autowrap();
|
||||
it_1.oneSpace();
|
||||
};
|
||||
document.append(_keyword_3, _function_3);
|
||||
ISemanticRegionsFinder _regionFor_4 = regions.regionFor(model);
|
||||
ISemanticRegion _keyword_4 = _regionFor_4.keyword("kw4");
|
||||
document.append(regions.regionFor(model).keyword("kw3"), _function_3);
|
||||
final Procedure1<IHiddenRegionFormatter> _function_4 = (IHiddenRegionFormatter it_1) -> {
|
||||
it_1.autowrap();
|
||||
it_1.newLine();
|
||||
};
|
||||
document.append(_keyword_4, _function_4);
|
||||
document.append(regions.regionFor(model).keyword("kw4"), _function_4);
|
||||
}
|
||||
};
|
||||
it.setFormatter(_function_2);
|
||||
|
@ -291,32 +262,24 @@ public class FormattableDocumentTest {
|
|||
final ISubFormatter _function = (IFormattableSubDocument doc) -> {
|
||||
@Extension
|
||||
final IFormattableSubDocument fits = doc.requireFitsInLine();
|
||||
ISemanticRegionsFinder _regionFor = regions.regionFor(model);
|
||||
ISemanticRegion _keyword = _regionFor.keyword("kwlist");
|
||||
final Procedure1<IHiddenRegionFormatter> _function_1 = (IHiddenRegionFormatter it_1) -> {
|
||||
it_1.oneSpace();
|
||||
};
|
||||
fits.append(_keyword, _function_1);
|
||||
ISemanticRegionsFinder _regionFor_1 = regions.regionFor(model);
|
||||
ISemanticRegion _keyword_1 = _regionFor_1.keyword("kw1");
|
||||
fits.append(regions.regionFor(model).keyword("kwlist"), _function_1);
|
||||
final Procedure1<IHiddenRegionFormatter> _function_2 = (IHiddenRegionFormatter it_1) -> {
|
||||
it_1.oneSpace();
|
||||
};
|
||||
fits.append(_keyword_1, _function_2);
|
||||
fits.append(regions.regionFor(model).keyword("kw1"), _function_2);
|
||||
};
|
||||
final ISubFormatter _function_1 = (IFormattableSubDocument doc) -> {
|
||||
ISemanticRegionsFinder _regionFor = regions.regionFor(model);
|
||||
ISemanticRegion _keyword = _regionFor.keyword("kwlist");
|
||||
final Procedure1<IHiddenRegionFormatter> _function_2 = (IHiddenRegionFormatter it_1) -> {
|
||||
it_1.newLine();
|
||||
};
|
||||
doc.append(_keyword, _function_2);
|
||||
ISemanticRegionsFinder _regionFor_1 = regions.regionFor(model);
|
||||
ISemanticRegion _keyword_1 = _regionFor_1.keyword("kw1");
|
||||
doc.append(regions.regionFor(model).keyword("kwlist"), _function_2);
|
||||
final Procedure1<IHiddenRegionFormatter> _function_3 = (IHiddenRegionFormatter it_1) -> {
|
||||
it_1.newLine();
|
||||
};
|
||||
doc.append(_keyword_1, _function_3);
|
||||
doc.append(regions.regionFor(model).keyword("kw1"), _function_3);
|
||||
};
|
||||
document.formatConditionally(model, _function, _function_1);
|
||||
}
|
||||
|
@ -351,32 +314,24 @@ public class FormattableDocumentTest {
|
|||
final ISubFormatter _function = (IFormattableSubDocument doc) -> {
|
||||
@Extension
|
||||
final IFormattableSubDocument fits = doc.requireFitsInLine();
|
||||
ISemanticRegionsFinder _regionFor = regions.regionFor(model);
|
||||
ISemanticRegion _keyword = _regionFor.keyword("kwlist");
|
||||
final Procedure1<IHiddenRegionFormatter> _function_1 = (IHiddenRegionFormatter it_1) -> {
|
||||
it_1.oneSpace();
|
||||
};
|
||||
fits.append(_keyword, _function_1);
|
||||
ISemanticRegionsFinder _regionFor_1 = regions.regionFor(model);
|
||||
ISemanticRegion _keyword_1 = _regionFor_1.keyword("kw1");
|
||||
fits.append(regions.regionFor(model).keyword("kwlist"), _function_1);
|
||||
final Procedure1<IHiddenRegionFormatter> _function_2 = (IHiddenRegionFormatter it_1) -> {
|
||||
it_1.oneSpace();
|
||||
};
|
||||
fits.append(_keyword_1, _function_2);
|
||||
fits.append(regions.regionFor(model).keyword("kw1"), _function_2);
|
||||
};
|
||||
final ISubFormatter _function_1 = (IFormattableSubDocument doc) -> {
|
||||
ISemanticRegionsFinder _regionFor = regions.regionFor(model);
|
||||
ISemanticRegion _keyword = _regionFor.keyword("kwlist");
|
||||
final Procedure1<IHiddenRegionFormatter> _function_2 = (IHiddenRegionFormatter it_1) -> {
|
||||
it_1.newLine();
|
||||
};
|
||||
doc.append(_keyword, _function_2);
|
||||
ISemanticRegionsFinder _regionFor_1 = regions.regionFor(model);
|
||||
ISemanticRegion _keyword_1 = _regionFor_1.keyword("kw1");
|
||||
doc.append(regions.regionFor(model).keyword("kwlist"), _function_2);
|
||||
final Procedure1<IHiddenRegionFormatter> _function_3 = (IHiddenRegionFormatter it_1) -> {
|
||||
it_1.newLine();
|
||||
};
|
||||
doc.append(_keyword_1, _function_3);
|
||||
doc.append(regions.regionFor(model).keyword("kw1"), _function_3);
|
||||
};
|
||||
document.formatConditionally(model, _function, _function_1);
|
||||
}
|
||||
|
@ -393,8 +348,7 @@ public class FormattableDocumentTest {
|
|||
@Test
|
||||
public void aroundDocument() {
|
||||
final Procedure1<GenericFormatterTestRequest> _function = (GenericFormatterTestRequest it) -> {
|
||||
FormatterRequest _request = it.getRequest();
|
||||
Collection<ITextRegion> _regions = _request.getRegions();
|
||||
Collection<ITextRegion> _regions = it.getRequest().getRegions();
|
||||
TextRegion _textRegion = new TextRegion(0, 6);
|
||||
_regions.add(_textRegion);
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
|
@ -403,12 +357,10 @@ public class FormattableDocumentTest {
|
|||
final GenericFormatter<IDList> _function_1 = new GenericFormatter<IDList>() {
|
||||
@Override
|
||||
protected void format(final IDList model, @Extension final ITextRegionExtensions regions, @Extension final IFormattableDocument document) {
|
||||
ISemanticRegionsFinder _regionFor = regions.regionFor(model);
|
||||
ISemanticRegion _keyword = _regionFor.keyword("idlist");
|
||||
final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it_1) -> {
|
||||
it_1.setSpace("!");
|
||||
};
|
||||
document.surround(_keyword, _function);
|
||||
document.surround(regions.regionFor(model).keyword("idlist"), _function);
|
||||
}
|
||||
};
|
||||
it.setFormatter(_function_1);
|
||||
|
@ -422,8 +374,7 @@ public class FormattableDocumentTest {
|
|||
@Test
|
||||
public void shouldFormat() {
|
||||
final Procedure1<GenericFormatterTestRequest> _function = (GenericFormatterTestRequest it) -> {
|
||||
FormatterRequest _request = it.getRequest();
|
||||
Collection<ITextRegion> _regions = _request.getRegions();
|
||||
Collection<ITextRegion> _regions = it.getRequest().getRegions();
|
||||
TextRegion _textRegion = new TextRegion(0, 6);
|
||||
_regions.add(_textRegion);
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
|
@ -450,8 +401,7 @@ public class FormattableDocumentTest {
|
|||
@Test(expected = IllegalStateException.class)
|
||||
public void shouldFormat_02() {
|
||||
final Procedure1<GenericFormatterTestRequest> _function = (GenericFormatterTestRequest it) -> {
|
||||
FormatterRequest _request = it.getRequest();
|
||||
Collection<ITextRegion> _regions = _request.getRegions();
|
||||
Collection<ITextRegion> _regions = it.getRequest().getRegions();
|
||||
TextRegion _textRegion = new TextRegion(0, 6);
|
||||
_regions.add(_textRegion);
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
|
|
|
@ -11,8 +11,8 @@ import com.google.inject.Inject;
|
|||
import com.google.inject.Provider;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
import org.eclipse.xtext.TerminalRule;
|
||||
import org.eclipse.xtext.formatting2.FormatterRequest;
|
||||
import org.eclipse.xtext.formatting2.IFormattableDocument;
|
||||
import org.eclipse.xtext.formatting2.IHiddenRegionFormatter;
|
||||
|
@ -21,7 +21,6 @@ import org.eclipse.xtext.formatting2.internal.formattertestlanguage.IDList;
|
|||
import org.eclipse.xtext.formatting2.internal.services.FormatterTestLanguageGrammarAccess;
|
||||
import org.eclipse.xtext.formatting2.internal.tests.FormatterTestLanguageInjectorProvider;
|
||||
import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion;
|
||||
import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder;
|
||||
import org.eclipse.xtext.formatting2.regionaccess.ITextRegionExtensions;
|
||||
import org.eclipse.xtext.formatting2.regionaccess.ITextReplacement;
|
||||
import org.eclipse.xtext.formatting2.regionaccess.TextRegionAccessBuilder;
|
||||
|
@ -65,9 +64,6 @@ public class FormatterReplacementsTest {
|
|||
final GenericFormatter<IDList> _function = new GenericFormatter<IDList>() {
|
||||
@Override
|
||||
protected void format(final IDList model, @Extension final ITextRegionExtensions regions, @Extension final IFormattableDocument document) {
|
||||
ISemanticRegionsFinder _regionFor = regions.regionFor(model);
|
||||
TerminalRule _iDRule = FormatterReplacementsTest.this._formatterTestLanguageGrammarAccess.getIDRule();
|
||||
List<ISemanticRegion> _ruleCallsTo = _regionFor.ruleCallsTo(_iDRule);
|
||||
final Consumer<ISemanticRegion> _function = (ISemanticRegion it) -> {
|
||||
final Procedure1<IHiddenRegionFormatter> _function_1 = (IHiddenRegionFormatter it_1) -> {
|
||||
it_1.autowrap();
|
||||
|
@ -75,14 +71,15 @@ public class FormatterReplacementsTest {
|
|||
};
|
||||
document.prepend(it, _function_1);
|
||||
};
|
||||
_ruleCallsTo.forEach(_function);
|
||||
regions.regionFor(model).ruleCallsTo(FormatterReplacementsTest.this._formatterTestLanguageGrammarAccess.getIDRule()).forEach(_function);
|
||||
}
|
||||
};
|
||||
final GenericFormatter<IDList> formatter = _function;
|
||||
final IDList parsed = this.parseHelper.parse("idlist aaa bbb");
|
||||
final FormatterRequest request = this.requestProvider.get();
|
||||
request.setAllowIdentityEdits(false);
|
||||
request.setTextRegionAccess(this.regionBuilder.forNodeModel(((XtextResource) parsed.eResource())).create());
|
||||
Resource _eResource = parsed.eResource();
|
||||
request.setTextRegionAccess(this.regionBuilder.forNodeModel(((XtextResource) _eResource)).create());
|
||||
final List<ITextReplacement> replacements = formatter.format(request);
|
||||
final Function1<ITextReplacement, String> _function_1 = (ITextReplacement it) -> {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
|
@ -96,8 +93,7 @@ public class FormatterReplacementsTest {
|
|||
_builder.append("\n");
|
||||
return _builder.toString();
|
||||
};
|
||||
List<String> _map = ListExtensions.<ITextReplacement, String>map(replacements, _function_1);
|
||||
final String actual = IterableExtensions.join(_map);
|
||||
final String actual = IterableExtensions.join(ListExtensions.<ITextReplacement, String>map(replacements, _function_1));
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("\" \" -> \" \"");
|
||||
_builder.newLine();
|
||||
|
|
|
@ -14,7 +14,6 @@ import java.io.BufferedOutputStream;
|
|||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
|
@ -29,8 +28,6 @@ import org.eclipse.xtext.formatting2.internal.FormatterTestLanguageStandaloneSet
|
|||
import org.eclipse.xtext.formatting2.internal.formattertestlanguage.FormattertestlanguageFactory;
|
||||
import org.eclipse.xtext.formatting2.internal.formattertestlanguage.IDList;
|
||||
import org.eclipse.xtext.formatting2.internal.tests.FormatterTestLanguageInjectorProvider;
|
||||
import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion;
|
||||
import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder;
|
||||
import org.eclipse.xtext.resource.IResourceFactory;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.eclipse.xtext.testing.InjectWith;
|
||||
|
@ -52,8 +49,7 @@ public class FormatterSerializerIntegrationTest {
|
|||
public static class InjectorProvider extends FormatterTestLanguageInjectorProvider {
|
||||
@Override
|
||||
protected Injector internalCreateInjector() {
|
||||
FormatterSerializerIntegrationTest.Setup _setup = new FormatterSerializerIntegrationTest.Setup();
|
||||
return _setup.createInjectorAndDoEMFRegistration();
|
||||
return new FormatterSerializerIntegrationTest.Setup().createInjectorAndDoEMFRegistration();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,12 +69,10 @@ public class FormatterSerializerIntegrationTest {
|
|||
|
||||
public static class Formatter extends AbstractFormatter2 {
|
||||
protected void _format(final IDList model, @Extension final IFormattableDocument document) {
|
||||
ISemanticRegionsFinder _regionFor = this.textRegionExtensions.regionFor(model);
|
||||
ISemanticRegion _keyword = _regionFor.keyword("idlist");
|
||||
final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> {
|
||||
it.setSpace(" ");
|
||||
};
|
||||
document.append(_keyword, _function);
|
||||
document.append(this.textRegionExtensions.regionFor(model).keyword("idlist"), _function);
|
||||
}
|
||||
|
||||
public void format(final Object model, final IFormattableDocument document) {
|
||||
|
@ -110,11 +104,8 @@ public class FormatterSerializerIntegrationTest {
|
|||
@Test
|
||||
public void testFormatterIntegrationWithSerializer() {
|
||||
try {
|
||||
URI _createURI = URI.createURI("dummy.ext");
|
||||
final Resource resource = this.factory.createResource(_createURI);
|
||||
ResourceSetImpl _resourceSetImpl = new ResourceSetImpl();
|
||||
EList<Resource> _resources = _resourceSetImpl.getResources();
|
||||
_resources.add(resource);
|
||||
final Resource resource = this.factory.createResource(URI.createURI("dummy.ext"));
|
||||
new ResourceSetImpl().getResources().add(resource);
|
||||
final IDList model = FormattertestlanguageFactory.eINSTANCE.createIDList();
|
||||
EList<String> _ids = model.getIds();
|
||||
_ids.add("foo");
|
||||
|
@ -122,10 +113,8 @@ public class FormatterSerializerIntegrationTest {
|
|||
_contents.add(model);
|
||||
final ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
BufferedOutputStream _bufferedOutputStream = new BufferedOutputStream(out);
|
||||
Map<Object, Object> _emptyMap = Collections.<Object, Object>emptyMap();
|
||||
resource.save(_bufferedOutputStream, _emptyMap);
|
||||
String _string = out.toString();
|
||||
Assert.assertEquals("idlist foo", _string);
|
||||
resource.save(_bufferedOutputStream, Collections.<Object, Object>emptyMap());
|
||||
Assert.assertEquals("idlist foo", out.toString());
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
*/
|
||||
package org.eclipse.xtext.formatting2.internal;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
|
@ -61,9 +60,7 @@ public class TestableTextSegmentSet {
|
|||
_builder_1.append("]");
|
||||
return _builder_1.toString();
|
||||
};
|
||||
Iterable<String> _map = IterableExtensions.<ITextSegment, String>map(this.set, _function);
|
||||
String _string = _map.toString();
|
||||
String _replace = _string.replace("\n", ", ");
|
||||
String _replace = IterableExtensions.<ITextSegment, String>map(this.set, _function).toString().replace("\n", ", ");
|
||||
_builder.append(_replace);
|
||||
_builder.newLineIfNotEmpty();
|
||||
return _builder.toString();
|
||||
|
@ -75,18 +72,16 @@ public class TestableTextSegmentSet {
|
|||
} catch (final Throwable _t) {
|
||||
if (_t instanceof ConflictingRegionsException) {
|
||||
final ConflictingRegionsException e = (ConflictingRegionsException)_t;
|
||||
Collection<RegionTrace> _traces = e.getTraces();
|
||||
final Function1<RegionTrace, ITextSegment> _function = (RegionTrace it) -> {
|
||||
return it.getRegion();
|
||||
};
|
||||
final Iterable<ITextSegment> conflicting = IterableExtensions.<RegionTrace, ITextSegment>map(_traces, _function);
|
||||
final Iterable<ITextSegment> conflicting = IterableExtensions.<RegionTrace, ITextSegment>map(e.getTraces(), _function);
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("mergeConflict:");
|
||||
final Function1<ITextSegment, String> _function_1 = (ITextSegment it) -> {
|
||||
return this.fmt(it);
|
||||
};
|
||||
Iterable<String> _map = IterableExtensions.<ITextSegment, String>map(conflicting, _function_1);
|
||||
String _join = IterableExtensions.join(_map, "<>");
|
||||
String _join = IterableExtensions.join(IterableExtensions.<ITextSegment, String>map(conflicting, _function_1), "<>");
|
||||
_builder.append(_join);
|
||||
this.issues.add(_builder.toString());
|
||||
} else {
|
||||
|
|
|
@ -54,8 +54,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("1 foo");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("0 0 H");
|
||||
_builder_1.newLine();
|
||||
|
@ -81,8 +80,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("1 /**/ foo");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append(" ");
|
||||
_builder_1.append("0 0 H");
|
||||
|
@ -118,8 +116,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("2 foo");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("0 0 H");
|
||||
_builder_1.newLine();
|
||||
|
@ -151,8 +148,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("3 foo");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("0 0 H");
|
||||
_builder_1.newLine();
|
||||
|
@ -178,8 +174,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("4 prefix foo");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append(" ");
|
||||
_builder_1.append("0 0 H");
|
||||
|
@ -221,8 +216,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("5 a + b");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("0 0 H");
|
||||
_builder_1.newLine();
|
||||
|
@ -268,8 +262,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("5 (a + b) + c");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append(" ");
|
||||
_builder_1.append("0 0 H");
|
||||
|
@ -356,8 +349,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (unassigned foo)");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append(" ");
|
||||
_builder_1.append("0 0 H");
|
||||
|
@ -401,8 +393,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (unassigned datatype foo)");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append(" ");
|
||||
_builder_1.append("0 0 H");
|
||||
|
@ -446,8 +437,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (unassigned datatype datatype foo)");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append(" ");
|
||||
_builder_1.append("0 0 H");
|
||||
|
@ -491,8 +481,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 ()");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("0 0 H");
|
||||
_builder_1.newLine();
|
||||
|
@ -522,8 +511,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (())");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("0 0 H");
|
||||
_builder_1.newLine();
|
||||
|
@ -561,8 +549,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 ((()))");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("0 0 H");
|
||||
_builder_1.newLine();
|
||||
|
@ -608,8 +595,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (((foo)))");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append(" ");
|
||||
_builder_1.append("0 0 H");
|
||||
|
@ -673,8 +659,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (child(((foo))))");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append(" ");
|
||||
_builder_1.append("0 0 H");
|
||||
|
@ -752,8 +737,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (datatype foo)");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append(" ");
|
||||
_builder_1.append("0 0 H");
|
||||
|
@ -793,8 +777,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (datatype datatype foo)");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append(" ");
|
||||
_builder_1.append("0 0 H");
|
||||
|
@ -834,8 +817,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (foo) action (ref foo) end");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append(" ");
|
||||
_builder_1.append("0 0 H");
|
||||
|
@ -915,8 +897,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (lit1)");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("0 0 H");
|
||||
_builder_1.newLine();
|
||||
|
@ -950,8 +931,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (foo) action");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append(" ");
|
||||
_builder_1.append("0 0 H");
|
||||
|
@ -1005,8 +985,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (foo) action action");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append(" ");
|
||||
_builder_1.append("0 0 H");
|
||||
|
@ -1070,8 +1049,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 () action action");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append(" ");
|
||||
_builder_1.append("0 0 H");
|
||||
|
@ -1129,8 +1107,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (fragment foo)");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append(" ");
|
||||
_builder_1.append("0 0 H");
|
||||
|
@ -1174,8 +1151,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (fragment recursion foo)");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append(" ");
|
||||
_builder_1.append("0 0 H");
|
||||
|
@ -1223,8 +1199,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (fragment child ())");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append(" ");
|
||||
_builder_1.append("0 0 H");
|
||||
|
@ -1282,8 +1257,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (fragment child (foo))");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append(" ");
|
||||
_builder_1.append("0 0 H");
|
||||
|
@ -1345,8 +1319,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (fragment recursion child ())");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append(" ");
|
||||
_builder_1.append("0 0 H");
|
||||
|
@ -1408,8 +1381,7 @@ public class RegionAccessBuilderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("7 action (foo)");
|
||||
_builder.newLine();
|
||||
String _string = _builder.toString();
|
||||
String _trim = _string.trim();
|
||||
String _trim = _builder.toString().trim();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append(" ");
|
||||
_builder_1.append("0 0 H");
|
||||
|
@ -1461,14 +1433,10 @@ public class RegionAccessBuilderTest {
|
|||
this.validationTestHelper.assertNoErrors(obj);
|
||||
final ITextRegionAccess access1 = this.createFromNodeModel(obj);
|
||||
final ITextRegionAccess access2 = this.serializer.serializeToRegions(obj);
|
||||
TextRegionAccessToString _textRegionAccessToString = new TextRegionAccessToString();
|
||||
TextRegionAccessToString _withRegionAccess = _textRegionAccessToString.withRegionAccess(access1);
|
||||
TextRegionAccessToString _cfg = this.cfg(_withRegionAccess);
|
||||
TextRegionAccessToString _cfg = this.cfg(new TextRegionAccessToString().withRegionAccess(access1));
|
||||
String _plus = (_cfg + "\n");
|
||||
Assert.assertEquals(exp, _plus);
|
||||
TextRegionAccessToString _textRegionAccessToString_1 = new TextRegionAccessToString();
|
||||
TextRegionAccessToString _withRegionAccess_1 = _textRegionAccessToString_1.withRegionAccess(access2);
|
||||
TextRegionAccessToString _cfg_1 = this.cfg(_withRegionAccess_1);
|
||||
TextRegionAccessToString _cfg_1 = this.cfg(new TextRegionAccessToString().withRegionAccess(access2));
|
||||
String _plus_1 = (_cfg_1 + "\n");
|
||||
Assert.assertEquals(exp, _plus_1);
|
||||
} catch (Throwable _e) {
|
||||
|
@ -1477,14 +1445,11 @@ public class RegionAccessBuilderTest {
|
|||
}
|
||||
|
||||
private TextRegionAccessToString cfg(final TextRegionAccessToString toStr) {
|
||||
TextRegionAccessToString _hideColumnExplanation = toStr.hideColumnExplanation();
|
||||
return _hideColumnExplanation.withTextWidth(10);
|
||||
return toStr.hideColumnExplanation().withTextWidth(10);
|
||||
}
|
||||
|
||||
private ITextRegionAccess createFromNodeModel(final EObject obj) {
|
||||
TextRegionAccessBuilder _get = this.textRegionAccessBuilder.get();
|
||||
Resource _eResource = obj.eResource();
|
||||
TextRegionAccessBuilder _forNodeModel = _get.forNodeModel(((XtextResource) _eResource));
|
||||
return _forNodeModel.create();
|
||||
return this.textRegionAccessBuilder.get().forNodeModel(((XtextResource) _eResource)).create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,12 +15,6 @@ import java.util.List;
|
|||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
import org.eclipse.xtext.Assignment;
|
||||
import org.eclipse.xtext.CrossReference;
|
||||
import org.eclipse.xtext.Keyword;
|
||||
import org.eclipse.xtext.ParserRule;
|
||||
import org.eclipse.xtext.RuleCall;
|
||||
import org.eclipse.xtext.TerminalRule;
|
||||
import org.eclipse.xtext.formatting2.regionaccess.IEObjectRegion;
|
||||
import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion;
|
||||
import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder;
|
||||
|
@ -75,9 +69,7 @@ public class SemanticRegionFinderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (foo)");
|
||||
final Mixed mixed = this.<Mixed>parseAs(_builder, Mixed.class);
|
||||
ITextRegionAccess _access = this.toAccess(mixed);
|
||||
IEObjectRegion _regionForEObject = _access.regionForEObject(mixed);
|
||||
final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor();
|
||||
final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor();
|
||||
final ISemanticRegion actual = finder.feature(RegionaccesstestlanguagePackage.Literals.MIXED__NAME);
|
||||
final List<ISemanticRegion> actuals = finder.features(RegionaccesstestlanguagePackage.Literals.MIXED__NAME);
|
||||
this.assertEquals("foo", actual, actuals);
|
||||
|
@ -88,13 +80,9 @@ public class SemanticRegionFinderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (ref foo) action (foo) end");
|
||||
final AssignedAction mixed = this.<AssignedAction>parseAs(_builder, AssignedAction.class);
|
||||
ITextRegionAccess _access = this.toAccess(mixed);
|
||||
Mixed _child = mixed.getChild();
|
||||
final IEObjectRegion finder = _access.regionForEObject(_child);
|
||||
ISemanticRegionsFinder _regionFor = finder.getRegionFor();
|
||||
final ISemanticRegion actual = _regionFor.feature(RegionaccesstestlanguagePackage.Literals.MIXED__REF);
|
||||
ISemanticRegionsFinder _regionFor_1 = finder.getRegionFor();
|
||||
final List<ISemanticRegion> actuals = _regionFor_1.features(RegionaccesstestlanguagePackage.Literals.MIXED__REF);
|
||||
final IEObjectRegion finder = this.toAccess(mixed).regionForEObject(mixed.getChild());
|
||||
final ISemanticRegion actual = finder.getRegionFor().feature(RegionaccesstestlanguagePackage.Literals.MIXED__REF);
|
||||
final List<ISemanticRegion> actuals = finder.getRegionFor().features(RegionaccesstestlanguagePackage.Literals.MIXED__REF);
|
||||
this.assertEquals("foo", actual, actuals);
|
||||
}
|
||||
|
||||
|
@ -103,9 +91,7 @@ public class SemanticRegionFinderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (foo) action");
|
||||
final AssignedAction mixed = this.<AssignedAction>parseAs(_builder, AssignedAction.class);
|
||||
ITextRegionAccess _access = this.toAccess(mixed);
|
||||
IEObjectRegion _regionForEObject = _access.regionForEObject(mixed);
|
||||
final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor();
|
||||
final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor();
|
||||
try {
|
||||
finder.feature(RegionaccesstestlanguagePackage.Literals.ASSIGNED_ACTION__CHILD);
|
||||
Assert.fail();
|
||||
|
@ -133,15 +119,9 @@ public class SemanticRegionFinderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (unassigned foo)");
|
||||
final Mixed mixed = this.<Mixed>parseAs(_builder, Mixed.class);
|
||||
ITextRegionAccess _access = this.toAccess(mixed);
|
||||
IEObjectRegion _regionForEObject = _access.regionForEObject(mixed);
|
||||
final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor();
|
||||
RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess = this._regionAccessTestLanguageGrammarAccess.getMixedAccess();
|
||||
RuleCall _iDTerminalRuleCall_1_1_0 = _mixedAccess.getIDTerminalRuleCall_1_1_0();
|
||||
final ISemanticRegion actual = finder.ruleCall(_iDTerminalRuleCall_1_1_0);
|
||||
RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess_1 = this._regionAccessTestLanguageGrammarAccess.getMixedAccess();
|
||||
RuleCall _iDTerminalRuleCall_1_1_0_1 = _mixedAccess_1.getIDTerminalRuleCall_1_1_0();
|
||||
final List<ISemanticRegion> actuals = finder.ruleCalls(_iDTerminalRuleCall_1_1_0_1);
|
||||
final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor();
|
||||
final ISemanticRegion actual = finder.ruleCall(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getIDTerminalRuleCall_1_1_0());
|
||||
final List<ISemanticRegion> actuals = finder.ruleCalls(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getIDTerminalRuleCall_1_1_0());
|
||||
this.assertEquals("foo", actual, actuals);
|
||||
}
|
||||
|
||||
|
@ -150,13 +130,9 @@ public class SemanticRegionFinderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (unassigned foo)");
|
||||
final Mixed mixed = this.<Mixed>parseAs(_builder, Mixed.class);
|
||||
ITextRegionAccess _access = this.toAccess(mixed);
|
||||
IEObjectRegion _regionForEObject = _access.regionForEObject(mixed);
|
||||
final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor();
|
||||
TerminalRule _iDRule = this._regionAccessTestLanguageGrammarAccess.getIDRule();
|
||||
final ISemanticRegion actual = finder.ruleCallTo(_iDRule);
|
||||
TerminalRule _iDRule_1 = this._regionAccessTestLanguageGrammarAccess.getIDRule();
|
||||
final List<ISemanticRegion> actuals = finder.ruleCallsTo(_iDRule_1);
|
||||
final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor();
|
||||
final ISemanticRegion actual = finder.ruleCallTo(this._regionAccessTestLanguageGrammarAccess.getIDRule());
|
||||
final List<ISemanticRegion> actuals = finder.ruleCallsTo(this._regionAccessTestLanguageGrammarAccess.getIDRule());
|
||||
this.assertEquals("foo", actual, actuals);
|
||||
}
|
||||
|
||||
|
@ -165,15 +141,9 @@ public class SemanticRegionFinderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (unassigned datatype foo)");
|
||||
final Mixed mixed = this.<Mixed>parseAs(_builder, Mixed.class);
|
||||
ITextRegionAccess _access = this.toAccess(mixed);
|
||||
IEObjectRegion _regionForEObject = _access.regionForEObject(mixed);
|
||||
final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor();
|
||||
RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess = this._regionAccessTestLanguageGrammarAccess.getMixedAccess();
|
||||
RuleCall _datatypeParserRuleCall_1_1_1 = _mixedAccess.getDatatypeParserRuleCall_1_1_1();
|
||||
final ISemanticRegion actual = finder.ruleCall(_datatypeParserRuleCall_1_1_1);
|
||||
RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess_1 = this._regionAccessTestLanguageGrammarAccess.getMixedAccess();
|
||||
RuleCall _datatypeParserRuleCall_1_1_1_1 = _mixedAccess_1.getDatatypeParserRuleCall_1_1_1();
|
||||
final List<ISemanticRegion> actuals = finder.ruleCalls(_datatypeParserRuleCall_1_1_1_1);
|
||||
final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor();
|
||||
final ISemanticRegion actual = finder.ruleCall(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getDatatypeParserRuleCall_1_1_1());
|
||||
final List<ISemanticRegion> actuals = finder.ruleCalls(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getDatatypeParserRuleCall_1_1_1());
|
||||
this.assertEquals("datatype foo", actual, actuals);
|
||||
}
|
||||
|
||||
|
@ -182,13 +152,9 @@ public class SemanticRegionFinderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (unassigned datatype foo)");
|
||||
final Mixed mixed = this.<Mixed>parseAs(_builder, Mixed.class);
|
||||
ITextRegionAccess _access = this.toAccess(mixed);
|
||||
IEObjectRegion _regionForEObject = _access.regionForEObject(mixed);
|
||||
final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor();
|
||||
ParserRule _datatypeRule = this._regionAccessTestLanguageGrammarAccess.getDatatypeRule();
|
||||
final ISemanticRegion actual = finder.ruleCallTo(_datatypeRule);
|
||||
ParserRule _datatypeRule_1 = this._regionAccessTestLanguageGrammarAccess.getDatatypeRule();
|
||||
final List<ISemanticRegion> actuals = finder.ruleCallsTo(_datatypeRule_1);
|
||||
final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor();
|
||||
final ISemanticRegion actual = finder.ruleCallTo(this._regionAccessTestLanguageGrammarAccess.getDatatypeRule());
|
||||
final List<ISemanticRegion> actuals = finder.ruleCallsTo(this._regionAccessTestLanguageGrammarAccess.getDatatypeRule());
|
||||
this.assertEquals("datatype foo", actual, actuals);
|
||||
}
|
||||
|
||||
|
@ -197,15 +163,9 @@ public class SemanticRegionFinderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (foo)");
|
||||
final Mixed mixed = this.<Mixed>parseAs(_builder, Mixed.class);
|
||||
ITextRegionAccess _access = this.toAccess(mixed);
|
||||
IEObjectRegion _regionForEObject = _access.regionForEObject(mixed);
|
||||
final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor();
|
||||
RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess = this._regionAccessTestLanguageGrammarAccess.getMixedAccess();
|
||||
RuleCall _nameIDTerminalRuleCall_2_2_0_0 = _mixedAccess.getNameIDTerminalRuleCall_2_2_0_0();
|
||||
final ISemanticRegion actual = finder.ruleCall(_nameIDTerminalRuleCall_2_2_0_0);
|
||||
RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess_1 = this._regionAccessTestLanguageGrammarAccess.getMixedAccess();
|
||||
RuleCall _nameIDTerminalRuleCall_2_2_0_0_1 = _mixedAccess_1.getNameIDTerminalRuleCall_2_2_0_0();
|
||||
final ISemanticRegion actuals = finder.ruleCall(_nameIDTerminalRuleCall_2_2_0_0_1);
|
||||
final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor();
|
||||
final ISemanticRegion actual = finder.ruleCall(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getNameIDTerminalRuleCall_2_2_0_0());
|
||||
final ISemanticRegion actuals = finder.ruleCall(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getNameIDTerminalRuleCall_2_2_0_0());
|
||||
Assert.assertEquals("foo", actual, actuals);
|
||||
}
|
||||
|
||||
|
@ -214,13 +174,9 @@ public class SemanticRegionFinderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (foo)");
|
||||
final Mixed mixed = this.<Mixed>parseAs(_builder, Mixed.class);
|
||||
ITextRegionAccess _access = this.toAccess(mixed);
|
||||
IEObjectRegion _regionForEObject = _access.regionForEObject(mixed);
|
||||
final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor();
|
||||
TerminalRule _iDRule = this._regionAccessTestLanguageGrammarAccess.getIDRule();
|
||||
final ISemanticRegion actual = finder.ruleCallTo(_iDRule);
|
||||
TerminalRule _iDRule_1 = this._regionAccessTestLanguageGrammarAccess.getIDRule();
|
||||
final ISemanticRegion actuals = finder.ruleCallTo(_iDRule_1);
|
||||
final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor();
|
||||
final ISemanticRegion actual = finder.ruleCallTo(this._regionAccessTestLanguageGrammarAccess.getIDRule());
|
||||
final ISemanticRegion actuals = finder.ruleCallTo(this._regionAccessTestLanguageGrammarAccess.getIDRule());
|
||||
Assert.assertEquals("foo", actual, actuals);
|
||||
}
|
||||
|
||||
|
@ -229,15 +185,9 @@ public class SemanticRegionFinderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (datatype foo)");
|
||||
final Mixed mixed = this.<Mixed>parseAs(_builder, Mixed.class);
|
||||
ITextRegionAccess _access = this.toAccess(mixed);
|
||||
IEObjectRegion _regionForEObject = _access.regionForEObject(mixed);
|
||||
final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor();
|
||||
RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess = this._regionAccessTestLanguageGrammarAccess.getMixedAccess();
|
||||
RuleCall _datatypeDatatypeParserRuleCall_2_2_2_0 = _mixedAccess.getDatatypeDatatypeParserRuleCall_2_2_2_0();
|
||||
final ISemanticRegion actual = finder.ruleCall(_datatypeDatatypeParserRuleCall_2_2_2_0);
|
||||
RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess_1 = this._regionAccessTestLanguageGrammarAccess.getMixedAccess();
|
||||
RuleCall _datatypeDatatypeParserRuleCall_2_2_2_0_1 = _mixedAccess_1.getDatatypeDatatypeParserRuleCall_2_2_2_0();
|
||||
final ISemanticRegion actuals = finder.ruleCall(_datatypeDatatypeParserRuleCall_2_2_2_0_1);
|
||||
final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor();
|
||||
final ISemanticRegion actual = finder.ruleCall(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getDatatypeDatatypeParserRuleCall_2_2_2_0());
|
||||
final ISemanticRegion actuals = finder.ruleCall(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getDatatypeDatatypeParserRuleCall_2_2_2_0());
|
||||
Assert.assertEquals("datatype foo", actual, actuals);
|
||||
}
|
||||
|
||||
|
@ -246,13 +196,9 @@ public class SemanticRegionFinderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (datatype foo)");
|
||||
final Mixed mixed = this.<Mixed>parseAs(_builder, Mixed.class);
|
||||
ITextRegionAccess _access = this.toAccess(mixed);
|
||||
IEObjectRegion _regionForEObject = _access.regionForEObject(mixed);
|
||||
final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor();
|
||||
ParserRule _datatypeRule = this._regionAccessTestLanguageGrammarAccess.getDatatypeRule();
|
||||
final ISemanticRegion actual = finder.ruleCallTo(_datatypeRule);
|
||||
ParserRule _datatypeRule_1 = this._regionAccessTestLanguageGrammarAccess.getDatatypeRule();
|
||||
final ISemanticRegion actuals = finder.ruleCallTo(_datatypeRule_1);
|
||||
final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor();
|
||||
final ISemanticRegion actual = finder.ruleCallTo(this._regionAccessTestLanguageGrammarAccess.getDatatypeRule());
|
||||
final ISemanticRegion actuals = finder.ruleCallTo(this._regionAccessTestLanguageGrammarAccess.getDatatypeRule());
|
||||
Assert.assertEquals("datatype foo", actual, actuals);
|
||||
}
|
||||
|
||||
|
@ -261,16 +207,9 @@ public class SemanticRegionFinderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (ref foo) action (foo) end");
|
||||
final AssignedAction mixed = this.<AssignedAction>parseAs(_builder, AssignedAction.class);
|
||||
ITextRegionAccess _access = this.toAccess(mixed);
|
||||
Mixed _child = mixed.getChild();
|
||||
IEObjectRegion _regionForEObject = _access.regionForEObject(_child);
|
||||
final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor();
|
||||
RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess = this._regionAccessTestLanguageGrammarAccess.getMixedAccess();
|
||||
RuleCall _refMixedIDTerminalRuleCall_2_2_3_1_0_1 = _mixedAccess.getRefMixedIDTerminalRuleCall_2_2_3_1_0_1();
|
||||
final ISemanticRegion actual = finder.ruleCall(_refMixedIDTerminalRuleCall_2_2_3_1_0_1);
|
||||
RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess_1 = this._regionAccessTestLanguageGrammarAccess.getMixedAccess();
|
||||
RuleCall _refMixedIDTerminalRuleCall_2_2_3_1_0_1_1 = _mixedAccess_1.getRefMixedIDTerminalRuleCall_2_2_3_1_0_1();
|
||||
final List<ISemanticRegion> actuals = finder.ruleCalls(_refMixedIDTerminalRuleCall_2_2_3_1_0_1_1);
|
||||
final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed.getChild()).getRegionFor();
|
||||
final ISemanticRegion actual = finder.ruleCall(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getRefMixedIDTerminalRuleCall_2_2_3_1_0_1());
|
||||
final List<ISemanticRegion> actuals = finder.ruleCalls(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getRefMixedIDTerminalRuleCall_2_2_3_1_0_1());
|
||||
this.assertEquals("foo", actual, actuals);
|
||||
}
|
||||
|
||||
|
@ -279,14 +218,9 @@ public class SemanticRegionFinderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (ref foo) action (foo) end");
|
||||
final AssignedAction mixed = this.<AssignedAction>parseAs(_builder, AssignedAction.class);
|
||||
ITextRegionAccess _access = this.toAccess(mixed);
|
||||
Mixed _child = mixed.getChild();
|
||||
IEObjectRegion _regionForEObject = _access.regionForEObject(_child);
|
||||
final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor();
|
||||
TerminalRule _iDRule = this._regionAccessTestLanguageGrammarAccess.getIDRule();
|
||||
final ISemanticRegion actual = finder.ruleCallTo(_iDRule);
|
||||
TerminalRule _iDRule_1 = this._regionAccessTestLanguageGrammarAccess.getIDRule();
|
||||
final List<ISemanticRegion> actuals = finder.ruleCallsTo(_iDRule_1);
|
||||
final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed.getChild()).getRegionFor();
|
||||
final ISemanticRegion actual = finder.ruleCallTo(this._regionAccessTestLanguageGrammarAccess.getIDRule());
|
||||
final List<ISemanticRegion> actuals = finder.ruleCallsTo(this._regionAccessTestLanguageGrammarAccess.getIDRule());
|
||||
this.assertEquals("foo", actual, actuals);
|
||||
}
|
||||
|
||||
|
@ -295,13 +229,9 @@ public class SemanticRegionFinderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (child (foo))");
|
||||
final Mixed mixed = this.<Mixed>parseAs(_builder, Mixed.class);
|
||||
ITextRegionAccess _access = this.toAccess(mixed);
|
||||
IEObjectRegion _regionForEObject = _access.regionForEObject(mixed);
|
||||
final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor();
|
||||
final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor();
|
||||
try {
|
||||
RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess = this._regionAccessTestLanguageGrammarAccess.getMixedAccess();
|
||||
RuleCall _eobjMixedParserRuleCall_2_2_1_1_0 = _mixedAccess.getEobjMixedParserRuleCall_2_2_1_1_0();
|
||||
finder.ruleCall(_eobjMixedParserRuleCall_2_2_1_1_0);
|
||||
finder.ruleCall(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getEobjMixedParserRuleCall_2_2_1_1_0());
|
||||
Assert.fail();
|
||||
} catch (final Throwable _t) {
|
||||
if (_t instanceof IllegalStateException) {
|
||||
|
@ -311,9 +241,7 @@ public class SemanticRegionFinderTest {
|
|||
}
|
||||
}
|
||||
try {
|
||||
RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess_1 = this._regionAccessTestLanguageGrammarAccess.getMixedAccess();
|
||||
RuleCall _eobjMixedParserRuleCall_2_2_1_1_0_1 = _mixedAccess_1.getEobjMixedParserRuleCall_2_2_1_1_0();
|
||||
finder.ruleCalls(_eobjMixedParserRuleCall_2_2_1_1_0_1);
|
||||
finder.ruleCalls(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getEobjMixedParserRuleCall_2_2_1_1_0());
|
||||
Assert.fail();
|
||||
} catch (final Throwable _t_1) {
|
||||
if (_t_1 instanceof IllegalStateException) {
|
||||
|
@ -329,12 +257,9 @@ public class SemanticRegionFinderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (child (foo))");
|
||||
final Mixed mixed = this.<Mixed>parseAs(_builder, Mixed.class);
|
||||
ITextRegionAccess _access = this.toAccess(mixed);
|
||||
IEObjectRegion _regionForEObject = _access.regionForEObject(mixed);
|
||||
final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor();
|
||||
final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor();
|
||||
try {
|
||||
ParserRule _mixedRule = this._regionAccessTestLanguageGrammarAccess.getMixedRule();
|
||||
finder.ruleCallTo(_mixedRule);
|
||||
finder.ruleCallTo(this._regionAccessTestLanguageGrammarAccess.getMixedRule());
|
||||
Assert.fail();
|
||||
} catch (final Throwable _t) {
|
||||
if (_t instanceof IllegalStateException) {
|
||||
|
@ -344,8 +269,7 @@ public class SemanticRegionFinderTest {
|
|||
}
|
||||
}
|
||||
try {
|
||||
ParserRule _mixedRule_1 = this._regionAccessTestLanguageGrammarAccess.getMixedRule();
|
||||
finder.ruleCallsTo(_mixedRule_1);
|
||||
finder.ruleCallsTo(this._regionAccessTestLanguageGrammarAccess.getMixedRule());
|
||||
Assert.fail();
|
||||
} catch (final Throwable _t_1) {
|
||||
if (_t_1 instanceof IllegalStateException) {
|
||||
|
@ -361,9 +285,7 @@ public class SemanticRegionFinderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (foo)");
|
||||
final Mixed mixed = this.<Mixed>parseAs(_builder, Mixed.class);
|
||||
ITextRegionAccess _access = this.toAccess(mixed);
|
||||
IEObjectRegion _regionForEObject = _access.regionForEObject(mixed);
|
||||
final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor();
|
||||
final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor();
|
||||
final ISemanticRegion actual = finder.keyword("(");
|
||||
final List<ISemanticRegion> actuals = finder.keywords("(");
|
||||
this.assertEquals("(", actual, actuals);
|
||||
|
@ -374,15 +296,9 @@ public class SemanticRegionFinderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (foo)");
|
||||
final Mixed mixed = this.<Mixed>parseAs(_builder, Mixed.class);
|
||||
ITextRegionAccess _access = this.toAccess(mixed);
|
||||
IEObjectRegion _regionForEObject = _access.regionForEObject(mixed);
|
||||
final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor();
|
||||
RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess = this._regionAccessTestLanguageGrammarAccess.getMixedAccess();
|
||||
Keyword _leftParenthesisKeyword_0 = _mixedAccess.getLeftParenthesisKeyword_0();
|
||||
final ISemanticRegion actual = finder.keyword(_leftParenthesisKeyword_0);
|
||||
RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess_1 = this._regionAccessTestLanguageGrammarAccess.getMixedAccess();
|
||||
Keyword _leftParenthesisKeyword_0_1 = _mixedAccess_1.getLeftParenthesisKeyword_0();
|
||||
final List<ISemanticRegion> actuals = finder.keywords(_leftParenthesisKeyword_0_1);
|
||||
final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor();
|
||||
final ISemanticRegion actual = finder.keyword(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getLeftParenthesisKeyword_0());
|
||||
final List<ISemanticRegion> actuals = finder.keywords(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getLeftParenthesisKeyword_0());
|
||||
this.assertEquals("(", actual, actuals);
|
||||
}
|
||||
|
||||
|
@ -391,16 +307,9 @@ public class SemanticRegionFinderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (ref foo) action (foo) end");
|
||||
final AssignedAction mixed = this.<AssignedAction>parseAs(_builder, AssignedAction.class);
|
||||
ITextRegionAccess _access = this.toAccess(mixed);
|
||||
Mixed _child = mixed.getChild();
|
||||
IEObjectRegion _regionForEObject = _access.regionForEObject(_child);
|
||||
final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor();
|
||||
RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess = this._regionAccessTestLanguageGrammarAccess.getMixedAccess();
|
||||
CrossReference _refMixedCrossReference_2_2_3_1_0 = _mixedAccess.getRefMixedCrossReference_2_2_3_1_0();
|
||||
final ISemanticRegion actual = finder.crossRef(_refMixedCrossReference_2_2_3_1_0);
|
||||
RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess_1 = this._regionAccessTestLanguageGrammarAccess.getMixedAccess();
|
||||
CrossReference _refMixedCrossReference_2_2_3_1_0_1 = _mixedAccess_1.getRefMixedCrossReference_2_2_3_1_0();
|
||||
final List<ISemanticRegion> actuals = finder.crossRefs(_refMixedCrossReference_2_2_3_1_0_1);
|
||||
final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed.getChild()).getRegionFor();
|
||||
final ISemanticRegion actual = finder.crossRef(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getRefMixedCrossReference_2_2_3_1_0());
|
||||
final List<ISemanticRegion> actuals = finder.crossRefs(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getRefMixedCrossReference_2_2_3_1_0());
|
||||
this.assertEquals("foo", actual, actuals);
|
||||
}
|
||||
|
||||
|
@ -409,15 +318,9 @@ public class SemanticRegionFinderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("6 (foo)");
|
||||
final Mixed mixed = this.<Mixed>parseAs(_builder, Mixed.class);
|
||||
ITextRegionAccess _access = this.toAccess(mixed);
|
||||
IEObjectRegion _regionForEObject = _access.regionForEObject(mixed);
|
||||
final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor();
|
||||
RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess = this._regionAccessTestLanguageGrammarAccess.getMixedAccess();
|
||||
Assignment _nameAssignment_2_2_0 = _mixedAccess.getNameAssignment_2_2_0();
|
||||
final ISemanticRegion actual = finder.assignment(_nameAssignment_2_2_0);
|
||||
RegionAccessTestLanguageGrammarAccess.MixedElements _mixedAccess_1 = this._regionAccessTestLanguageGrammarAccess.getMixedAccess();
|
||||
Assignment _nameAssignment_2_2_0_1 = _mixedAccess_1.getNameAssignment_2_2_0();
|
||||
final List<ISemanticRegion> actuals = finder.assignments(_nameAssignment_2_2_0_1);
|
||||
final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor();
|
||||
final ISemanticRegion actual = finder.assignment(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getNameAssignment_2_2_0());
|
||||
final List<ISemanticRegion> actuals = finder.assignments(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getNameAssignment_2_2_0());
|
||||
this.assertEquals("foo", actual, actuals);
|
||||
}
|
||||
|
||||
|
@ -428,15 +331,9 @@ public class SemanticRegionFinderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("5 (foo)");
|
||||
final Expression expr = this.<Expression>parseAs(_builder, Expression.class);
|
||||
ITextRegionAccess _access = this.toAccess(expr);
|
||||
IEObjectRegion _regionForEObject = _access.regionForEObject(expr);
|
||||
final ISemanticRegionsFinder finder = _regionForEObject.getRegionFor();
|
||||
List<Pair<ISemanticRegion, ISemanticRegion>> _keywordPairs = finder.keywordPairs("(", ")");
|
||||
final String actual1 = this.pairsToString(_keywordPairs);
|
||||
Keyword _leftParenthesisKeyword_0 = rule.getLeftParenthesisKeyword_0();
|
||||
Keyword _rightParenthesisKeyword_2 = rule.getRightParenthesisKeyword_2();
|
||||
List<Pair<ISemanticRegion, ISemanticRegion>> _keywordPairs_1 = finder.keywordPairs(_leftParenthesisKeyword_0, _rightParenthesisKeyword_2);
|
||||
final String actual2 = this.pairsToString(_keywordPairs_1);
|
||||
final ISemanticRegionsFinder finder = this.toAccess(expr).regionForEObject(expr).getRegionFor();
|
||||
final String actual1 = this.pairsToString(finder.keywordPairs("(", ")"));
|
||||
final String actual2 = this.pairsToString(finder.keywordPairs(rule.getLeftParenthesisKeyword_0(), rule.getRightParenthesisKeyword_2()));
|
||||
final String expected = "(foo)";
|
||||
Assert.assertEquals(expected, actual1);
|
||||
Assert.assertEquals(expected, actual2);
|
||||
|
@ -449,15 +346,9 @@ public class SemanticRegionFinderTest {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("5 (a + ((b) + c) + d)");
|
||||
final Expression expr = this.<Expression>parseAs(_builder, Expression.class);
|
||||
ITextRegionAccess _access = this.toAccess(expr);
|
||||
IEObjectRegion _regionForRootEObject = _access.regionForRootEObject();
|
||||
final ISemanticRegionsFinder finder = _regionForRootEObject.getAllRegionsFor();
|
||||
List<Pair<ISemanticRegion, ISemanticRegion>> _keywordPairs = finder.keywordPairs("(", ")");
|
||||
final String actual1 = this.pairsToString(_keywordPairs);
|
||||
Keyword _leftParenthesisKeyword_0 = rule.getLeftParenthesisKeyword_0();
|
||||
Keyword _rightParenthesisKeyword_2 = rule.getRightParenthesisKeyword_2();
|
||||
List<Pair<ISemanticRegion, ISemanticRegion>> _keywordPairs_1 = finder.keywordPairs(_leftParenthesisKeyword_0, _rightParenthesisKeyword_2);
|
||||
final String actual2 = this.pairsToString(_keywordPairs_1);
|
||||
final ISemanticRegionsFinder finder = this.toAccess(expr).regionForRootEObject().getAllRegionsFor();
|
||||
final String actual1 = this.pairsToString(finder.keywordPairs("(", ")"));
|
||||
final String actual2 = this.pairsToString(finder.keywordPairs(rule.getLeftParenthesisKeyword_0(), rule.getRightParenthesisKeyword_2()));
|
||||
final String expected = "(b); ((b) + c); (a + ((b) + c) + d)";
|
||||
Assert.assertEquals(expected, actual1);
|
||||
Assert.assertEquals(expected, actual2);
|
||||
|
@ -465,13 +356,9 @@ public class SemanticRegionFinderTest {
|
|||
|
||||
private String pairsToString(final Iterable<Pair<ISemanticRegion, ISemanticRegion>> pairs) {
|
||||
final Function1<Pair<ISemanticRegion, ISemanticRegion>, String> _function = (Pair<ISemanticRegion, ISemanticRegion> it) -> {
|
||||
ISemanticRegion _key = it.getKey();
|
||||
ISemanticRegion _value = it.getValue();
|
||||
ITextSegment _merge = _key.merge(_value);
|
||||
return _merge.getText();
|
||||
return it.getKey().merge(it.getValue()).getText();
|
||||
};
|
||||
Iterable<String> _map = IterableExtensions.<Pair<ISemanticRegion, ISemanticRegion>, String>map(pairs, _function);
|
||||
return IterableExtensions.join(_map, "; ");
|
||||
return IterableExtensions.join(IterableExtensions.<Pair<ISemanticRegion, ISemanticRegion>, String>map(pairs, _function), "; ");
|
||||
}
|
||||
|
||||
private <T extends EObject> T parseAs(final CharSequence seq, final Class<T> cls) {
|
||||
|
@ -485,10 +372,8 @@ public class SemanticRegionFinderTest {
|
|||
}
|
||||
|
||||
private ITextRegionAccess toAccess(final EObject obj) {
|
||||
TextRegionAccessBuilder _get = this.textRegionAccessBuilder.get();
|
||||
Resource _eResource = obj.eResource();
|
||||
TextRegionAccessBuilder _forNodeModel = _get.forNodeModel(((XtextResource) _eResource));
|
||||
return _forNodeModel.create();
|
||||
return this.textRegionAccessBuilder.get().forNodeModel(((XtextResource) _eResource)).create();
|
||||
}
|
||||
|
||||
private void assertEquals(final String expected, final ITextSegment single, final Collection<? extends ITextSegment> regions) {
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
package org.eclipse.xtext.generator;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.eclipse.emf.ecore.EcorePackage;
|
||||
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
|
||||
|
@ -25,51 +24,37 @@ public class TypeReferenceTest {
|
|||
@Test
|
||||
public void testDefaultPackage() {
|
||||
final TypeReference ref = TypeReference.typeRef("EString");
|
||||
String _packageName = ref.getPackageName();
|
||||
Assert.assertEquals("", _packageName);
|
||||
String _simpleName = ref.getSimpleName();
|
||||
Assert.assertEquals("EString", _simpleName);
|
||||
Assert.assertEquals("", ref.getPackageName());
|
||||
Assert.assertEquals("EString", ref.getSimpleName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnderscopresAnd$() {
|
||||
final TypeReference ref = TypeReference.typeRef("E_$tring");
|
||||
String _packageName = ref.getPackageName();
|
||||
Assert.assertEquals("", _packageName);
|
||||
String _simpleName = ref.getSimpleName();
|
||||
Assert.assertEquals("E_$tring", _simpleName);
|
||||
Assert.assertEquals("", ref.getPackageName());
|
||||
Assert.assertEquals("E_$tring", ref.getSimpleName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnderscopresAnd$02() {
|
||||
final TypeReference ref = TypeReference.typeRef("$.$._$.E_$tring");
|
||||
String _packageName = ref.getPackageName();
|
||||
Assert.assertEquals("$.$._$", _packageName);
|
||||
String _simpleName = ref.getSimpleName();
|
||||
Assert.assertEquals("E_$tring", _simpleName);
|
||||
Assert.assertEquals("$.$._$", ref.getPackageName());
|
||||
Assert.assertEquals("E_$tring", ref.getSimpleName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPackageName() {
|
||||
final TypeReference ref = TypeReference.typeRef("org.example.MyType");
|
||||
String _simpleName = ref.getSimpleName();
|
||||
Assert.assertEquals("MyType", _simpleName);
|
||||
String _packageName = ref.getPackageName();
|
||||
Assert.assertEquals("org.example", _packageName);
|
||||
Assert.assertEquals("MyType", ref.getSimpleName());
|
||||
Assert.assertEquals("org.example", ref.getPackageName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParametrizedType() {
|
||||
TypeReference _typeRef = TypeReference.typeRef("String");
|
||||
final TypeReference ref = TypeReference.typeRef("java.util.List", _typeRef);
|
||||
String _simpleName = ref.getSimpleName();
|
||||
Assert.assertEquals("List", _simpleName);
|
||||
String _packageName = ref.getPackageName();
|
||||
Assert.assertEquals("java.util", _packageName);
|
||||
List<TypeReference> _typeArguments = ref.getTypeArguments();
|
||||
TypeReference _head = IterableExtensions.<TypeReference>head(_typeArguments);
|
||||
String _simpleName_1 = _head.getSimpleName();
|
||||
Assert.assertEquals("String", _simpleName_1);
|
||||
final TypeReference ref = TypeReference.typeRef("java.util.List", TypeReference.typeRef("String"));
|
||||
Assert.assertEquals("List", ref.getSimpleName());
|
||||
Assert.assertEquals("java.util", ref.getPackageName());
|
||||
Assert.assertEquals("String", IterableExtensions.<TypeReference>head(ref.getTypeArguments()).getSimpleName());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
|
@ -80,34 +65,25 @@ public class TypeReferenceTest {
|
|||
@Test
|
||||
public void testNestedType() {
|
||||
final TypeReference ref = new TypeReference("java.util", "Map.Entry");
|
||||
String _packageName = ref.getPackageName();
|
||||
Assert.assertEquals("java.util", _packageName);
|
||||
String _simpleName = ref.getSimpleName();
|
||||
Assert.assertEquals("Entry", _simpleName);
|
||||
List<String> _simpleNames = ref.getSimpleNames();
|
||||
Assert.assertEquals(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("Map", "Entry")), _simpleNames);
|
||||
Assert.assertEquals("java.util", ref.getPackageName());
|
||||
Assert.assertEquals("Entry", ref.getSimpleName());
|
||||
Assert.assertEquals(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("Map", "Entry")), ref.getSimpleNames());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLowerCaseNestedType() {
|
||||
final TypeReference ref = new TypeReference("java.util", "Map.entry");
|
||||
String _packageName = ref.getPackageName();
|
||||
Assert.assertEquals("java.util", _packageName);
|
||||
String _simpleName = ref.getSimpleName();
|
||||
Assert.assertEquals("entry", _simpleName);
|
||||
List<String> _simpleNames = ref.getSimpleNames();
|
||||
Assert.assertEquals(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("Map", "entry")), _simpleNames);
|
||||
Assert.assertEquals("java.util", ref.getPackageName());
|
||||
Assert.assertEquals("entry", ref.getSimpleName());
|
||||
Assert.assertEquals(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("Map", "entry")), ref.getSimpleNames());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGuessTypeRef() {
|
||||
final TypeReference ref = TypeReference.guessTypeRef("java.util.Map.Entry");
|
||||
String _packageName = ref.getPackageName();
|
||||
Assert.assertEquals("java.util", _packageName);
|
||||
String _simpleName = ref.getSimpleName();
|
||||
Assert.assertEquals("Entry", _simpleName);
|
||||
List<String> _simpleNames = ref.getSimpleNames();
|
||||
Assert.assertEquals(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("Map", "Entry")), _simpleNames);
|
||||
Assert.assertEquals("java.util", ref.getPackageName());
|
||||
Assert.assertEquals("Entry", ref.getSimpleName());
|
||||
Assert.assertEquals(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("Map", "Entry")), ref.getSimpleNames());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
|
@ -118,22 +94,19 @@ public class TypeReferenceTest {
|
|||
@Test
|
||||
public void testJavaPath() {
|
||||
final TypeReference ref = TypeReference.typeRef("org.example.MyType");
|
||||
String _javaPath = ref.getJavaPath();
|
||||
Assert.assertEquals("org/example/MyType.java", _javaPath);
|
||||
Assert.assertEquals("org/example/MyType.java", ref.getJavaPath());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testXtendPath() {
|
||||
final TypeReference ref = TypeReference.typeRef("org.example.MyType");
|
||||
String _xtendPath = ref.getXtendPath();
|
||||
Assert.assertEquals("org/example/MyType.xtend", _xtendPath);
|
||||
Assert.assertEquals("org/example/MyType.xtend", ref.getXtendPath());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEObject() {
|
||||
final ResourceSetImpl rs = new ResourceSetImpl();
|
||||
final TypeReference ref = new TypeReference(EcorePackage.Literals.EOBJECT, rs);
|
||||
String _name = ref.getName();
|
||||
Assert.assertEquals("org.eclipse.emf.ecore.EObject", _name);
|
||||
Assert.assertEquals("org.eclipse.emf.ecore.EObject", ref.getName());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,34 +37,27 @@ public class AntlrGrammarComparatorTestHelper {
|
|||
private static class TestErrorHandler implements AntlrGrammarComparator.IErrorHandler {
|
||||
@Override
|
||||
public void handleMismatch(final String match, final String matchReference, final AntlrGrammarComparator.ErrorContext context) {
|
||||
AntlrGrammarComparator.MatchState _testedGrammar = context.getTestedGrammar();
|
||||
int _lineNumber = _testedGrammar.getLineNumber();
|
||||
AntlrGrammarComparator.MatchState _referenceGrammar = context.getReferenceGrammar();
|
||||
int _lineNumber_1 = _referenceGrammar.getLineNumber();
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("Inputs differs at token ");
|
||||
_builder.append(match);
|
||||
_builder.append(" (line ");
|
||||
AntlrGrammarComparator.MatchState _testedGrammar_1 = context.getTestedGrammar();
|
||||
int _lineNumber_2 = _testedGrammar_1.getLineNumber();
|
||||
_builder.append(_lineNumber_2);
|
||||
int _lineNumber = context.getTestedGrammar().getLineNumber();
|
||||
_builder.append(_lineNumber);
|
||||
_builder.append("), expected token ");
|
||||
_builder.append(matchReference);
|
||||
_builder.append(" (line ");
|
||||
AntlrGrammarComparator.MatchState _referenceGrammar_1 = context.getReferenceGrammar();
|
||||
int _lineNumber_3 = _referenceGrammar_1.getLineNumber();
|
||||
_builder.append(_lineNumber_3);
|
||||
int _lineNumber_1 = context.getReferenceGrammar().getLineNumber();
|
||||
_builder.append(_lineNumber_1);
|
||||
_builder.append(").");
|
||||
_builder.newLineIfNotEmpty();
|
||||
AntlrGrammarComparatorTestHelper.fail(_lineNumber, _lineNumber_1, _builder.toString());
|
||||
AntlrGrammarComparatorTestHelper.fail(context.getTestedGrammar().getLineNumber(), context.getReferenceGrammar().getLineNumber(), _builder.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleInvalidGeneratedGrammarFile(final AntlrGrammarComparator.ErrorContext context) {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("Noticed an unmatched character sequence in \'testee\' in/before line ");
|
||||
AntlrGrammarComparator.MatchState _testedGrammar = context.getTestedGrammar();
|
||||
int _lineNumber = _testedGrammar.getLineNumber();
|
||||
int _lineNumber = context.getTestedGrammar().getLineNumber();
|
||||
_builder.append(_lineNumber);
|
||||
_builder.append(".");
|
||||
_builder.newLineIfNotEmpty();
|
||||
|
@ -75,8 +68,7 @@ public class AntlrGrammarComparatorTestHelper {
|
|||
public void handleInvalidReferenceGrammarFile(final AntlrGrammarComparator.ErrorContext context) {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("Noticed an unmatched character sequence in \'expected\' in/before line ");
|
||||
AntlrGrammarComparator.MatchState _referenceGrammar = context.getReferenceGrammar();
|
||||
int _lineNumber = _referenceGrammar.getLineNumber();
|
||||
int _lineNumber = context.getReferenceGrammar().getLineNumber();
|
||||
_builder.append(_lineNumber);
|
||||
_builder.append(".");
|
||||
_builder.newLineIfNotEmpty();
|
||||
|
|
|
@ -43,16 +43,14 @@ public class TraceRegionMergerTest {
|
|||
TraceRegionMergerTest.TestBuilder _xblockexpression = null;
|
||||
{
|
||||
final TraceRegionMergerTest.TraceBuilder traceBuilder = new TraceRegionMergerTest.TraceBuilder(this, uri);
|
||||
AbstractTraceRegion _apply = init.apply(traceBuilder);
|
||||
this.roots.add(_apply);
|
||||
this.roots.add(init.apply(traceBuilder));
|
||||
_xblockexpression = this;
|
||||
}
|
||||
return _xblockexpression;
|
||||
}
|
||||
|
||||
public void assertMerged(final Procedure1<? super TraceRegionMergerTest.AssertBuilder> init) {
|
||||
TraceRegionMerger _traceRegionMerger = new TraceRegionMerger();
|
||||
final AbstractTraceRegion mergedRoot = _traceRegionMerger.mergeTraceRegions(this.roots);
|
||||
final AbstractTraceRegion mergedRoot = new TraceRegionMerger().mergeTraceRegions(this.roots);
|
||||
Assert.assertNotNull(mergedRoot);
|
||||
LinkedList<AbstractTraceRegion> _newLinkedList = CollectionLiterals.<AbstractTraceRegion>newLinkedList(mergedRoot);
|
||||
final TraceRegionMergerTest.AssertBuilder assertBuilder = new TraceRegionMergerTest.AssertBuilder(this, _newLinkedList);
|
||||
|
@ -133,15 +131,15 @@ public class TraceRegionMergerTest {
|
|||
Assert.assertEquals(head.toString(), length, head.getMyLength());
|
||||
Assert.assertEquals(head.toString(), startLine, head.getMyLineNumber());
|
||||
Assert.assertEquals(head.toString(), endLine, head.getMyEndLineNumber());
|
||||
List<ILocationData> _associatedLocations = head.getAssociatedLocations();
|
||||
final Function1<ILocationData, SourceRelativeURI> _function = (ILocationData it) -> {
|
||||
return it.getSrcRelativePath();
|
||||
};
|
||||
List<SourceRelativeURI> _map = ListExtensions.<ILocationData, SourceRelativeURI>map(_associatedLocations, _function);
|
||||
final Set<SourceRelativeURI> associatedLocations = IterableExtensions.<SourceRelativeURI>toSet(_map);
|
||||
final Set<SourceRelativeURI> associatedLocations = IterableExtensions.<SourceRelativeURI>toSet(ListExtensions.<ILocationData, SourceRelativeURI>map(head.getAssociatedLocations(), _function));
|
||||
Assert.assertEquals(head.toString(), ((Object[])Conversions.unwrapArray(uris, Object.class)).length, ((Object[])Conversions.unwrapArray(associatedLocations, Object.class)).length);
|
||||
for (final String uri : uris) {
|
||||
Assert.assertTrue(("Missing " + uri), associatedLocations.contains(new SourceRelativeURI(URI.createURI(uri))));
|
||||
URI _createURI = URI.createURI(uri);
|
||||
SourceRelativeURI _sourceRelativeURI = new SourceRelativeURI(_createURI);
|
||||
Assert.assertTrue(("Missing " + uri), associatedLocations.contains(_sourceRelativeURI));
|
||||
}
|
||||
if ((init == null)) {
|
||||
Assert.assertTrue(head.getNestedRegions().isEmpty());
|
||||
|
@ -176,7 +174,6 @@ public class TraceRegionMergerTest {
|
|||
};
|
||||
return it.region(2, 6, 1, 3, _function_1);
|
||||
};
|
||||
TraceRegionMergerTest.TestBuilder _traceTo = this.traceTo("foo", _function);
|
||||
final Procedure1<TraceRegionMergerTest.AssertBuilder> _function_1 = (TraceRegionMergerTest.AssertBuilder it) -> {
|
||||
final Procedure1<TraceRegionMergerTest.AssertBuilder> _function_2 = (TraceRegionMergerTest.AssertBuilder it_1) -> {
|
||||
it_1.region(2, 2, 1, 2, "foo");
|
||||
|
@ -185,7 +182,7 @@ public class TraceRegionMergerTest {
|
|||
};
|
||||
it.region(2, 6, 1, 3, _function_2);
|
||||
};
|
||||
_traceTo.assertMerged(_function_1);
|
||||
this.traceTo("foo", _function).assertMerged(_function_1);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -197,7 +194,6 @@ public class TraceRegionMergerTest {
|
|||
};
|
||||
return it.region(0, 4, 0, 2, _function_1);
|
||||
};
|
||||
TraceRegionMergerTest.TestBuilder _traceTo = this.traceTo("foo", _function);
|
||||
final Function1<TraceRegionMergerTest.TraceBuilder, AbstractTraceRegion> _function_1 = (TraceRegionMergerTest.TraceBuilder it) -> {
|
||||
final Procedure1<TraceRegionMergerTest.TraceBuilder> _function_2 = (TraceRegionMergerTest.TraceBuilder it_1) -> {
|
||||
it_1.region(0, 2, 0, 1);
|
||||
|
@ -205,7 +201,6 @@ public class TraceRegionMergerTest {
|
|||
};
|
||||
return it.region(0, 4, 0, 2, _function_2);
|
||||
};
|
||||
TraceRegionMergerTest.TestBuilder _traceTo_1 = _traceTo.traceTo("bar", _function_1);
|
||||
final Procedure1<TraceRegionMergerTest.AssertBuilder> _function_2 = (TraceRegionMergerTest.AssertBuilder it) -> {
|
||||
final Procedure1<TraceRegionMergerTest.AssertBuilder> _function_3 = (TraceRegionMergerTest.AssertBuilder it_1) -> {
|
||||
it_1.region(0, 2, 0, 1, "foo", "bar");
|
||||
|
@ -213,7 +208,7 @@ public class TraceRegionMergerTest {
|
|||
};
|
||||
it.region(0, 4, 0, 2, _function_3);
|
||||
};
|
||||
_traceTo_1.assertMerged(_function_2);
|
||||
this.traceTo("foo", _function).traceTo("bar", _function_1).assertMerged(_function_2);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -224,14 +219,12 @@ public class TraceRegionMergerTest {
|
|||
};
|
||||
return it.region(0, 2, 0, 1, _function_1);
|
||||
};
|
||||
TraceRegionMergerTest.TestBuilder _traceTo = this.traceTo("foo", _function);
|
||||
final Function1<TraceRegionMergerTest.TraceBuilder, AbstractTraceRegion> _function_1 = (TraceRegionMergerTest.TraceBuilder it) -> {
|
||||
final Procedure1<TraceRegionMergerTest.TraceBuilder> _function_2 = (TraceRegionMergerTest.TraceBuilder it_1) -> {
|
||||
it_1.region(2, 2, 1, 2);
|
||||
};
|
||||
return it.region(2, 2, 1, 2, _function_2);
|
||||
};
|
||||
TraceRegionMergerTest.TestBuilder _traceTo_1 = _traceTo.traceTo("bar", _function_1);
|
||||
final Procedure1<TraceRegionMergerTest.AssertBuilder> _function_2 = (TraceRegionMergerTest.AssertBuilder it) -> {
|
||||
final Procedure1<TraceRegionMergerTest.AssertBuilder> _function_3 = (TraceRegionMergerTest.AssertBuilder it_1) -> {
|
||||
it_1.region(0, 2, 0, 1, "foo");
|
||||
|
@ -239,7 +232,7 @@ public class TraceRegionMergerTest {
|
|||
};
|
||||
it.region(0, 4, 0, 2, _function_3);
|
||||
};
|
||||
_traceTo_1.assertMerged(_function_2);
|
||||
this.traceTo("foo", _function).traceTo("bar", _function_1).assertMerged(_function_2);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -251,14 +244,12 @@ public class TraceRegionMergerTest {
|
|||
};
|
||||
return it.region(0, 4, 0, 2, _function_1);
|
||||
};
|
||||
TraceRegionMergerTest.TestBuilder _traceTo = this.traceTo("foo", _function);
|
||||
final Function1<TraceRegionMergerTest.TraceBuilder, AbstractTraceRegion> _function_1 = (TraceRegionMergerTest.TraceBuilder it) -> {
|
||||
final Procedure1<TraceRegionMergerTest.TraceBuilder> _function_2 = (TraceRegionMergerTest.TraceBuilder it_1) -> {
|
||||
it_1.region(2, 2, 1, 2);
|
||||
};
|
||||
return it.region(2, 2, 1, 2, _function_2);
|
||||
};
|
||||
TraceRegionMergerTest.TestBuilder _traceTo_1 = _traceTo.traceTo("bar", _function_1);
|
||||
final Procedure1<TraceRegionMergerTest.AssertBuilder> _function_2 = (TraceRegionMergerTest.AssertBuilder it) -> {
|
||||
final Procedure1<TraceRegionMergerTest.AssertBuilder> _function_3 = (TraceRegionMergerTest.AssertBuilder it_1) -> {
|
||||
it_1.region(0, 2, 0, 1, "foo");
|
||||
|
@ -266,7 +257,7 @@ public class TraceRegionMergerTest {
|
|||
};
|
||||
it.region(0, 4, 0, 2, _function_3);
|
||||
};
|
||||
_traceTo_1.assertMerged(_function_2);
|
||||
this.traceTo("foo", _function).traceTo("bar", _function_1).assertMerged(_function_2);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -278,11 +269,9 @@ public class TraceRegionMergerTest {
|
|||
};
|
||||
return it.region(2, 6, 1, 3, _function_1);
|
||||
};
|
||||
TraceRegionMergerTest.TestBuilder _traceTo = this.traceTo("foo", _function);
|
||||
final Function1<TraceRegionMergerTest.TraceBuilder, AbstractTraceRegion> _function_1 = (TraceRegionMergerTest.TraceBuilder it) -> {
|
||||
return it.region(0, 3, 0, 1);
|
||||
};
|
||||
TraceRegionMergerTest.TestBuilder _traceTo_1 = _traceTo.traceTo("bar", _function_1);
|
||||
final Procedure1<TraceRegionMergerTest.AssertBuilder> _function_2 = (TraceRegionMergerTest.AssertBuilder it) -> {
|
||||
final Procedure1<TraceRegionMergerTest.AssertBuilder> _function_3 = (TraceRegionMergerTest.AssertBuilder it_1) -> {
|
||||
it_1.region(0, 2, 0, 1, "bar");
|
||||
|
@ -293,7 +282,7 @@ public class TraceRegionMergerTest {
|
|||
};
|
||||
it.region(0, 8, 0, 3, _function_3);
|
||||
};
|
||||
_traceTo_1.assertMerged(_function_2);
|
||||
this.traceTo("foo", _function).traceTo("bar", _function_1).assertMerged(_function_2);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -301,11 +290,9 @@ public class TraceRegionMergerTest {
|
|||
final Function1<TraceRegionMergerTest.TraceBuilder, AbstractTraceRegion> _function = (TraceRegionMergerTest.TraceBuilder it) -> {
|
||||
return it.region(0, 6, 0, 2);
|
||||
};
|
||||
TraceRegionMergerTest.TestBuilder _traceTo = this.traceTo("foo", _function);
|
||||
final Function1<TraceRegionMergerTest.TraceBuilder, AbstractTraceRegion> _function_1 = (TraceRegionMergerTest.TraceBuilder it) -> {
|
||||
return it.region(2, 2, 0, 1);
|
||||
};
|
||||
TraceRegionMergerTest.TestBuilder _traceTo_1 = _traceTo.traceTo("bar", _function_1);
|
||||
final Procedure1<TraceRegionMergerTest.AssertBuilder> _function_2 = (TraceRegionMergerTest.AssertBuilder it) -> {
|
||||
final Procedure1<TraceRegionMergerTest.AssertBuilder> _function_3 = (TraceRegionMergerTest.AssertBuilder it_1) -> {
|
||||
it_1.region(0, 2, 0, 0, "foo");
|
||||
|
@ -314,7 +301,7 @@ public class TraceRegionMergerTest {
|
|||
};
|
||||
it.region(0, 6, 0, 2, _function_3);
|
||||
};
|
||||
_traceTo_1.assertMerged(_function_2);
|
||||
this.traceTo("foo", _function).traceTo("bar", _function_1).assertMerged(_function_2);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -322,11 +309,9 @@ public class TraceRegionMergerTest {
|
|||
final Function1<TraceRegionMergerTest.TraceBuilder, AbstractTraceRegion> _function = (TraceRegionMergerTest.TraceBuilder it) -> {
|
||||
return it.region(0, 6, 0, 2);
|
||||
};
|
||||
TraceRegionMergerTest.TestBuilder _traceTo = this.traceTo("foo", _function);
|
||||
final Function1<TraceRegionMergerTest.TraceBuilder, AbstractTraceRegion> _function_1 = (TraceRegionMergerTest.TraceBuilder it) -> {
|
||||
return it.region(3, 2, 1, 1);
|
||||
};
|
||||
TraceRegionMergerTest.TestBuilder _traceTo_1 = _traceTo.traceTo("bar", _function_1);
|
||||
final Procedure1<TraceRegionMergerTest.AssertBuilder> _function_2 = (TraceRegionMergerTest.AssertBuilder it) -> {
|
||||
final Procedure1<TraceRegionMergerTest.AssertBuilder> _function_3 = (TraceRegionMergerTest.AssertBuilder it_1) -> {
|
||||
it_1.region(0, 3, 0, 1, "foo");
|
||||
|
@ -335,7 +320,7 @@ public class TraceRegionMergerTest {
|
|||
};
|
||||
it.region(0, 6, 0, 2, _function_3);
|
||||
};
|
||||
_traceTo_1.assertMerged(_function_2);
|
||||
this.traceTo("foo", _function).traceTo("bar", _function_1).assertMerged(_function_2);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -343,11 +328,9 @@ public class TraceRegionMergerTest {
|
|||
final Function1<TraceRegionMergerTest.TraceBuilder, AbstractTraceRegion> _function = (TraceRegionMergerTest.TraceBuilder it) -> {
|
||||
return it.region(0, 4, 0, 1);
|
||||
};
|
||||
TraceRegionMergerTest.TestBuilder _traceTo = this.traceTo("foo", _function);
|
||||
final Function1<TraceRegionMergerTest.TraceBuilder, AbstractTraceRegion> _function_1 = (TraceRegionMergerTest.TraceBuilder it) -> {
|
||||
return it.region(2, 4, 0, 2);
|
||||
};
|
||||
TraceRegionMergerTest.TestBuilder _traceTo_1 = _traceTo.traceTo("bar", _function_1);
|
||||
final Procedure1<TraceRegionMergerTest.AssertBuilder> _function_2 = (TraceRegionMergerTest.AssertBuilder it) -> {
|
||||
final Procedure1<TraceRegionMergerTest.AssertBuilder> _function_3 = (TraceRegionMergerTest.AssertBuilder it_1) -> {
|
||||
it_1.region(0, 2, 0, 0, "foo");
|
||||
|
@ -356,7 +339,7 @@ public class TraceRegionMergerTest {
|
|||
};
|
||||
it.region(0, 6, 0, 2, _function_3);
|
||||
};
|
||||
_traceTo_1.assertMerged(_function_2);
|
||||
this.traceTo("foo", _function).traceTo("bar", _function_1).assertMerged(_function_2);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -364,11 +347,9 @@ public class TraceRegionMergerTest {
|
|||
final Function1<TraceRegionMergerTest.TraceBuilder, AbstractTraceRegion> _function = (TraceRegionMergerTest.TraceBuilder it) -> {
|
||||
return it.region(0, 4, 0, 1);
|
||||
};
|
||||
TraceRegionMergerTest.TestBuilder _traceTo = this.traceTo("foo", _function);
|
||||
final Function1<TraceRegionMergerTest.TraceBuilder, AbstractTraceRegion> _function_1 = (TraceRegionMergerTest.TraceBuilder it) -> {
|
||||
return it.region(3, 3, 1, 2);
|
||||
};
|
||||
TraceRegionMergerTest.TestBuilder _traceTo_1 = _traceTo.traceTo("bar", _function_1);
|
||||
final Procedure1<TraceRegionMergerTest.AssertBuilder> _function_2 = (TraceRegionMergerTest.AssertBuilder it) -> {
|
||||
final Procedure1<TraceRegionMergerTest.AssertBuilder> _function_3 = (TraceRegionMergerTest.AssertBuilder it_1) -> {
|
||||
it_1.region(0, 3, 0, 1, "foo");
|
||||
|
@ -377,7 +358,7 @@ public class TraceRegionMergerTest {
|
|||
};
|
||||
it.region(0, 6, 0, 2, _function_3);
|
||||
};
|
||||
_traceTo_1.assertMerged(_function_2);
|
||||
this.traceTo("foo", _function).traceTo("bar", _function_1).assertMerged(_function_2);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -390,7 +371,6 @@ public class TraceRegionMergerTest {
|
|||
};
|
||||
return it.region(0, 9, 0, 3, _function_1);
|
||||
};
|
||||
TraceRegionMergerTest.TestBuilder _traceTo = this.traceTo("foo", _function);
|
||||
final Function1<TraceRegionMergerTest.TraceBuilder, AbstractTraceRegion> _function_1 = (TraceRegionMergerTest.TraceBuilder it) -> {
|
||||
final Procedure1<TraceRegionMergerTest.TraceBuilder> _function_2 = (TraceRegionMergerTest.TraceBuilder it_1) -> {
|
||||
it_1.region(1, 3, 0, 1);
|
||||
|
@ -398,7 +378,6 @@ public class TraceRegionMergerTest {
|
|||
};
|
||||
return it.region(1, 6, 0, 2, _function_2);
|
||||
};
|
||||
TraceRegionMergerTest.TestBuilder _traceTo_1 = _traceTo.traceTo("bar", _function_1);
|
||||
final Procedure1<TraceRegionMergerTest.AssertBuilder> _function_2 = (TraceRegionMergerTest.AssertBuilder it) -> {
|
||||
final Procedure1<TraceRegionMergerTest.AssertBuilder> _function_3 = (TraceRegionMergerTest.AssertBuilder it_1) -> {
|
||||
it_1.region(0, 1, 0, 0, "foo");
|
||||
|
@ -410,7 +389,7 @@ public class TraceRegionMergerTest {
|
|||
};
|
||||
it.region(0, 9, 0, 3, _function_3);
|
||||
};
|
||||
_traceTo_1.assertMerged(_function_2);
|
||||
this.traceTo("foo", _function).traceTo("bar", _function_1).assertMerged(_function_2);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -423,7 +402,6 @@ public class TraceRegionMergerTest {
|
|||
};
|
||||
return it.region(0, 9, 0, 3, _function_1);
|
||||
};
|
||||
TraceRegionMergerTest.TestBuilder _traceTo = this.traceTo("foo", _function);
|
||||
final Function1<TraceRegionMergerTest.TraceBuilder, AbstractTraceRegion> _function_1 = (TraceRegionMergerTest.TraceBuilder it) -> {
|
||||
final Procedure1<TraceRegionMergerTest.TraceBuilder> _function_2 = (TraceRegionMergerTest.TraceBuilder it_1) -> {
|
||||
it_1.region(2, 3, 0, 1);
|
||||
|
@ -431,7 +409,6 @@ public class TraceRegionMergerTest {
|
|||
};
|
||||
return it.region(2, 6, 0, 2, _function_2);
|
||||
};
|
||||
TraceRegionMergerTest.TestBuilder _traceTo_1 = _traceTo.traceTo("bar", _function_1);
|
||||
final Procedure1<TraceRegionMergerTest.AssertBuilder> _function_2 = (TraceRegionMergerTest.AssertBuilder it) -> {
|
||||
final Procedure1<TraceRegionMergerTest.AssertBuilder> _function_3 = (TraceRegionMergerTest.AssertBuilder it_1) -> {
|
||||
it_1.region(0, 2, 0, 0, "foo");
|
||||
|
@ -443,7 +420,7 @@ public class TraceRegionMergerTest {
|
|||
};
|
||||
it.region(0, 9, 0, 3, _function_3);
|
||||
};
|
||||
_traceTo_1.assertMerged(_function_2);
|
||||
this.traceTo("foo", _function).traceTo("bar", _function_1).assertMerged(_function_2);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -456,7 +433,6 @@ public class TraceRegionMergerTest {
|
|||
};
|
||||
return it.region(0, 9, 0, 3, _function_1);
|
||||
};
|
||||
TraceRegionMergerTest.TestBuilder _traceTo = this.traceTo("foo", _function);
|
||||
final Function1<TraceRegionMergerTest.TraceBuilder, AbstractTraceRegion> _function_1 = (TraceRegionMergerTest.TraceBuilder it) -> {
|
||||
final Procedure1<TraceRegionMergerTest.TraceBuilder> _function_2 = (TraceRegionMergerTest.TraceBuilder it_1) -> {
|
||||
it_1.region(1, 3, 0, 1);
|
||||
|
@ -464,7 +440,6 @@ public class TraceRegionMergerTest {
|
|||
};
|
||||
return it.region(1, 6, 0, 2, _function_2);
|
||||
};
|
||||
TraceRegionMergerTest.TestBuilder _traceTo_1 = _traceTo.traceTo("bar", _function_1);
|
||||
final Function1<TraceRegionMergerTest.TraceBuilder, AbstractTraceRegion> _function_2 = (TraceRegionMergerTest.TraceBuilder it) -> {
|
||||
final Procedure1<TraceRegionMergerTest.TraceBuilder> _function_3 = (TraceRegionMergerTest.TraceBuilder it_1) -> {
|
||||
it_1.region(2, 3, 0, 1);
|
||||
|
@ -472,7 +447,6 @@ public class TraceRegionMergerTest {
|
|||
};
|
||||
return it.region(2, 6, 0, 2, _function_3);
|
||||
};
|
||||
TraceRegionMergerTest.TestBuilder _traceTo_2 = _traceTo_1.traceTo("baz", _function_2);
|
||||
final Procedure1<TraceRegionMergerTest.AssertBuilder> _function_3 = (TraceRegionMergerTest.AssertBuilder it) -> {
|
||||
final Procedure1<TraceRegionMergerTest.AssertBuilder> _function_4 = (TraceRegionMergerTest.AssertBuilder it_1) -> {
|
||||
it_1.region(0, 1, 0, 0, "foo");
|
||||
|
@ -487,11 +461,10 @@ public class TraceRegionMergerTest {
|
|||
};
|
||||
it.region(0, 9, 0, 3, _function_4);
|
||||
};
|
||||
_traceTo_2.assertMerged(_function_3);
|
||||
this.traceTo("foo", _function).traceTo("bar", _function_1).traceTo("baz", _function_2).assertMerged(_function_3);
|
||||
}
|
||||
|
||||
public TraceRegionMergerTest.TestBuilder traceTo(final String uri, final Function1<? super TraceRegionMergerTest.TraceBuilder, ? extends AbstractTraceRegion> init) {
|
||||
TraceRegionMergerTest.TestBuilder _testBuilder = new TraceRegionMergerTest.TestBuilder();
|
||||
return _testBuilder.traceTo(uri, init);
|
||||
return new TraceRegionMergerTest.TestBuilder().traceTo(uri, init);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -292,8 +292,6 @@ public class TraceRegionToStringTest {
|
|||
|
||||
public void operator_tripleEquals(final TraceRegionToStringTester actual, final CharSequence expectation) {
|
||||
final String rendered = actual.toString();
|
||||
String _string = expectation.toString();
|
||||
String _trim = _string.trim();
|
||||
Assert.assertEquals(_trim, rendered);
|
||||
Assert.assertEquals(expectation.toString().trim(), rendered);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,8 +39,7 @@ public class IndexTestLanguageInjectorProvider implements IInjectorProvider, IRe
|
|||
}
|
||||
|
||||
protected Injector internalCreateInjector() {
|
||||
IndexTestLanguageStandaloneSetup _indexTestLanguageStandaloneSetup = new IndexTestLanguageStandaloneSetup();
|
||||
return _indexTestLanguageStandaloneSetup.createInjectorAndDoEMFRegistration();
|
||||
return new IndexTestLanguageStandaloneSetup().createInjectorAndDoEMFRegistration();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -104,8 +104,7 @@ public class Bug410560Test extends AbstractXtextTests {
|
|||
final Model model = ((Model) _model);
|
||||
Resource _eResource = model.eResource();
|
||||
final XtextResource res = ((XtextResource) _eResource);
|
||||
int _indexOf = modelAsString.indexOf("a");
|
||||
res.update(_indexOf, 1, "b");
|
||||
res.update(modelAsString.indexOf("a"), 1, "b");
|
||||
Assert.assertSame(model, IterableExtensions.<EObject>head(res.getContents()));
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
|
@ -120,9 +119,7 @@ public class Bug410560Test extends AbstractXtextTests {
|
|||
final Model model = ((Model) _model);
|
||||
Resource _eResource = model.eResource();
|
||||
final XtextResource res = ((XtextResource) _eResource);
|
||||
int _indexOf = modelAsString.indexOf("t");
|
||||
int _length = "tworequired a b".length();
|
||||
res.update(_indexOf, _length, " ");
|
||||
res.update(modelAsString.indexOf("t"), "tworequired a b".length(), " ");
|
||||
Assert.assertSame(model, IterableExtensions.<EObject>head(res.getContents()));
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
|
@ -137,9 +134,7 @@ public class Bug410560Test extends AbstractXtextTests {
|
|||
final Model model = ((Model) _model);
|
||||
Resource _eResource = model.eResource();
|
||||
final XtextResource res = ((XtextResource) _eResource);
|
||||
int _indexOf = modelAsString.indexOf("t");
|
||||
int _length = "tworequired a b".length();
|
||||
res.update(_indexOf, _length, " ");
|
||||
res.update(modelAsString.indexOf("t"), "tworequired a b".length(), " ");
|
||||
Assert.assertSame(model, IterableExtensions.<EObject>head(res.getContents()));
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
|
@ -150,10 +145,7 @@ public class Bug410560Test extends AbstractXtextTests {
|
|||
public void testPartialParsingRemoveNestedIndent_01() {
|
||||
try {
|
||||
final String modelAsString = "({{ tworequired a b }})";
|
||||
PartialParsingProcessor _get = this.<PartialParsingProcessor>get(PartialParsingProcessor.class);
|
||||
int _indexOf = modelAsString.indexOf("t");
|
||||
int _length = "tworequired a b".length();
|
||||
_get.processFile(modelAsString, modelAsString, _indexOf, _length, " ");
|
||||
this.<PartialParsingProcessor>get(PartialParsingProcessor.class).processFile(modelAsString, modelAsString, modelAsString.indexOf("t"), "tworequired a b".length(), " ");
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import org.eclipse.emf.ecore.resource.Resource;
|
|||
import org.eclipse.xtext.nodemodel.ICompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.impl.InvariantChecker;
|
||||
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
|
||||
import org.eclipse.xtext.parser.IParseResult;
|
||||
import org.eclipse.xtext.parser.fragments.fragmentTestLanguage.PRFNamed;
|
||||
import org.eclipse.xtext.parser.fragments.fragmentTestLanguage.PRFNamedWithAction;
|
||||
import org.eclipse.xtext.parser.fragments.fragmentTestLanguage.ParserRuleFragments;
|
||||
|
@ -95,7 +94,8 @@ public abstract class AbstractFragmentsTest extends AbstractXtextTests {
|
|||
final ParserRuleFragments fragments = this.parseAndValidate("#4 prev current");
|
||||
Assert.assertNotNull(fragments);
|
||||
Assert.assertEquals("current", fragments.getElement().getName());
|
||||
Assert.assertEquals("prev", ((PRFNamedWithAction) fragments.getElement()).getPrev().getName());
|
||||
PRFNamed _element = fragments.getElement();
|
||||
Assert.assertEquals("prev", ((PRFNamedWithAction) _element).getPrev().getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -116,7 +116,8 @@ public abstract class AbstractFragmentsTest extends AbstractXtextTests {
|
|||
final ParserRuleFragments fragments = this.parseAndValidate("#5 prev current");
|
||||
Assert.assertNotNull(fragments);
|
||||
Assert.assertEquals("current", fragments.getElement().getName());
|
||||
Assert.assertEquals("prev", ((PRFNamedWithAction) fragments.getElement()).getPrev().getName());
|
||||
PRFNamed _element = fragments.getElement();
|
||||
Assert.assertEquals("prev", ((PRFNamedWithAction) _element).getPrev().getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -125,7 +126,8 @@ public abstract class AbstractFragmentsTest extends AbstractXtextTests {
|
|||
final ParserRuleFragments fragments = this.parseAndValidate("#6 prev current");
|
||||
Assert.assertNotNull(fragments);
|
||||
Assert.assertEquals("current", fragments.getElement().getName());
|
||||
Assert.assertEquals("prev", ((PRFNamedWithAction) fragments.getElement()).getPrev().getName());
|
||||
PRFNamed _element = fragments.getElement();
|
||||
Assert.assertEquals("prev", ((PRFNamedWithAction) _element).getPrev().getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -263,8 +265,7 @@ public abstract class AbstractFragmentsTest extends AbstractXtextTests {
|
|||
this.validationTestHelper.assertNoIssues(result);
|
||||
Resource _eResource = result.eResource();
|
||||
final XtextResource resource = ((XtextResource) _eResource);
|
||||
IParseResult _parseResult = resource.getParseResult();
|
||||
final ICompositeNode node = _parseResult.getRootNode();
|
||||
final ICompositeNode node = resource.getParseResult().getRootNode();
|
||||
this.invariantChecker.checkInvariant(node);
|
||||
return result;
|
||||
} catch (Throwable _e) {
|
||||
|
|
|
@ -13,7 +13,6 @@ import org.eclipse.emf.ecore.resource.Resource;
|
|||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
import org.eclipse.xtext.nodemodel.ICompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.impl.InvariantChecker;
|
||||
import org.eclipse.xtext.parser.IParseResult;
|
||||
import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree;
|
||||
import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.TreeNode;
|
||||
import org.eclipse.xtext.parser.indentation.tests.IndentationAwareTestLanguageInjectorProvider;
|
||||
|
@ -109,9 +108,7 @@ public class IndentationAwareLanguageTest {
|
|||
_builder_1.append("\t");
|
||||
_builder_1.append("child");
|
||||
_builder_1.newLine();
|
||||
String _string = _builder_1.toString();
|
||||
String _asText = this.asText(tree);
|
||||
Assert.assertEquals(_string, _asText);
|
||||
Assert.assertEquals(_builder_1.toString(), this.asText(tree));
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
|
@ -139,9 +136,7 @@ public class IndentationAwareLanguageTest {
|
|||
_builder_1.append("\t");
|
||||
_builder_1.append("child");
|
||||
_builder_1.newLine();
|
||||
String _string = _builder_1.toString();
|
||||
String _asText = this.asText(tree);
|
||||
Assert.assertEquals(_string, _asText);
|
||||
Assert.assertEquals(_builder_1.toString(), this.asText(tree));
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
|
@ -174,9 +169,7 @@ public class IndentationAwareLanguageTest {
|
|||
_builder_1.append("\t");
|
||||
_builder_1.append("d");
|
||||
_builder_1.newLine();
|
||||
String _string = _builder_1.toString();
|
||||
String _asText = this.asText(tree);
|
||||
Assert.assertEquals(_string, _asText);
|
||||
Assert.assertEquals(_builder_1.toString(), this.asText(tree));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -228,9 +221,7 @@ public class IndentationAwareLanguageTest {
|
|||
_builder_1.newLine();
|
||||
_builder_1.append("h");
|
||||
_builder_1.newLine();
|
||||
String _string = _builder_1.toString();
|
||||
String _asText = this.asText(tree);
|
||||
Assert.assertEquals(_string, _asText);
|
||||
Assert.assertEquals(_builder_1.toString(), this.asText(tree));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -258,9 +249,7 @@ public class IndentationAwareLanguageTest {
|
|||
_builder_1.newLine();
|
||||
_builder_1.append("d");
|
||||
_builder_1.newLine();
|
||||
String _string = _builder_1.toString();
|
||||
String _asText = this.asText(tree);
|
||||
Assert.assertEquals(_string, _asText);
|
||||
Assert.assertEquals(_builder_1.toString(), this.asText(tree));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -372,9 +361,7 @@ public class IndentationAwareLanguageTest {
|
|||
_builder_1.append("\t\t\t\t");
|
||||
_builder_1.append("level4_9");
|
||||
_builder_1.newLine();
|
||||
String _string = _builder_1.toString();
|
||||
String _asText = this.asText(tree);
|
||||
Assert.assertEquals(_string, _asText);
|
||||
Assert.assertEquals(_builder_1.toString(), this.asText(tree));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -410,9 +397,7 @@ public class IndentationAwareLanguageTest {
|
|||
_builder_1.append("\t");
|
||||
_builder_1.append("y");
|
||||
_builder_1.newLine();
|
||||
String _string = _builder_1.toString();
|
||||
String _asText = this.asText(tree);
|
||||
Assert.assertEquals(_string, _asText);
|
||||
Assert.assertEquals(_builder_1.toString(), this.asText(tree));
|
||||
}
|
||||
|
||||
private Tree parseAndValidate(final CharSequence s) {
|
||||
|
@ -421,8 +406,7 @@ public class IndentationAwareLanguageTest {
|
|||
this.validationTestHelper.assertNoIssues(result);
|
||||
Resource _eResource = result.eResource();
|
||||
final XtextResource resource = ((XtextResource) _eResource);
|
||||
IParseResult _parseResult = resource.getParseResult();
|
||||
final ICompositeNode node = _parseResult.getRootNode();
|
||||
final ICompositeNode node = resource.getParseResult().getRootNode();
|
||||
this.invariantChecker.checkInvariant(node);
|
||||
return result;
|
||||
} catch (Throwable _e) {
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
package org.eclipse.xtext.parser.indentation;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
|
@ -56,8 +55,7 @@ public class IndentationAwarePartialParsingErrorTest {
|
|||
final XtextResource resource = ((XtextResource) _eResource);
|
||||
final int idx = model.indexOf(" // 8");
|
||||
resource.update(idx, 0, "c");
|
||||
EList<EObject> _contents = resource.getContents();
|
||||
EObject _head = IterableExtensions.<EObject>head(_contents);
|
||||
EObject _head = IterableExtensions.<EObject>head(resource.getContents());
|
||||
final Tree reparsed = ((Tree) _head);
|
||||
Assert.assertNotSame(tree, reparsed);
|
||||
} catch (Throwable _e) {
|
||||
|
@ -89,8 +87,7 @@ public class IndentationAwarePartialParsingErrorTest {
|
|||
final XtextResource resource = ((XtextResource) _eResource);
|
||||
final int idx = model.indexOf(" // tab");
|
||||
resource.update(idx, 0, "c");
|
||||
EList<EObject> _contents = resource.getContents();
|
||||
EObject _head = IterableExtensions.<EObject>head(_contents);
|
||||
EObject _head = IterableExtensions.<EObject>head(resource.getContents());
|
||||
final Tree reparsed = ((Tree) _head);
|
||||
Assert.assertNotSame(tree, reparsed);
|
||||
} catch (Throwable _e) {
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
*/
|
||||
package org.eclipse.xtext.resource;
|
||||
|
||||
import java.util.Map;
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||
|
@ -35,9 +34,7 @@ public abstract class AbstractResourceSetTest {
|
|||
return _xblockexpression;
|
||||
};
|
||||
final Resource.Factory nullFactory = _function;
|
||||
Resource.Factory.Registry _resourceFactoryRegistry = rs.getResourceFactoryRegistry();
|
||||
Map<String, Object> _extensionToFactoryMap = _resourceFactoryRegistry.getExtensionToFactoryMap();
|
||||
_extensionToFactoryMap.put("xmi", nullFactory);
|
||||
rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", nullFactory);
|
||||
Assert.assertEquals(0, rs.getURIResourceMap().size());
|
||||
final URI uri = URI.createURI("file:/does/not/exist.xmi");
|
||||
final Resource demandLoaded = rs.getResource(uri, true);
|
||||
|
|
|
@ -34,8 +34,7 @@ public abstract class AbstractXtextResourceSetTest extends AbstractResourceSetTe
|
|||
EList<Resource> _resources = rs.getResources();
|
||||
_resources.add(resource);
|
||||
Assert.assertEquals(1, rs.getURIResourceMap().size());
|
||||
EList<Resource> _resources_1 = rs.getResources();
|
||||
_resources_1.remove(resource);
|
||||
rs.getResources().remove(resource);
|
||||
Assert.assertTrue(resource.eAdapters().isEmpty());
|
||||
Assert.assertEquals(0, rs.getURIResourceMap().size());
|
||||
}
|
||||
|
@ -50,8 +49,7 @@ public abstract class AbstractXtextResourceSetTest extends AbstractResourceSetTe
|
|||
ArrayList<Resource> _newArrayList = CollectionLiterals.<Resource>newArrayList(resource);
|
||||
Iterables.<Resource>addAll(_resources, _newArrayList);
|
||||
Assert.assertEquals(1, rs.getURIResourceMap().size());
|
||||
EList<Resource> _resources_1 = rs.getResources();
|
||||
_resources_1.remove(resource);
|
||||
rs.getResources().remove(resource);
|
||||
Assert.assertTrue(resource.eAdapters().isEmpty());
|
||||
Assert.assertEquals(0, rs.getURIResourceMap().size());
|
||||
}
|
||||
|
@ -78,8 +76,7 @@ public abstract class AbstractXtextResourceSetTest extends AbstractResourceSetTe
|
|||
resource.setURI(null);
|
||||
Assert.assertEquals(1, rs.getURIResourceMap().size());
|
||||
Assert.assertEquals(resource, rs.getURIResourceMap().get(null));
|
||||
EList<Resource> _resources_1 = rs.getResources();
|
||||
_resources_1.remove(resource);
|
||||
rs.getResources().remove(resource);
|
||||
Assert.assertTrue(resource.eAdapters().isEmpty());
|
||||
Assert.assertEquals(0, rs.getURIResourceMap().size());
|
||||
}
|
||||
|
@ -94,8 +91,7 @@ public abstract class AbstractXtextResourceSetTest extends AbstractResourceSetTe
|
|||
ArrayList<Resource> _newArrayList = CollectionLiterals.<Resource>newArrayList(resource);
|
||||
Iterables.<Resource>addAll(_resources, _newArrayList);
|
||||
Assert.assertEquals(1, rs.getURIResourceMap().size());
|
||||
EList<Resource> _resources_1 = rs.getResources();
|
||||
_resources_1.clear();
|
||||
rs.getResources().clear();
|
||||
Assert.assertTrue(resource.eAdapters().isEmpty());
|
||||
Assert.assertEquals(0, rs.getURIResourceMap().size());
|
||||
}
|
||||
|
@ -111,8 +107,7 @@ public abstract class AbstractXtextResourceSetTest extends AbstractResourceSetTe
|
|||
Iterables.<Resource>addAll(_resources, _newArrayList);
|
||||
Assert.assertEquals(1, rs.getURIResourceMap().size());
|
||||
rs.eSetDeliver(false);
|
||||
EList<Resource> _resources_1 = rs.getResources();
|
||||
_resources_1.clear();
|
||||
rs.getResources().clear();
|
||||
Assert.assertTrue(resource.eAdapters().isEmpty());
|
||||
Assert.assertEquals(0, rs.getURIResourceMap().size());
|
||||
}
|
||||
|
@ -126,8 +121,7 @@ public abstract class AbstractXtextResourceSetTest extends AbstractResourceSetTe
|
|||
EList<Resource> _resources = rs.getResources();
|
||||
_resources.add(resource);
|
||||
Assert.assertEquals(2, rs.getURIResourceMap().size());
|
||||
EList<Resource> _resources_1 = rs.getResources();
|
||||
_resources_1.remove(resource);
|
||||
rs.getResources().remove(resource);
|
||||
Assert.assertTrue(resource.eAdapters().isEmpty());
|
||||
Assert.assertEquals(0, rs.getURIResourceMap().size());
|
||||
}
|
||||
|
@ -142,8 +136,7 @@ public abstract class AbstractXtextResourceSetTest extends AbstractResourceSetTe
|
|||
ArrayList<Resource> _newArrayList = CollectionLiterals.<Resource>newArrayList(resource);
|
||||
Iterables.<Resource>addAll(_resources, _newArrayList);
|
||||
Assert.assertEquals(2, rs.getURIResourceMap().size());
|
||||
EList<Resource> _resources_1 = rs.getResources();
|
||||
_resources_1.remove(resource);
|
||||
rs.getResources().remove(resource);
|
||||
Assert.assertTrue(resource.eAdapters().isEmpty());
|
||||
Assert.assertEquals(0, rs.getURIResourceMap().size());
|
||||
}
|
||||
|
@ -176,8 +169,7 @@ public abstract class AbstractXtextResourceSetTest extends AbstractResourceSetTe
|
|||
Assert.assertEquals(1, rs.getURIResourceMap().size());
|
||||
Assert.assertEquals(resource, rs.getURIResourceMap().get(null));
|
||||
Assert.assertEquals(0, rs.getNormalizationMap().size());
|
||||
EList<Resource> _resources_1 = rs.getResources();
|
||||
_resources_1.remove(resource);
|
||||
rs.getResources().remove(resource);
|
||||
Assert.assertTrue(resource.eAdapters().isEmpty());
|
||||
Assert.assertEquals(0, rs.getURIResourceMap().size());
|
||||
Assert.assertEquals(0, rs.getNormalizationMap().size());
|
||||
|
@ -193,8 +185,7 @@ public abstract class AbstractXtextResourceSetTest extends AbstractResourceSetTe
|
|||
ArrayList<Resource> _newArrayList = CollectionLiterals.<Resource>newArrayList(resource);
|
||||
Iterables.<Resource>addAll(_resources, _newArrayList);
|
||||
Assert.assertEquals(2, rs.getURIResourceMap().size());
|
||||
EList<Resource> _resources_1 = rs.getResources();
|
||||
_resources_1.clear();
|
||||
rs.getResources().clear();
|
||||
Assert.assertTrue(resource.eAdapters().isEmpty());
|
||||
Assert.assertEquals(0, rs.getURIResourceMap().size());
|
||||
}
|
||||
|
@ -210,8 +201,7 @@ public abstract class AbstractXtextResourceSetTest extends AbstractResourceSetTe
|
|||
Iterables.<Resource>addAll(_resources, _newArrayList);
|
||||
Assert.assertEquals(2, rs.getURIResourceMap().size());
|
||||
rs.eSetDeliver(false);
|
||||
EList<Resource> _resources_1 = rs.getResources();
|
||||
_resources_1.clear();
|
||||
rs.getResources().clear();
|
||||
Assert.assertTrue(resource.eAdapters().isEmpty());
|
||||
Assert.assertEquals(0, rs.getURIResourceMap().size());
|
||||
}
|
||||
|
|
|
@ -39,8 +39,7 @@ public class Bug451668Test extends AbstractXtextTests {
|
|||
try {
|
||||
this.with(OptionalEmptyTestLanguageStandaloneSetup.class);
|
||||
Bug451668Test.TestResource r = this.<Bug451668Test.TestResource>get(Bug451668Test.TestResource.class);
|
||||
URI _createURI = URI.createURI("foo.dummy");
|
||||
r.setURI(_createURI);
|
||||
r.setURI(URI.createURI("foo.dummy"));
|
||||
StringInputStream _stringInputStream = new StringInputStream("");
|
||||
r.load(_stringInputStream, null);
|
||||
Assert.assertTrue(r.isLoaded());
|
||||
|
|
|
@ -7,14 +7,10 @@
|
|||
*/
|
||||
package org.eclipse.xtext.resource;
|
||||
|
||||
import java.util.Map;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.xtext.ParserRule;
|
||||
import org.eclipse.xtext.nodemodel.ICompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
|
||||
import org.eclipse.xtext.parser.IParseResult;
|
||||
import org.eclipse.xtext.resource.IResourceFactory;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.eclipse.xtext.testlanguages.ReferenceGrammarTestLanguageStandaloneSetup;
|
||||
|
@ -36,49 +32,30 @@ public class SetEntryPointOnXtextResourceTest extends AbstractXtextTests {
|
|||
try {
|
||||
this.with(ReferenceGrammarTestLanguageStandaloneSetup.class);
|
||||
final String model = "kind (Hugo 13)";
|
||||
ReferenceGrammarTestLanguageGrammarAccess _get = this.<ReferenceGrammarTestLanguageGrammarAccess>get(ReferenceGrammarTestLanguageGrammarAccess.class);
|
||||
final ParserRule kindRule = _get.getKindRule();
|
||||
final ParserRule kindRule = this.<ReferenceGrammarTestLanguageGrammarAccess>get(ReferenceGrammarTestLanguageGrammarAccess.class).getKindRule();
|
||||
final XtextResource resource = this.createResource();
|
||||
resource.setEntryPoint(kindRule);
|
||||
StringInputStream _stringInputStream = new StringInputStream(model);
|
||||
Map<Object, Object> _emptyMap = CollectionLiterals.<Object, Object>emptyMap();
|
||||
resource.load(_stringInputStream, _emptyMap);
|
||||
EList<Resource.Diagnostic> _errors = resource.getErrors();
|
||||
boolean _isEmpty = _errors.isEmpty();
|
||||
Assert.assertTrue(_isEmpty);
|
||||
IParseResult _parseResult = resource.getParseResult();
|
||||
ICompositeNode _rootNode = _parseResult.getRootNode();
|
||||
ParserRule _entryParserRule = NodeModelUtils.getEntryParserRule(_rootNode);
|
||||
Assert.assertEquals(kindRule, _entryParserRule);
|
||||
IParseResult _parseResult_1 = resource.getParseResult();
|
||||
ICompositeNode _rootNode_1 = _parseResult_1.getRootNode();
|
||||
final String originalNodeModel = NodeModelUtils.compactDump(_rootNode_1, false);
|
||||
int _length = model.length();
|
||||
resource.update(0, _length, ((" " + model) + " "));
|
||||
IParseResult _parseResult_2 = resource.getParseResult();
|
||||
ICompositeNode _rootNode_2 = _parseResult_2.getRootNode();
|
||||
final String reparsedNodeModel = NodeModelUtils.compactDump(_rootNode_2, false);
|
||||
resource.load(_stringInputStream, CollectionLiterals.<Object, Object>emptyMap());
|
||||
Assert.assertTrue(resource.getErrors().isEmpty());
|
||||
Assert.assertEquals(kindRule, NodeModelUtils.getEntryParserRule(resource.getParseResult().getRootNode()));
|
||||
final String originalNodeModel = NodeModelUtils.compactDump(resource.getParseResult().getRootNode(), false);
|
||||
resource.update(0, model.length(), ((" " + model) + " "));
|
||||
final String reparsedNodeModel = NodeModelUtils.compactDump(resource.getParseResult().getRootNode(), false);
|
||||
Assert.assertEquals(originalNodeModel, reparsedNodeModel);
|
||||
ReferenceGrammarTestLanguageGrammarAccess _get_1 = this.<ReferenceGrammarTestLanguageGrammarAccess>get(ReferenceGrammarTestLanguageGrammarAccess.class);
|
||||
final ParserRule erwachsenerRule = _get_1.getErwachsenerRule();
|
||||
final ParserRule erwachsenerRule = this.<ReferenceGrammarTestLanguageGrammarAccess>get(ReferenceGrammarTestLanguageGrammarAccess.class).getErwachsenerRule();
|
||||
resource.setEntryPoint(erwachsenerRule);
|
||||
int _length_1 = model.length();
|
||||
resource.update(0, _length_1, "erwachsener (Peter 30)");
|
||||
IParseResult _parseResult_3 = resource.getParseResult();
|
||||
ICompositeNode _rootNode_3 = _parseResult_3.getRootNode();
|
||||
ParserRule _entryParserRule_1 = NodeModelUtils.getEntryParserRule(_rootNode_3);
|
||||
Assert.assertEquals(erwachsenerRule, _entryParserRule_1);
|
||||
resource.update(0, model.length(), "erwachsener (Peter 30)");
|
||||
Assert.assertEquals(erwachsenerRule, NodeModelUtils.getEntryParserRule(resource.getParseResult().getRootNode()));
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
}
|
||||
|
||||
private XtextResource createResource() {
|
||||
IResourceFactory _get = this.<IResourceFactory>get(IResourceFactory.class);
|
||||
String _currentFileExtension = this.getCurrentFileExtension();
|
||||
String _plus = ("dummy." + _currentFileExtension);
|
||||
URI _createURI = URI.createURI(_plus);
|
||||
Resource _createResource = _get.createResource(_createURI);
|
||||
Resource _createResource = this.<IResourceFactory>get(IResourceFactory.class).createResource(URI.createURI(_plus));
|
||||
return ((XtextResource) _createResource);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,16 +9,11 @@ package org.eclipse.xtext.resource;
|
|||
|
||||
import com.google.common.collect.Iterables;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.emf.ecore.resource.URIConverter;
|
||||
import org.eclipse.xtext.resource.AbstractXtextResourceSetTest;
|
||||
import org.eclipse.xtext.resource.NullResource;
|
||||
import org.eclipse.xtext.resource.SynchronizedXtextResourceSet;
|
||||
|
@ -54,11 +49,8 @@ public class SynchronizedXtextResourceSetTest extends AbstractXtextResourceSetTe
|
|||
return _xblockexpression;
|
||||
};
|
||||
final Resource.Factory nullFactory = _function;
|
||||
Resource.Factory.Registry _resourceFactoryRegistry = resourceSet.getResourceFactoryRegistry();
|
||||
Map<String, Object> _extensionToFactoryMap = _resourceFactoryRegistry.getExtensionToFactoryMap();
|
||||
_extensionToFactoryMap.put("xmi", nullFactory);
|
||||
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", nullFactory);
|
||||
final ArrayList<Thread> threads = CollectionLiterals.<Thread>newArrayList();
|
||||
IntegerRange _upTo = new IntegerRange(1, 10);
|
||||
final Consumer<Integer> _function_1 = (Integer i) -> {
|
||||
final Runnable _function_2 = () -> {
|
||||
final ArrayList<Resource> resources = CollectionLiterals.<Resource>newArrayList();
|
||||
|
@ -67,71 +59,40 @@ public class SynchronizedXtextResourceSetTest extends AbstractXtextResourceSetTe
|
|||
String _plus = (i + " ");
|
||||
String _plus_1 = (_plus + Integer.valueOf(j));
|
||||
String _plus_2 = (_plus_1 + ".xmi");
|
||||
URI _createURI = URI.createURI(_plus_2);
|
||||
final Resource resource = resourceSet.createResource(_createURI);
|
||||
final Resource resource = resourceSet.createResource(URI.createURI(_plus_2));
|
||||
Assert.assertNotNull(resource);
|
||||
resources.add(resource);
|
||||
URI _uRI = resource.getURI();
|
||||
String _plus_3 = (_uRI + "b");
|
||||
URI _createURI_1 = URI.createURI(_plus_3);
|
||||
resource.setURI(_createURI_1);
|
||||
resource.setURI(URI.createURI(_plus_3));
|
||||
}
|
||||
}
|
||||
};
|
||||
Thread _thread = new Thread(_function_2);
|
||||
threads.add(_thread);
|
||||
};
|
||||
_upTo.forEach(_function_1);
|
||||
new IntegerRange(1, 10).forEach(_function_1);
|
||||
for (final Thread thread : threads) {
|
||||
thread.start();
|
||||
}
|
||||
for (final Thread thread_1 : threads) {
|
||||
thread_1.join();
|
||||
}
|
||||
EList<Resource> _resources = resourceSet.getResources();
|
||||
int _size = _resources.size();
|
||||
Assert.assertEquals(50000, _size);
|
||||
EList<Resource> _resources_1 = resourceSet.getResources();
|
||||
Set<Resource> _set = IterableExtensions.<Resource>toSet(_resources_1);
|
||||
int _size_1 = _set.size();
|
||||
Map<URI, Resource> _uRIResourceMap = resourceSet.getURIResourceMap();
|
||||
Collection<Resource> _values = _uRIResourceMap.values();
|
||||
Set<Resource> _set_1 = IterableExtensions.<Resource>toSet(_values);
|
||||
int _size_2 = _set_1.size();
|
||||
Assert.assertEquals(_size_1, _size_2);
|
||||
EList<Resource> _resources_2 = resourceSet.getResources();
|
||||
Assert.assertEquals(50000, resourceSet.getResources().size());
|
||||
Assert.assertEquals(IterableExtensions.<Resource>toSet(resourceSet.getResources()).size(), IterableExtensions.<Resource>toSet(resourceSet.getURIResourceMap().values()).size());
|
||||
final Function1<Resource, List<URI>> _function_2 = (Resource it) -> {
|
||||
URI _uRI = it.getURI();
|
||||
URIConverter _uRIConverter = resourceSet.getURIConverter();
|
||||
URI _uRI_1 = it.getURI();
|
||||
URI _normalize = _uRIConverter.normalize(_uRI_1);
|
||||
URI _normalize = resourceSet.getURIConverter().normalize(it.getURI());
|
||||
return Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(_uRI, _normalize));
|
||||
};
|
||||
List<List<URI>> _map = ListExtensions.<Resource, List<URI>>map(_resources_2, _function_2);
|
||||
Iterable<URI> _flatten = Iterables.<URI>concat(_map);
|
||||
Set<URI> _set_2 = IterableExtensions.<URI>toSet(_flatten);
|
||||
Map<URI, Resource> _uRIResourceMap_1 = resourceSet.getURIResourceMap();
|
||||
Set<URI> _keySet = _uRIResourceMap_1.keySet();
|
||||
Assert.assertEquals(_set_2, _keySet);
|
||||
EList<Resource> _resources_3 = resourceSet.getResources();
|
||||
Assert.assertEquals(IterableExtensions.<URI>toSet(Iterables.<URI>concat(ListExtensions.<Resource, List<URI>>map(resourceSet.getResources(), _function_2))), resourceSet.getURIResourceMap().keySet());
|
||||
final Function1<Resource, String> _function_3 = (Resource it) -> {
|
||||
URI _uRI = it.getURI();
|
||||
return _uRI.toString();
|
||||
return it.getURI().toString();
|
||||
};
|
||||
List<String> _map_1 = ListExtensions.<Resource, String>map(_resources_3, _function_3);
|
||||
List<String> _list = IterableExtensions.<String>toList(_map_1);
|
||||
List<String> _sort = IterableExtensions.<String>sort(_list);
|
||||
String _join = IterableExtensions.join(_sort, "\n");
|
||||
Map<URI, URI> _normalizationMap = resourceSet.getNormalizationMap();
|
||||
Set<URI> _keySet_1 = _normalizationMap.keySet();
|
||||
final Function1<URI, String> _function_4 = (URI it) -> {
|
||||
return it.toString();
|
||||
};
|
||||
Iterable<String> _map_2 = IterableExtensions.<URI, String>map(_keySet_1, _function_4);
|
||||
List<String> _list_1 = IterableExtensions.<String>toList(_map_2);
|
||||
List<String> _sort_1 = IterableExtensions.<String>sort(_list_1);
|
||||
String _join_1 = IterableExtensions.join(_sort_1, "\n");
|
||||
Assert.assertEquals(_join, _join_1);
|
||||
Assert.assertEquals(IterableExtensions.join(IterableExtensions.<String>sort(IterableExtensions.<String>toList(ListExtensions.<Resource, String>map(resourceSet.getResources(), _function_3))), "\n"), IterableExtensions.join(IterableExtensions.<String>sort(IterableExtensions.<String>toList(IterableExtensions.<URI, String>map(resourceSet.getNormalizationMap().keySet(), _function_4))), "\n"));
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
|
|
|
@ -10,8 +10,6 @@ package org.eclipse.xtext.resource.persistence;
|
|||
import com.google.common.collect.Iterables;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.EcorePackage;
|
||||
|
@ -22,9 +20,7 @@ import org.eclipse.xtext.linking.LangATestLanguageStandaloneSetup;
|
|||
import org.eclipse.xtext.linking.langATestLanguage.Main;
|
||||
import org.eclipse.xtext.linking.langATestLanguage.Type;
|
||||
import org.eclipse.xtext.resource.IReferenceDescription;
|
||||
import org.eclipse.xtext.resource.IResourceDescription;
|
||||
import org.eclipse.xtext.resource.XtextResourceSet;
|
||||
import org.eclipse.xtext.resource.persistence.IResourceStorageFacade;
|
||||
import org.eclipse.xtext.resource.persistence.PortableURIs;
|
||||
import org.eclipse.xtext.resource.persistence.ResourceStorageLoadable;
|
||||
import org.eclipse.xtext.resource.persistence.ResourceStorageWritable;
|
||||
|
@ -51,34 +47,24 @@ public class PortableURIsTest extends AbstractXtextTests {
|
|||
public void testPortableUris() {
|
||||
try {
|
||||
final XtextResourceSet resourceSet = this.<XtextResourceSet>get(XtextResourceSet.class);
|
||||
URI _createURI = URI.createURI("hubba:/bubba.langatestlanguage");
|
||||
Resource _createResource = resourceSet.createResource(_createURI);
|
||||
Resource _createResource = resourceSet.createResource(URI.createURI("hubba:/bubba.langatestlanguage"));
|
||||
final StorageAwareResource resourceA = ((StorageAwareResource) _createResource);
|
||||
URI _createURI_1 = URI.createURI("hubba:/bubba2.langatestlanguage");
|
||||
Resource _createResource_1 = resourceSet.createResource(_createURI_1);
|
||||
Resource _createResource_1 = resourceSet.createResource(URI.createURI("hubba:/bubba2.langatestlanguage"));
|
||||
final StorageAwareResource resourceB = ((StorageAwareResource) _createResource_1);
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("type B");
|
||||
_builder.newLine();
|
||||
InputStream _asStream = this.getAsStream(_builder.toString());
|
||||
resourceB.load(_asStream, null);
|
||||
resourceB.load(this.getAsStream(_builder.toString()), null);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("import \'hubba:/bubba2.langatestlanguage\'");
|
||||
_builder_1.newLine();
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("type A extends B");
|
||||
_builder_1.newLine();
|
||||
InputStream _asStream_1 = this.getAsStream(_builder_1.toString());
|
||||
resourceA.load(_asStream_1, null);
|
||||
EList<EObject> _contents = resourceA.getContents();
|
||||
Iterable<Main> _filter = Iterables.<Main>filter(_contents, Main.class);
|
||||
Main _head = IterableExtensions.<Main>head(_filter);
|
||||
EList<Type> _types = _head.getTypes();
|
||||
Type _head_1 = IterableExtensions.<Type>head(_types);
|
||||
final Type extended = _head_1.getExtends();
|
||||
resourceA.load(this.getAsStream(_builder_1.toString()), null);
|
||||
final Type extended = IterableExtensions.<Type>head(IterableExtensions.<Main>head(Iterables.<Main>filter(resourceA.getContents(), Main.class)).getTypes()).getExtends();
|
||||
final URI uri = EcoreUtil.getURI(extended);
|
||||
PortableURIs _portableURIs = resourceA.getPortableURIs();
|
||||
final URI portableURI = _portableURIs.toPortableURI(resourceA, uri);
|
||||
final URI portableURI = resourceA.getPortableURIs().toPortableURI(resourceA, uri);
|
||||
Assert.assertEquals(resourceA.getURI(), portableURI.trimFragment());
|
||||
Assert.assertTrue(resourceA.getPortableURIs().isPortableURIFragment(portableURI.fragment()));
|
||||
Assert.assertSame(extended, resourceA.getEObject(portableURI.fragment()));
|
||||
|
@ -91,42 +77,35 @@ public class PortableURIsTest extends AbstractXtextTests {
|
|||
public void testPortableReferenceDescriptions() {
|
||||
try {
|
||||
final XtextResourceSet resourceSet = this.<XtextResourceSet>get(XtextResourceSet.class);
|
||||
URI _createURI = URI.createURI("hubba:/bubba.langatestlanguage");
|
||||
Resource _createResource = resourceSet.createResource(_createURI);
|
||||
Resource _createResource = resourceSet.createResource(URI.createURI("hubba:/bubba.langatestlanguage"));
|
||||
final StorageAwareResource resourceA = ((StorageAwareResource) _createResource);
|
||||
URI _createURI_1 = URI.createURI("hubba:/bubba2.langatestlanguage");
|
||||
Resource _createResource_1 = resourceSet.createResource(_createURI_1);
|
||||
Resource _createResource_1 = resourceSet.createResource(URI.createURI("hubba:/bubba2.langatestlanguage"));
|
||||
final StorageAwareResource resourceB = ((StorageAwareResource) _createResource_1);
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("type B");
|
||||
_builder.newLine();
|
||||
InputStream _asStream = this.getAsStream(_builder.toString());
|
||||
resourceB.load(_asStream, null);
|
||||
resourceB.load(this.getAsStream(_builder.toString()), null);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("import \'hubba:/bubba2.langatestlanguage\'");
|
||||
_builder_1.newLine();
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("type A extends B");
|
||||
_builder_1.newLine();
|
||||
InputStream _asStream_1 = this.getAsStream(_builder_1.toString());
|
||||
resourceA.load(_asStream_1, null);
|
||||
resourceA.load(this.getAsStream(_builder_1.toString()), null);
|
||||
final ByteArrayOutputStream bout = new ByteArrayOutputStream();
|
||||
IResourceStorageFacade _resourceStorageFacade = resourceA.getResourceStorageFacade();
|
||||
final ResourceStorageWritable writable = _resourceStorageFacade.createResourceStorageWritable(bout);
|
||||
final ResourceStorageWritable writable = resourceA.getResourceStorageFacade().createResourceStorageWritable(bout);
|
||||
writable.writeResource(resourceA);
|
||||
IResourceStorageFacade _resourceStorageFacade_1 = resourceA.getResourceStorageFacade();
|
||||
byte[] _byteArray = bout.toByteArray();
|
||||
ByteArrayInputStream _byteArrayInputStream = new ByteArrayInputStream(_byteArray);
|
||||
final ResourceStorageLoadable loadable = _resourceStorageFacade_1.createResourceStorageLoadable(_byteArrayInputStream);
|
||||
URI _createURI_2 = URI.createURI("hubba:/bubba3.langatestlanguage");
|
||||
Resource _createResource_2 = resourceSet.createResource(_createURI_2);
|
||||
final ResourceStorageLoadable loadable = resourceA.getResourceStorageFacade().createResourceStorageLoadable(_byteArrayInputStream);
|
||||
Resource _createResource_2 = resourceSet.createResource(URI.createURI("hubba:/bubba3.langatestlanguage"));
|
||||
final StorageAwareResource resourceC = ((StorageAwareResource) _createResource_2);
|
||||
resourceC.loadFromStorage(loadable);
|
||||
IResourceDescription _resourceDescription = resourceC.getResourceDescription();
|
||||
Iterable<IReferenceDescription> _referenceDescriptions = _resourceDescription.getReferenceDescriptions();
|
||||
final IReferenceDescription refDesc = IterableExtensions.<IReferenceDescription>head(_referenceDescriptions);
|
||||
Assert.assertSame(IterableExtensions.<Type>head(((Main) IterableExtensions.<EObject>head(resourceB.getContents())).getTypes()), resourceSet.getEObject(refDesc.getTargetEObjectUri(), false));
|
||||
Assert.assertSame(IterableExtensions.<Type>head(((Main) IterableExtensions.<EObject>head(resourceC.getContents())).getTypes()), resourceSet.getEObject(refDesc.getSourceEObjectUri(), false));
|
||||
final IReferenceDescription refDesc = IterableExtensions.<IReferenceDescription>head(resourceC.getResourceDescription().getReferenceDescriptions());
|
||||
EObject _head = IterableExtensions.<EObject>head(resourceB.getContents());
|
||||
Assert.assertSame(IterableExtensions.<Type>head(((Main) _head).getTypes()), resourceSet.getEObject(refDesc.getTargetEObjectUri(), false));
|
||||
EObject _head_1 = IterableExtensions.<EObject>head(resourceC.getContents());
|
||||
Assert.assertSame(IterableExtensions.<Type>head(((Main) _head_1).getTypes()), resourceSet.getEObject(refDesc.getSourceEObjectUri(), false));
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
|
@ -151,7 +130,6 @@ public class PortableURIsTest extends AbstractXtextTests {
|
|||
public void checkFragmentBothDirections(final EObject container, final EObject child) {
|
||||
final PortableURIs portableURIs = new PortableURIs();
|
||||
final String fragment = portableURIs.getFragment(container, child);
|
||||
EObject _eObject = portableURIs.getEObject(container, fragment);
|
||||
Assert.assertSame(child, _eObject);
|
||||
Assert.assertSame(child, portableURIs.getEObject(container, fragment));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import java.io.ByteArrayOutputStream;
|
|||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.emf.ecore.EcorePackage;
|
||||
import org.eclipse.xtext.naming.QualifiedName;
|
||||
|
@ -64,7 +63,8 @@ public class SerializableResourceDescriptionTest {
|
|||
it_1.setEObjectURI(uri.appendFragment("baz"));
|
||||
it_1.qualifiedName = QualifiedName.create("foo", "baz");
|
||||
it_1.setEClass(EcorePackage.eINSTANCE.getEAttribute());
|
||||
it_1.userData = CollectionLiterals.<String, String>newHashMap(Pair.<String, String>of("myKey", "myValue"));
|
||||
Pair<String, String> _mappedTo = Pair.<String, String>of("myKey", "myValue");
|
||||
it_1.userData = CollectionLiterals.<String, String>newHashMap(_mappedTo);
|
||||
};
|
||||
SerializableEObjectDescription _doubleArrow_2 = ObjectExtensions.<SerializableEObjectDescription>operator_doubleArrow(_serializableEObjectDescription, _function_3);
|
||||
it.setDescriptions(Collections.<SerializableEObjectDescription>unmodifiableList(CollectionLiterals.<SerializableEObjectDescription>newArrayList(_doubleArrow_2)));
|
||||
|
@ -91,15 +91,12 @@ public class SerializableResourceDescriptionTest {
|
|||
Assert.assertEquals(before.getURI(), after.getURI());
|
||||
Assert.assertEquals(before.getImportedNames(), after.getImportedNames());
|
||||
Assert.assertEquals(before.getReferences().size(), after.getReferences().size());
|
||||
List<SerializableReferenceDescription> _references = before.getReferences();
|
||||
int _size = _references.size();
|
||||
int _size = before.getReferences().size();
|
||||
ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true);
|
||||
for (final int i : _doubleDotLessThan) {
|
||||
{
|
||||
List<SerializableReferenceDescription> _references_1 = before.getReferences();
|
||||
final SerializableReferenceDescription beforeRef = _references_1.get(i);
|
||||
List<SerializableReferenceDescription> _references_2 = after.getReferences();
|
||||
final SerializableReferenceDescription afterRef = _references_2.get(i);
|
||||
final SerializableReferenceDescription beforeRef = before.getReferences().get(i);
|
||||
final SerializableReferenceDescription afterRef = after.getReferences().get(i);
|
||||
Assert.assertEquals(beforeRef.getContainerEObjectURI(), afterRef.getContainerEObjectURI());
|
||||
Assert.assertEquals(beforeRef.getSourceEObjectUri(), afterRef.getSourceEObjectUri());
|
||||
Assert.assertEquals(beforeRef.getTargetEObjectUri(), afterRef.getTargetEObjectUri());
|
||||
|
@ -108,15 +105,12 @@ public class SerializableResourceDescriptionTest {
|
|||
}
|
||||
}
|
||||
Assert.assertEquals(before.getDescriptions().size(), after.getDescriptions().size());
|
||||
List<SerializableEObjectDescription> _descriptions = before.getDescriptions();
|
||||
int _size_1 = _descriptions.size();
|
||||
int _size_1 = before.getDescriptions().size();
|
||||
ExclusiveRange _doubleDotLessThan_1 = new ExclusiveRange(0, _size_1, true);
|
||||
for (final int i_1 : _doubleDotLessThan_1) {
|
||||
{
|
||||
List<SerializableEObjectDescription> _descriptions_1 = before.getDescriptions();
|
||||
final SerializableEObjectDescription beforeDesc = _descriptions_1.get(i_1);
|
||||
List<SerializableEObjectDescription> _descriptions_2 = after.getDescriptions();
|
||||
final SerializableEObjectDescription afterDesc = _descriptions_2.get(i_1);
|
||||
final SerializableEObjectDescription beforeDesc = before.getDescriptions().get(i_1);
|
||||
final SerializableEObjectDescription afterDesc = after.getDescriptions().get(i_1);
|
||||
Assert.assertEquals(beforeDesc.getEClass(), afterDesc.getEClass());
|
||||
Assert.assertEquals(beforeDesc.getName(), afterDesc.getName());
|
||||
Assert.assertEquals(beforeDesc.qualifiedName, afterDesc.qualifiedName);
|
||||
|
@ -184,7 +178,8 @@ public class SerializableResourceDescriptionTest {
|
|||
it_1.setEObjectURI(uri.appendFragment("baz"));
|
||||
it_1.qualifiedName = QualifiedName.create("foo", "baz");
|
||||
it_1.setEClass(EcorePackage.eINSTANCE.getEAttribute());
|
||||
it_1.userData = CollectionLiterals.<String, String>newHashMap(Pair.<String, String>of("myKey", "myValue"));
|
||||
Pair<String, String> _mappedTo = Pair.<String, String>of("myKey", "myValue");
|
||||
it_1.userData = CollectionLiterals.<String, String>newHashMap(_mappedTo);
|
||||
};
|
||||
SerializableEObjectDescription _doubleArrow_5 = ObjectExtensions.<SerializableEObjectDescription>operator_doubleArrow(_serializableEObjectDescription, _function_6);
|
||||
it.setDescriptions(Collections.<SerializableEObjectDescription>unmodifiableList(CollectionLiterals.<SerializableEObjectDescription>newArrayList(_doubleArrow_5)));
|
||||
|
|
|
@ -9,7 +9,6 @@ package org.eclipse.xtext.serializer;
|
|||
|
||||
import com.google.inject.Inject;
|
||||
import java.util.List;
|
||||
import org.eclipse.emf.ecore.EStructuralFeature;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
import org.eclipse.xtext.Grammar;
|
||||
import org.eclipse.xtext.serializer.analysis.IGrammarConstraintProvider;
|
||||
|
@ -297,26 +296,21 @@ public class GrammarConstraintProviderFeatureTest {
|
|||
_builder.newLineIfNotEmpty();
|
||||
final Grammar grammar = this.parser.parse(_builder);
|
||||
this.validator.assertNoErrors(grammar);
|
||||
SerializationContextMap<IGrammarConstraintProvider.IConstraint> _constraints = this.constraintProvider.getConstraints(grammar);
|
||||
List<SerializationContextMap.Entry<IGrammarConstraintProvider.IConstraint>> _values = _constraints.values();
|
||||
final Function1<SerializationContextMap.Entry<IGrammarConstraintProvider.IConstraint>, IGrammarConstraintProvider.IConstraint> _function = (SerializationContextMap.Entry<IGrammarConstraintProvider.IConstraint> it) -> {
|
||||
return it.getValue();
|
||||
};
|
||||
final List<IGrammarConstraintProvider.IConstraint> constraints = ListExtensions.<SerializationContextMap.Entry<IGrammarConstraintProvider.IConstraint>, IGrammarConstraintProvider.IConstraint>map(_values, _function);
|
||||
final List<IGrammarConstraintProvider.IConstraint> constraints = ListExtensions.<SerializationContextMap.Entry<IGrammarConstraintProvider.IConstraint>, IGrammarConstraintProvider.IConstraint>map(this.constraintProvider.getConstraints(grammar).values(), _function);
|
||||
final Function1<IGrammarConstraintProvider.IConstraint, String> _function_1 = (IGrammarConstraintProvider.IConstraint it) -> {
|
||||
String _name = it.getName();
|
||||
String _plus = (_name + "{\n ");
|
||||
IGrammarConstraintProvider.IFeatureInfo[] _features = it.getFeatures();
|
||||
final Function1<IGrammarConstraintProvider.IFeatureInfo, String> _function_2 = (IGrammarConstraintProvider.IFeatureInfo it_1) -> {
|
||||
return this.asString(it_1);
|
||||
};
|
||||
List<String> _map = ListExtensions.<IGrammarConstraintProvider.IFeatureInfo, String>map(((List<IGrammarConstraintProvider.IFeatureInfo>)Conversions.doWrapArray(_features)), _function_2);
|
||||
String _join = IterableExtensions.join(_map, "\n ");
|
||||
String _join = IterableExtensions.join(ListExtensions.<IGrammarConstraintProvider.IFeatureInfo, String>map(((List<IGrammarConstraintProvider.IFeatureInfo>)Conversions.doWrapArray(it.getFeatures())), _function_2), "\n ");
|
||||
String _plus_1 = (_plus + _join);
|
||||
return (_plus_1 + "\n}");
|
||||
};
|
||||
List<String> _map = ListExtensions.<IGrammarConstraintProvider.IConstraint, String>map(constraints, _function_1);
|
||||
String _join = IterableExtensions.join(_map, "\n");
|
||||
String _join = IterableExtensions.join(ListExtensions.<IGrammarConstraintProvider.IConstraint, String>map(constraints, _function_1), "\n");
|
||||
return (_join + "\n");
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
|
@ -333,8 +327,7 @@ public class GrammarConstraintProviderFeatureTest {
|
|||
_xifexpression = Integer.valueOf(it.getUpperBound());
|
||||
}
|
||||
final Object upper = ((Object)_xifexpression);
|
||||
EStructuralFeature _feature = it.getFeature();
|
||||
String _name = _feature.getName();
|
||||
String _name = it.getFeature().getName();
|
||||
String _plus = (_name + "[");
|
||||
int _lowerBound = it.getLowerBound();
|
||||
String _plus_1 = (_plus + Integer.valueOf(_lowerBound));
|
||||
|
|
|
@ -11,7 +11,6 @@ import com.google.common.base.Function;
|
|||
import com.google.common.collect.Iterables;
|
||||
import com.google.inject.Inject;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
import org.eclipse.xtext.AbstractElement;
|
||||
|
@ -941,45 +940,35 @@ public class GrammarPDAProviderTest {
|
|||
final Grammar grammar = this.parser.parse(_builder);
|
||||
this.validator.assertNoErrors(grammar);
|
||||
final SerializationContextMap<Pda<ISerState, RuleCall>> pdas = this.pdaProvider.getGrammarPDAs(grammar);
|
||||
List<SerializationContextMap.Entry<Pda<ISerState, RuleCall>>> _values = pdas.values();
|
||||
final Consumer<SerializationContextMap.Entry<Pda<ISerState, RuleCall>>> _function = (SerializationContextMap.Entry<Pda<ISerState, RuleCall>> it) -> {
|
||||
this.assertNoLeakedGrammarElements(grammar, it.getValue());
|
||||
};
|
||||
_values.forEach(_function);
|
||||
List<SerializationContextMap.Entry<Pda<ISerState, RuleCall>>> _values_1 = pdas.values();
|
||||
pdas.values().forEach(_function);
|
||||
final Function1<SerializationContextMap.Entry<Pda<ISerState, RuleCall>>, List<ISerializationContext>> _function_1 = (SerializationContextMap.Entry<Pda<ISerState, RuleCall>> it) -> {
|
||||
return it.getContexts();
|
||||
};
|
||||
List<List<ISerializationContext>> _map = ListExtensions.<SerializationContextMap.Entry<Pda<ISerState, RuleCall>>, List<ISerializationContext>>map(_values_1, _function_1);
|
||||
Iterable<ISerializationContext> _flatten = Iterables.<ISerializationContext>concat(_map);
|
||||
List<ISerializationContext> _sort = IterableExtensions.<ISerializationContext>sort(_flatten);
|
||||
final Function1<ISerializationContext, String> _function_2 = (ISerializationContext it) -> {
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append(it);
|
||||
_builder_1.append(":");
|
||||
_builder_1.newLineIfNotEmpty();
|
||||
_builder_1.append("\t");
|
||||
Pda<ISerState, RuleCall> _get = pdas.get(it);
|
||||
String _listString = this.toListString(_get);
|
||||
String _listString = this.toListString(pdas.get(it));
|
||||
_builder_1.append(_listString, "\t");
|
||||
_builder_1.newLineIfNotEmpty();
|
||||
return _builder_1.toString();
|
||||
};
|
||||
List<String> _map_1 = ListExtensions.<ISerializationContext, String>map(_sort, _function_2);
|
||||
return IterableExtensions.join(_map_1);
|
||||
return IterableExtensions.join(ListExtensions.<ISerializationContext, String>map(IterableExtensions.<ISerializationContext>sort(Iterables.<ISerializationContext>concat(ListExtensions.<SerializationContextMap.Entry<Pda<ISerState, RuleCall>>, List<ISerializationContext>>map(pdas.values(), _function_1))), _function_2));
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
}
|
||||
|
||||
private void assertNoLeakedGrammarElements(final Grammar grammar, final Pda<ISerState, RuleCall> pda) {
|
||||
NfaUtil _nfaUtil = new NfaUtil();
|
||||
Set<ISerState> _collect = _nfaUtil.<ISerState>collect(pda);
|
||||
final Function1<ISerState, AbstractElement> _function = (ISerState it) -> {
|
||||
return it.getGrammarElement();
|
||||
};
|
||||
Iterable<AbstractElement> _map = IterableExtensions.<ISerState, AbstractElement>map(_collect, _function);
|
||||
Iterable<AbstractElement> _filterNull = IterableExtensions.<AbstractElement>filterNull(_map);
|
||||
Iterable<AbstractElement> _filterNull = IterableExtensions.<AbstractElement>filterNull(IterableExtensions.<ISerState, AbstractElement>map(new NfaUtil().<ISerState>collect(pda), _function));
|
||||
for (final AbstractElement ele : _filterNull) {
|
||||
{
|
||||
final Grammar actual = GrammarUtil.getGrammar(ele);
|
||||
|
@ -995,22 +984,15 @@ public class GrammarPDAProviderTest {
|
|||
|
||||
protected void toDot(final Pda<ISerState, RuleCall> pda, final String name) {
|
||||
try {
|
||||
Thread _currentThread = Thread.currentThread();
|
||||
StackTraceElement[] _stackTrace = _currentThread.getStackTrace();
|
||||
StackTraceElement _get = _stackTrace[6];
|
||||
final String test = _get.getMethodName();
|
||||
PdaToDot<Object, Object> _pdaToDot = new PdaToDot<Object, Object>();
|
||||
_pdaToDot.draw(pda, (((("dot2/" + test) + "_") + name) + ".pdf"), "-T pdf");
|
||||
final String test = Thread.currentThread().getStackTrace()[6].getMethodName();
|
||||
new PdaToDot<Object, Object>().draw(pda, (((("dot2/" + test) + "_") + name) + ".pdf"), "-T pdf");
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
}
|
||||
|
||||
private String toListString(final Pda<ISerState, RuleCall> pda) {
|
||||
GrammarElementTitleSwitch _grammarElementTitleSwitch = new GrammarElementTitleSwitch();
|
||||
GrammarElementTitleSwitch _showAssignments = _grammarElementTitleSwitch.showAssignments();
|
||||
GrammarElementTitleSwitch _hideCardinality = _showAssignments.hideCardinality();
|
||||
final GrammarElementTitleSwitch ts = _hideCardinality.showQualified();
|
||||
final GrammarElementTitleSwitch ts = new GrammarElementTitleSwitch().showAssignments().hideCardinality().showQualified();
|
||||
final PdaListFormatter<ISerState, RuleCall> formatter = new PdaListFormatter<ISerState, RuleCall>();
|
||||
final Function<ISerState, String> _function = (ISerState it) -> {
|
||||
String _switchResult = null;
|
||||
|
@ -1024,21 +1006,16 @@ public class GrammarPDAProviderTest {
|
|||
_switchResult = "stop";
|
||||
break;
|
||||
default:
|
||||
AbstractElement _grammarElement = it.getGrammarElement();
|
||||
_switchResult = ts.apply(_grammarElement);
|
||||
_switchResult = ts.apply(it.getGrammarElement());
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
AbstractElement _grammarElement = it.getGrammarElement();
|
||||
_switchResult = ts.apply(_grammarElement);
|
||||
_switchResult = ts.apply(it.getGrammarElement());
|
||||
}
|
||||
return _switchResult;
|
||||
};
|
||||
formatter.setStateFormatter(_function);
|
||||
GrammarElementTitleSwitch _grammarElementTitleSwitch_1 = new GrammarElementTitleSwitch();
|
||||
GrammarElementTitleSwitch _showAssignments_1 = _grammarElementTitleSwitch_1.showAssignments();
|
||||
GrammarElementTitleSwitch _hideCardinality_1 = _showAssignments_1.hideCardinality();
|
||||
formatter.setStackitemFormatter(_hideCardinality_1);
|
||||
formatter.setStackitemFormatter(new GrammarElementTitleSwitch().showAssignments().hideCardinality());
|
||||
formatter.sortFollowers();
|
||||
String _format = formatter.format(pda);
|
||||
return (_format + "\n");
|
||||
|
|
|
@ -8,11 +8,9 @@
|
|||
package org.eclipse.xtext.serializer;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
import org.eclipse.xtext.serializer.HiddenTokenSequencerTestLanguageInjectorProvider;
|
||||
import org.eclipse.xtext.serializer.ISerializer;
|
||||
import org.eclipse.xtext.serializer.hiddentokensequencertest.DomainModel;
|
||||
import org.eclipse.xtext.serializer.hiddentokensequencertest.Entity;
|
||||
import org.eclipse.xtext.serializer.hiddentokensequencertest.HiddentokensequencertestFactory;
|
||||
import org.eclipse.xtext.serializer.hiddentokensequencertest.Model;
|
||||
|
@ -97,15 +95,9 @@ public class SerializationAfterModelChangeTest {
|
|||
it.setDescription("BBB");
|
||||
};
|
||||
final Entity event = ObjectExtensions.<Entity>operator_doubleArrow(_createEntity, _function);
|
||||
DomainModel _domainModel = model.getDomainModel();
|
||||
EList<Entity> _entities = _domainModel.getEntities();
|
||||
_entities.remove(1);
|
||||
DomainModel _domainModel_1 = model.getDomainModel();
|
||||
EList<Entity> _entities_1 = _domainModel_1.getEntities();
|
||||
_entities_1.remove(1);
|
||||
DomainModel _domainModel_2 = model.getDomainModel();
|
||||
EList<Entity> _entities_2 = _domainModel_2.getEntities();
|
||||
_entities_2.add(event);
|
||||
model.getDomainModel().getEntities().remove(1);
|
||||
model.getDomainModel().getEntities().remove(1);
|
||||
model.getDomainModel().getEntities().add(event);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("entities");
|
||||
_builder_1.newLine();
|
||||
|
@ -172,12 +164,8 @@ public class SerializationAfterModelChangeTest {
|
|||
_builder.append("end");
|
||||
_builder.newLine();
|
||||
final Model model = this._parseHelper.parse(_builder);
|
||||
DomainModel _domainModel = model.getDomainModel();
|
||||
EList<Entity> _entities = _domainModel.getEntities();
|
||||
final Entity head = IterableExtensions.<Entity>head(_entities);
|
||||
DomainModel _domainModel_1 = model.getDomainModel();
|
||||
EList<Entity> _entities_1 = _domainModel_1.getEntities();
|
||||
_entities_1.move(1, head);
|
||||
final Entity head = IterableExtensions.<Entity>head(model.getDomainModel().getEntities());
|
||||
model.getDomainModel().getEntities().move(1, head);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("entities");
|
||||
_builder_1.newLine();
|
||||
|
@ -219,9 +207,7 @@ public class SerializationAfterModelChangeTest {
|
|||
it.setDescription("Fizzle");
|
||||
};
|
||||
final Entity event = ObjectExtensions.<Entity>operator_doubleArrow(_createEntity, _function);
|
||||
DomainModel _domainModel = model.getDomainModel();
|
||||
EList<Entity> _entities = _domainModel.getEntities();
|
||||
_entities.add(event);
|
||||
model.getDomainModel().getEntities().add(event);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("entities");
|
||||
_builder_1.newLine();
|
||||
|
@ -258,9 +244,7 @@ public class SerializationAfterModelChangeTest {
|
|||
it.setDescription("Fizzle");
|
||||
};
|
||||
final Entity event = ObjectExtensions.<Entity>operator_doubleArrow(_createEntity, _function);
|
||||
DomainModel _domainModel = model.getDomainModel();
|
||||
EList<Entity> _entities = _domainModel.getEntities();
|
||||
_entities.add(event);
|
||||
model.getDomainModel().getEntities().add(event);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("entities");
|
||||
_builder_1.newLine();
|
||||
|
@ -297,9 +281,7 @@ public class SerializationAfterModelChangeTest {
|
|||
it.setDescription("Fizzle");
|
||||
};
|
||||
final Entity event = ObjectExtensions.<Entity>operator_doubleArrow(_createEntity, _function);
|
||||
DomainModel _domainModel = model.getDomainModel();
|
||||
EList<Entity> _entities = _domainModel.getEntities();
|
||||
_entities.add(event);
|
||||
model.getDomainModel().getEntities().add(event);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("entities");
|
||||
_builder_1.newLine();
|
||||
|
@ -340,9 +322,7 @@ public class SerializationAfterModelChangeTest {
|
|||
_builder.append("end");
|
||||
_builder.newLine();
|
||||
final Model model = this._parseHelper.parse(_builder);
|
||||
DomainModel _domainModel = model.getDomainModel();
|
||||
EList<Entity> _entities = _domainModel.getEntities();
|
||||
_entities.remove(1);
|
||||
model.getDomainModel().getEntities().remove(1);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("entities");
|
||||
_builder_1.newLine();
|
||||
|
@ -379,9 +359,7 @@ public class SerializationAfterModelChangeTest {
|
|||
_builder.append("end");
|
||||
_builder.newLine();
|
||||
final Model model = this._parseHelper.parse(_builder);
|
||||
DomainModel _domainModel = model.getDomainModel();
|
||||
EList<Entity> _entities = _domainModel.getEntities();
|
||||
_entities.remove(1);
|
||||
model.getDomainModel().getEntities().remove(1);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("entities");
|
||||
_builder_1.newLine();
|
||||
|
@ -421,9 +399,7 @@ public class SerializationAfterModelChangeTest {
|
|||
_builder.append("end");
|
||||
_builder.newLine();
|
||||
final Model model = this._parseHelper.parse(_builder);
|
||||
DomainModel _domainModel = model.getDomainModel();
|
||||
EList<Entity> _entities = _domainModel.getEntities();
|
||||
_entities.remove(1);
|
||||
model.getDomainModel().getEntities().remove(1);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("entities");
|
||||
_builder_1.newLine();
|
||||
|
@ -458,9 +434,7 @@ public class SerializationAfterModelChangeTest {
|
|||
_builder.append("end");
|
||||
_builder.newLine();
|
||||
final Model model = this._parseHelper.parse(_builder);
|
||||
DomainModel _domainModel = model.getDomainModel();
|
||||
EList<Entity> _entities = _domainModel.getEntities();
|
||||
_entities.remove(1);
|
||||
model.getDomainModel().getEntities().remove(1);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("entities");
|
||||
_builder_1.newLine();
|
||||
|
@ -489,9 +463,7 @@ public class SerializationAfterModelChangeTest {
|
|||
_builder.append("end");
|
||||
_builder.newLine();
|
||||
final Model model = this._parseHelper.parse(_builder);
|
||||
DomainModel _domainModel = model.getDomainModel();
|
||||
EList<Entity> _entities = _domainModel.getEntities();
|
||||
_entities.remove(1);
|
||||
model.getDomainModel().getEntities().remove(1);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("entities");
|
||||
_builder_1.newLine();
|
||||
|
@ -526,9 +498,7 @@ public class SerializationAfterModelChangeTest {
|
|||
it.setDescription("Fizzle");
|
||||
};
|
||||
final Entity event = ObjectExtensions.<Entity>operator_doubleArrow(_createEntity, _function);
|
||||
DomainModel _domainModel = model.getDomainModel();
|
||||
EList<Entity> _entities = _domainModel.getEntities();
|
||||
_entities.add(0, event);
|
||||
model.getDomainModel().getEntities().add(0, event);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("entities Baz \"Fizzle\"");
|
||||
_builder_1.newLine();
|
||||
|
|
|
@ -13,7 +13,6 @@ import org.eclipse.emf.common.util.EList;
|
|||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
import org.eclipse.xtext.serializer.HiddenTokenSequencerTestLanguageInjectorProvider;
|
||||
import org.eclipse.xtext.serializer.ISerializer;
|
||||
import org.eclipse.xtext.serializer.hiddentokensequencertest.DomainModel;
|
||||
import org.eclipse.xtext.serializer.hiddentokensequencertest.Entity;
|
||||
import org.eclipse.xtext.serializer.hiddentokensequencertest.Model;
|
||||
import org.eclipse.xtext.testing.InjectWith;
|
||||
|
@ -74,19 +73,15 @@ public class SerializerPerformanceTest {
|
|||
}
|
||||
_builder.append("end");
|
||||
_builder.newLine();
|
||||
Model _parse = this._parseHelper.parse(_builder);
|
||||
this.model = _parse;
|
||||
DomainModel _domainModel = this.model.getDomainModel();
|
||||
final EList<Entity> entities = _domainModel.getEntities();
|
||||
ExclusiveRange _doubleDotLessThan_1 = new ExclusiveRange(0, SerializerPerformanceTest.numberOfElements, true);
|
||||
this.model = this._parseHelper.parse(_builder);
|
||||
final EList<Entity> entities = this.model.getDomainModel().getEntities();
|
||||
final Function1<Integer, Boolean> _function = (Integer it) -> {
|
||||
return Boolean.valueOf((((it).intValue() % SerializerPerformanceTest.editEvery) == 0));
|
||||
};
|
||||
Iterable<Integer> _filter = IterableExtensions.<Integer>filter(_doubleDotLessThan_1, _function);
|
||||
final Function1<Integer, Entity> _function_1 = (Integer it) -> {
|
||||
return entities.get((it).intValue());
|
||||
};
|
||||
final Iterable<Entity> removeUs = IterableExtensions.<Integer, Entity>map(_filter, _function_1);
|
||||
final Iterable<Entity> removeUs = IterableExtensions.<Integer, Entity>map(IterableExtensions.<Integer>filter(new ExclusiveRange(0, SerializerPerformanceTest.numberOfElements, true), _function), _function_1);
|
||||
CollectionExtensions.<Entity>removeAll(entities, removeUs);
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
|
|
|
@ -127,8 +127,7 @@ public class SerializerValidationDiagnosticsTest {
|
|||
final Model model = this._parseHelper.parse(_builder);
|
||||
EObject _x11 = model.getX11();
|
||||
final MultiKeywordsOrID mt = ((MultiKeywordsOrID) _x11);
|
||||
EList<String> _val = mt.getVal();
|
||||
_val.clear();
|
||||
mt.getVal().clear();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("Could not serialize MultiKeywordsOrID:");
|
||||
_builder_1.newLine();
|
||||
|
@ -181,10 +180,7 @@ public class SerializerValidationDiagnosticsTest {
|
|||
} catch (final Throwable _t) {
|
||||
if (_t instanceof Throwable) {
|
||||
final Throwable t = (Throwable)_t;
|
||||
String _string = expected.toString();
|
||||
String _trim = _string.trim();
|
||||
String _message = t.getMessage();
|
||||
Assert.assertEquals(_trim, _message);
|
||||
Assert.assertEquals(expected.toString().trim(), t.getMessage());
|
||||
} else {
|
||||
throw Exceptions.sneakyThrow(_t);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import java.util.List;
|
|||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.emf.ecore.resource.impl.ResourceImpl;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.eclipse.xtext.tasks.DefaultTaskFinder;
|
||||
import org.eclipse.xtext.tasks.ITaskFinder;
|
||||
import org.eclipse.xtext.tasks.Priority;
|
||||
|
@ -42,8 +41,7 @@ public class DefaultTaskFinderTest extends AbstractXtextTests {
|
|||
public void setup() {
|
||||
try {
|
||||
this.with(NoJdtTestLanguageStandaloneSetup.class);
|
||||
DefaultTaskFinder _get = this.<DefaultTaskFinder>get(DefaultTaskFinder.class);
|
||||
this.finder = _get;
|
||||
this.finder = this.<DefaultTaskFinder>get(DefaultTaskFinder.class);
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
|
@ -51,8 +49,7 @@ public class DefaultTaskFinderTest extends AbstractXtextTests {
|
|||
|
||||
@Test
|
||||
public void testNonXtextResource() {
|
||||
ResourceImpl _resourceImpl = new ResourceImpl();
|
||||
this.assertContainsTasks(_resourceImpl, Collections.<Task>unmodifiableList(CollectionLiterals.<Task>newArrayList()));
|
||||
this.assertContainsTasks(new ResourceImpl(), Collections.<Task>unmodifiableList(CollectionLiterals.<Task>newArrayList()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -77,8 +74,6 @@ public class DefaultTaskFinderTest extends AbstractXtextTests {
|
|||
_builder.newLine();
|
||||
_builder.append("Hello notATODO!");
|
||||
_builder.newLine();
|
||||
String _unix = LineDelimiters.toUnix(_builder.toString());
|
||||
XtextResource _resourceFromString = this.getResourceFromString(_unix);
|
||||
Task _task = new Task();
|
||||
final Procedure1<Task> _function = (Task it) -> {
|
||||
TaskTag _taskTag = new TaskTag();
|
||||
|
@ -107,7 +102,8 @@ public class DefaultTaskFinderTest extends AbstractXtextTests {
|
|||
it.setLineNumber(3);
|
||||
};
|
||||
Task _doubleArrow_1 = ObjectExtensions.<Task>operator_doubleArrow(_task_1, _function_1);
|
||||
this.assertContainsTasks(_resourceFromString,
|
||||
this.assertContainsTasks(this.getResourceFromString(
|
||||
LineDelimiters.toUnix(_builder.toString())),
|
||||
Collections.<Task>unmodifiableList(CollectionLiterals.<Task>newArrayList(_doubleArrow, _doubleArrow_1)));
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
|
@ -116,15 +112,11 @@ public class DefaultTaskFinderTest extends AbstractXtextTests {
|
|||
|
||||
private void assertContainsTasks(final Resource resource, final List<Task> expectedTasks) {
|
||||
final List<Task> actualTasks = this.finder.findTasks(resource);
|
||||
Assert.assertEquals(expectedTasks.size(), actualTasks.size());
|
||||
int _size = expectedTasks.size();
|
||||
int _size_1 = actualTasks.size();
|
||||
Assert.assertEquals(_size, _size_1);
|
||||
int _size_2 = expectedTasks.size();
|
||||
ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size_2, true);
|
||||
ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true);
|
||||
for (final Integer i : _doubleDotLessThan) {
|
||||
Task _get = expectedTasks.get((i).intValue());
|
||||
Task _get_1 = actualTasks.get((i).intValue());
|
||||
TaskAssert.assertExactMatch(_get, _get_1);
|
||||
TaskAssert.assertExactMatch(expectedTasks.get((i).intValue()), actualTasks.get((i).intValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -172,8 +172,7 @@ public class DefaultTaskParserTest {
|
|||
_builder.append("*/");
|
||||
_builder.newLine();
|
||||
final String source = _builder.toString();
|
||||
String _unix = LineDelimiters.toUnix(source);
|
||||
final List<Task> parsed = this.parser.parseTasks(_unix, this.definitions);
|
||||
final List<Task> parsed = this.parser.parseTasks(LineDelimiters.toUnix(source), this.definitions);
|
||||
Assert.assertEquals(expectation, parsed.size());
|
||||
ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, expectation, true);
|
||||
for (final Integer i_1 : _doubleDotLessThan) {
|
||||
|
@ -182,9 +181,7 @@ public class DefaultTaskParserTest {
|
|||
}
|
||||
|
||||
private void assertContainsTasks(final CharSequence source, final List<Task> expectedTasks) {
|
||||
String _string = source.toString();
|
||||
String _unix = LineDelimiters.toUnix(_string);
|
||||
final List<Task> actualTasks = this.parser.parseTasks(_unix, this.definitions);
|
||||
final List<Task> actualTasks = this.parser.parseTasks(LineDelimiters.toUnix(source.toString()), this.definitions);
|
||||
Assert.assertEquals(expectedTasks.size(), actualTasks.size());
|
||||
int _size = expectedTasks.size();
|
||||
ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true);
|
||||
|
|
|
@ -55,26 +55,18 @@ public class PreferenceTaskTagProviderTest {
|
|||
final String prios = PreferenceTaskTagProvider.serializePriorities(tags);
|
||||
final IPreferenceValuesProvider.SingletonPreferenceValuesProvider valueProvider = new IPreferenceValuesProvider.SingletonPreferenceValuesProvider();
|
||||
final MapBasedPreferenceValues values = valueProvider.getPreferenceValues(null);
|
||||
String _id = PreferenceTaskTagProvider.TAGS_KEY.getId();
|
||||
values.put(_id, names);
|
||||
String _id_1 = PreferenceTaskTagProvider.PRIORITIES_KEY.getId();
|
||||
values.put(_id_1, prios);
|
||||
String _id_2 = PreferenceTaskTagProvider.CASE_SENSITIVE_KEY.getId();
|
||||
values.put(_id_2, "false");
|
||||
values.put(PreferenceTaskTagProvider.TAGS_KEY.getId(), names);
|
||||
values.put(PreferenceTaskTagProvider.PRIORITIES_KEY.getId(), prios);
|
||||
values.put(PreferenceTaskTagProvider.CASE_SENSITIVE_KEY.getId(), "false");
|
||||
final PreferenceTaskTagProvider tagProvider = new PreferenceTaskTagProvider();
|
||||
tagProvider.setPreferenceValuesProvider(valueProvider);
|
||||
final TaskTags parsedTags = tagProvider.getTaskTags(null);
|
||||
boolean _isCaseSensitive = parsedTags.isCaseSensitive();
|
||||
Assert.assertEquals(Boolean.valueOf(false), Boolean.valueOf(_isCaseSensitive));
|
||||
Assert.assertEquals(Boolean.valueOf(false), Boolean.valueOf(parsedTags.isCaseSensitive()));
|
||||
Assert.assertEquals(tags.size(), IterableExtensions.size(parsedTags));
|
||||
int _size = tags.size();
|
||||
int _size_1 = IterableExtensions.size(parsedTags);
|
||||
Assert.assertEquals(_size, _size_1);
|
||||
int _size_2 = tags.size();
|
||||
ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size_2, true);
|
||||
ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true);
|
||||
for (final Integer i : _doubleDotLessThan) {
|
||||
TaskTag _get = tags.get((i).intValue());
|
||||
TaskTag _get_1 = ((TaskTag[])Conversions.unwrapArray(parsedTags, TaskTag.class))[(i).intValue()];
|
||||
TaskAssert.assertExactMatch(_get, _get_1);
|
||||
TaskAssert.assertExactMatch(tags.get((i).intValue()), ((TaskTag[])Conversions.unwrapArray(parsedTags, TaskTag.class))[(i).intValue()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue