Skip to content

Commit aeb8995

Browse files
authored
Merge pull request #170 from CodinGame/fix-typescript-plugin-loading
Fix typescript plugin loading
2 parents c31243d + cb89027 commit aeb8995

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

scripts/vscode.patch

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ index 775a1be5996..ce8435bd920 100644
6969
if (!/(^\.\/)|(^\.\.\/)/.test(relativePath)) {
7070
relativePath = './' + relativePath;
7171
diff --git a/extensions/typescript-language-features/web/webServer.ts b/extensions/typescript-language-features/web/webServer.ts
72-
index 1688a93fcc0..fec4cd1baa1 100644
72+
index 1688a93fcc0..fb57c8db79e 100644
7373
--- a/extensions/typescript-language-features/web/webServer.ts
7474
+++ b/extensions/typescript-language-features/web/webServer.ts
7575
@@ -44,7 +44,7 @@ function fromResource(extensionUri: URI, uri: URI) {
@@ -86,7 +86,7 @@ index 1688a93fcc0..fec4cd1baa1 100644
8686
const scriptPath = combinePaths(packageRoot, browser);
8787
try {
8888
- const { default: module } = await import(/* webpackIgnore: true */scriptPath);
89-
+ const { default: module } = await import(/* webpackIgnore: true */ '' + scriptPath + '');
89+
+ const { default: module } = await new Function('url', 'return importExt(url)')(scriptPath);
9090
return { module, error: undefined };
9191
} catch (e) {
9292
return { module: undefined, error: e };
@@ -543,7 +543,7 @@ index b83a462131d..5555f431ba0 100644
543543
performance.mark('code/extHost/didInitAPI');
544544

545545
diff --git a/src/vs/workbench/api/worker/extensionHostWorker.ts b/src/vs/workbench/api/worker/extensionHostWorker.ts
546-
index 6e6f8845da5..89cab1e16da 100644
546+
index 6e6f8845da5..48462781c2a 100644
547547
--- a/src/vs/workbench/api/worker/extensionHostWorker.ts
548548
+++ b/src/vs/workbench/api/worker/extensionHostWorker.ts
549549
@@ -15,7 +15,6 @@ import * as performance from 'vs/base/common/performance';
@@ -554,7 +554,15 @@ index 6e6f8845da5..89cab1e16da 100644
554554
import { URI } from 'vs/base/common/uri';
555555

556556
//#region --- Define, capture, and override some globals
557-
@@ -47,7 +46,7 @@ function shouldTransformUri(uri: string): boolean {
557+
@@ -35,6 +34,7 @@ declare namespace self {
558+
let importScripts: any;
559+
let fetch: _Fetch;
560+
let XMLHttpRequest: any;
561+
+ let importExt: any;
562+
}
563+
564+
const nativeClose = self.close.bind(self);
565+
@@ -47,7 +47,7 @@ function shouldTransformUri(uri: string): boolean {
558566
// In principle, we could convert any URI, but we have concerns
559567
// that parsing https URIs might end up decoding escape characters
560568
// and result in an unintended transformation
@@ -563,7 +571,7 @@ index 6e6f8845da5..89cab1e16da 100644
563571
}
564572

565573
const nativeFetch = fetch.bind(self);
566-
@@ -89,66 +88,167 @@ self.addEventListener = () => console.trace(`'addEventListener' has been blocked
574+
@@ -89,66 +89,171 @@ self.addEventListener = () => console.trace(`'addEventListener' has been blocked
567575
(<any>self)['webkitResolveLocalFileSystemSyncURL'] = undefined;
568576
(<any>self)['webkitResolveLocalFileSystemURL'] = undefined;
569577

@@ -650,6 +658,10 @@ index 6e6f8845da5..89cab1e16da 100644
650658
+ nativeImportScripts(...urls.map(asWorkerBrowserUrl));
651659
+ };
652660
+
661+
+ self.importExt = (url: string) => {
662+
+ // prevent bundler from trying to transform dynamic import
663+
+ return new Function('url', 'return import(url)')(asWorkerBrowserUrl(url));
664+
+ };
653665
+
654666
+ nativeImportScripts(workerUrl);
655667
+ }).toString();
@@ -785,7 +797,7 @@ index 6e6f8845da5..89cab1e16da 100644
785797
}
786798

787799
//#endregion ---
788-
@@ -255,6 +355,7 @@ export function create(): { onmessage: (message: any) => void } {
800+
@@ -255,6 +360,7 @@ export function create(): { onmessage: (message: any) => void } {
789801
);
790802

791803
patchFetching(uri => extHostMain.asBrowserUri(uri));

src/service-override/storage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,5 +154,5 @@ export default function getStorageServiceOverride (provider?: IStorageProvider):
154154
export {
155155
IStorageItemsChangeEvent,
156156
ExternalStorageService,
157-
InjectedBrowserStorageService
157+
InjectedBrowserStorageService as BrowserStorageService
158158
}

0 commit comments

Comments
 (0)