Skip to content

Commit 8700973

Browse files
committed
its working!
1 parent acf39c5 commit 8700973

File tree

2 files changed

+7
-42
lines changed

2 files changed

+7
-42
lines changed

src/browser/pages/vscode.html

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -40,35 +40,19 @@
4040

4141
<!-- Startup (do not modify order of script tags!) -->
4242
<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. */
43+
const normalize = (url, keepTrailing = false) => {
44+
return url.replace(/\/\/+/g, "/").replace(/\/+$/, keepTrailing ? "/" : "")
6645
}
46+
6747
const resolveBase = (base) => {
6848
// After resolving the base will either start with / or be an empty string.
6949
if (!base || base.startsWith("/")) {
7050
return base ?? ""
7151
}
52+
const parts = location.pathname.split("/")
53+
parts[parts.length - 1] = base
54+
const url = new URL(location.origin + "/" + parts.join("/"))
55+
return normalize(url.pathname)
7256
}
7357

7458
const base = resolveBase("{{CS_STATIC_BASE}}")
@@ -88,7 +72,6 @@
8872
"iconv-lite-umd": `../node_modules/iconv-lite-umd/lib/iconv-lite-umd.js`,
8973
jschardet: `../node_modules/jschardet/dist/jschardet.min.js`,
9074
},
91-
"vs/nls": nlsConfig,
9275
}
9376
</script>
9477
<!-- <script data-cfasync="false" type="module" src="{{CS_STATIC_BASE}}/out/browser/pages/vscode.browserified.js"></script> -->

src/browser/pages/vscode.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,6 @@ 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-
}
5032

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

0 commit comments

Comments
 (0)