UNPKG

1.51 kBTypeScriptView Raw
1import { Disposable, TextDocument, ProviderResult, FoldingRange as VFoldingRange, FoldingContext, FoldingRangeProvider, EventEmitter } from 'vscode';
2import { ClientCapabilities, CancellationToken, ServerCapabilities, DocumentSelector, FoldingRangeRegistrationOptions, FoldingRangeOptions } from 'vscode-languageserver-protocol';
3import { TextDocumentLanguageFeature, FeatureClient } from './features';
4export interface ProvideFoldingRangeSignature {
5 (this: void, document: TextDocument, context: FoldingContext, token: CancellationToken): ProviderResult<VFoldingRange[]>;
6}
7export interface FoldingRangeProviderMiddleware {
8 provideFoldingRanges?: (this: void, document: TextDocument, context: FoldingContext, token: CancellationToken, next: ProvideFoldingRangeSignature) => ProviderResult<VFoldingRange[]>;
9}
10export type FoldingRangeProviderShape = {
11 provider: FoldingRangeProvider;
12 onDidChangeFoldingRange: EventEmitter<void>;
13};
14export declare class FoldingRangeFeature extends TextDocumentLanguageFeature<boolean | FoldingRangeOptions, FoldingRangeRegistrationOptions, FoldingRangeProviderShape, FoldingRangeProviderMiddleware> {
15 constructor(client: FeatureClient<FoldingRangeProviderMiddleware>);
16 fillClientCapabilities(capabilities: ClientCapabilities): void;
17 initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void;
18 protected registerLanguageProvider(options: FoldingRangeRegistrationOptions): [Disposable, FoldingRangeProviderShape];
19}