xref: /llvm-project/mlir/utils/vscode/src/config.ts (revision dc9fb65c4ffedc983c29bb0cddebf6fc4e9146e6)
1import * as vscode from 'vscode';
2
3/**
4 *  Gets the config value `mlir.<key>`, with an optional workspace folder.
5 */
6export function get<T>(key: string,
7                       workspaceFolder: vscode.WorkspaceFolder = null,
8                       defaultValue: T = undefined): T {
9  return vscode.workspace.getConfiguration('mlir', workspaceFolder)
10      .get<T>(key, defaultValue);
11}
12
13/**
14 *  Sets the config value `mlir.<key>`.
15 */
16export function update<T>(key: string, value: T,
17                          target?: vscode.ConfigurationTarget) {
18  return vscode.workspace.getConfiguration('mlir').update(key, value, target);
19}
20