Skip to content

Commit 51a2a2a

Browse files
committed
feat: apply patch after setting up subtree
1 parent 41bee49 commit 51a2a2a

File tree

84 files changed

+3360
-191
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+3360
-191
lines changed

lib/vscode/.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@
1414
**/extensions/**/build/**
1515
**/extensions/markdown-language-features/media/**
1616
**/extensions/typescript-basics/test/colorize-fixtures/**
17+
# This is a code-server code symlink.
18+
src/vs/base/node/proxy_agent.ts

lib/vscode/.eslintrc.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"code-no-standalone-editor": "warn",
6565
"code-no-unexternalized-strings": "warn",
6666
"code-layering": [
67-
"warn",
67+
"off",
6868
{
6969
"common": [],
7070
"node": [
@@ -90,7 +90,7 @@
9090
}
9191
],
9292
"code-import-patterns": [
93-
"warn",
93+
"off",
9494
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9595
// !!! Do not relax these rules !!!
9696
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

lib/vscode/.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ out-vscode-reh-web-pkg/
2525
out-vscode-web/
2626
out-vscode-web-min/
2727
out-vscode-web-pkg/
28-
src/vs/server
2928
resources/server
3029
build/node_modules
3130
coverage/

lib/vscode/.yarnrc

-3
This file was deleted.

lib/vscode/build/gulpfile.reh.js

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ BUILD_TARGETS.forEach(({ platform, arch }) => {
4444
});
4545

4646
function getNodeVersion() {
47+
return process.versions.node;
4748
const yarnrc = fs.readFileSync(path.join(REPO_ROOT, 'remote', '.yarnrc'), 'utf8');
4849
const target = /^target "(.*)"$/m.exec(yarnrc)[1];
4950
return target;

lib/vscode/build/lib/extensions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function fromLocal(extensionPath: string, forWeb: boolean): Stream {
7070
if (isWebPacked) {
7171
input = updateExtensionPackageJSON(input, (data: any) => {
7272
delete data.scripts;
73-
delete data.dependencies;
73+
// https://github.com/cdr/code-server/pull/2041#issuecomment-685910322
7474
delete data.devDependencies;
7575
if (data.main) {
7676
data.main = data.main.replace('/out/', /dist/);

lib/vscode/build/lib/node.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as path from 'path';
7-
import * as fs from 'fs';
87

98
const root = path.dirname(path.dirname(__dirname));
10-
const yarnrcPath = path.join(root, 'remote', '.yarnrc');
11-
const yarnrc = fs.readFileSync(yarnrcPath, 'utf8');
12-
const version = /^target\s+"([^"]+)"$/m.exec(yarnrc)![1];
9+
const version = process.versions.node;
1310
const node = process.platform === 'win32' ? 'node.exe' : 'node';
1411
const nodePath = path.join(root, '.build', 'node', `v${version}`, `${process.platform}-${process.arch}`, node);
1512

16-
console.log(nodePath);
13+
console.log(nodePath);

lib/vscode/build/lib/util.ts

+1
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ export function streamToPromise(stream: NodeJS.ReadWriteStream): Promise<void> {
336336
}
337337

338338
export function getElectronVersion(): string {
339+
return process.versions.node;
339340
const yarnrc = fs.readFileSync(path.join(root, '.yarnrc'), 'utf8');
340341
const target = /^target "(.*)"$/m.exec(yarnrc)![1];
341342
return target;

lib/vscode/build/npm/postinstall.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ function yarnInstall(location, opts) {
3333

3434
yarnInstall('extensions'); // node modules shared by all extensions
3535

36-
if (!(process.platform === 'win32' && (process.arch === 'arm64' || process.env['npm_config_arch'] === 'arm64'))) {
37-
yarnInstall('remote'); // node modules used by vscode server
38-
yarnInstall('remote/web'); // node modules used by vscode web
39-
}
36+
// NOTE@coder: Skip these dependencies since we don't use them.
37+
// if (!(process.platform === 'win32' && (process.arch === 'arm64' || process.env['npm_config_arch'] === 'arm64'))) {
38+
// yarnInstall('remote'); // node modules used by vscode server
39+
// yarnInstall('remote/web'); // node modules used by vscode web
40+
// }
4041

4142
const allExtensionFolders = fs.readdirSync('extensions');
4243
const extensions = allExtensionFolders.filter(e => {
@@ -69,9 +70,9 @@ runtime "${runtime}"`;
6970
}
7071

7172
yarnInstall(`build`); // node modules required for build
72-
yarnInstall('test/automation'); // node modules required for smoketest
73-
yarnInstall('test/smoke'); // node modules required for smoketest
74-
yarnInstall('test/integration/browser'); // node modules required for integration
73+
// yarnInstall('test/automation'); // node modules required for smoketest
74+
// yarnInstall('test/smoke'); // node modules required for smoketest
75+
// yarnInstall('test/integration/browser'); // node modules required for integration
7576
yarnInstallBuildDependencies(); // node modules for watching, specific to host node version, not electron
7677

7778
cp.execSync('git config pull.rebase true');

lib/vscode/build/npm/preinstall.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ let err = false;
88
const majorNodeVersion = parseInt(/^(\d+)\./.exec(process.versions.node)[1]);
99

1010
if (majorNodeVersion < 10 || majorNodeVersion >= 13) {
11-
console.error('\033[1;31m*** Please use node >=10 and <=12.\033[0;0m');
12-
err = true;
11+
// We are ok building above Node 12.
12+
// console.error('\033[1;31m*** Please use node >=10 and <=12.\033[0;0m');
13+
// err = true;
1314
}
1415

1516
const cp = require('child_process');

lib/vscode/coder.js

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// This must be ran from VS Code's root.
2+
const gulp = require("gulp");
3+
const path = require("path");
4+
const _ = require("underscore");
5+
const buildfile = require("./src/buildfile");
6+
const common = require("./build/lib/optimize");
7+
const util = require("./build/lib/util");
8+
const deps = require("./build/dependencies");
9+
10+
const vscodeEntryPoints = _.flatten([
11+
buildfile.entrypoint("vs/workbench/workbench.web.api"),
12+
buildfile.entrypoint("vs/server/entry"),
13+
buildfile.base,
14+
buildfile.workbenchWeb,
15+
buildfile.workerExtensionHost,
16+
buildfile.workerNotebook,
17+
buildfile.keyboardMaps,
18+
buildfile.entrypoint("vs/platform/files/node/watcher/unix/watcherApp"),
19+
buildfile.entrypoint("vs/platform/files/node/watcher/nsfw/watcherApp"),
20+
buildfile.entrypoint("vs/workbench/services/extensions/node/extensionHostProcess"),
21+
]);
22+
23+
const vscodeResources = [
24+
"out-build/vs/server/fork.js",
25+
"!out-build/vs/server/doc/**",
26+
"out-build/vs/workbench/services/extensions/worker/extensionHostWorkerMain.js",
27+
"out-build/bootstrap.js",
28+
"out-build/bootstrap-fork.js",
29+
"out-build/bootstrap-amd.js",
30+
'out-build/bootstrap-node.js',
31+
"out-build/paths.js",
32+
'out-build/vs/**/*.{svg,png,html,ttf}',
33+
"!out-build/vs/code/browser/workbench/*.html",
34+
'!out-build/vs/code/electron-browser/**',
35+
"out-build/vs/base/common/performance.js",
36+
"out-build/vs/base/node/languagePacks.js",
37+
'out-build/vs/base/browser/ui/codicons/codicon/**',
38+
"out-build/vs/workbench/browser/media/*-theme.css",
39+
"out-build/vs/workbench/contrib/debug/**/*.json",
40+
"out-build/vs/workbench/contrib/externalTerminal/**/*.scpt",
41+
"out-build/vs/workbench/contrib/webview/browser/pre/*.js",
42+
"out-build/vs/**/markdown.css",
43+
"out-build/vs/workbench/contrib/tasks/**/*.json",
44+
"out-build/vs/platform/files/**/*.md",
45+
"!**/test/**"
46+
];
47+
48+
gulp.task("optimize", gulp.series(
49+
util.rimraf("out-vscode"),
50+
common.optimizeTask({
51+
src: "out-build",
52+
entryPoints: vscodeEntryPoints,
53+
resources: vscodeResources,
54+
loaderConfig: common.loaderConfig(),
55+
out: "out-vscode",
56+
inlineAmdImages: true,
57+
bundleInfo: undefined
58+
}),
59+
));
60+
61+
gulp.task("minify", gulp.series(
62+
util.rimraf("out-vscode-min"),
63+
common.minifyTask("out-vscode")
64+
));

lib/vscode/extensions/postinstall.js

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ function processRoot() {
2424
rimraf.sync(filePath);
2525
}
2626
}
27+
28+
// Delete .bin so it doesn't contain broken symlinks that trip up nfpm.
29+
rimraf.sync(path.join(__dirname, 'node_modules', '.bin'));
2730
}
2831

2932
function processLib() {

lib/vscode/extensions/typescript-language-features/src/utils/platform.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
import * as vscode from 'vscode';
77

88
export function isWeb(): boolean {
9-
// @ts-expect-error
9+
// NOTE@coder: Remove unused ts-expect-error directive which causes tsc to error.
1010
return typeof navigator !== 'undefined' && vscode.env.uiKind === vscode.UIKind.Web;
1111
}

lib/vscode/package.json

+9-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@
4646
"watch-web": "gulp watch-web --max_old_space_size=4095",
4747
"eslint": "eslint -c .eslintrc.json --rulesdir ./build/lib/eslint --ext .ts --ext .js ./src/vs ./extensions"
4848
},
49+
"dependencies_comment": "Move rimraf to dependencies because it is used in the postinstall script.",
4950
"dependencies": {
51+
"@coder/logger": "1.1.16",
52+
"@coder/node-browser": "^1.0.8",
53+
"@coder/requirefs": "^1.1.5",
5054
"applicationinsights": "1.0.8",
5155
"chokidar": "3.4.3",
5256
"graceful-fs": "4.2.3",
@@ -60,6 +64,8 @@
6064
"native-keymap": "2.2.0",
6165
"native-watchdog": "1.3.0",
6266
"node-pty": "0.10.0-beta17",
67+
"proxy-agent": "^4.0.0",
68+
"rimraf": "^2.2.8",
6369
"spdlog": "^0.11.1",
6470
"sudo-prompt": "9.1.1",
6571
"tas-client-umd": "0.1.2",
@@ -161,7 +167,6 @@
161167
"pump": "^1.0.1",
162168
"queue": "3.0.6",
163169
"rcedit": "^1.1.0",
164-
"rimraf": "^2.2.8",
165170
"sinon": "^1.17.2",
166171
"source-map": "^0.4.4",
167172
"style-loader": "^1.0.0",
@@ -193,5 +198,8 @@
193198
"windows-foreground-love": "0.2.0",
194199
"windows-mutex": "0.3.0",
195200
"windows-process-tree": "0.2.4"
201+
},
202+
"resolutions": {
203+
"minimist": "^1.2.5"
196204
}
197205
}

lib/vscode/product.json

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"nameShort": "Code - OSS",
3-
"nameLong": "Code - OSS",
2+
"nameShort": "code-server",
3+
"nameLong": "code-server",
44
"applicationName": "code-oss",
55
"dataFolderName": ".vscode-oss",
66
"win32MutexName": "vscodeoss",
@@ -20,7 +20,7 @@
2020
"darwinBundleIdentifier": "com.visualstudio.code.oss",
2121
"linuxIconName": "com.visualstudio.code.oss",
2222
"licenseFileName": "LICENSE.txt",
23-
"reportIssueUrl": "https://github.com/microsoft/vscode/issues/new",
23+
"reportIssueUrl": "https://github.com/cdr/code-server/issues/new",
2424
"urlProtocol": "code-oss",
2525
"extensionAllowedProposedApi": [
2626
"ms-vscode.vscode-js-profile-flame",
@@ -136,5 +136,14 @@
136136
"publisherDisplayName": "Microsoft"
137137
}
138138
}
139-
]
139+
],
140+
141+
"//": "https://github.com/VSCodium/vscodium/pull/155/files",
142+
"documentationUrl": "https://go.microsoft.com/fwlink/?LinkID=533484#vscode",
143+
"keyboardShortcutsUrlMac": "https://go.microsoft.com/fwlink/?linkid=832143",
144+
"keyboardShortcutsUrlLinux": "https://go.microsoft.com/fwlink/?linkid=832144",
145+
"keyboardShortcutsUrlWin": "https://go.microsoft.com/fwlink/?linkid=832145",
146+
"introductoryVideosUrl": "https://go.microsoft.com/fwlink/?linkid=832146",
147+
"tipsAndTricksUrl": "https://go.microsoft.com/fwlink/?linkid=852118",
148+
"newsletterSignupUrl": "https://www.research.net/r/vsc-newsletter"
140149
}

lib/vscode/remote/.yarnrc

-3
This file was deleted.

lib/vscode/src/vs/base/common/network.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,17 @@ class RemoteAuthoritiesImpl {
113113
if (host && host.indexOf(':') !== -1) {
114114
host = `[${host}]`;
115115
}
116-
const port = this._ports[authority];
116+
// const port = this._ports[authority];
117117
const connectionToken = this._connectionTokens[authority];
118118
let query = `path=${encodeURIComponent(uri.path)}`;
119119
if (typeof connectionToken === 'string') {
120120
query += `&tkn=${encodeURIComponent(connectionToken)}`;
121121
}
122+
// NOTE@coder: Changed this to work against the current path.
122123
return URI.from({
123124
scheme: platform.isWeb ? this._preferredWebSchema : Schemas.vscodeRemoteResource,
124-
authority: `${host}:${port}`,
125-
path: `/vscode-remote-resource`,
125+
authority: window.location.host,
126+
path: `${window.location.pathname.replace(/\/+$/, '')}/vscode-remote-resource`,
126127
query
127128
});
128129
}

lib/vscode/src/vs/base/common/platform.ts

+12
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,18 @@ if (typeof navigator === 'object' && !isElectronRenderer) {
7171
_isWeb = true;
7272
_locale = navigator.language;
7373
_language = _locale;
74+
75+
// NOTE@coder: Make languages work.
76+
const el = typeof document !== 'undefined' && document.getElementById('vscode-remote-nls-configuration');
77+
const rawNlsConfig = el && el.getAttribute('data-settings');
78+
if (rawNlsConfig) {
79+
try {
80+
const nlsConfig: NLSConfig = JSON.parse(rawNlsConfig);
81+
_locale = nlsConfig.locale;
82+
_translationsConfigFile = nlsConfig._translationsConfigFile;
83+
_language = nlsConfig.availableLanguages['*'] || LANGUAGE_DEFAULT;
84+
} catch (error) { /* Oh well. */ }
85+
}
7486
}
7587

7688
// Native environment

lib/vscode/src/vs/base/common/processes.ts

+1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ export function sanitizeProcessEnvironment(env: IProcessEnvironment, ...preserve
112112
/^VSCODE_.+$/,
113113
/^SNAP(|_.*)$/,
114114
/^GDK_PIXBUF_.+$/,
115+
/^CODE_SERVER_.+$/,
115116
];
116117
const envKeys = Object.keys(env);
117118
envKeys

lib/vscode/src/vs/base/common/uriIpc.ts

+19-12
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import { URI, UriComponents } from 'vs/base/common/uri';
77
import { MarshalledObject } from 'vs/base/common/marshalling';
8+
import { Schemas } from './network';
89

910
export interface IURITransformer {
1011
transformIncoming(uri: UriComponents): UriComponents;
@@ -31,29 +32,35 @@ function toJSON(uri: URI): UriComponents {
3132

3233
export class URITransformer implements IURITransformer {
3334

34-
private readonly _uriTransformer: IRawURITransformer;
35-
36-
constructor(uriTransformer: IRawURITransformer) {
37-
this._uriTransformer = uriTransformer;
35+
constructor(private readonly remoteAuthority: string) {
3836
}
3937

38+
// NOTE@coder: Coming in from the browser it'll be vscode-remote so it needs
39+
// to be transformed into file.
4040
public transformIncoming(uri: UriComponents): UriComponents {
41-
const result = this._uriTransformer.transformIncoming(uri);
42-
return (result === uri ? uri : toJSON(URI.from(result)));
41+
return uri.scheme === Schemas.vscodeRemote
42+
? toJSON(URI.file(uri.path))
43+
: uri;
4344
}
4445

46+
// NOTE@coder: Going out to the browser it'll be file so it needs to be
47+
// transformed into vscode-remote.
4548
public transformOutgoing(uri: UriComponents): UriComponents {
46-
const result = this._uriTransformer.transformOutgoing(uri);
47-
return (result === uri ? uri : toJSON(URI.from(result)));
49+
return uri.scheme === Schemas.file
50+
? toJSON(URI.from({ authority: this.remoteAuthority, scheme: Schemas.vscodeRemote, path: uri.path }))
51+
: uri;
4852
}
4953

5054
public transformOutgoingURI(uri: URI): URI {
51-
const result = this._uriTransformer.transformOutgoing(uri);
52-
return (result === uri ? uri : URI.from(result));
55+
return uri.scheme === Schemas.file
56+
? URI.from({ authority: this.remoteAuthority, scheme: Schemas.vscodeRemote, path:uri.path })
57+
: uri;
5358
}
5459

5560
public transformOutgoingScheme(scheme: string): string {
56-
return this._uriTransformer.transformOutgoingScheme(scheme);
61+
return scheme === Schemas.file
62+
? Schemas.vscodeRemote
63+
: scheme;
5764
}
5865
}
5966

@@ -152,4 +159,4 @@ export function transformAndReviveIncomingURIs<T>(obj: T, transformer: IURITrans
152159
return obj;
153160
}
154161
return result;
155-
}
162+
}

lib/vscode/src/vs/base/node/languagePacks.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ function factory(nodeRequire, path, fs, perf) {
128128
function getLanguagePackConfigurations(userDataPath) {
129129
const configFile = path.join(userDataPath, 'languagepacks.json');
130130
try {
131-
return nodeRequire(configFile);
131+
// NOTE@coder: Swapped require with readFile since require is cached and
132+
// we don't restart the server-side portion of code-server when the
133+
// language changes.
134+
return JSON.parse(fs.readFileSync(configFile, 'utf8'));
132135
} catch (err) {
133136
// Do nothing. If we can't read the file we have no
134137
// language pack config.

0 commit comments

Comments
 (0)