Skip to content
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 tokens for timeout in dynamic completions #2434

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

davidanthoff
Copy link
Member

This rewrites the timeout functionality in terms of cancel tokens, which I think is a) more in line with the general VS Code patterns and b) will allow us to cancel even more aggressively once we support cancel tokens across the JSONRPC boundary.

The code for the two functions is copied from https://github.com/microsoft/vscode/blob/be7046f09199da197a2b566f90f51f7e2653fed7/src/vs/platform/remote/common/remoteAgentConnection.ts#L89, I don't fully understand why that isn't just part of the json-rpc npm package, but whatever :)

The one thing that is not entirely clear to me is whether we should just call return if cancelled, or return an empty result? The old code seemed to do both things.

@davidanthoff davidanthoff added this to the Backlog milestone Sep 6, 2021
completionPromise,
cancelPromise
])
const items = await conn.sendRequest(requestTypeGetCompletionItems, { line, mod }) // TODO pass newToken once we support tokens in JSONRPC.jl
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't this mean that we always wait for this to go through before returning, unless cancellation got requested before we dispatch this request?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, yes, you're right. I don't know actually what the semantics are if we were to pass the token to the sendRequest call: would this await here finish right away, irrespective of what is happening on the server? In that case we could just pass the token here, even if the server doesn't yet implement cancel notifications. Or would it send the cancel notification message to the server and then wait until the request returns?

Copy link
Member

Choose a reason for hiding this comment

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

The latter, I think.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, seems more likely...

@davidanthoff davidanthoff removed this from the Backlog milestone Oct 15, 2022
Base automatically changed from avi/dynamics to master April 6, 2023 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants