use of org.eclipse.xtext.testing.SignatureHelpConfiguration in project xtext-core by eclipse.
the class SignatureHelpTest method afterOperationCall.
@Test
public void afterOperationCall() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("foo(1, 2)");
final String testMe = _builder.toString();
final Procedure1<SignatureHelpConfiguration> _function = (SignatureHelpConfiguration it) -> {
it.setModel(this.getModel(testMe));
it.setLine(SignatureHelpTest.LINE_NUMBER);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("foo(1, 2)");
it.setColumn(_builder_1.length());
it.setExpectedSignatureHelp("<empty>");
};
this.testSignatureHelp(_function);
}
use of org.eclipse.xtext.testing.SignatureHelpConfiguration in project xtext-core by eclipse.
the class AbstractLanguageServerTest method testSignatureHelp.
protected void testSignatureHelp(final Procedure1<? super SignatureHelpConfiguration> configurator) {
try {
@Extension final SignatureHelpConfiguration configuration = new SignatureHelpConfiguration();
configuration.setFilePath(("MyModel." + this.fileExtension));
configurator.apply(configuration);
final String fileUri = this.initializeContext(configuration).getUri();
TextDocumentPositionParams _textDocumentPositionParams = new TextDocumentPositionParams();
final Procedure1<TextDocumentPositionParams> _function = (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);
final CompletableFuture<SignatureHelp> signatureHelpFuture = this.languageServer.signatureHelp(_doubleArrow);
final SignatureHelp signatureHelp = signatureHelpFuture.get();
Procedure1<? super SignatureHelp> _assertSignatureHelp = configuration.getAssertSignatureHelp();
boolean _tripleNotEquals = (_assertSignatureHelp != null);
if (_tripleNotEquals) {
configuration.getAssertSignatureHelp().apply(signatureHelp);
} else {
final String actualSignatureHelp = this.toExpectation(signatureHelp);
this.assertEquals(configuration.getExpectedSignatureHelp().trim(), actualSignatureHelp.trim());
}
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtext.testing.SignatureHelpConfiguration in project xtext-core by eclipse.
the class SignatureHelpTest method multipleArgsWithLeadingWhitespaceBeforeFirstArg_ExpectFirstArg.
@Test
public void multipleArgsWithLeadingWhitespaceBeforeFirstArg_ExpectFirstArg() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("foo( 1, 2)");
final String testMe = _builder.toString();
final Procedure1<SignatureHelpConfiguration> _function = (SignatureHelpConfiguration it) -> {
it.setModel(this.getModel(testMe));
it.setLine(SignatureHelpTest.LINE_NUMBER);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("foo( 1");
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);
}
use of org.eclipse.xtext.testing.SignatureHelpConfiguration in project xtext-core by eclipse.
the class SignatureHelpTest method singleArgWithTrailingWhitespace.
@Test
public void singleArgWithTrailingWhitespace() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("foo(1 )");
final String testMe = _builder.toString();
final Procedure1<SignatureHelpConfiguration> _function = (SignatureHelpConfiguration it) -> {
it.setModel(this.getModel(testMe));
it.setLine(SignatureHelpTest.LINE_NUMBER);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("foo(1 ");
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);
}
use of org.eclipse.xtext.testing.SignatureHelpConfiguration in project xtext-core by eclipse.
the class SignatureHelpTest method multipleArgsAtCommaIncomplete.
@Test
public void multipleArgsAtCommaIncomplete() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("foo(1, 2,)");
final String testMe = _builder.toString();
final Procedure1<SignatureHelpConfiguration> _function = (SignatureHelpConfiguration it) -> {
it.setModel(this.getModel(testMe));
it.setLine(SignatureHelpTest.LINE_NUMBER);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("foo(1, 2,");
it.setColumn(_builder_1.length());
it.setExpectedSignatureHelp("C.foo(a: A, b: B, c: C): void | c: C");
};
this.testSignatureHelp(_function);
}
Aggregations