-
Notifications
You must be signed in to change notification settings - Fork 30.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add ExtHostFileSystemInfo which knows what schemes are reserved and w…
…hich are used, #91697
- Loading branch information
Showing
7 changed files
with
69 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { Schemas } from 'vs/base/common/network'; | ||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; | ||
import { ExtHostFileSystemInfoShape } from 'vs/workbench/api/common/extHost.protocol'; | ||
|
||
export class ExtHostFileSystemInfo implements ExtHostFileSystemInfoShape { | ||
|
||
declare readonly _serviceBrand: undefined; | ||
|
||
private readonly _systemSchemes = new Set(Object.keys(Schemas)); | ||
private readonly _providerInfo = new Map<string, number>(); | ||
|
||
$acceptProviderInfos(scheme: string, capabilities: number | null): void { | ||
if (capabilities === null) { | ||
this._providerInfo.delete(scheme); | ||
} else { | ||
this._providerInfo.set(scheme, capabilities); | ||
} | ||
} | ||
|
||
isFreeScheme(scheme: string): boolean { | ||
return !this._providerInfo.has(scheme) && !this._systemSchemes.has(scheme); | ||
} | ||
|
||
getCapabilities(scheme: string): number | undefined { | ||
return this._providerInfo.get(scheme); | ||
} | ||
} | ||
|
||
export interface IExtHostFileSystemInfo extends ExtHostFileSystemInfo { } | ||
export const IExtHostFileSystemInfo = createDecorator<IExtHostFileSystemInfo>('IExtHostFileSystemInfo'); |