code-server icon indicating copy to clipboard operation
code-server copied to clipboard

[Feat]: Way to invoke code-server with --disable-workspace-trust option.

Open GrahamDumpleton opened this issue 3 years ago • 1 comments

What is your suggestion?

VS Code now has the workspace trust feature which requires a workspace to be trusted before working in it. Upstream VS Code does have a command line option --disable-workspace-trust to disable this feature:

  • https://code.visualstudio.com/docs/editor/workspace-trust#_commandline-switch

but the same option is not available in code-server. Further, adding settings to:

  • ~/.local/share/code-server/User/settings.json

such as:

    "security.workspace.trust.banner": "never",
    "security.workspace.trust.untrustedFiles": "open"

have no effect since VS Code settings in the main are stored in the browser now and file based settings aren't used.

The ask is for a way to be able to disable workspace trust mechanism from the command line when running code-server.

Why do you want this feature?

Am embedding code-server in another hosted web application where precisely controlling what files are available and users needing to trust the workspace is not a great workflow and is unnecessary.

Further, we are using a VS Code extension which allows remote API access to automate actions in VS Code from the web application code-server is embedded in, such as open a file, but this extension's workflow is broken by the workspace trust feature because a file cannot be opened via the remote API until the workspace is trusted.

Are there any workarounds to get this functionality today?

No idea.

Are you interested in submitting a PR for this?

I have no knowledge on how it would be added.

GrahamDumpleton avatar Jun 22 '22 01:06 GrahamDumpleton

Found was not using the correct setting. Need to set:

"security.workspace.trust.enabled": false

which isn't visible from UI settings page and have to work out can use it from VS Code docs.

A command line option --disable-workspace-trust would still make this easier for where want to disable it just for a single session.

GrahamDumpleton avatar Jun 22 '22 01:06 GrahamDumpleton