Search in sources :

Example 1 with SignatureHelpConfiguration

use of org.eclipse.xtext.testing.SignatureHelpConfiguration in project xtext-core by eclipse.

the class SignatureHelpTest method thirdArgExactMatch.

@Test
public void thirdArgExactMatch() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("foo(1, 2, 3)");
    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, 3");
        it.setColumn(_builder_1.length());
        it.setExpectedSignatureHelp("C.foo(a: A, b: B, c: C): void | c: C");
    };
    this.testSignatureHelp(_function);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) SignatureHelpConfiguration(org.eclipse.xtext.testing.SignatureHelpConfiguration) Test(org.junit.Test) AbstractTestLangLanguageServerTest(org.eclipse.xtext.ide.tests.server.AbstractTestLangLanguageServerTest)

Example 2 with SignatureHelpConfiguration

use of org.eclipse.xtext.testing.SignatureHelpConfiguration in project xtext-core by eclipse.

the class SignatureHelpTest method multipleArgsWithLeadingWhitespaceAtComma_ExpectFirstArg.

@Test
public void multipleArgsWithLeadingWhitespaceAtComma_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 | b: B");
    };
    this.testSignatureHelp(_function);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) SignatureHelpConfiguration(org.eclipse.xtext.testing.SignatureHelpConfiguration) Test(org.junit.Test) AbstractTestLangLanguageServerTest(org.eclipse.xtext.ide.tests.server.AbstractTestLangLanguageServerTest)

Example 3 with SignatureHelpConfiguration

use of org.eclipse.xtext.testing.SignatureHelpConfiguration in project xtext-core by eclipse.

the class SignatureHelpTest method singleArgsExactMatchAfterTriggerChar.

@Test
public void singleArgsExactMatchAfterTriggerChar() {
    final Procedure1<SignatureHelpConfiguration> _function = (SignatureHelpConfiguration it) -> {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("type A { op foo(a: A) { } } type Main { op main() { foo() } }");
        it.setModel(_builder.toString());
        it.setLine(0);
        StringConcatenation _builder_1 = new StringConcatenation();
        _builder_1.append("type A { op foo(a: A) { } } type Main { op main() { foo(");
        it.setColumn(_builder_1.length());
        it.setExpectedSignatureHelp("A.foo(a: A): void | a: A");
    };
    this.testSignatureHelp(_function);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) SignatureHelpConfiguration(org.eclipse.xtext.testing.SignatureHelpConfiguration) Test(org.junit.Test) AbstractTestLangLanguageServerTest(org.eclipse.xtext.ide.tests.server.AbstractTestLangLanguageServerTest)

Example 4 with SignatureHelpConfiguration

use of org.eclipse.xtext.testing.SignatureHelpConfiguration in project xtext-core by eclipse.

the class SignatureHelpTest method secondArgExactMatch.

@Test
public void secondArgExactMatch() {
    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("B.foo(a: A, b: B): int | C.foo(a: A, b: B, c: C): void | b: B");
    };
    this.testSignatureHelp(_function);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) SignatureHelpConfiguration(org.eclipse.xtext.testing.SignatureHelpConfiguration) Test(org.junit.Test) AbstractTestLangLanguageServerTest(org.eclipse.xtext.ide.tests.server.AbstractTestLangLanguageServerTest)

Example 5 with SignatureHelpConfiguration

use of org.eclipse.xtext.testing.SignatureHelpConfiguration in project xtext-core by eclipse.

the class SignatureHelpTest method multipleArgsAtComma.

@Test
public void multipleArgsAtComma() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("foo(1, 2, 3)");
    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);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) SignatureHelpConfiguration(org.eclipse.xtext.testing.SignatureHelpConfiguration) Test(org.junit.Test) AbstractTestLangLanguageServerTest(org.eclipse.xtext.ide.tests.server.AbstractTestLangLanguageServerTest)

Aggregations

SignatureHelpConfiguration (org.eclipse.xtext.testing.SignatureHelpConfiguration)16 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)15 AbstractTestLangLanguageServerTest (org.eclipse.xtext.ide.tests.server.AbstractTestLangLanguageServerTest)15 Test (org.junit.Test)15 Position (org.eclipse.lsp4j.Position)1 SignatureHelp (org.eclipse.lsp4j.SignatureHelp)1 TextDocumentIdentifier (org.eclipse.lsp4j.TextDocumentIdentifier)1 TextDocumentPositionParams (org.eclipse.lsp4j.TextDocumentPositionParams)1 Extension (org.eclipse.xtext.xbase.lib.Extension)1