use of org.eclipse.xtext.testing.DocumentHighlightConfiguration in project xtext-core by eclipse.
the class DocumentHighlightTest method singleLineMultipleOccurrences_SelectionOnReadSite.
@Test
public void singleLineMultipleOccurrences_SelectionOnReadSite() {
final Procedure1<DocumentHighlightConfiguration> _function = (DocumentHighlightConfiguration it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("type A { op foo() { } op bar() { foo(10) } }");
it.setModel(_builder.toString());
it.setLine(0);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("type A { op foo() { } op bar() { fo");
it.setColumn(_builder_1.length());
it.setExpectedDocumentHighlight("W [[0, 12] .. [0, 15]] | R [[0, 33] .. [0, 36]]");
};
this.testDocumentHighlight(_function);
}
use of org.eclipse.xtext.testing.DocumentHighlightConfiguration in project xtext-core by eclipse.
the class DocumentHighlightTest method singleLineSingleOccurrence.
@Test
public void singleLineSingleOccurrence() {
final Procedure1<DocumentHighlightConfiguration> _function = (DocumentHighlightConfiguration it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("type A { op foo() { } }");
it.setModel(_builder.toString());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("type A { op fo");
it.setColumn(_builder_1.length());
it.setExpectedDocumentHighlight("W [[0, 12] .. [0, 15]]");
};
this.testDocumentHighlight(_function);
}
use of org.eclipse.xtext.testing.DocumentHighlightConfiguration in project xtext-core by eclipse.
the class AbstractLanguageServerTest method testDocumentHighlight.
protected void testDocumentHighlight(final Procedure1<? super DocumentHighlightConfiguration> configurator) {
try {
DocumentHighlightConfiguration _documentHighlightConfiguration = new DocumentHighlightConfiguration();
final Procedure1<DocumentHighlightConfiguration> _function = (DocumentHighlightConfiguration it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("MyModel.");
_builder.append(this.fileExtension);
it.setFilePath(_builder.toString());
};
@Extension final DocumentHighlightConfiguration configuration = ObjectExtensions.<DocumentHighlightConfiguration>operator_doubleArrow(_documentHighlightConfiguration, _function);
configurator.apply(configuration);
final String fileUri = this.initializeContext(configuration).getUri();
TextDocumentPositionParams _textDocumentPositionParams = new TextDocumentPositionParams();
final Procedure1<TextDocumentPositionParams> _function_1 = (TextDocumentPositionParams it) -> {
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(fileUri);
it.setTextDocument(_textDocumentIdentifier);
int _line = configuration.getLine();
int _column = configuration.getColumn();
Position _position = new Position(_line, _column);
it.setPosition(_position);
};
TextDocumentPositionParams _doubleArrow = ObjectExtensions.<TextDocumentPositionParams>operator_doubleArrow(_textDocumentPositionParams, _function_1);
final CompletableFuture<List<? extends DocumentHighlight>> highlights = this.languageServer.documentHighlight(_doubleArrow);
final Function1<DocumentHighlight, String> _function_2 = (DocumentHighlight it) -> {
return this.toExpectation(it);
};
final String actualDocumentHighlight = IterableExtensions.join(ListExtensions.map(highlights.get(), _function_2), " | ");
this.assertEquals(configuration.getExpectedDocumentHighlight(), actualDocumentHighlight);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtext.testing.DocumentHighlightConfiguration in project xtext-core by eclipse.
the class DocumentHighlightTest method singleLineSingleOccurrenceWithVariable.
@Test
public void singleLineSingleOccurrenceWithVariable() {
final Procedure1<DocumentHighlightConfiguration> _function = (DocumentHighlightConfiguration it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("type A { int foo op foo() { } }");
it.setModel(_builder.toString());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("type A { int fo");
it.setColumn(_builder_1.length());
it.setExpectedDocumentHighlight("W [[0, 13] .. [0, 16]]");
};
this.testDocumentHighlight(_function);
}
use of org.eclipse.xtext.testing.DocumentHighlightConfiguration in project xtext-core by eclipse.
the class DocumentHighlightTest method singleLineNoOccurrences_SelectionAfterWriteSiteMethodName.
@Test
public void singleLineNoOccurrences_SelectionAfterWriteSiteMethodName() {
final Procedure1<DocumentHighlightConfiguration> _function = (DocumentHighlightConfiguration it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("type A { op foo() { } }");
it.setModel(_builder.toString());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("type A { op foo(");
it.setColumn(_builder_1.length());
it.setExpectedDocumentHighlight("");
};
this.testDocumentHighlight(_function);
}
Aggregations