forked from PowerShell/vscode-powershell
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsettings.ts
77 lines (66 loc) · 2.57 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
/*---------------------------------------------------------
* 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;
}
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 {
useX86Host?: boolean;
enableProfileLoading?: boolean;
scriptAnalysis?: IScriptAnalysisSettings;
developer?: IDeveloperSettings;
codeFormatting?: ICodeFormattingSettings;
}
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
};
return {
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)
};
}