externalUriOpenerService.ts ×9

Frontier kind: Code frontier

unlabeled · c_8485a8ca618c

2 tests · 21053 LOC · 79 files · introduces 0 tests · 38 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
9 ranges38 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2166 ranges21053 lines · 79 files · Browse complete extent
All tests (intent)
2 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 38 introduced LOC across 9 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/externalUriOpener/common/externalUriOpenerService.ts 38 introduced LOC · 9 ranges

Open complete file

80 return [];
81 }
83 > // First see if we have a preferredOpener
84 > if (ctx.preferredOpenerId) {
85 if (ctx.preferredOpenerId === defaultExternalUriOpenerId) {
86 return [];
93 }
94 }
96 > // Check to see if we have a configured opener
97 > const configuredOpener = this.getConfiguredOpenerForUri(allOpeners, targetUri);
98 > if (configuredOpener) {
99 // Skip the `canOpen` check here since the opener was specifically requested.
100 return configuredOpener === defaultExternalUriOpenerId ? [] : [configuredOpener];
101 }
103 > // Then check to see if there is a valid opener
104 > const validOpeners: Array<{ opener: IExternalUriOpener; priority: languages.ExternalUriOpenerPriority }> = [];
105 > await Promise.all(Array.from(allOpeners.values()).map(async opener => {
106 > let priority: languages.ExternalUriOpenerPriority;
107 > try {
108 > priority = await opener.canOpen(ctx.sourceUri, token);
109 > } catch (e) {
110 this.logService.error(e);
111 return;
112 }
114 > switch (priority) {
115 > case languages.ExternalUriOpenerPriority.Option:
116 > case languages.ExternalUriOpenerPriority.Default:
117 > case languages.ExternalUriOpenerPriority.Preferred:
118 > validOpeners.push({ opener, priority });
119 > break;
120 > }
121 > }));
122 >
123 > if (validOpeners.length === 0) {
124 return [];
125 }
127 > // See if we have a preferred opener first
128 > const preferred = validOpeners.filter(x => x.priority === languages.ExternalUriOpenerPriority.Preferred).at(0);
129 > if (preferred) {
130 return [preferred.opener];
131 }
147 return false;
148 } else if (allOpeners.length === 1) {
149 > return allOpeners[0].openExternalUri(targetUri, ctx, token); externalUriOpenerService.ts
150 > }
151
152 // Otherwise prompt
166 await Promise.all(Iterable.map(this._providers, async (provider) => {
167 for await (const opener of provider.getOpeners(targetUri)) {
168 > allOpeners.set(opener.id, opener); externalUriOpenerService.ts
169 > }
170 }));
171 return allOpeners;
173
174 private getConfiguredOpenerForUri(openers: Map<string, IExternalUriOpener>, targetUri: URI): IExternalUriOpener | 'default' | undefined {
175 > const config = this.configurationService.getValue<ExternalUriOpenersConfiguration>(externalUriOpenersSettingId) || {}; externalUriOpenerService.ts
176 > for (const [uriGlob, id] of Object.entries(config)) {
177 if (testUrlMatchesGlob(targetUri, uriGlob)) {
178 if (id === defaultExternalUriOpenerId) {