(context: vscode.ExtensionContext)
| 13 | import {shouldRestartOnConfigurationChange} from './config_change'; |
| 14 | |
| 15 | export function activate(context: vscode.ExtensionContext) { |
| 16 | const client = new AngularLanguageClient(context); |
| 17 | context.subscriptions.push(client); |
| 18 | |
| 19 | const startServer = async () => { |
| 20 | registerCommands(client, context); |
| 21 | |
| 22 | // Restart the server on configuration changes that affect startup/session state. |
| 23 | const disposable = vscode.workspace.onDidChangeConfiguration( |
| 24 | async (e: vscode.ConfigurationChangeEvent) => { |
| 25 | if (!shouldRestartOnConfigurationChange(e)) { |
| 26 | return; |
| 27 | } |
| 28 | await client.stop(); |
| 29 | await client.start(); |
| 30 | }, |
| 31 | ); |
| 32 | context.subscriptions.push(disposable); |
| 33 | |
| 34 | await client.start(); |
| 35 | }; |
| 36 | |
| 37 | // If the workspace is untrusted, operate in limited mode: |
| 38 | // Do NOT start the language server or register commands. |
| 39 | if (!vscode.workspace.isTrusted) { |
| 40 | const trustDisposable = vscode.workspace.onDidGrantWorkspaceTrust(async () => { |
| 41 | await startServer(); |
| 42 | }); |
| 43 | context.subscriptions.push(trustDisposable); |
| 44 | return; |
| 45 | } |
| 46 | |
| 47 | startServer(); |
| 48 | } |
nothing calls this directly
no test coverage detected