mirror of
https://github.com/Microsoft/vscode
synced 2024-10-02 17:32:41 +00:00
Lint more redundant activation events (#173186)
* `onWalkthrough` * `onTerminalQuickFixRequest` * `onTerminalProfile` * `onRenderer`
This commit is contained in:
parent
8922a506d6
commit
b42443093a
|
@ -17,7 +17,7 @@ const allowedBadgeProviders: string[] = (product.extensionAllowedBadgeProviders
|
|||
const allowedBadgeProvidersRegex: RegExp[] = (product.extensionAllowedBadgeProvidersRegex || []).map((r: string) => new RegExp(r));
|
||||
const extensionEnabledApiProposals: Record<string, string[]> = product.extensionEnabledApiProposals ?? {};
|
||||
const reservedImplicitActivationEventPrefixes = ['onNotebookSerializer:'];
|
||||
const redundantImplicitActivationEventPrefixes = ['onLanguage:', 'onView:', 'onAuthenticationRequest:', 'onCommand:', 'onCustomEditor:'];
|
||||
const redundantImplicitActivationEventPrefixes = ['onLanguage:', 'onView:', 'onAuthenticationRequest:', 'onCommand:', 'onCustomEditor:', 'onTerminalProfile:', 'onRenderer:', 'onTerminalQuickFixRequest:', 'onWalkthrough:'];
|
||||
|
||||
function isTrustedSVGSource(uri: Uri): boolean {
|
||||
return allowedBadgeProviders.includes(uri.authority.toLowerCase()) || allowedBadgeProvidersRegex.some(r => r.test(uri.toString()));
|
||||
|
@ -453,5 +453,41 @@ function parseImplicitActivationEvents(tree: JsonNode): Set<string> {
|
|||
});
|
||||
});
|
||||
|
||||
// walkthroughs
|
||||
const walkthroughs = findNodeAtLocation(tree, ['contributes', 'walkthroughs']);
|
||||
walkthroughs?.children?.forEach(child => {
|
||||
const id = findNodeAtLocation(child, ['id']);
|
||||
if (id && id.type === 'string') {
|
||||
activationEvents.add(`onWalkthrough:${id.value}`);
|
||||
}
|
||||
});
|
||||
|
||||
// notebookRenderers
|
||||
const notebookRenderers = findNodeAtLocation(tree, ['contributes', 'notebookRenderer']);
|
||||
notebookRenderers?.children?.forEach(child => {
|
||||
const id = findNodeAtLocation(child, ['id']);
|
||||
if (id && id.type === 'string') {
|
||||
activationEvents.add(`onRenderer:${id.value}`);
|
||||
}
|
||||
});
|
||||
|
||||
// terminalProfiles
|
||||
const terminalProfiles = findNodeAtLocation(tree, ['contributes', 'terminal', 'profiles']);
|
||||
terminalProfiles?.children?.forEach(child => {
|
||||
const id = findNodeAtLocation(child, ['id']);
|
||||
if (id && id.type === 'string') {
|
||||
activationEvents.add(`onTerminalProfile:${id.value}`);
|
||||
}
|
||||
});
|
||||
|
||||
// terminalQuickFixes
|
||||
const terminalQuickFixes = findNodeAtLocation(tree, ['contributes', 'terminal', 'quickFixes']);
|
||||
terminalQuickFixes?.children?.forEach(child => {
|
||||
const id = findNodeAtLocation(child, ['id']);
|
||||
if (id && id.type === 'string') {
|
||||
activationEvents.add(`onTerminalQuickFixRequest:${id.value}`);
|
||||
}
|
||||
});
|
||||
|
||||
return activationEvents;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue