@@ -28,6 +28,7 @@ import { ExtHostContext, ExtHostWorkspaceShape, ITextSearchComplete, IWorkspaceD
2828import { IEditSessionIdentityService } from 'vs/platform/workspace/common/editSessions' ;
2929import { EditorResourceAccessor , SaveReason , SideBySideEditor } from 'vs/workbench/common/editor' ;
3030import { coalesce , firstOrDefault } from 'vs/base/common/arrays' ;
31+ import { ICanonicalUriIdentityService } from 'vs/platform/workspace/common/canonicalUriIdentity' ;
3132
3233@extHostNamedCustomer ( MainContext . MainThreadWorkspace )
3334export class MainThreadWorkspace implements MainThreadWorkspaceShape {
@@ -42,6 +43,7 @@ export class MainThreadWorkspace implements MainThreadWorkspaceShape {
4243 @ISearchService private readonly _searchService : ISearchService ,
4344 @IWorkspaceContextService private readonly _contextService : IWorkspaceContextService ,
4445 @IEditSessionIdentityService private readonly _editSessionIdentityService : IEditSessionIdentityService ,
46+ @ICanonicalUriIdentityService private readonly _canonicalUriIdentityService : ICanonicalUriIdentityService ,
4547 @IEditorService private readonly _editorService : IEditorService ,
4648 @IWorkspaceEditingService private readonly _workspaceEditingService : IWorkspaceEditingService ,
4749 @INotificationService private readonly _notificationService : INotificationService ,
@@ -269,4 +271,29 @@ export class MainThreadWorkspace implements MainThreadWorkspaceShape {
269271 disposable ?. dispose ( ) ;
270272 this . registeredEditSessionProviders . delete ( handle ) ;
271273 }
274+
275+ // --- canonical uri identities ---
276+ private registeredCanonicalUriIdentityProviders = new Map < number , IDisposable > ( ) ;
277+
278+ $registerCanonicalUriIdentityProvider ( handle : number , scheme : string ) {
279+ const disposable = this . _canonicalUriIdentityService . registerCanonicalUriIdentityProvider ( {
280+ scheme : scheme ,
281+ provideCanonicalUriIdentity : async ( uri : UriComponents , token : CancellationToken ) => {
282+ const result = await this . _proxy . $provideCanonicalUriIdentity ( uri , token ) ;
283+ if ( result ) {
284+ return URI . revive ( result ) ;
285+ }
286+ return result ;
287+ }
288+ } ) ;
289+
290+ this . registeredCanonicalUriIdentityProviders . set ( handle , disposable ) ;
291+ this . _toDispose . add ( disposable ) ;
292+ }
293+
294+ $unregisterCanonicalUriIdentityProvider ( handle : number ) {
295+ const disposable = this . registeredCanonicalUriIdentityProviders . get ( handle ) ;
296+ disposable ?. dispose ( ) ;
297+ this . registeredCanonicalUriIdentityProviders . delete ( handle ) ;
298+ }
272299}
0 commit comments