Search in sources :

Example 1 with FoldingRangeRequestParams

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

the class AbstractLanguageServerTest method testFolding.

/**
 * @since 2.26
 */
protected void testFolding(final Procedure1<? super FoldingConfiguration> configurator) {
    try {
        @Extension final FoldingConfiguration configuration = new FoldingConfiguration();
        configuration.setFilePath(("MyModel." + this.fileExtension));
        configurator.apply(configuration);
        final FileInfo fileInfo = this.initializeContext(configuration);
        FoldingRangeRequestParams _foldingRangeRequestParams = new FoldingRangeRequestParams();
        final Procedure1<FoldingRangeRequestParams> _function = (FoldingRangeRequestParams it) -> {
            String _uri = fileInfo.getUri();
            TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(_uri);
            it.setTextDocument(_textDocumentIdentifier);
        };
        FoldingRangeRequestParams _doubleArrow = ObjectExtensions.<FoldingRangeRequestParams>operator_doubleArrow(_foldingRangeRequestParams, _function);
        final List<FoldingRange> foldings = this.languageServer.foldingRange(_doubleArrow).get();
        this.assertEqualsStricter(configuration.getExpectedFoldings(), this.toExpectation(foldings));
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : Extension(org.eclipse.xtext.xbase.lib.Extension) FoldingRangeRequestParams(org.eclipse.lsp4j.FoldingRangeRequestParams) VersionedTextDocumentIdentifier(org.eclipse.lsp4j.VersionedTextDocumentIdentifier) TextDocumentIdentifier(org.eclipse.lsp4j.TextDocumentIdentifier) FoldingRange(org.eclipse.lsp4j.FoldingRange)

Example 2 with FoldingRangeRequestParams

use of org.eclipse.lsp4j.FoldingRangeRequestParams in project eclipse.jdt.ls by eclipse.

the class FoldingRangeHandlerTest method getFoldingRanges.

private List<FoldingRange> getFoldingRanges(String className) throws CoreException {
    String uri = ClassFileUtil.getURI(project, className);
    TextDocumentIdentifier identifier = new TextDocumentIdentifier(uri);
    FoldingRangeRequestParams params = new FoldingRangeRequestParams();
    params.setTextDocument(identifier);
    return new FoldingRangeHandler().foldingRange(params, monitor);
}
Also used : FoldingRangeRequestParams(org.eclipse.lsp4j.FoldingRangeRequestParams) TextDocumentIdentifier(org.eclipse.lsp4j.TextDocumentIdentifier)

Aggregations

FoldingRangeRequestParams (org.eclipse.lsp4j.FoldingRangeRequestParams)2 TextDocumentIdentifier (org.eclipse.lsp4j.TextDocumentIdentifier)2 FoldingRange (org.eclipse.lsp4j.FoldingRange)1 VersionedTextDocumentIdentifier (org.eclipse.lsp4j.VersionedTextDocumentIdentifier)1 Extension (org.eclipse.xtext.xbase.lib.Extension)1