Search in sources :

Example 6 with TestCompletionConfiguration

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

the class CompletionTest method testCompletion_05.

@Test
public void testCompletion_05() {
    final Procedure1<TestCompletionConfiguration> _function = (TestCompletionConfiguration it) -> {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("type Foo {}");
        _builder.newLine();
        _builder.append("type foo {}");
        _builder.newLine();
        _builder.append("type Boo {}");
        _builder.newLine();
        _builder.append("type boo {}");
        _builder.newLine();
        it.setModel(_builder.toString());
        it.setLine(1);
        it.setColumn("type Bar {".length());
        StringConcatenation _builder_1 = new StringConcatenation();
        _builder_1.append("Boo (TypeDeclaration) -> Boo [[1, 10] .. [1, 10]]");
        _builder_1.newLine();
        _builder_1.append("boo (TypeDeclaration) -> boo [[1, 10] .. [1, 10]]");
        _builder_1.newLine();
        _builder_1.append("Foo (TypeDeclaration) -> Foo [[1, 10] .. [1, 10]]");
        _builder_1.newLine();
        _builder_1.append("foo (TypeDeclaration) -> foo [[1, 10] .. [1, 10]]");
        _builder_1.newLine();
        _builder_1.append("boolean -> boolean [[1, 10] .. [1, 10]]");
        _builder_1.newLine();
        _builder_1.append("int -> int [[1, 10] .. [1, 10]]");
        _builder_1.newLine();
        _builder_1.append("op -> op [[1, 10] .. [1, 10]]");
        _builder_1.newLine();
        _builder_1.append("string -> string [[1, 10] .. [1, 10]]");
        _builder_1.newLine();
        _builder_1.append("void -> void [[1, 10] .. [1, 10]]");
        _builder_1.newLine();
        _builder_1.append("} -> } [[1, 10] .. [1, 10]]");
        _builder_1.newLine();
        _builder_1.append("{ -> { [[1, 9] .. [1, 10]]");
        _builder_1.newLine();
        it.setExpectedCompletionItems(_builder_1.toString());
    };
    this.testCompletion(_function);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) TestCompletionConfiguration(org.eclipse.xtext.testing.TestCompletionConfiguration) Test(org.junit.Test) AbstractTestLangLanguageServerTest(org.eclipse.xtext.ide.tests.server.AbstractTestLangLanguageServerTest)

Aggregations

TestCompletionConfiguration (org.eclipse.xtext.testing.TestCompletionConfiguration)6 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)5 AbstractTestLangLanguageServerTest (org.eclipse.xtext.ide.tests.server.AbstractTestLangLanguageServerTest)5 Test (org.junit.Test)5 List (java.util.List)1 CompletionItem (org.eclipse.lsp4j.CompletionItem)1 CompletionList (org.eclipse.lsp4j.CompletionList)1 Position (org.eclipse.lsp4j.Position)1 TextDocumentIdentifier (org.eclipse.lsp4j.TextDocumentIdentifier)1 TextDocumentPositionParams (org.eclipse.lsp4j.TextDocumentPositionParams)1 Either (org.eclipse.lsp4j.jsonrpc.messages.Either)1 Extension (org.eclipse.xtext.xbase.lib.Extension)1