-
Notifications
You must be signed in to change notification settings - Fork 511
/
Copy pathsettings.ts
93 lines (80 loc) · 3.19 KB
/
settings.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
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*---------------------------------------------------------
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
'use strict';
import vscode = require('vscode');
export interface ICodeFormattingSettings {
openBraceOnSameLine: boolean;
newLineAfterOpenBrace: boolean;
newLineAfterCloseBrace: boolean;
whitespaceBeforeOpenBrace: boolean;
whitespaceBeforeOpenParen: boolean;
whitespaceAroundOperator: boolean;
whitespaceAfterSeparator: boolean;
ignoreOneLineBlock: boolean;
alignPropertyValuePairs: boolean;
}
export interface IScriptAnalysisSettings {
enable?: boolean;
settingsPath: string;
}
export interface IDeveloperSettings {
featureFlags?: string[];
powerShellExePath?: string;
bundledModulesPath?: string;
editorServicesLogLevel?: string;
editorServicesWaitForDebugger?: boolean;
powerShellExeIsWindowsDevBuild?: boolean;
}
export interface ISettings {
startAutomatically?: boolean;
useX86Host?: boolean;
enableProfileLoading?: boolean;
scriptAnalysis?: IScriptAnalysisSettings;
developer?: IDeveloperSettings;
codeFormatting?: ICodeFormattingSettings;
integratedConsole?: IIntegratedConsoleSettings;
}
export interface IIntegratedConsoleSettings {
showOnStartup?: boolean;
focusConsoleOnExecute?: boolean;
}
export function load(myPluginId: string): ISettings {
let configuration: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration(myPluginId);
let defaultScriptAnalysisSettings: IScriptAnalysisSettings = {
enable: true,
settingsPath: ""
};
let defaultDeveloperSettings: IDeveloperSettings = {
featureFlags: [],
powerShellExePath: undefined,
bundledModulesPath: undefined,
editorServicesLogLevel: "Normal",
editorServicesWaitForDebugger: false,
powerShellExeIsWindowsDevBuild: false
};
let defaultCodeFormattingSettings: ICodeFormattingSettings = {
openBraceOnSameLine: true,
newLineAfterOpenBrace: true,
newLineAfterCloseBrace: true,
whitespaceBeforeOpenBrace: true,
whitespaceBeforeOpenParen: true,
whitespaceAroundOperator: true,
whitespaceAfterSeparator: true,
ignoreOneLineBlock: true,
alignPropertyValuePairs: true
};
let defaultIntegratedConsoleSettings: IIntegratedConsoleSettings = {
showOnStartup: true,
focusConsoleOnExecute: true
};
return {
startAutomatically: configuration.get<boolean>("startAutomatically", true),
useX86Host: configuration.get<boolean>("useX86Host", false),
enableProfileLoading: configuration.get<boolean>("enableProfileLoading", false),
scriptAnalysis: configuration.get<IScriptAnalysisSettings>("scriptAnalysis", defaultScriptAnalysisSettings),
developer: configuration.get<IDeveloperSettings>("developer", defaultDeveloperSettings),
codeFormatting: configuration.get<ICodeFormattingSettings>("codeFormatting", defaultCodeFormattingSettings),
integratedConsole: configuration.get<IIntegratedConsoleSettings>("integratedConsole", defaultIntegratedConsoleSettings)
};
}