Search in sources :

Example 11 with SignatureHelpConfiguration

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

the class SignatureHelpTest method firstArgExactMatch.

@Test
public void firstArgExactMatch() {
    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);
}
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 12 with SignatureHelpConfiguration

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

the class SignatureHelpTest method singleArgWithLeadingWhitespace.

@Test
public void singleArgWithLeadingWhitespace() {
    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);
}
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 13 with SignatureHelpConfiguration

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

the class SignatureHelpTest method multipleArgsWithCommentAtCommaIncomplete.

@Test
public void multipleArgsWithCommentAtCommaIncomplete() {
    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);
}
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 14 with SignatureHelpConfiguration

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

the class SignatureHelpTest method multipleArgsWithLeadingWhitespaceBeforeComma_ExpectFirstArg.

@Test
public void multipleArgsWithLeadingWhitespaceBeforeComma_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);
}
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 15 with SignatureHelpConfiguration

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

the class SignatureHelpTest method noArgsExactMatch.

@Test
public void noArgsExactMatch() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("foo()");
    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(");
        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);
}
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