Skip to content

Add proposed API flag #2002

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 28 additions & 7 deletions ci/dev/vscode.patch
Original file line number Diff line number Diff line change
Expand Up @@ -1269,10 +1269,10 @@ index 0000000000..56331ff1fc
+require('../../bootstrap-amd').load('vs/server/entry');
diff --git a/src/vs/server/ipc.d.ts b/src/vs/server/ipc.d.ts
new file mode 100644
index 0000000000..7e1cd270c8
index 0000000000..16ed214d94
--- /dev/null
+++ b/src/vs/server/ipc.d.ts
@@ -0,0 +1,115 @@
@@ -0,0 +1,119 @@
+/**
+ * External interfaces for integration into code-server over IPC. No vs imports
+ * should be made in this file.
Expand Down Expand Up @@ -1321,6 +1321,7 @@ index 0000000000..7e1cd270c8
+export interface Args {
+ 'user-data-dir'?: string;
+
+ 'enable-proposed-api'?: string[];
+ 'extensions-dir'?: string;
+ 'builtin-extensions-dir'?: string;
+ 'extra-extensions-dir'?: string[];
Expand Down Expand Up @@ -1368,7 +1369,10 @@ index 0000000000..7e1cd270c8
+ readonly workspaceUri?: UriComponents;
+ readonly logLevel?: number;
+ readonly workspaceProvider?: {
+ payload: [["userDataPath", string]];
+ payload: [
+ ["userDataPath", string],
+ ["enableProposedApi", string],
+ ];
+ };
+ };
+ readonly remoteUserDataUri: UriComponents;
Expand Down Expand Up @@ -2477,10 +2481,10 @@ index 0000000000..3c74512192
+}
diff --git a/src/vs/server/node/server.ts b/src/vs/server/node/server.ts
new file mode 100644
index 0000000000..f2c16b9f81
index 0000000000..4b88fedb2f
--- /dev/null
+++ b/src/vs/server/node/server.ts
@@ -0,0 +1,282 @@
@@ -0,0 +1,285 @@
+import * as fs from 'fs';
+import * as net from 'net';
+import * as path from 'path';
Expand Down Expand Up @@ -2580,7 +2584,10 @@ index 0000000000..f2c16b9f81
+ remoteAuthority: options.remoteAuthority,
+ logLevel: getLogLevel(environment),
+ workspaceProvider: {
+ payload: [["userDataPath", environment.userDataPath]],
+ payload: [
+ ["userDataPath", environment.userDataPath],
+ ["enableProposedApi", JSON.stringify(options.args["enable-proposed-api"] || [])]
+ ],
+ },
+ },
+ remoteUserDataUri: transformer.transformOutgoing(URI.file(environment.userDataPath)),
Expand Down Expand Up @@ -3075,7 +3082,7 @@ index 6e3182a696..7df85da165 100644
};

diff --git a/src/vs/workbench/services/environment/browser/environmentService.ts b/src/vs/workbench/services/environment/browser/environmentService.ts
index ba2701ec54..efea3bd5bc 100644
index ba2701ec54..4d4aaa6958 100644
--- a/src/vs/workbench/services/environment/browser/environmentService.ts
+++ b/src/vs/workbench/services/environment/browser/environmentService.ts
@@ -121,8 +121,18 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
Expand All @@ -3098,6 +3105,20 @@ index ba2701ec54..efea3bd5bc 100644

@memoize
get settingsResource(): URI { return joinPath(this.userRoamingDataHome, 'settings.json'); }
@@ -284,7 +294,12 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
extensionHostDebugEnvironment.params.port = parseInt(value);
break;
case 'enableProposedApi':
- extensionHostDebugEnvironment.extensionEnabledProposedApi = [];
+ try {
+ extensionHostDebugEnvironment.extensionEnabledProposedApi = JSON.parse(value);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wtf it only lets you pass in a string?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol yeah I think it's technically possible to put other things in there but that's what the types say.

+ } catch (error) {
+ console.error(error);
+ extensionHostDebugEnvironment.extensionEnabledProposedApi = [];
+ }
break;
}
}
diff --git a/src/vs/workbench/services/extensionManagement/common/extensionEnablementService.ts b/src/vs/workbench/services/extensionManagement/common/extensionEnablementService.ts
index c28b147740..6090200d9c 100644
--- a/src/vs/workbench/services/extensionManagement/common/extensionEnablementService.ts
Expand Down
5 changes: 5 additions & 0 deletions src/node/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ const options: Options<Required<Args>> = {
description:
"Install or update a VS Code extension by id or vsix. The identifier of an extension is `${publisher}.${name}`. To install a specific version provide `@${version}`. For example: '[email protected]'.",
},
"enable-proposed-api": {
type: "string[]",
description:
"Enable proposed API features for extensions. Can receive one or more extension IDs to enable individually.",
},
"uninstall-extension": { type: "string[]", description: "Uninstall a VS Code extension by id." },
"show-versions": { type: "boolean", description: "Show VS Code extension versions." },
"proxy-domain": { type: "string[]", description: "Domain used for proxying ports." },
Expand Down