Skip to content

Commit

Permalink
Only write dev.containers.defaultExtensions setting if devcontainers …
Browse files Browse the repository at this point in the history
…extension is installed (#116)
  • Loading branch information
jeanp413 authored Nov 11, 2024
1 parent 05ae415 commit 34bf004
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Gitpod",
"description": "Gitpod Support",
"publisher": "gitpod",
"version": "0.0.178",
"version": "0.0.179",
"license": "MIT",
"icon": "resources/gitpod.png",
"repository": {
Expand Down
27 changes: 14 additions & 13 deletions src/services/remoteService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,7 @@ export class RemoteService extends Disposable implements IRemoteService {

async updateRemoteConfig() {
const remoteSSHconfig = vscode.workspace.getConfiguration('remote.SSH');
const defaultSSHExtConfigInfo =
remoteSSHconfig.inspect<string[]>('defaultExtensions');
const defaultSSHExtConfigInfo = remoteSSHconfig.inspect<string[]>('defaultExtensions');
const defaultSSHExtensions = defaultSSHExtConfigInfo?.globalValue ?? [];
if (!defaultSSHExtensions.includes('gitpod.gitpod-remote-ssh')) {
defaultSSHExtensions.unshift('gitpod.gitpod-remote-ssh');
Expand All @@ -343,17 +342,19 @@ export class RemoteService extends Disposable implements IRemoteService {
);
}

const remoteDevContainerConfig =
vscode.workspace.getConfiguration('dev.containers');
const defaultDevContainerExtConfigInfo = remoteDevContainerConfig.inspect<string[]>('defaultExtensions');
const defaultDevContainerExtensions = defaultDevContainerExtConfigInfo?.globalValue ?? [];
if (!defaultDevContainerExtensions.includes('gitpod.gitpod-remote-ssh')) {
defaultDevContainerExtensions.unshift('gitpod.gitpod-remote-ssh');
await remoteDevContainerConfig.update(
'defaultExtensions',
defaultDevContainerExtensions,
vscode.ConfigurationTarget.Global,
);
const msVscodeRemoteContainersExt = vscode.extensions.getExtension('ms-vscode-remote.remote-containers');
if (msVscodeRemoteContainersExt) {
const remoteDevContainerConfig = vscode.workspace.getConfiguration('dev.containers');
const defaultDevContainerExtConfigInfo = remoteDevContainerConfig.inspect<string[]>('defaultExtensions');
const defaultDevContainerExtensions = defaultDevContainerExtConfigInfo?.globalValue ?? [];
if (!defaultDevContainerExtensions.includes('gitpod.gitpod-remote-ssh')) {
defaultDevContainerExtensions.unshift('gitpod.gitpod-remote-ssh');
await remoteDevContainerConfig.update(
'defaultExtensions',
defaultDevContainerExtensions,
vscode.ConfigurationTarget.Global,
);
}
}

const currentConfigFile = remoteSSHconfig.get<string>('configFile');
Expand Down

0 comments on commit 34bf004

Please sign in to comment.