Skip to content

Commit 5d94be3

Browse files
authored
Make fs-methods on IHostUtils optional and handle that accordingly (microsoft#186709)
fixes microsoft#184446
1 parent 032b14c commit 5d94be3

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

src/vs/workbench/api/common/extHostExtensionService.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ export interface IHostUtils {
6262
readonly _serviceBrand: undefined;
6363
readonly pid: number | undefined;
6464
exit(code: number): void;
65-
exists(path: string): Promise<boolean>;
66-
realpath(path: string): Promise<string>;
65+
fsExists?(path: string): Promise<boolean>;
66+
fsRealpath?(path: string): Promise<string>;
6767
}
6868

6969
type TelemetryActivationEventFragment = {
@@ -325,11 +325,11 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme
325325
* Applies realpath to file-uris and returns all others uris unmodified
326326
*/
327327
private async _realPathExtensionUri(uri: URI): Promise<URI> {
328-
if (uri.scheme !== Schemas.file) {
329-
return uri;
328+
if (uri.scheme === Schemas.file && this._hostUtils.fsRealpath) {
329+
const realpathValue = await this._hostUtils.fsRealpath(uri.fsPath);
330+
return URI.file(realpathValue);
330331
}
331-
const realpathValue = await this._hostUtils.realpath(uri.fsPath);
332-
return URI.file(realpathValue);
332+
return uri;
333333
}
334334

335335
// create trie to enable fast 'filename -> extension id' look up
@@ -683,8 +683,8 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme
683683
const host: IExtensionActivationHost = {
684684
logService: this._logService,
685685
folders: folders.map(folder => folder.uri),
686-
forceUsingSearch: localWithRemote,
687-
exists: (uri) => this._hostUtils.exists(uri.fsPath),
686+
forceUsingSearch: localWithRemote || !this._hostUtils.fsExists,
687+
exists: (uri) => this._hostUtils.fsExists!(uri.fsPath),
688688
checkExists: (folders, includes, token) => this._mainThreadWorkspaceProxy.$checkExists(folders, includes, token)
689689
};
690690

src/vs/workbench/api/node/extensionHostProcess.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,8 @@ async function startExtensionHostProcess(): Promise<void> {
382382
declare readonly _serviceBrand: undefined;
383383
public readonly pid = process.pid;
384384
exit(code: number) { nativeExit(code); }
385-
exists(path: string) { return Promises.exists(path); }
386-
realpath(path: string) { return realpath(path); }
385+
fsExists(path: string) { return Promises.exists(path); }
386+
fsRealpath(path: string) { return realpath(path); }
387387
};
388388

389389
// Attempt to load uri transformer

src/vs/workbench/api/worker/extensionHostWorker.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,6 @@ const hostUtil = new class implements IHostUtils {
159159
exit(_code?: number | undefined): void {
160160
nativeClose();
161161
}
162-
async exists(_path: string): Promise<boolean> {
163-
return true;
164-
}
165-
async realpath(path: string): Promise<string> {
166-
return path;
167-
}
168162
};
169163

170164

0 commit comments

Comments
 (0)