src/vs/workbench/contrib/externalUriOpener/common/externalUriOpenerService.ts/ExternalUriOpenerService/getOpeners
class ExternalUriOpenerService:	private async getOpeners(targetUri: URI, allowOptional: boolean, ctx: { sourceUri: URI, preferredOpenerId?: string }, token: CancellationToken): Promise<IExternalUriOpener[]> {
		const allOpeners = await this.getAllOpenersForUri(targetUri);

		if (allOpeners.size === 0) {
			return [];
		}

		// First see if we have a preferredOpener
		if (ctx.preferredOpenerId) {
			if (ctx.preferredOpenerId === defaultExternalUriOpenerId) {
				return [];
			}

			const preferredOpener = allOpeners.get(ctx.preferredOpenerId);
			if (preferredOpener) {
				// Skip the `canOpen` check here since the opener was specifically requested.
				return [preferredOpener];
			}
		}

		// Check to see if we have a configured opener
		const configuredOpener = this.getConfiguredOpenerForUri(allOpeners, targetUri);
		if (configuredOpener) {
			// Skip the `canOpen` check here since the opener was specifically requested.
			return configuredOpener === defaultExternalUriOpenerId ? [] : [configuredOpener];
		}

		// Then check to see if there is a valid opener
		const validOpeners: Array<{ opener: IExternalUriOpener, priority: modes.ExternalUriOpenerPriority }> = [];
		await Promise.all(Array.from(allOpeners.values()).map(async opener => {
			let priority: modes.ExternalUriOpenerPriority;
			try {
				priority = await opener.canOpen(ctx.sourceUri, token);
			} catch (e) {
				this.logService.error(e);
				return;
			}

			switch (priority) {
				case modes.ExternalUriOpenerPriority.Option:
				case modes.ExternalUriOpenerPriority.Default:
				case modes.ExternalUriOpenerPriority.Preferred:
					validOpeners.push({ opener, priority });
					break;
			}
		}));

		if (validOpeners.length === 0) {
			return [];
		}

		// See if we have a preferred opener first
		const preferred = firstOrDefault(validOpeners.filter(x => x.priority === modes.ExternalUriOpenerPriority.Preferred));
		if (preferred) {
			return [preferred.opener];
		}

		// See if we only have optional openers, use the default opener
		if (!allowOptional && validOpeners.every(x => x.priority === modes.ExternalUriOpenerPriority.Option)) {
			return [];
		}

		return validOpeners.map(value => value.opener);
	}