UNPKG

1.86 kBTypeScriptView Raw
1import { Disposable, TextDocument, ProviderResult, Range as VRange, Position as VPosition, WorkspaceEdit as VWorkspaceEdit, RenameProvider } from 'vscode';
2import { ClientCapabilities, CancellationToken, ServerCapabilities, DocumentSelector, RenameOptions, RenameRegistrationOptions } from 'vscode-languageserver-protocol';
3import { TextDocumentLanguageFeature, FeatureClient, DocumentSelectorOptions } from './features';
4export interface ProvideRenameEditsSignature {
5 (this: void, document: TextDocument, position: VPosition, newName: string, token: CancellationToken): ProviderResult<VWorkspaceEdit>;
6}
7export interface PrepareRenameSignature {
8 (this: void, document: TextDocument, position: VPosition, token: CancellationToken): ProviderResult<VRange | {
9 range: VRange;
10 placeholder: string;
11 }>;
12}
13export interface RenameMiddleware {
14 provideRenameEdits?: (this: void, document: TextDocument, position: VPosition, newName: string, token: CancellationToken, next: ProvideRenameEditsSignature) => ProviderResult<VWorkspaceEdit>;
15 prepareRename?: (this: void, document: TextDocument, position: VPosition, token: CancellationToken, next: PrepareRenameSignature) => ProviderResult<VRange | {
16 range: VRange;
17 placeholder: string;
18 }>;
19}
20export declare class RenameFeature extends TextDocumentLanguageFeature<boolean | RenameOptions, RenameRegistrationOptions, RenameProvider, RenameMiddleware> {
21 constructor(client: FeatureClient<RenameMiddleware>);
22 fillClientCapabilities(capabilities: ClientCapabilities): void;
23 initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void;
24 protected registerLanguageProvider(options: RenameRegistrationOptions & DocumentSelectorOptions): [Disposable, RenameProvider];
25 private registerProvider;
26 private isDefaultBehavior;
27}