(
context: vscode.ExtensionContext,
)
| 48 | ]; |
| 49 | |
| 50 | export async function activate( |
| 51 | context: vscode.ExtensionContext, |
| 52 | ): Promise<IPowerShellExtensionClient> { |
| 53 | logger = new Logger(); |
| 54 | if (context.extensionMode === vscode.ExtensionMode.Development) { |
| 55 | restartOnExtensionFileChanges(context); |
| 56 | } |
| 57 | |
| 58 | telemetryReporter = new TelemetryReporter(TELEMETRY_KEY); |
| 59 | |
| 60 | const settings = getSettings(); |
| 61 | logger.writeDebug( |
| 62 | `Loaded settings:\n${JSON.stringify(settings, undefined, 2)}`, |
| 63 | ); |
| 64 | |
| 65 | languageConfigurationDisposable = vscode.languages.setLanguageConfiguration( |
| 66 | PowerShellLanguageId, |
| 67 | { |
| 68 | // TODO: Remove the useless escapes |
| 69 | wordPattern: |
| 70 | // eslint-disable-next-line no-useless-escape |
| 71 | /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\=\+\[\{\]\}\\\|\;\'\"\,\.\<\>\/\?\s]+)/g, |
| 72 | |
| 73 | indentationRules: { |
| 74 | // ^(.*\*/)?\s*\}.*$ |
| 75 | decreaseIndentPattern: /^(.*\*\/)?\s*\}.*$/, |
| 76 | // ^.*\{[^}"']*$ |
| 77 | increaseIndentPattern: /^.*\{[^}"']*$/, |
| 78 | }, |
| 79 | |
| 80 | comments: { |
| 81 | lineComment: "#", |
| 82 | blockComment: ["<#", "#>"], |
| 83 | }, |
| 84 | |
| 85 | brackets: [ |
| 86 | ["{", "}"], |
| 87 | ["[", "]"], |
| 88 | ["(", ")"], |
| 89 | ], |
| 90 | |
| 91 | onEnterRules: [ |
| 92 | { |
| 93 | // e.g. /** | */ |
| 94 | // eslint-disable-next-line no-useless-escape |
| 95 | beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/, |
| 96 | afterText: /^\s*\*\/$/, |
| 97 | action: { |
| 98 | indentAction: vscode.IndentAction.IndentOutdent, |
| 99 | appendText: " * ", |
| 100 | }, |
| 101 | }, |
| 102 | { |
| 103 | // e.g. /** ...| |
| 104 | // eslint-disable-next-line no-useless-escape |
| 105 | beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/, |
| 106 | action: { |
| 107 | indentAction: vscode.IndentAction.None, |
nothing calls this directly
no test coverage detected