Skip to content

Do not suggest implicit activation message when engine does not support it #251898

@cschot

Description

@cschot

When targeting versions prior than 1.75 and activationEvents contains events that implicitly activate the extension, like onCommand

/* 
 * package.json: 
 */

{
	/* ... */
	"engines": {
		"vscode": "^1.74.0"
	},
	"activationEvents": [
		"onCommand:x.a",
		"onCommand:x.b",
		"onCommand:x.c",
		"onCommand:x.d",
		"onCommand:x.e"
	],
	/* ... */
}

the problems panel shows:
This activation event can be removed for extensions targeting engine version ^1.75 as VS Code will generate these automatically from your package.json contribution declarations.
for every such event.

Image

This is unnecessarily annoying. I hope this can be fixed by someone as a good first issue Issues identified as good for first-time contributors
This message is pushed by this code:

const bumpEngineForImplicitActivationEvents = l10n.t("This activation event can be removed for extensions targeting engine version ^1.75 as VS Code will generate these automatically from your package.json contribution declarations.");

if (info.implicitActivationEvents?.has(activationEvent) && redundantImplicitActivationEventPrefixes.some((prefix) => activationEvent.startsWith(prefix))) {
const start = document.positionAt(activationEventNode.offset);
const end = document.positionAt(activationEventNode.offset + activationEventNode.length);
const message = isImplicitActivationSupported ? redundantImplicitActivationEvent : bumpEngineForImplicitActivationEvents;
diagnostics.push(new Diagnostic(new Range(start, end), message, isImplicitActivationSupported ? DiagnosticSeverity.Warning : DiagnosticSeverity.Information));
}

Also it looks like the source code does not suppress this message for versions 2.0.0<=>2.74.x

I noticed the source code of this builtin extension extension-editing does not contain any *.test.js files.
Are these tests available somewhere else? Or is this extension currently not tested?

Metadata

Metadata

Assignees

Labels

extension-activationIssues related to extension activationfeature-requestRequest for new features or functionalitygood first issueIssues identified as good for first-time contributors

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions