Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vscode] Stub for proposed API: EditSessionIdentityProvider #12508

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/plugin-ext/src/common/plugin-api-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,7 @@ export interface WorkspaceExt {
$provideTextDocumentContent(uri: string): Promise<string | undefined | null>;
$onTextSearchResult(searchRequestId: number, done: boolean, result?: SearchInWorkspaceResult): void;
$onWorkspaceTrustChanged(trust: boolean | undefined): void;
$registerEditSessionIdentityProvider(scheme: string, provider: theia.EditSessionIdentityProvider): theia.Disposable
}

export interface TimelineExt {
Expand Down
3 changes: 3 additions & 0 deletions packages/plugin-ext/src/plugin/plugin-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,9 @@ export function createAPIFactory(
},
get onDidGrantWorkspaceTrust(): theia.Event<void> {
return workspaceExt.onDidGrantWorkspaceTrust;
},
registerEditSessionIdentityProvider(scheme: string, provider: theia.EditSessionIdentityProvider) {
return workspaceExt.$registerEditSessionIdentityProvider(scheme, provider);
}
};

Expand Down
7 changes: 6 additions & 1 deletion packages/plugin-ext/src/plugin/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { Path } from '@theia/core/lib/common/path';
import { RPCProtocol } from '../common/rpc-protocol';
import { WorkspaceRootsChangeEvent, SearchInWorkspaceResult, Range } from '../common/plugin-api-rpc-model';
import { EditorsAndDocumentsExtImpl } from './editors-and-documents';
import { URI } from './types-impl';
import { Disposable, URI } from './types-impl';
import { normalize } from '@theia/core/lib/common/paths';
import { relative } from '../common/paths-util';
import { Schemes } from '../common/uri-components';
Expand Down Expand Up @@ -449,4 +449,9 @@ export class WorkspaceExtImpl implements WorkspaceExt {
}
}

/** @stubbed */
$registerEditSessionIdentityProvider(scheme: string, provider: theia.EditSessionIdentityProvider): theia.Disposable {
return Disposable.NULL;
}

}
23 changes: 23 additions & 0 deletions packages/plugin/src/theia-proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,29 @@ export module '@theia/plugin' {
}

// #endregion

// #region SessionIdentityProvider
export namespace workspace {
/**
*
* @param scheme The URI scheme that this provider can provide edit session identities for.
* @param provider A provider which can convert URIs for workspace folders of scheme @param scheme to
* an edit session identifier which is stable across machines. This enables edit sessions to be resolved.
*/
export function registerEditSessionIdentityProvider(scheme: string, provider: EditSessionIdentityProvider): Disposable;
}

export interface EditSessionIdentityProvider {
/**
*
* @param workspaceFolder The workspace folder to provide an edit session identity for.
* @param token A cancellation token for the request.
* @returns An string representing the edit session identity for the requested workspace folder.
*/
provideEditSessionIdentity(workspaceFolder: WorkspaceFolder, token: CancellationToken): ProviderResult<string>;
}

// #endregion
}

/**
Expand Down