forked from salesforce/salesforcedx-vscode-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextension.ts
More file actions
61 lines (52 loc) · 2.14 KB
/
extension.ts
File metadata and controls
61 lines (52 loc) · 2.14 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
56
57
58
59
60
61
/*
* Copyright (c) 2023, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: MIT
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import * as vscode from 'vscode';
import * as onboardingWizard from './commands/wizard/onboardingWizard';
import * as configureLintingToolsCommand from './commands/lint/configureLintingToolsCommand';
import * as settingsCommand from './commands/settings/settings';
import { CoreExtensionService } from './services/CoreExtensionService';
import { WorkspaceUtils } from './utils/workspaceUtils';
import * as lspClient from './lsp/client/client';
import {
SECTION_DIAGNOSTICS,
getUpdateDiagnosticsSettingCommand
} from './commands/settings/settings';
export function activate(context: vscode.ExtensionContext) {
// We need to do this first in case any other services need access to those provided by the core extension
try {
CoreExtensionService.loadDependencies(context);
} catch (err) {
console.error(err);
vscode.window.showErrorMessage(
vscode.l10n.t(
'Failed to activate the extension! Could not load required services from the Salesforce Extension Pack: {0}',
(err as Error).message
)
);
return;
}
vscode.commands.executeCommand(
'setContext',
'sfdx_project_opened',
WorkspaceUtils.isSfdxProjectOpened()
);
onboardingWizard.registerCommand(context);
onboardingWizard.onActivate(context);
settingsCommand.registerCommand(context);
configureLintingToolsCommand.registerCommand(context);
const command = getUpdateDiagnosticsSettingCommand(context);
// Enable LSP only if opened workspace is a sfdx project.
if (WorkspaceUtils.isSfdxProjectOpened()) {
lspClient.activate(context, command, SECTION_DIAGNOSTICS);
}
}
// This method is called when your extension is deactivated
export function deactivate() {
lspClient.deactivate();
}