Skip to content

Commit 1f0f202

Browse files
NEW: @W-18088088@: Add warning if using v4 still (#197)
1 parent b11dc57 commit 1f0f202

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

src/extension.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,20 @@ export async function activate(context: vscode.ExtensionContext): Promise<SFCAEx
330330
// =================================================================================================================
331331
// == Finalize activation
332332
// =================================================================================================================
333+
334+
if(!settingsManager.getCodeAnalyzerV5Enabled()) {
335+
const button1Text: string = "Enable V5";
336+
const button2Text: string = "Show 'EnableV5' in Settings";
337+
vscode.window.showWarningMessage(messages.stoppingV4SupportSoon, button1Text, button2Text).then(selection => {
338+
if (selection === button1Text) {
339+
settingsManager.setCodeAnalyzerV5Enabled(true);
340+
} else if (selection === button2Text) {
341+
const settingUri = vscode.Uri.parse('vscode://settings/codeAnalyzer.enableV5');
342+
vscode.commands.executeCommand('vscode.open', settingUri);
343+
}
344+
});
345+
}
346+
333347
telemetryService.sendExtensionActivationEvent(extensionHrStart);
334348
logger.log('Extension sfdx-code-analyzer-vscode activated.');
335349
return {

src/lib/messages.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
77
export const messages = {
8+
stoppingV4SupportSoon: "We plan to stop supporting v4.x of Code Analyzer in the coming months. We highly recommend that you start using v5.x, which is currently in Beta, by setting 'Code Analyzer: Enable V5' to true. For information on v5.x, see https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/code-analyzer.html.",
89
scanProgressReport: {
910
identifyingTargets: {
1011
message: "Code Analyzer is identifying targets.",

src/lib/settings.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ export class SettingsManagerImpl implements SettingsManager {
4141
return vscode.workspace.getConfiguration('codeAnalyzer').get('enableV5');
4242
}
4343

44+
public setCodeAnalyzerV5Enabled(value: boolean): void {
45+
vscode.workspace.getConfiguration('codeAnalyzer').update('enableV5', value, vscode.ConfigurationTarget.Global);
46+
}
47+
4448
public getCodeAnalyzerTags(): string {
4549
return vscode.workspace.getConfiguration('codeAnalyzer').get('ruleSelectors');
4650
}

0 commit comments

Comments
 (0)