Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/contrib/files/electron-browser/fileCommands.ts
3296 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { URI } from '../../../../base/common/uri.js';
7
import { IWorkspaceContextService } from '../../../../platform/workspace/common/workspace.js';
8
import { sequence } from '../../../../base/common/async.js';
9
import { Schemas } from '../../../../base/common/network.js';
10
import { INativeHostService } from '../../../../platform/native/common/native.js';
11
12
// Commands
13
14
export function revealResourcesInOS(resources: URI[], nativeHostService: INativeHostService, workspaceContextService: IWorkspaceContextService): void {
15
if (resources.length) {
16
sequence(resources.map(r => async () => {
17
if (r.scheme === Schemas.file || r.scheme === Schemas.vscodeUserData) {
18
nativeHostService.showItemInFolder(r.with({ scheme: Schemas.file }).fsPath);
19
}
20
}));
21
} else if (workspaceContextService.getWorkspace().folders.length) {
22
const uri = workspaceContextService.getWorkspace().folders[0].uri;
23
if (uri.scheme === Schemas.file) {
24
nativeHostService.showItemInFolder(uri.fsPath);
25
}
26
}
27
}
28
29