forked from mrsone40/.github-workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvscodeapi.ts
More file actions
43 lines (35 loc) · 1.34 KB
/
vscodeapi.ts
File metadata and controls
43 lines (35 loc) · 1.34 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
/* eslint-disable @typescript-eslint/no-explicit-any */
import {
commands,
ConfigurationScope,
Disposable,
LogOutputChannel,
Uri,
window,
workspace,
WorkspaceConfiguration,
WorkspaceFolder,
} from 'vscode';
export function createOutputChannel(name: string): LogOutputChannel {
return window.createOutputChannel(name, { log: true });
}
export function getConfiguration(config: string, scope?: ConfigurationScope): WorkspaceConfiguration {
return workspace.getConfiguration(config, scope);
}
export function registerCommand(command: string, callback: (...args: any[]) => any, thisArg?: any): Disposable {
return commands.registerCommand(command, callback, thisArg);
}
export const { onDidChangeConfiguration } = workspace;
export function isVirtualWorkspace(): boolean {
const isVirtual = workspace.workspaceFolders && workspace.workspaceFolders.every((f) => f.uri.scheme !== 'file');
return !!isVirtual;
}
export function getWorkspaceFolders(): readonly WorkspaceFolder[] {
return workspace.workspaceFolders ?? [];
}
export function getWorkspaceFolder(uri: Uri): WorkspaceFolder | undefined {
return workspace.getWorkspaceFolder(uri);
}