Skip to content

include priority in requestItem and add to request queue accordingly#60582

Merged
mjbvz merged 5 commits intomicrosoft:masterfrom
ParkourKarthik:interrupt-references-codelens
Oct 17, 2018
Merged

include priority in requestItem and add to request queue accordingly#60582
mjbvz merged 5 commits intomicrosoft:masterfrom
ParkourKarthik:interrupt-references-codelens

Conversation

@ParkourKarthik
Copy link
Contributor

Tries to fix #60213

@ParkourKarthik
Copy link
Contributor Author

@mjbvz
I hope this is the kind of change you expected. Instead of low and normal priority mark, I've used normal and high. Also, I believe that executeWithoutWaitingForResponse is of higher priority request from the user and changed accordingly.
Kindly review and let me know if I should modify things.

Copy link
Collaborator

@mjbvz mjbvz left a comment

Choose a reason for hiding this comment

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

Right general idea but needs some work:

  • I don't think we should introduce priority levels like low and high. Rather all requests should have the same priority (as they do today) with us specifically marking a few requests as low priority.

  • Make sure to mark the code lens reference's request as low priority since this was the original focus of #60213

  • Don't touch executeWithoutWaitingForResponse. It's separate from this issue

@ParkourKarthik
Copy link
Contributor Author

ParkourKarthik commented Oct 12, 2018

Thanks for the review.

specifically marking a few requests as low priority

Does that mean that we will have to insert all other request in the queue in the beginning of the array?

mark the code lens reference's request as low priority

By marking, do you mean we'll have to get the request type within the push function and based on that we'll have to insert into the queue?

Based on your review remarks, I believe that I'll have to remove the priority property that I introduced. Correct me if I'm wrong.

@mjbvz
Copy link
Collaborator

mjbvz commented Oct 12, 2018

  1. The simplest way to implement this would be to always enqueue normal priority requests in front of low priority requests. When pushing a normal priority request onto the queue, check to see if the previously queued request is a low priority one. If it is, then insert the new request in front of that one instead of at the very end of the queue.

  2. I think it would be best add a new lowPriority flag to the execute function.

  3. Yes, instead of a generic priority property just have a lowPriority boolean property.

Let me know if that makes sense

@ParkourKarthik
Copy link
Contributor Author

I hope I got your points.

  • Additionally, I've considered multiple lowPriority requests at the end of the queue and inserting requests before them.
  • Only the execute function has the flag lowPriority set to true.

Let me know if anything should be updated further.

Copy link
Collaborator

@mjbvz mjbvz left a comment

Choose a reason for hiding this comment

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

Approach for the queue looks good but again make sure to hook this up to mark the references lens requests as low priority.

@ParkourKarthik
Copy link
Contributor Author

ParkourKarthik commented Oct 16, 2018

@mjbvz

hook this up to mark the references lens requests

I couldn't get to the point where the references codelens request is being made to add the flag. Could you please guide me a little on this one. (although I tried to trace)

Copy link
Collaborator

@mjbvz mjbvz left a comment

Choose a reason for hiding this comment

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

Queue changes look good. Please make sure to update the references calls of execute in referencesCodeLens too so that this logic is actually being used somewhere

@mjbvz
Copy link
Collaborator

mjbvz commented Oct 17, 2018

Just saw your comment. Yeah I just realized that we don't directly call execute in this path anymore and instead use a command that invokes this indirectly: https://github.com/Microsoft/vscode/blob/4b8f928808f3fbf4745702d3b558e8ccbe2a726a/extensions/typescript-language-features/src/features/referencesCodeLens.ts#L21

This was a fairly recent change: dc47417

I'll merge this PR in as is and see what we want to do about the references requests

@mjbvz mjbvz merged commit f891d5a into microsoft:master Oct 17, 2018
@mjbvz mjbvz added this to the October 2018 milestone Oct 17, 2018
@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Interrupt references code lens requests if user performs an action

2 participants