-
Notifications
You must be signed in to change notification settings - Fork 22
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
Use asExternalUri For Server Url #196
Use asExternalUri For Server Url #196
Conversation
I'm re-submitting this PR. I attempted to make this change before, but multiple bugs were brought up for the remote use-case. I would like for this change to be merged in, and to address the concerns in PR #173 as separate feature additions / merge requests. The changes that I tried to implement before were way out of scope of the base change. |
case VSCODE_MESSAGES.EXPERIMENT_SELECTED: | ||
// Need to block scope the variable 'experiment'... | ||
if (true) { | ||
let experiment: Experiment | undefined; | ||
if (message.data && message.data.wrapper) { | ||
experiment = convertSignalExperiment(JSONBig.parse(message.data.wrapper)); | ||
} else { | ||
experiment = undefined; | ||
} | ||
signalManager().fireExperimentSelectedSignal(experiment); | ||
} | ||
signalManager().fireExperimentSelectedSignal(experiment); | ||
} | ||
return; |
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.
The variable name experiment
is also used above in line 107 of this code.
I was getting an error for "'experiment' has already been declared". So, I block-scoped the code to appease the typescript compiler. Otherwise, it would not build.
No logic changed here.
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.
No need of an if(true)
statement, just wrap both switch cases with braces so that any variable declared within that block is only visible within the block.
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 just removed this code from the PR.
7b3f2ec
to
48f7b23
Compare
@williamsyang-work Please ignore the 3PP license check CI job failing ATM - it's nothing related to your PR and will not prevent merging. FYI, IP check tickets are opened for the baseline dependencies reported as errors (unapproved), and they should be approved soon, letting the job pass. But until then, no worries. |
c4bfc0c
to
c61d1d9
Compare
The issue of pending back-end calls reported here #173 (review), that causes the application not to function until the port forwarding manually removed, is still an issue. Could you please describe what's the plan to address them? |
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.
It looks like that this update breaks the local case. When testing it for a local use case I noticed some issues when opening a trace. The trace explorer on the left with the 3 webviews disappear, as well as the status bar indicates that the server is down (while the trace panel is opened in the middle).
const analysisProvider = new AnalysisProvider(); | ||
// TODO: For now, a different command opens traces from file explorer. Remove when we have a proper trace finder | ||
const fileOpenHandler = fileHandler(analysisProvider); | ||
context.subscriptions.push( | ||
vscode.commands.registerCommand('traces.openTraceFile', async (file: vscode.Uri) => { | ||
await startTraceServerIfAvailable(file.fsPath); | ||
await updateUris(); |
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 we should call it at every open. updateUris() will each webview (e.g. open traces) with the new url and the tspclient instance is refreshed. This will require a refressh of each webview which doesn't exist. I think the URLs should be only updated when changed.
@@ -162,6 +168,7 @@ export function activate(context: vscode.ExtensionContext): ExternalAPI { | |||
return; | |||
} | |||
await startTraceServerIfAvailable(traceUri.fsPath); | |||
await updateUris(); |
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.
same comment here. The URL should not be updated everytime a trace is opened. It should be only be done if necessary.
b3142da
to
cc4d9e5
Compare
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.
Is this still a draft? There are compilation errors as well linting error. Ignore the license check, that error will go away once license check by Eclipse is finished.
287bc2a
to
4dd1784
Compare
Refactors TspClientProvider to use VSCode.asExternalUri method to generate a dynamic uri. This will automatically detect if we are using remote-ssh, initialize port forwarding to the server's port, and change the provided url to a web-worker that is managing port-forwarding to the VSCode backend. Removes the TraceServerUrlManager class. The functionality to generate new TspClients when the Uri is changed is moved into this repo's TspClientProvider implementation. Removes the tspClient.ts file. This functionality did not work with the async nature of asExternalUri, and was not designed to handle Uri changes. Most functionality was already implemented in TspClientProviderImpl.ts. Creates VSCodeBackendTspClientProvider class. This is a child class of TspClientProviderImpl with expanded functionality that should only be used on the extension's backend. Signed-off-by: Will Yang <[email protected]>
4dd1784
to
dc685dc
Compare
I just fixed the linting errors, build errors, and rebased with the current master. It's now ready to continue the review process! |
I'm not getting this behavior when I am running the local version. But it seems Neel is also running into this error with the current code: #204 (comment). |
When using the latest update, I didn't get the issue for the local case anymore. So, I focused on the remote case, which there seems to be differences when running in vscodium vs vscode. I need investigate more to be able to pinpoint what's going on. I'm trying the local case as well again. |
url-change-fix-not-working.mp4 |
Hope this helps in being able to reproduce it! |
Closing this PR. |
Refactors TspClientProvider to use VSCode.asExternalUri method to generate a dynamic
uri. This will automatically detect if we are using remote-ssh, initialize port forwarding
to the server's port, and change the provided url to a web-worker that is managing
port-forwarding to the VSCode backend.
Removes the TraceServerUrlManager class. The functionality to generate new TspClients
when the Uri is changed is moved into this repo's TspClientProvider implementation.
Removes the tspClient.ts file. This functionality did not work with the async nature of
asExternalUri, and was not designed to handle Uri changes. Most functionality was already
implemented in TspClientProviderImpl.ts.
Creates VSCodeBackendTspClientProvider class. This is a child class of TspClientProviderImpl
with expanded functionality that should only be used on the extension's backend.
Signed-off-by: Will Yang [email protected]