Search in sources :

Example 1 with DocumentHighlightConfiguration

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

the class DocumentHighlightTest method singleLineNoOccurrences_SelectionBeforeWriteSiteMethodName.

@Test
public void singleLineNoOccurrences_SelectionBeforeWriteSiteMethodName() {
    final Procedure1<DocumentHighlightConfiguration> _function = (DocumentHighlightConfiguration it) -> {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("type A { op foo() { } }");
        it.setModel(_builder.toString());
        StringConcatenation _builder_1 = new StringConcatenation();
        _builder_1.append("type A { op");
        it.setColumn(_builder_1.length());
        it.setExpectedDocumentHighlight("");
    };
    this.testDocumentHighlight(_function);
}
Also used : DocumentHighlightConfiguration(org.eclipse.xtext.testing.DocumentHighlightConfiguration) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Test(org.junit.Test) AbstractTestLangLanguageServerTest(org.eclipse.xtext.ide.tests.server.AbstractTestLangLanguageServerTest)

Example 2 with DocumentHighlightConfiguration

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

the class DocumentHighlightTest method multipleLinesMultipleOccurrences_WithWhitespaces.

@Test
public void multipleLinesMultipleOccurrences_WithWhitespaces() {
    final Procedure1<DocumentHighlightConfiguration> _function = (DocumentHighlightConfiguration it) -> {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("type A {");
        _builder.newLine();
        _builder.append("    ");
        _builder.append("op foo() { }");
        _builder.newLine();
        _builder.append("    ");
        _builder.append("op bar() {");
        _builder.newLine();
        _builder.append("        ");
        _builder.append("foo(10)");
        _builder.newLine();
        _builder.append("    ");
        _builder.append("}");
        _builder.newLine();
        _builder.append("}");
        it.setModel(_builder.toString());
        it.setLine(1);
        StringConcatenation _builder_1 = new StringConcatenation();
        _builder_1.append("    ");
        _builder_1.append("op fo");
        it.setColumn(_builder_1.length());
        it.setExpectedDocumentHighlight("W [[1, 7] .. [1, 10]] | R [[3, 8] .. [3, 11]]");
    };
    this.testDocumentHighlight(_function);
}
Also used : DocumentHighlightConfiguration(org.eclipse.xtext.testing.DocumentHighlightConfiguration) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Test(org.junit.Test) AbstractTestLangLanguageServerTest(org.eclipse.xtext.ide.tests.server.AbstractTestLangLanguageServerTest)

Example 3 with DocumentHighlightConfiguration

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

the class DocumentHighlightTest method singleLineMultipleOccurrences_SelectionOnWriteSite.

@Test
public void singleLineMultipleOccurrences_SelectionOnWriteSite() {
    final Procedure1<DocumentHighlightConfiguration> _function = (DocumentHighlightConfiguration it) -> {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("type A { op foo() { } op bar() { foo(10) } }");
        it.setModel(_builder.toString());
        it.setLine(0);
        StringConcatenation _builder_1 = new StringConcatenation();
        _builder_1.append("type A { op fo");
        it.setColumn(_builder_1.length());
        it.setExpectedDocumentHighlight("W [[0, 12] .. [0, 15]] | R [[0, 33] .. [0, 36]]");
    };
    this.testDocumentHighlight(_function);
}
Also used : DocumentHighlightConfiguration(org.eclipse.xtext.testing.DocumentHighlightConfiguration) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Test(org.junit.Test) AbstractTestLangLanguageServerTest(org.eclipse.xtext.ide.tests.server.AbstractTestLangLanguageServerTest)

Example 4 with DocumentHighlightConfiguration

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

the class DocumentHighlightTest method multipleLinesMultipleOccurrences_WithHorizontalTabs.

@Test
public void multipleLinesMultipleOccurrences_WithHorizontalTabs() {
    final Procedure1<DocumentHighlightConfiguration> _function = (DocumentHighlightConfiguration it) -> {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("type A {");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("op foo() { }");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("op bar() {");
        _builder.newLine();
        _builder.append("\t\t");
        _builder.append("foo(10)");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("}");
        _builder.newLine();
        _builder.append("}");
        it.setModel(_builder.toString());
        it.setLine(1);
        StringConcatenation _builder_1 = new StringConcatenation();
        _builder_1.append("\t");
        _builder_1.append("op fo");
        it.setColumn(_builder_1.length());
        it.setExpectedDocumentHighlight("W [[1, 4] .. [1, 7]] | R [[3, 2] .. [3, 5]]");
    };
    this.testDocumentHighlight(_function);
}
Also used : DocumentHighlightConfiguration(org.eclipse.xtext.testing.DocumentHighlightConfiguration) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Test(org.junit.Test) AbstractTestLangLanguageServerTest(org.eclipse.xtext.ide.tests.server.AbstractTestLangLanguageServerTest)

Example 5 with DocumentHighlightConfiguration

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

the class DocumentHighlightTest method singleLineSingleOccurrenceWithMultipleTypes.

@Test
public void singleLineSingleOccurrenceWithMultipleTypes() {
    final Procedure1<DocumentHighlightConfiguration> _function = (DocumentHighlightConfiguration it) -> {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("type A { op foo() { } } type B { op foo() { } }");
        it.setModel(_builder.toString());
        StringConcatenation _builder_1 = new StringConcatenation();
        _builder_1.append("type A { op fo");
        it.setColumn(_builder_1.length());
        it.setExpectedDocumentHighlight("W [[0, 12] .. [0, 15]]");
    };
    this.testDocumentHighlight(_function);
}
Also used : DocumentHighlightConfiguration(org.eclipse.xtext.testing.DocumentHighlightConfiguration) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Test(org.junit.Test) AbstractTestLangLanguageServerTest(org.eclipse.xtext.ide.tests.server.AbstractTestLangLanguageServerTest)

Aggregations

StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)10 DocumentHighlightConfiguration (org.eclipse.xtext.testing.DocumentHighlightConfiguration)10 AbstractTestLangLanguageServerTest (org.eclipse.xtext.ide.tests.server.AbstractTestLangLanguageServerTest)9 Test (org.junit.Test)9 List (java.util.List)1 CompletionList (org.eclipse.lsp4j.CompletionList)1 DocumentHighlight (org.eclipse.lsp4j.DocumentHighlight)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