src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts

171 LOC · 112 covered · 59 uncovered · 17 ranges · 33 concepts · 3 introducers · 14 tests

File neighbourhood

The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file

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 related-file, concept, and source links on this page.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the filesrc/vs/platform/extensionManagement/common/extensionGalleryManifestService.ts · 228 LOCcommon/extensionGalleryM…src/vs/platform/extensionResourceLoader/common/extensionResourceLoaderService.ts · 46 LOCcommon/extensionResource…src/vs/platform/theme/common/tokenClassificationRegistry.ts · 632 LOCcommon/tokenClassificati…src/vs/workbench/services/themes/common/colorThemeData.ts · 1083 LOCcommon/colorThemeData.tssrc/vs/workbench/services/themes/common/plistParser.ts · 492 LOCcommon/plistParser.tssrc/vs/workbench/services/themes/common/textMateScopeMatcher.ts · 134 LOCcommon/textMateScopeMatc…src/vs/workbench/services/themes/common/themeCompatibility.ts · 76 LOCcommon/themeCompatibilit…JavaScript Issue #25437|occurrence=1, JavaScript Issue #141816|occurrence=1 · 0 introduced LOCJavaScript Issue #25437|…indentation.ts ×1 · 2 introduced LOCindentation.ts ×1textModelTokens.ts ×4 · 12 introduced LOCtextModelTokens.ts ×4JavaScript Enriching the hover|occurrence=1 · 0 introduced LOCJavaScript Enriching the…JavaScript Issue #86176|occurrence=1 · 0 introduced LOCJavaScript Issue #86176|…indentation.ts ×4 · 41 introduced LOCindentation.ts ×4indentation.ts ×1 · 2 introduced LOCindentation.ts ×1indentation.ts ×6 · 27 introduced LOCindentation.ts ×6languageConfigurationExtensionPoint.ts ×38 · 309 introduced LOClanguageConfigurationExt…languageConfigurationExtensionPoint.ts ×6 · 12 introduced LOClanguageConfigurationExt…shiftCommand.ts ×1 · 5 introduced LOCshiftCommand.ts ×1languageConfigurationExtensionPoint.ts ×19 · 775 introduced LOClanguageConfigurationExt…colorThemeData.ts ×16 · 64 introduced LOCcolorThemeData.ts ×16tokenClassificationRegistry.ts ×1 · 3 introduced LOCtokenClassificationRegis…tokenClassificationRegistry.ts ×2 · 7 introduced LOCtokenClassificationRegis…tokenStyleResolving.test|title=Themes - TokenStyleResolving language|occurrence=1 · 0 introduced LOCtokenStyleResolving.test…colorThemeData.ts ×1 · 2 introduced LOCcolorThemeData.ts ×1colorThemeData.ts ×12 · 57 introduced LOCcolorThemeData.ts ×12tokenClassificationRegistry.ts ×2 · 6 introduced LOCtokenClassificationRegis…colorThemeData.ts ×5 · 21 introduced LOCcolorThemeData.ts ×5colorThemeData.ts ×1 · 6 introduced LOCcolorThemeData.ts ×1colorThemeData.ts ×33 · 242 introduced LOCcolorThemeData.ts ×33colorThemeData.ts ×2 · 5 introduced LOCcolorThemeData.ts ×2tokenStyleResolving.test|title=Themes - TokenStyleResolving resolveScopes - match most specific|occurrence=1 · 0 introduced LOCtokenStyleResolving.test…colorThemeData.ts ×5 · 33 introduced LOCcolorThemeData.ts ×5colorThemeData.ts ×1 · 4 introduced LOCcolorThemeData.ts ×1tokenClassificationRegistry.ts ×1 · 16 introduced LOCtokenClassificationRegis…colorThemeData.ts ×1 · 1 introduced LOCcolorThemeData.ts ×1colorThemeData.ts ×13 · 114 introduced LOCcolorThemeData.ts ×13colorThemeData.ts ×1 · 1 introduced LOCcolorThemeData.ts ×1colorThemeData.ts ×4 · 15 introduced LOCcolorThemeData.ts ×4colorThemeData.ts ×57 · 483 introduced LOCcolorThemeData.ts ×57extensionResourceLoader.ts ×12 · 89 introduced LOCextensionResourceLoader.…JavaScript Enriching the hover|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/codeEditor/test/node/autoindent.test|title=Auto-Reindentation - TypeScript/JavaScript Enriching the hover|occurrence=1JavaScript Enriching the…JavaScript Issue #141816|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/codeEditor/test/node/autoindent.test|title=Auto-Reindentation - TypeScript/JavaScript Issue #141816|occurrence=1JavaScript Issue #141816…JavaScript Issue #209859: do not do reindentation for tokens inside of a string|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/codeEditor/test/node/autoindent.test|title=Auto-Reindentation - TypeScript/JavaScript Issue #209859: do not do reindentation for tokens inside of a string|occurrence=1JavaScript Issue #209859…JavaScript Issue #25437|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/codeEditor/test/node/autoindent.test|title=Auto-Reindentation - TypeScript/JavaScript Issue #25437|occurrence=1JavaScript Issue #25437|…JavaScript Issue #29886|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/codeEditor/test/node/autoindent.test|title=Auto-Reindentation - TypeScript/JavaScript Issue #29886|occurrence=1JavaScript Issue #29886|…JavaScript Issue #86176|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/codeEditor/test/node/autoindent.test|title=Auto-Reindentation - TypeScript/JavaScript Issue #86176|occurrence=1JavaScript Issue #86176|…autoindent.test|title=Language Configuration Parsing Folding markers support object regex syntax with flags|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/codeEditor/test/node/autoindent.test|title=Language Configuration Parsing Folding markers support object regex syntax with flags|occurrence=1autoindent.test|title=La…tokenStyleResolving.test|title=Themes - TokenStyleResolving color defaults|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/services/themes/test/node/tokenStyleResolving.test|title=Themes - TokenStyleResolving color defaults|occurrence=1tokenStyleResolving.test…tokenStyleResolving.test|title=Themes - TokenStyleResolving language - scope resolving|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/services/themes/test/node/tokenStyleResolving.test|title=Themes - TokenStyleResolving language - scope resolving|occurrence=1tokenStyleResolving.test…tokenStyleResolving.test|title=Themes - TokenStyleResolving language|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/services/themes/test/node/tokenStyleResolving.test|title=Themes - TokenStyleResolving language|occurrence=1tokenStyleResolving.test…tokenStyleResolving.test|title=Themes - TokenStyleResolving resolveScopes - match most specific|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/services/themes/test/node/tokenStyleResolving.test|title=Themes - TokenStyleResolving resolveScopes - match most specific|occurrence=1tokenStyleResolving.test…tokenStyleResolving.test|title=Themes - TokenStyleResolving resolveScopes|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/services/themes/test/node/tokenStyleResolving.test|title=Themes - TokenStyleResolving resolveScopes|occurrence=1tokenStyleResolving.test…tokenStyleResolving.test|title=Themes - TokenStyleResolving rule matching|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/services/themes/test/node/tokenStyleResolving.test|title=Themes - TokenStyleResolving rule matching|occurrence=1tokenStyleResolving.test…tokenStyleResolving.test|title=Themes - TokenStyleResolving super type|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/services/themes/test/node/tokenStyleResolving.test|title=Themes - TokenStyleResolving super type|occurrence=1tokenStyleResolving.test…Focused file · src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts · 171 LOCcommon/extensionResource…

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.

1 > /*--------------------------------------------------------------------------------------------- extensionResourceLoader.ts ×12
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { isWeb } from '../../../base/common/platform.js';
7 > import { format2 } from '../../../base/common/strings.js';
8 > import { URI } from '../../../base/common/uri.js';
9 > import { IConfigurationService } from '../../configuration/common/configuration.js';
10 > import { IEnvironmentService } from '../../environment/common/environment.js';
11 > import { IFileService } from '../../files/common/files.js';
12 > import { createDecorator } from '../../instantiation/common/instantiation.js';
13 > import { IProductService } from '../../product/common/productService.js';
14 > import { getServiceMachineId } from '../../externalServices/common/serviceMachineId.js';
15 > import { IStorageService } from '../../storage/common/storage.js';
16 > import { TelemetryLevel } from '../../telemetry/common/telemetry.js';
17 > import { getTelemetryLevel, supportsTelemetry } from '../../telemetry/common/telemetryUtils.js';
18 > import { RemoteAuthorities } from '../../../base/common/network.js';
19 > import { TargetPlatform } from '../../extensions/common/extensions.js';
20 > import { ExtensionGalleryResourceType, getExtensionGalleryManifestResourceUri, IExtensionGalleryManifest, IExtensionGalleryManifestService } from '../../extensionManagement/common/extensionGalleryManifest.js';
21 > import { ILogService } from '../../log/common/log.js';
22 > import { Disposable } from '../../../base/common/lifecycle.js';
23 >
24 > const WEB_EXTENSION_RESOURCE_END_POINT_SEGMENT = '/web-extension-resource/';
25 >
26 > export const IExtensionResourceLoaderService = createDecorator<IExtensionResourceLoaderService>('extensionResourceLoaderService');
27 >
28 > /**
29 > * A service useful for reading resources from within extensions.
30 > */
31 > export interface IExtensionResourceLoaderService {
32 > readonly _serviceBrand: undefined;
33 >
34 > /**
35 > * Read a certain resource within an extension.
36 > */
37 > readExtensionResource(uri: URI): Promise<string>;
38 >
39 > /**
40 > * Returns whether the gallery provides extension resources.
41 > */
42 > supportsExtensionGalleryResources(): Promise<boolean>;
43 >
44 > /**
45 > * Return true if the given URI is a extension gallery resource.
46 > */
47 > isExtensionGalleryResource(uri: URI): Promise<boolean>;
48 >
49 > /**
50 > * Computes the URL of a extension gallery resource. Returns `undefined` if gallery does not provide extension resources.
51 > */
52 > getExtensionGalleryResourceURL(galleryExtension: { publisher: string; name: string; version: string; targetPlatform?: TargetPlatform }, path?: string): Promise<URI | undefined>;
53 > }
54 >
55 > export function migratePlatformSpecificExtensionGalleryResourceURL(resource: URI, targetPlatform: TargetPlatform): URI | undefined {
56 if (resource.query !== `target=${targetPlatform}`) {
57 return undefined;
58 }
59 const paths = resource.path.split('/');
60 if (!paths[3]) {
61 return undefined;
62 }
63 paths[3] = `${paths[3]}+${targetPlatform}`;
64 return resource.with({ query: null, path: paths.join('/') });
65 }
67 > export abstract class AbstractExtensionResourceLoaderService extends Disposable implements IExtensionResourceLoaderService {
68 >
69 > readonly _serviceBrand: undefined;
70 >
71 > private readonly _initPromise: Promise<void>;
72 >
73 > private _extensionGalleryResourceUrlTemplate: string | undefined;
74 > private _extensionGalleryAuthority: string | undefined;
75 >
76 > constructor(
77 > protected readonly _fileService: IFileService, colorThemeData.ts ×57
78 > private readonly _storageService: IStorageService,
79 > private readonly _productService: IProductService,
80 > private readonly _environmentService: IEnvironmentService,
81 > private readonly _configurationService: IConfigurationService,
82 > private readonly _extensionGalleryManifestService: IExtensionGalleryManifestService,
83 > protected readonly _logService: ILogService,
84 > ) {
85 > super();
86 > this._initPromise = this._init();
87 > }
89 > private async _init(): Promise<void> {
91 > const manifest = await this._extensionGalleryManifestService.getExtensionGalleryManifest();
92 > this.resolve(manifest);
93 > this._register(this._extensionGalleryManifestService.onDidChangeExtensionGalleryManifest(() => this.resolve(manifest)));
94 > } catch (error) {
95 this._logService.error(error);
96 }
99 > private resolve(manifest: IExtensionGalleryManifest | null): void {
100 > this._extensionGalleryResourceUrlTemplate = manifest ? getExtensionGalleryManifestResourceUri(manifest, ExtensionGalleryResourceType.ExtensionResourceUri) : undefined; colorThemeData.ts ×57
101 > this._extensionGalleryAuthority = this._extensionGalleryResourceUrlTemplate ? this._getExtensionGalleryAuthority(URI.parse(this._extensionGalleryResourceUrlTemplate)) : undefined;
102 > }
104 > public async supportsExtensionGalleryResources(): Promise<boolean> {
105 await this._initPromise;
106 return this._extensionGalleryResourceUrlTemplate !== undefined;
107 }
109 > public async getExtensionGalleryResourceURL({ publisher, name, version, targetPlatform }: { publisher: string; name: string; version: string; targetPlatform?: TargetPlatform }, path?: string): Promise<URI | undefined> {
110 await this._initPromise;
111 if (this._extensionGalleryResourceUrlTemplate) {
112 const uri = URI.parse(format2(this._extensionGalleryResourceUrlTemplate, {
113 publisher,
114 name,
115 version: targetPlatform !== undefined
116 && targetPlatform !== TargetPlatform.UNDEFINED
117 && targetPlatform !== TargetPlatform.UNKNOWN
118 && targetPlatform !== TargetPlatform.UNIVERSAL
119 ? `${version}+${targetPlatform}`
120 : version,
121 path: 'extension'
122 }));
123 return this._isWebExtensionResourceEndPoint(uri) ? uri.with({ scheme: RemoteAuthorities.getPreferredWebSchema() }) : uri;
124 }
125 return undefined;
126 }
128 > public abstract readExtensionResource(uri: URI): Promise<string>;
129 >
130 > async isExtensionGalleryResource(uri: URI): Promise<boolean> {
131 > await this._initPromise; colorThemeData.ts ×16
132 > return !!this._extensionGalleryAuthority && this._extensionGalleryAuthority === this._getExtensionGalleryAuthority(uri);
133 > }
135 > protected async getExtensionGalleryRequestHeaders(): Promise<Record<string, string>> {
136 const headers: Record<string, string> = {
137 'X-Client-Name': `${this._productService.applicationName}${isWeb ? '-web' : ''}`,
138 'X-Client-Version': this._productService.version
139 };
140 if (supportsTelemetry(this._productService, this._environmentService) && getTelemetryLevel(this._configurationService) === TelemetryLevel.USAGE) {
141 headers['X-Machine-Id'] = await this._getServiceMachineId();
142 }
143 if (this._productService.commit) {
144 headers['X-Client-Commit'] = this._productService.commit;
145 }
146 return headers;
147 }
149 > private _serviceMachineIdPromise: Promise<string> | undefined;
150 > private _getServiceMachineId(): Promise<string> {
151 if (!this._serviceMachineIdPromise) {
152 this._serviceMachineIdPromise = getServiceMachineId(this._environmentService, this._fileService, this._storageService);
153 }
154 return this._serviceMachineIdPromise;
155 }
157 > private _getExtensionGalleryAuthority(uri: URI): string | undefined {
158 if (this._isWebExtensionResourceEndPoint(uri)) {
159 return uri.authority;
160 }
161 const index = uri.authority.indexOf('.');
162 return index !== -1 ? uri.authority.substring(index + 1) : undefined;
163 }
165 > protected _isWebExtensionResourceEndPoint(uri: URI): boolean {
166 const uriPath = uri.path, serverRootPath = RemoteAuthorities.getServerRootPath();
167 // test if the path starts with the server root path followed by the web extension resource end point segment
168 return uriPath.startsWith(serverRootPath) && uriPath.startsWith(WEB_EXTENSION_RESOURCE_END_POINT_SEGMENT, serverRootPath.length);
169 }
171 > }