@@ -29,36 +29,52 @@ export class BuiltinExtensionsScannerService implements IBuiltinExtensionsScanne
2929 @IWorkbenchEnvironmentService environmentService : IWorkbenchEnvironmentService ,
3030 @IUriIdentityService uriIdentityService : IUriIdentityService ,
3131 ) {
32+ if ( isWeb ) {
33+ const builtinExtensionsServiceUrl = this . _getBuiltinExtensionsUrl ( environmentService ) ;
34+ if ( builtinExtensionsServiceUrl ) {
35+ let scannedBuiltinExtensions : IScannedBuiltinExtension [ ] = [ ] ;
3236
33- const builtinExtensionsServiceUrl = environmentService . options ?. builtinExtensionsServiceUrl ? URI . parse ( environmentService . options ?. builtinExtensionsServiceUrl ) : undefined ;
34- if ( isWeb && builtinExtensionsServiceUrl ) {
35-
36- let scannedBuiltinExtensions : IScannedBuiltinExtension [ ] = [ ] ;
37-
38- if ( environmentService . isBuilt ) {
39- // Built time configuration (do NOT modify)
40- scannedBuiltinExtensions = [ /*BUILD->INSERT_BUILTIN_EXTENSIONS*/ ] ;
41- } else {
42- // Find builtin extensions by checking for DOM
43- const builtinExtensionsElement = document . getElementById ( 'vscode-workbench-builtin-extensions' ) ;
44- const builtinExtensionsElementAttribute = builtinExtensionsElement ? builtinExtensionsElement . getAttribute ( 'data-settings' ) : undefined ;
45- if ( builtinExtensionsElementAttribute ) {
46- try {
47- scannedBuiltinExtensions = JSON . parse ( builtinExtensionsElementAttribute ) ;
48- } catch ( error ) { /* ignore error*/ }
37+ if ( environmentService . isBuilt ) {
38+ // Built time configuration (do NOT modify)
39+ scannedBuiltinExtensions = [ /*BUILD->INSERT_BUILTIN_EXTENSIONS*/ ] ;
40+ } else {
41+ // Find builtin extensions by checking for DOM
42+ const builtinExtensionsElement = document . getElementById ( 'vscode-workbench-builtin-extensions' ) ;
43+ const builtinExtensionsElementAttribute = builtinExtensionsElement ? builtinExtensionsElement . getAttribute ( 'data-settings' ) : undefined ;
44+ if ( builtinExtensionsElementAttribute ) {
45+ try {
46+ scannedBuiltinExtensions = JSON . parse ( builtinExtensionsElementAttribute ) ;
47+ } catch ( error ) { /* ignore error*/ }
48+ }
4949 }
50+
51+ this . builtinExtensions = scannedBuiltinExtensions . map ( e => ( {
52+ identifier : { id : getGalleryExtensionId ( e . packageJSON . publisher , e . packageJSON . name ) } ,
53+ location : uriIdentityService . extUri . joinPath ( builtinExtensionsServiceUrl ! , e . extensionPath ) ,
54+ type : ExtensionType . System ,
55+ packageJSON : e . packageJSON ,
56+ packageNLS : e . packageNLS ,
57+ readmeUrl : e . readmePath ? uriIdentityService . extUri . joinPath ( builtinExtensionsServiceUrl ! , e . readmePath ) : undefined ,
58+ changelogUrl : e . changelogPath ? uriIdentityService . extUri . joinPath ( builtinExtensionsServiceUrl ! , e . changelogPath ) : undefined ,
59+ } ) ) ;
5060 }
61+ }
62+ }
5163
52- this . builtinExtensions = scannedBuiltinExtensions . map ( e => ( {
53- identifier : { id : getGalleryExtensionId ( e . packageJSON . publisher , e . packageJSON . name ) } ,
54- location : uriIdentityService . extUri . joinPath ( builtinExtensionsServiceUrl ! , e . extensionPath ) ,
55- type : ExtensionType . System ,
56- packageJSON : e . packageJSON ,
57- packageNLS : e . packageNLS ,
58- readmeUrl : e . readmePath ? uriIdentityService . extUri . joinPath ( builtinExtensionsServiceUrl ! , e . readmePath ) : undefined ,
59- changelogUrl : e . changelogPath ? uriIdentityService . extUri . joinPath ( builtinExtensionsServiceUrl ! , e . changelogPath ) : undefined ,
60- } ) ) ;
64+ private _getBuiltinExtensionsUrl ( environmentService : IWorkbenchEnvironmentService ) : URI | undefined {
65+ if ( environmentService . options ?. builtinExtensionsServiceUrl ) {
66+ return URI . parse ( environmentService . options ?. builtinExtensionsServiceUrl ) ;
67+ }
68+ let enableBuiltinExtensions : boolean ;
69+ if ( environmentService . options && typeof environmentService . options . _enableBuiltinExtensions !== 'undefined' ) {
70+ enableBuiltinExtensions = environmentService . options . _enableBuiltinExtensions ;
71+ } else {
72+ enableBuiltinExtensions = environmentService . configuration . remoteAuthority ? false : true ;
73+ }
74+ if ( enableBuiltinExtensions ) {
75+ return URI . parse ( require . toUrl ( '../../../../../../extensions' ) ) ;
6176 }
77+ return undefined ;
6278 }
6379
6480 async scanBuiltinExtensions ( ) : Promise < IScannedExtension [ ] > {
0 commit comments