Search in sources :

Example 6 with HoverTestConfiguration

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

the class HoverTest method testHover_05.

@Test
public void testHover_05() {
    final Procedure1<HoverTestConfiguration> _function = (HoverTestConfiguration it) -> {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("/**");
        _builder.newLine();
        _builder.append(" ");
        _builder.append("* Some documentation.");
        _builder.newLine();
        _builder.append(" ");
        _builder.append("*/");
        _builder.newLine();
        _builder.append("type Foo {");
        _builder.newLine();
        _builder.append("}");
        _builder.newLine();
        Pair<String, String> _mappedTo = Pair.<String, String>of(("MyModel2." + this.fileExtension), _builder.toString());
        it.setFilesInScope(Collections.<String, CharSequence>unmodifiableMap(CollectionLiterals.<String, CharSequence>newHashMap(_mappedTo)));
        StringConcatenation _builder_1 = new StringConcatenation();
        _builder_1.append("type Bar extends Foo {");
        _builder_1.newLine();
        _builder_1.append("}");
        _builder_1.newLine();
        it.setModel(_builder_1.toString());
        it.setColumn("type Bar extends F".length());
        StringConcatenation _builder_2 = new StringConcatenation();
        _builder_2.append("[[0, 17] .. [0, 20]]");
        _builder_2.newLine();
        _builder_2.append("Some documentation.");
        _builder_2.newLine();
        it.setExpectedHover(_builder_2.toString());
    };
    this.testHover(_function);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) HoverTestConfiguration(org.eclipse.xtext.testing.HoverTestConfiguration) Pair(org.eclipse.xtext.xbase.lib.Pair) Test(org.junit.Test) AbstractTestLangLanguageServerTest(org.eclipse.xtext.ide.tests.server.AbstractTestLangLanguageServerTest)

Aggregations

HoverTestConfiguration (org.eclipse.xtext.testing.HoverTestConfiguration)6 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)5 AbstractTestLangLanguageServerTest (org.eclipse.xtext.ide.tests.server.AbstractTestLangLanguageServerTest)5 Test (org.junit.Test)5 Hover (org.eclipse.lsp4j.Hover)1 Position (org.eclipse.lsp4j.Position)1 TextDocumentIdentifier (org.eclipse.lsp4j.TextDocumentIdentifier)1 TextDocumentPositionParams (org.eclipse.lsp4j.TextDocumentPositionParams)1 Extension (org.eclipse.xtext.xbase.lib.Extension)1 Pair (org.eclipse.xtext.xbase.lib.Pair)1