Skip to content

Implement reference streaming - #20346

Closed
Nick Snyder (nicksnyder) wants to merge 1 commit into
microsoft:masterfrom
sourcegraph:streamref
Closed

Nick Snyder (nicksnyder) wants to merge 1 commit into
microsoft:masterfrom
sourcegraph:streamref

Conversation

@nicksnyder

@nicksnyder Nick Snyder (nicksnyder) commented Feb 9, 2017 •

Copy link
Copy Markdown
Contributor

This PR implements the necessary changes in vscode to support streaming the response for "Find all references" requests as described in #20010 (please read this issue for complete context).

Streaming results makes reference requests more responsive for large repos since the user does not have to wait for all results to start seeing some results. If the user interacts with the reference results before they have finished streaming in, their position and state will be preserved.

Before merging:

  • Use ProgressCallback
  • Fix CI errors
    src/vs/editor/contrib/referenceSearch/browser/referencesModel.ts:32:32:Unexternalized string found: ":"
    src/vs/editor/contrib/referenceSearch/browser/referencesModel.ts:36:96:Unexternalized string found: ":"
    /home/travis/build/Microsoft/vscode/src/vs/workbench/test/node/api/extHostLanguageFeatures.test.ts(592,11): Supplied parameters do not match any signature of call target.
    

@mention-bot

Copy link
Copy Markdown

Nick Snyder (@nicksnyder), thanks for your PR! By analyzing the history of the files in this pull request, we identified Johannes Rieken (@jrieken) and alexandrudima to be potential reviewers.

@msftclas

Hi Nick Snyder (@nicksnyder), I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. I promise there's no faxing. https://cla.microsoft.com.

TTYL, MSBOT;

* This allows RevealedReference to be passed around (i.e. to Controller)
* and updates to the reference can be seen.
*/
type RevealedReference = { ref: OneReference | undefined };

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am unsure if the Controller should own the state of what is expanded & revealed or if the ReferenceWidget should own the state. Currently the ReferenceWidget does not retain a reference to the Controller and I am unfamiliar with the lifecycle, so this implementation has the ReferenceWidget owning this state and passing it through to the controller.

Comment thread src/vs/vscode.d.ts Outdated
* signaled by returning `undefined`, `null`, or an empty array.
*/
provideReferences(document: TextDocument, position: Position, context: ReferenceContext, token: CancellationToken): ProviderResult<Location[]>;
provideReferences(document: TextDocument, position: Position, context: ReferenceContext, token: CancellationToken, progress: (locations: Location[]) => void): ProviderResult<Location[]>;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Two comments here:

  1. AFAIK this change is backwards compatible because we are adding the callback as a last parameter. VS Code controls all callers (so we can require it to be passed), but implementors of this function can ignore the progress parameter if they want.
  2. Unsure if progress is the right name for this parameter. It is for intermediate results, not for reporting a percent completion. Wasn't sure if I should use the proposed Progress<T> type for this. Thoughts?

@msftgits

Copy link
Copy Markdown

Hi, I am closing and re-opening this PR to bump the CLA bot. Sorry for the inconvenience!

@msftclas

Hi Nick Snyder (@nicksnyder), I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!
We will now validate the agreement and then real humans will evaluate your PR.

TTYL, MSBOT;

@jrieken

Copy link
Copy Markdown
Contributor

I appreciate the effort but the concerns I have expressed in #20010 still exist and I still believe this should be tackled UX first before talking about APIs

@nicksnyder

Copy link
Copy Markdown
Contributor Author

Johannes Rieken (@jrieken) Are you saying that maintaining the users state (e.g. expand/collapse/reveal) is not sufficient? (this PR does maintain that state). Running it locally, the UX proposed by this PR seems very reasonable to me.

If you could run my branch locally and tell me concrete problems with the UX of what I proposed, then I can work on it.

The demo extension has data streaming in very slowly so I could test each case. More than likely results would stream in much quicker. If you are abstractly worried about jittery UI, I could explore throttling UI updates, but that may actually increase jitter compared to allowing results to stream in one at a time.

Nick Snyder (nicksnyder) added a commit to sourcegraph/vscode that referenced this pull request Feb 20, 2017
This is a backport of microsoft#20346 to our patch branch.
I had to remove references to Map since the version of VS Code in our patch branch doesn't support that type.
Nick Snyder (nicksnyder) added a commit to sourcegraph/vscode that referenced this pull request Feb 21, 2017
This is a backport of microsoft#20346 to our patch branch.
I had to remove references to Map since the version of VS Code in our patch branch doesn't support that type.
Quinn Slack (sqs) pushed a commit to sourcegraph/vscode that referenced this pull request Mar 10, 2017
This is a backport of microsoft#20346 to our patch branch.
I had to remove references to Map since the version of VS Code in our patch branch doesn't support that type.
@nicksnyder

Copy link
Copy Markdown
Contributor Author

Going to close this PR as it is out of date and I have a better proposal partially implemented. Will submit a new PR when it is ready.

@github-actions github-actions Bot locked and limited conversation to collaborators Mar 27, 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.

5 participants