Skip to content

Commit 7155ad8

Browse files
committed
wip again
1 parent 023b53d commit 7155ad8

File tree

3 files changed

+51
-5
lines changed

3 files changed

+51
-5
lines changed

ci/dev/watch.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ class Watcher {
155155
}
156156
if (line.includes("Watching for file changes")) {
157157
restartServer()
158+
bundleBrowserCode(browserFiles)
158159
}
159160
})
160161

src/browser/pages/vscode.html

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,32 @@
3939
<body aria-label=""></body>
4040

4141
<!-- Startup (do not modify order of script tags!) -->
42-
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/out/browser/pages/vscode.browserified.js"></script>
43-
<script data-cfasync="false" type="module" src="{{CS_STATIC_BASE}}/out/browser/register.browserified.js"></script>
4442
<script>
43+
let nlsConfig
44+
try {
45+
nlsConfig = JSON.parse(document.getElementById("vscode-remote-nls-configuration").getAttribute("data-settings"))
46+
if (nlsConfig._resolvedLanguagePackCoreLocation) {
47+
const bundles = Object.create(null)
48+
nlsConfig.loadBundle = (bundle, _language, cb) => {
49+
const result = bundles[bundle]
50+
if (result) {
51+
return cb(undefined, result)
52+
}
53+
// FIXME: Only works if path separators are /.
54+
const path = nlsConfig._resolvedLanguagePackCoreLocation + "/" + bundle.replace(/\//g, "!") + ".nls.json"
55+
fetch(`${options.base}/vscode/resource/?path=${encodeURIComponent(path)}`)
56+
.then((response) => response.json())
57+
.then((json) => {
58+
bundles[bundle] = json
59+
cb(undefined, json)
60+
})
61+
.catch(cb)
62+
}
63+
}
64+
} catch (error) {
65+
/* Probably fine. */
66+
}
67+
console.log("hello joe")
4568
self.require = {
4669
// Without the full URL VS Code will try to load file://.
4770
baseUrl: `${window.location.origin}{{CS_STATIC_BASE}}/lib/vscode/out`,
@@ -57,16 +80,20 @@
5780
"iconv-lite-umd": `../node_modules/iconv-lite-umd/lib/iconv-lite-umd.js`,
5881
jschardet: `../node_modules/jschardet/dist/jschardet.min.js`,
5982
},
60-
// "vs/nls": nlsConfig,
83+
"vs/nls": nlsConfig,
6184
}
62-
require(["vs/code/browser/workbench/workbench"], function () {})
6385
</script>
64-
<script data-cfasync="false" type="module" src="{{CS_STATIC_BASE}}/lib/vscode/out/vs/loader.js"></script>
86+
<!-- <script data-cfasync="false" type="module" src="{{CS_STATIC_BASE}}/out/browser/pages/vscode.browserified.js"></script> -->
87+
<script data-cfasync="false" type="module" src="{{CS_STATIC_BASE}}/out/browser/register.browserified.js"></script>
88+
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/lib/vscode/out/vs/loader.js"></script>
6589
<script>
6690
performance.mark("code/willLoadWorkbenchMain")
6791
</script>
6892
<!-- PROD_ONLY
6993
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/lib/vscode/out/vs/workbench/workbench.web.api.nls.js"></script>
7094
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/lib/vscode/out/vs/workbench/workbench.web.api.js"></script>
7195
END_PROD_ONLY -->
96+
<script>
97+
require(["vs/code/browser/workbench/workbench"], function () {})
98+
</script>
7299
</html>

src/browser/pages/vscode.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,24 @@ try {
2929
} catch (error) {
3030
/* Probably fine. */
3131
}
32+
console.log("hello joe")
33+
;(self.require as any) = {
34+
// Without the full URL VS Code will try to load file://.
35+
baseUrl: `${window.location.origin}{{CS_STATIC_BASE}}/lib/vscode/out`,
36+
recordStats: true,
37+
paths: {
38+
"vscode-textmate": `../node_modules/vscode-textmate/release/main`,
39+
"vscode-oniguruma": `../node_modules/vscode-oniguruma/release/main`,
40+
xterm: `../node_modules/xterm/lib/xterm.js`,
41+
"xterm-addon-search": `../node_modules/xterm-addon-search/lib/xterm-addon-search.js`,
42+
"xterm-addon-unicode11": `../node_modules/xterm-addon-unicode11/lib/xterm-addon-unicode11.js`,
43+
"xterm-addon-webgl": `../node_modules/xterm-addon-webgl/lib/xterm-addon-webgl.js`,
44+
"tas-client-umd": `../node_modules/tas-client-umd/lib/tas-client-umd.js`,
45+
"iconv-lite-umd": `../node_modules/iconv-lite-umd/lib/iconv-lite-umd.js`,
46+
jschardet: `../node_modules/jschardet/dist/jschardet.min.js`,
47+
},
48+
"vs/nls": nlsConfig,
49+
}
3250

3351
try {
3452
document.body.style.background = JSON.parse(localStorage.getItem("colorThemeData")!).colorMap["editor.background"]

0 commit comments

Comments
 (0)