org.eclipse.lsp4j.FoldingRangeRequestParams Java Examples

The following examples show how to use org.eclipse.lsp4j.FoldingRangeRequestParams. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XMLTextDocumentService.java    From lemminx with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public CompletableFuture<List<FoldingRange>> foldingRange(FoldingRangeRequestParams params) {
	return computeDOMAsync(params.getTextDocument(), (cancelChecker, xmlDocument) -> {
		return getXMLLanguageService().getFoldingRanges(xmlDocument, sharedSettings.getFoldingSettings(),
				cancelChecker);
	});
}
 
Example #2
Source File: JDTLanguageServer.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public CompletableFuture<List<FoldingRange>> foldingRange(FoldingRangeRequestParams params) {
	logInfo(">> document/foldingRange");
	return computeAsyncWithClientProgress((monitor) -> {
		waitForLifecycleJobs(monitor);
		return new FoldingRangeHandler().foldingRange(params, monitor);
	});
}
 
Example #3
Source File: FoldingRangeHandler.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
public List<FoldingRange> foldingRange(FoldingRangeRequestParams params, IProgressMonitor monitor) {
	List<FoldingRange> $ = new ArrayList<>();
	ITypeRoot unit = JDTUtils.resolveTypeRoot(params.getTextDocument().getUri());
	if (unit == null) {
		return $;
	}
	computeFoldingRanges($, unit, monitor);
	return $;
}
 
Example #4
Source File: SyntaxLanguageServer.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public CompletableFuture<List<FoldingRange>> foldingRange(FoldingRangeRequestParams params) {
	logInfo(">> document/foldingRange");
	return computeAsync((monitor) -> {
		waitForLifecycleJobs(monitor);
		return new FoldingRangeHandler().foldingRange(params, monitor);
	});
}
 
Example #5
Source File: FoldingRangeHandlerTest.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
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);
}
 
Example #6
Source File: TextDocumentService.java    From lsp4j with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * The folding range request is sent from the client to the server to return all folding
 * ranges found in a given text document.
 * 
 * Since version 3.10.0
 */
@JsonRequest
default CompletableFuture<List<FoldingRange>> foldingRange(FoldingRangeRequestParams params) {
	throw new UnsupportedOperationException();
}