-
Notifications
You must be signed in to change notification settings - Fork 14
Improve ports #24
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
Improve ports #24
Conversation
@@ -1028,6 +1030,71 @@ export default class RemoteConnector extends Disposable { | |||
} | |||
} | |||
|
|||
private async configureMachineSettings(wsConfig: WorkspaceConfig) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not this logic implemented in remote extension? It has access to machine setitngs, supervisor and VS Code api. I don't see a point to implement in local extension.
@@ -1057,6 +1124,8 @@ export default class RemoteConnector extends Disposable { | |||
|
|||
await this.context.globalState.update(`${RemoteConnector.SSH_DEST_KEY}${sshDestStr}`, { ...connectionInfo, isFirstConnection: false }); | |||
|
|||
this.configureMachineSettings(workspaceInfo.workspace.config).then(() => this.tunnelPortsFromConfig(workspaceInfo.workspace.config.ports ?? [])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
config.ports are not real ports, they are intitial configuration for supervisor.
We should observe port status endpoint from supervisor and reconcile it with VS Code as here: https://github.com/gitpod-io/openvscode-server/blob/849af772ba8e6a3a2944ccaf004d70cb549d3f3e/extensions/gitpod-web/src/extension.ts#L551-L592
|
||
// settings.json is a json with comments file so we use jsonc-parser library | ||
const settingsJson = parseJson(settingsStr); | ||
if (settingsJson['remote.autoForwardPortsSource'] === undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it is necessary if we are listening to supervisor changes and call asExternalUri. Less VS Code needs to scan is better.
const machineSettingsResource = extRemoteLogsUri.with({ path: path.posix.join(remoteUserDataPath, 'Machine', 'settings.json') }); | ||
try { | ||
let settingsStr: string = '{}'; | ||
const fileExists = await vscode.workspace.fs.stat(machineSettingsResource).then(() => true, () => false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not we use document API to respect dirty changes from a user?
Description
Related Issue(s)
Fixes gitpod-io/gitpod#8377
How to test
Release Notes