mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
Tolerate minor edit session identity differences (#163804)
Also add basic support for partial edit session identity matches
This commit is contained in:
@@ -231,6 +231,9 @@ export class MainThreadWorkspace implements MainThreadWorkspaceShape {
|
||||
scheme: scheme,
|
||||
getEditSessionIdentifier: async (workspaceFolder: WorkspaceFolder, token: CancellationToken) => {
|
||||
return this._proxy.$getEditSessionIdentifier(workspaceFolder.uri, token);
|
||||
},
|
||||
provideEditSessionIdentityMatch: async (workspaceFolder: WorkspaceFolder, identity1: string, identity2: string, token: CancellationToken) => {
|
||||
return this._proxy.$provideEditSessionIdentityMatch(workspaceFolder.uri, identity1, identity2, token);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ import { combinedDisposable } from 'vs/base/common/lifecycle';
|
||||
import { checkProposedApiEnabled, ExtensionIdentifierSet, isProposedApiEnabled } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { DebugConfigurationProviderTriggerKind } from 'vs/workbench/contrib/debug/common/debug';
|
||||
import { IExtHostLocalizationService } from 'vs/workbench/api/common/extHostLocalizationService';
|
||||
import { EditSessionIdentityMatch } from 'vs/platform/workspace/common/editSessions';
|
||||
|
||||
export interface IExtensionRegistries {
|
||||
mine: ExtensionDescriptionRegistry;
|
||||
@@ -1393,6 +1394,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
TabInputInteractiveWindow: extHostTypes.InteractiveWindowInput,
|
||||
TerminalExitReason: extHostTypes.TerminalExitReason,
|
||||
LogLevel: LogLevel,
|
||||
EditSessionIdentityMatch: EditSessionIdentityMatch
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@ import { ILanguageStatus } from 'vs/workbench/services/languageStatus/common/lan
|
||||
import { CandidatePort } from 'vs/workbench/services/remote/common/remoteExplorerService';
|
||||
import { ITextQueryBuilderOptions } from 'vs/workbench/services/search/common/queryBuilder';
|
||||
import * as search from 'vs/workbench/services/search/common/search';
|
||||
import { EditSessionIdentityMatch } from 'vs/platform/workspace/common/editSessions';
|
||||
|
||||
export interface IWorkspaceData extends IStaticWorkspaceData {
|
||||
folders: { uri: UriComponents; name: string; index: number }[];
|
||||
@@ -1421,6 +1422,7 @@ export interface ExtHostWorkspaceShape {
|
||||
$handleTextSearchResult(result: search.IRawFileMatch2, requestId: number): void;
|
||||
$onDidGrantWorkspaceTrust(): void;
|
||||
$getEditSessionIdentifier(folder: UriComponents, token: CancellationToken): Promise<string | undefined>;
|
||||
$provideEditSessionIdentityMatch(folder: UriComponents, identity1: string, identity2: string, token: CancellationToken): Promise<EditSessionIdentityMatch | undefined>;
|
||||
}
|
||||
|
||||
export interface ExtHostFileSystemInfoShape {
|
||||
|
||||
@@ -21,6 +21,7 @@ import { FileSystemProviderCapabilities } from 'vs/platform/files/common/files';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { Severity } from 'vs/platform/notification/common/notification';
|
||||
import { EditSessionIdentityMatch } from 'vs/platform/workspace/common/editSessions';
|
||||
import { Workspace, WorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||
import { IExtHostFileSystemInfo } from 'vs/workbench/api/common/extHostFileSystemInfo';
|
||||
import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService';
|
||||
@@ -627,6 +628,31 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
async $provideEditSessionIdentityMatch(workspaceFolder: UriComponents, identity1: string, identity2: string, cancellationToken: CancellationToken): Promise<EditSessionIdentityMatch | undefined> {
|
||||
this._logService.info('Getting edit session identifier for workspaceFolder', workspaceFolder);
|
||||
const folder = await this.resolveWorkspaceFolder(URI.revive(workspaceFolder));
|
||||
if (!folder) {
|
||||
this._logService.warn('Unable to resolve workspace folder');
|
||||
return undefined;
|
||||
}
|
||||
|
||||
this._logService.info('Invoking #provideEditSessionIdentity for workspaceFolder', folder);
|
||||
|
||||
const provider = this._editSessionIdentityProviders.get(folder.uri.scheme);
|
||||
this._logService.info(`Provider for scheme ${folder.uri.scheme} is defined: `, !!provider);
|
||||
if (!provider) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const result = await provider.provideEditSessionIdentityMatch?.(identity1, identity2, cancellationToken);
|
||||
this._logService.info('Provider returned edit session identifier match result: ', result);
|
||||
if (!result) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
export const IExtHostWorkspace = createDecorator<IExtHostWorkspace>('IExtHostWorkspace');
|
||||
|
||||
Reference in New Issue
Block a user