This repository was archived by the owner on Nov 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsettings.ts
More file actions
55 lines (46 loc) · 2.15 KB
/
settings.ts
File metadata and controls
55 lines (46 loc) · 2.15 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
44
45
46
47
48
49
50
51
52
53
54
55
import vscode = require("vscode");
export let PowerShellLanguageId = "powerShellUniversal";
export interface ISettings {
appToken: string;
url: string;
localEditing: boolean;
checkModules: boolean;
connections: IConnection[];
}
export interface IConnection {
name: string;
appToken?: string | null;
url: string;
allowInvalidCertificate?: boolean;
windowsAuth?: boolean;
}
export function load(): ISettings {
const configuration: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration(PowerShellLanguageId);
return {
appToken: configuration.get<string>("appToken", ""),
url: configuration.get<string>("url", "http://localhost:5000"),
localEditing: configuration.get<boolean>("localEditing", false),
checkModules: configuration.get<boolean>("checkModules", false),
connections: configuration.get<IConnection[]>("connections", []),
};
}
export async function SetAppToken(value: string) {
const configuration: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration(PowerShellLanguageId);
await configuration.update("appToken", value, vscode.ConfigurationTarget.Global);
}
export async function SetServerPath(value: string) {
const configuration: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration(PowerShellLanguageId);
await configuration.update("serverPath", value, vscode.ConfigurationTarget.Global);
}
export async function SetUrl(value: string) {
const configuration: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration(PowerShellLanguageId);
await configuration.update("url", value, vscode.ConfigurationTarget.Global);
}
export async function SetPort(value: number) {
const configuration: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration(PowerShellLanguageId);
await configuration.update("port", value, vscode.ConfigurationTarget.Global);
}
export async function SetCheckModules(value: boolean) {
const configuration: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration(PowerShellLanguageId);
await configuration.update("checkModules", value, vscode.ConfigurationTarget.Global);
}