Search in sources :

Example 1 with DocumentHighlightParams

use of org.eclipse.lsp4j.DocumentHighlightParams in project xtext-core by eclipse.

the class AbstractLanguageServerTest method testDocumentHighlight.

protected void testDocumentHighlight(final Procedure1<? super DocumentHighlightConfiguration> configurator) {
    try {
        DocumentHighlightConfiguration _documentHighlightConfiguration = new DocumentHighlightConfiguration();
        final Procedure1<DocumentHighlightConfiguration> _function = (DocumentHighlightConfiguration it) -> {
            StringConcatenation _builder = new StringConcatenation();
            _builder.append("MyModel.");
            _builder.append(this.fileExtension);
            it.setFilePath(_builder.toString());
        };
        @Extension final DocumentHighlightConfiguration configuration = ObjectExtensions.<DocumentHighlightConfiguration>operator_doubleArrow(_documentHighlightConfiguration, _function);
        configurator.apply(configuration);
        final String fileUri = this.initializeContext(configuration).getUri();
        DocumentHighlightParams _documentHighlightParams = new DocumentHighlightParams();
        final Procedure1<DocumentHighlightParams> _function_1 = (DocumentHighlightParams it) -> {
            TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(fileUri);
            it.setTextDocument(_textDocumentIdentifier);
            int _line = configuration.getLine();
            int _column = configuration.getColumn();
            Position _position = new Position(_line, _column);
            it.setPosition(_position);
        };
        DocumentHighlightParams _doubleArrow = ObjectExtensions.<DocumentHighlightParams>operator_doubleArrow(_documentHighlightParams, _function_1);
        final CompletableFuture<List<? extends DocumentHighlight>> highlights = this.languageServer.documentHighlight(_doubleArrow);
        final Function1<DocumentHighlight, String> _function_2 = (DocumentHighlight it) -> {
            return this.toExpectation(it);
        };
        final String actualDocumentHighlight = IterableExtensions.join(ListExtensions.map(highlights.get(), _function_2), " | ");
        this.assertEquals(configuration.getExpectedDocumentHighlight(), actualDocumentHighlight);
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : DocumentHighlight(org.eclipse.lsp4j.DocumentHighlight) VersionedTextDocumentIdentifier(org.eclipse.lsp4j.VersionedTextDocumentIdentifier) TextDocumentIdentifier(org.eclipse.lsp4j.TextDocumentIdentifier) Position(org.eclipse.lsp4j.Position) Extension(org.eclipse.xtext.xbase.lib.Extension) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) DocumentHighlightParams(org.eclipse.lsp4j.DocumentHighlightParams) List(java.util.List) CompletionList(org.eclipse.lsp4j.CompletionList)

Aggregations

List (java.util.List)1 CompletionList (org.eclipse.lsp4j.CompletionList)1 DocumentHighlight (org.eclipse.lsp4j.DocumentHighlight)1 DocumentHighlightParams (org.eclipse.lsp4j.DocumentHighlightParams)1 Position (org.eclipse.lsp4j.Position)1 TextDocumentIdentifier (org.eclipse.lsp4j.TextDocumentIdentifier)1 VersionedTextDocumentIdentifier (org.eclipse.lsp4j.VersionedTextDocumentIdentifier)1 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)1 Extension (org.eclipse.xtext.xbase.lib.Extension)1