Skip to content

Commit 61f870b

Browse files
committed
Merge remote-tracking branch 'upstream/master'
* upstream/master: Show hidden files by default Fix human readable byte size when zero Expose actions registry (coder#701) Set NODE_ENV and VERSION when building (coder#700) Don't try to create builtin extensions directory Suppress "disconnected" notification on extension host Extra extensions directories (coder#694) Updated Data Directory Flag (coder#664) Remove broken links (coder#671)
2 parents 747845e + a2ad3d4 commit 61f870b

File tree

21 files changed

+383
-29
lines changed

21 files changed

+383
-29
lines changed

build/tasks.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { register, run } from "@coder/runner";
2+
import { logger, field } from "@coder/logger";
23
import * as fs from "fs";
34
import * as fse from "fs-extra";
45
import * as os from "os";
@@ -17,6 +18,11 @@ const vscodeVersion = process.env.VSCODE_VERSION || "1.33.1";
1718
const vsSourceUrl = `https://codesrv-ci.cdr.sh/vstar-${vscodeVersion}.tar.gz`;
1819

1920
const buildServerBinary = register("build:server:binary", async (runner) => {
21+
logger.info("Building with environment", field("env", {
22+
NODE_ENV: process.env.NODE_ENV,
23+
VERSION: process.env.VERSION,
24+
}));
25+
2026
await ensureInstalled();
2127
await Promise.all([
2228
buildBootstrapFork(),

doc/admin/install/aws.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This tutorial shows you how to deploy `code-server` on an EC2 AWS instance.
44

5-
If you're just starting out, we recommend [installing code-server locally](../../self-hosted/index.md). It takes only a few minutes and lets you try out all of the features. You can also try out the IDE on a container hosted [by Coder](http://coder.com/signup)
5+
If you're just starting out, we recommend [installing code-server locally](../../self-hosted/index.md). It takes only a few minutes and lets you try out all of the features.
66

77
---
88

doc/admin/install/digitalocean.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This tutorial shows you how to deploy `code-server` to a single node running on DigitalOcean.
44

5-
If you're just starting out, we recommend [installing code-server locally](../../self-hosted/index.md). It takes only a few minutes and lets you try out all of the features. You can also try out the IDE on a container hosted [by Coder](http://coder.com/signup)
5+
If you're just starting out, we recommend [installing code-server locally](../../self-hosted/index.md). It takes only a few minutes and lets you try out all of the features.
66

77
---
88

doc/admin/install/google_cloud.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This tutorial shows you how to deploy `code-server` to a single node running on Google Cloud.
44

5-
If you're just starting out, we recommend [installing code-server locally](../../self-hosted/index.md). It takes only a few minutes and lets you try out all of the features. You can also try out the IDE on a container hosted [by Coder](http://coder.com/signup)
5+
If you're just starting out, we recommend [installing code-server locally](../../self-hosted/index.md). It takes only a few minutes and lets you try out all of the features.
66

77
---
88

@@ -59,7 +59,7 @@ sudo ./code-server -p 80
5959

6060
> For instructions on how to keep the server running after you end your SSH session please checkout [how to use systemd](https://www.linode.com/docs/quick-answers/linux/start-service-at-boot/) to start linux based services if they are killed
6161
62-
- Access code-server from the public IP of your Google Cloud instance we noted earlier in your browser.
62+
- Access code-server from the public IP of your Google Cloud instance we noted earlier in your browser.
6363
> example: 32.32.32.234
6464
6565
- You will be greeted with this page. Code-server is using a self-signed SSL certificate for easy setup. To proceed to the IDE, click **"Advanced"**<img src ="../../assets/chrome_warning.png">

doc/self-hosted/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Options:
5656
```
5757

5858
### Data Directory
59-
Use `code-server -d (path/to/directory)` or `code-server --data-dir=(path/to/directory)`, excluding the parentheses to specify the root folder that VS Code will start in.
59+
Use `code-server -d (path/to/directory)` or `code-server --user-data-dir=(path/to/directory)`, excluding the parentheses to specify the root folder that VS Code will start in.
6060

6161
### Host
6262
By default, code-server will use `0.0.0.0` as its address. This can be changed by using `code-server -h` or `code-server --host=` followed by the address you want to use.

packages/ide-api/api.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// tslint:disable no-any
22

33
import { ITerminalService } from "vs/workbench/contrib/terminal/common/terminal";
4+
import { IWorkbenchActionRegistry } from 'vs/workbench/common/actions';
5+
import { Action } from 'vs/base/common/actions';
6+
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
47

58
export interface EvalHelper { }
69
interface ActiveEvalEmitter {
@@ -146,7 +149,10 @@ declare namespace ide {
146149
export const client: {};
147150

148151
export const workbench: {
152+
readonly action: Action,
153+
readonly syncActionDescriptor: SyncActionDescriptor,
149154
readonly statusbarService: IStatusbarService;
155+
readonly actionsRegistry: IWorkbenchActionRegistry;
150156
readonly notificationService: INotificationService;
151157
readonly storageService: IStorageService;
152158
readonly menuRegistry: IMenuRegistry;

packages/protocol/src/browser/client.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@ export class Client {
278278
shell: init.getShell(),
279279
extensionsDirectory: init.getExtensionsDirectory(),
280280
builtInExtensionsDirectory: init.getBuiltinExtensionsDir(),
281+
extraExtensionDirectories: init.getExtraExtensionDirectoriesList(),
282+
extraBuiltinExtensionDirectories: init.getExtraBuiltinExtensionDirectoriesList(),
281283
};
282284
this.initDataEmitter.emit(this._initData);
283285
break;

packages/protocol/src/common/connection.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ export interface InitData {
2525
readonly shell: string;
2626
readonly extensionsDirectory: string;
2727
readonly builtInExtensionsDirectory: string;
28+
readonly extraExtensionDirectories: string[];
29+
readonly extraBuiltinExtensionDirectories: string[];
2830
}
2931

3032
export interface SharedProcessData {

packages/protocol/src/node/server.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ export interface ServerOptions {
1515
readonly cacheDirectory: string;
1616
readonly builtInExtensionsDirectory: string;
1717
readonly extensionsDirectory: string;
18+
readonly extraExtensionDirectories?: string[];
19+
readonly extraBuiltinExtensionDirectories?: string[];
1820
readonly fork?: ForkProvider;
1921
}
2022

@@ -99,6 +101,8 @@ export class Server {
99101
initMsg.setTmpDirectory(os.tmpdir());
100102
initMsg.setOperatingSystem(platformToProto(os.platform()));
101103
initMsg.setShell(os.userInfo().shell || global.process.env.SHELL || "");
104+
initMsg.setExtraExtensionDirectoriesList(this.options.extraExtensionDirectories || []);
105+
initMsg.setExtraBuiltinExtensionDirectoriesList(this.options.extraBuiltinExtensionDirectories || []);
102106
const srvMsg = new ServerMessage();
103107
srvMsg.setInit(initMsg);
104108
connection.send(srvMsg.serializeBinary());

packages/protocol/src/proto/client.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,6 @@ message WorkingInit {
4242
string shell = 6;
4343
string builtin_extensions_dir = 7;
4444
string extensions_directory = 8;
45+
repeated string extra_extension_directories = 9;
46+
repeated string extra_builtin_extension_directories = 10;
4547
}

packages/protocol/src/proto/client_pb.d.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,16 @@ export class WorkingInit extends jspb.Message {
135135
getExtensionsDirectory(): string;
136136
setExtensionsDirectory(value: string): void;
137137

138+
clearExtraExtensionDirectoriesList(): void;
139+
getExtraExtensionDirectoriesList(): Array<string>;
140+
setExtraExtensionDirectoriesList(value: Array<string>): void;
141+
addExtraExtensionDirectories(value: string, index?: number): string;
142+
143+
clearExtraBuiltinExtensionDirectoriesList(): void;
144+
getExtraBuiltinExtensionDirectoriesList(): Array<string>;
145+
setExtraBuiltinExtensionDirectoriesList(value: Array<string>): void;
146+
addExtraBuiltinExtensionDirectories(value: string, index?: number): string;
147+
138148
serializeBinary(): Uint8Array;
139149
toObject(includeInstance?: boolean): WorkingInit.AsObject;
140150
static toObject(includeInstance: boolean, msg: WorkingInit): WorkingInit.AsObject;
@@ -155,6 +165,8 @@ export namespace WorkingInit {
155165
shell: string,
156166
builtinExtensionsDir: string,
157167
extensionsDirectory: string,
168+
extraExtensionDirectoriesList: Array<string>,
169+
extraBuiltinExtensionDirectoriesList: Array<string>,
158170
}
159171

160172
export enum OperatingSystem {

packages/protocol/src/proto/client_pb.js

Lines changed: 97 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ if (goog.DEBUG && !COMPILED) {
7272
* @constructor
7373
*/
7474
proto.WorkingInit = function(opt_data) {
75-
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
75+
jspb.Message.initialize(this, opt_data, 0, -1, proto.WorkingInit.repeatedFields_, null);
7676
};
7777
goog.inherits(proto.WorkingInit, jspb.Message);
7878
if (goog.DEBUG && !COMPILED) {
@@ -759,6 +759,13 @@ proto.ServerMessage.prototype.hasSharedProcessActive = function() {
759759

760760

761761

762+
/**
763+
* List of repeated fields within this message type.
764+
* @private {!Array<number>}
765+
* @const
766+
*/
767+
proto.WorkingInit.repeatedFields_ = [9,10];
768+
762769

763770

764771
if (jspb.Message.GENERATE_TO_OBJECT) {
@@ -795,7 +802,9 @@ proto.WorkingInit.toObject = function(includeInstance, msg) {
795802
operatingSystem: jspb.Message.getFieldWithDefault(msg, 5, 0),
796803
shell: jspb.Message.getFieldWithDefault(msg, 6, ""),
797804
builtinExtensionsDir: jspb.Message.getFieldWithDefault(msg, 7, ""),
798-
extensionsDirectory: jspb.Message.getFieldWithDefault(msg, 8, "")
805+
extensionsDirectory: jspb.Message.getFieldWithDefault(msg, 8, ""),
806+
extraExtensionDirectoriesList: jspb.Message.getRepeatedField(msg, 9),
807+
extraBuiltinExtensionDirectoriesList: jspb.Message.getRepeatedField(msg, 10)
799808
};
800809

801810
if (includeInstance) {
@@ -864,6 +873,14 @@ proto.WorkingInit.deserializeBinaryFromReader = function(msg, reader) {
864873
var value = /** @type {string} */ (reader.readString());
865874
msg.setExtensionsDirectory(value);
866875
break;
876+
case 9:
877+
var value = /** @type {string} */ (reader.readString());
878+
msg.addExtraExtensionDirectories(value);
879+
break;
880+
case 10:
881+
var value = /** @type {string} */ (reader.readString());
882+
msg.addExtraBuiltinExtensionDirectories(value);
883+
break;
867884
default:
868885
reader.skipField();
869886
break;
@@ -949,6 +966,20 @@ proto.WorkingInit.serializeBinaryToWriter = function(message, writer) {
949966
f
950967
);
951968
}
969+
f = message.getExtraExtensionDirectoriesList();
970+
if (f.length > 0) {
971+
writer.writeRepeatedString(
972+
9,
973+
f
974+
);
975+
}
976+
f = message.getExtraBuiltinExtensionDirectoriesList();
977+
if (f.length > 0) {
978+
writer.writeRepeatedString(
979+
10,
980+
f
981+
);
982+
}
952983
};
953984

954985

@@ -1081,4 +1112,68 @@ proto.WorkingInit.prototype.setExtensionsDirectory = function(value) {
10811112
};
10821113

10831114

1115+
/**
1116+
* repeated string extra_extension_directories = 9;
1117+
* @return {!Array<string>}
1118+
*/
1119+
proto.WorkingInit.prototype.getExtraExtensionDirectoriesList = function() {
1120+
return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 9));
1121+
};
1122+
1123+
1124+
/** @param {!Array<string>} value */
1125+
proto.WorkingInit.prototype.setExtraExtensionDirectoriesList = function(value) {
1126+
jspb.Message.setField(this, 9, value || []);
1127+
};
1128+
1129+
1130+
/**
1131+
* @param {string} value
1132+
* @param {number=} opt_index
1133+
*/
1134+
proto.WorkingInit.prototype.addExtraExtensionDirectories = function(value, opt_index) {
1135+
jspb.Message.addToRepeatedField(this, 9, value, opt_index);
1136+
};
1137+
1138+
1139+
/**
1140+
* Clears the list making it empty but non-null.
1141+
*/
1142+
proto.WorkingInit.prototype.clearExtraExtensionDirectoriesList = function() {
1143+
this.setExtraExtensionDirectoriesList([]);
1144+
};
1145+
1146+
1147+
/**
1148+
* repeated string extra_builtin_extension_directories = 10;
1149+
* @return {!Array<string>}
1150+
*/
1151+
proto.WorkingInit.prototype.getExtraBuiltinExtensionDirectoriesList = function() {
1152+
return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 10));
1153+
};
1154+
1155+
1156+
/** @param {!Array<string>} value */
1157+
proto.WorkingInit.prototype.setExtraBuiltinExtensionDirectoriesList = function(value) {
1158+
jspb.Message.setField(this, 10, value || []);
1159+
};
1160+
1161+
1162+
/**
1163+
* @param {string} value
1164+
* @param {number=} opt_index
1165+
*/
1166+
proto.WorkingInit.prototype.addExtraBuiltinExtensionDirectories = function(value, opt_index) {
1167+
jspb.Message.addToRepeatedField(this, 10, value, opt_index);
1168+
};
1169+
1170+
1171+
/**
1172+
* Clears the list making it empty but non-null.
1173+
*/
1174+
proto.WorkingInit.prototype.clearExtraBuiltinExtensionDirectoriesList = function() {
1175+
this.setExtraBuiltinExtensionDirectoriesList([]);
1176+
};
1177+
1178+
10841179
goog.object.extend(exports, proto);

packages/protocol/test/server.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import { createClient } from "./helpers";
33
describe("Server", () => {
44
const dataDirectory = "/tmp/example";
55
const workingDirectory = "/working/dir";
6+
const extensionsDirectory = "/tmp/example";
67
const builtInExtensionsDirectory = "/tmp/example";
78
const cacheDirectory = "/tmp/cache";
89
const client = createClient({
10+
extensionsDirectory,
911
builtInExtensionsDirectory,
1012
cacheDirectory,
1113
dataDirectory,

packages/server/src/cli.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,19 @@ import opn = require("opn");
1616

1717
import * as commander from "commander";
1818

19+
const collect = <T>(value: T, previous: T[]): T[] => {
20+
return previous.concat(value);
21+
};
22+
1923
commander.version(process.env.VERSION || "development")
2024
.name("code-server")
2125
.description("Run VS Code on a remote server.")
2226
.option("--cert <value>")
2327
.option("--cert-key <value>")
24-
.option("-e, --extensions-dir <dir>", "Set the root path for extensions.")
25-
.option("-d --user-data-dir <dir>", " Specifies the directory that user data is kept in, useful when running as root.")
28+
.option("-e, --extensions-dir <dir>", "Override the main default path for user extensions.")
29+
.option("--extra-extensions-dir [dir]", "Path to an extra user extension directory (repeatable).", collect, [])
30+
.option("--extra-builtin-extensions-dir [dir]", "Path to an extra built-in extension directory (repeatable).", collect, [])
31+
.option("-d --user-data-dir <dir>", "Specifies the directory that user data is kept in, useful when running as root.")
2632
.option("--data-dir <value>", "DEPRECATED: Use '--user-data-dir' instead. Customize where user-data is stored.")
2733
.option("-h, --host <value>", "Customize the hostname.", "0.0.0.0")
2834
.option("-o, --open", "Open in the browser on startup.", false)
@@ -59,6 +65,8 @@ const bold = (text: string | number): string | number => {
5965

6066
readonly userDataDir?: string;
6167
readonly extensionsDir?: string;
68+
readonly extraExtensionsDir?: string[];
69+
readonly extraBuiltinExtensionsDir?: string[];
6270

6371
readonly dataDir?: string;
6472
readonly password?: string;
@@ -84,6 +92,9 @@ const bold = (text: string | number): string | number => {
8492

8593
const dataDir = path.resolve(options.userDataDir || options.dataDir || path.join(dataHome, "code-server"));
8694
const extensionsDir = options.extensionsDir ? path.resolve(options.extensionsDir) : path.resolve(dataDir, "extensions");
95+
const builtInExtensionsDir = path.resolve(buildDir || path.join(__dirname, ".."), "build/extensions");
96+
const extraExtensionDirs = options.extraExtensionsDir ? options.extraExtensionsDir.map((p) => path.resolve(p)) : [];
97+
const extraBuiltinExtensionDirs = options.extraBuiltinExtensionsDir ? options.extraBuiltinExtensionsDir.map((p) => path.resolve(p)) : [];
8798
const workingDir = path.resolve(args[0] || process.cwd());
8899
const dependenciesDir = path.join(os.tmpdir(), "code-server/dependencies");
89100

@@ -101,6 +112,8 @@ const bold = (text: string | number): string | number => {
101112
fse.mkdirp(extensionsDir),
102113
fse.mkdirp(workingDir),
103114
fse.mkdirp(dependenciesDir),
115+
...extraExtensionDirs.map((p) => fse.mkdirp(p)),
116+
...extraBuiltinExtensionDirs.map((p) => fse.mkdirp(p)),
104117
]);
105118

106119
const unpackExecutable = (binaryName: string): void => {
@@ -116,7 +129,6 @@ const bold = (text: string | number): string | number => {
116129
// tslint:disable-next-line no-any
117130
(<any>global).RIPGREP_LOCATION = path.join(dependenciesDir, "rg");
118131

119-
const builtInExtensionsDir = path.resolve(buildDir || path.join(__dirname, ".."), "build/extensions");
120132
if (options.bootstrapFork) {
121133
const modulePath = options.bootstrapFork;
122134
if (!modulePath) {
@@ -192,7 +204,7 @@ const bold = (text: string | number): string | number => {
192204
// TODO: fill in appropriate doc url
193205
logger.info("Additional documentation: http://github.com/cdr/code-server");
194206
logger.info("Initializing", field("data-dir", dataDir), field("extensions-dir", extensionsDir), field("working-dir", workingDir), field("log-dir", logDir));
195-
const sharedProcess = new SharedProcess(dataDir, extensionsDir, builtInExtensionsDir);
207+
const sharedProcess = new SharedProcess(dataDir, extensionsDir, builtInExtensionsDir, extraExtensionDirs, extraBuiltinExtensionDirs);
196208
const sendSharedProcessReady = (socket: WebSocket): void => {
197209
const active = new SharedProcessActive();
198210
active.setSocketPath(sharedProcess.socketPath);
@@ -247,6 +259,8 @@ const bold = (text: string | number): string | number => {
247259
serverOptions: {
248260
extensionsDirectory: extensionsDir,
249261
builtInExtensionsDirectory: builtInExtensionsDir,
262+
extraExtensionDirectories: extraExtensionDirs,
263+
extraBuiltinExtensionDirectories: extraBuiltinExtensionDirs,
250264
dataDirectory: dataDir,
251265
workingDirectory: workingDir,
252266
cacheDirectory: cacheHome,

packages/server/src/vscode/sharedProcess.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ export class SharedProcess {
3939
private readonly userDataDir: string,
4040
private readonly extensionsDir: string,
4141
private readonly builtInExtensionsDir: string,
42+
private readonly extraExtensionDirs: string[],
43+
private readonly extraBuiltinExtensionDirs: string[],
4244
) {
4345
this.retry.run();
4446
}
@@ -134,6 +136,8 @@ export class SharedProcess {
134136
"builtin-extensions-dir": this.builtInExtensionsDir,
135137
"user-data-dir": this.userDataDir,
136138
"extensions-dir": this.extensionsDir,
139+
"extra-extension-dirs": this.extraExtensionDirs,
140+
"extra-builtin-extension-dirs": this.extraBuiltinExtensionDirs,
137141
},
138142
logLevel: this.logger.level,
139143
sharedIPCHandle: this.socketPath,

0 commit comments

Comments
 (0)