-
Notifications
You must be signed in to change notification settings - Fork 511
/
Copy pathExamples.ts
25 lines (21 loc) · 910 Bytes
/
Examples.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import path = require("path");
import utils = require("../utils")
import vscode = require("vscode");
export class ExamplesFeature implements vscode.Disposable {
private command: vscode.Disposable;
private examplesPath: vscode.Uri;
constructor() {
this.examplesPath = vscode.Uri.file(path.resolve(__dirname, "../examples"));
this.command = vscode.commands.registerCommand("PowerShell.OpenExamplesFolder", async () => {
await vscode.commands.executeCommand("vscode.openFolder", this.examplesPath, true);
// Return existence of the path for testing. The `vscode.openFolder`
// command should do this, but doesn't (yet).
return utils.checkIfFileExists(this.examplesPath);
});
}
public dispose(): void {
this.command.dispose();
}
}