Skip to content

Added support for multiple selections in Open Link action#41242

Merged
jrieken merged 3 commits intomicrosoft:masterfrom
mlewand:open-link-multi-selections
Jan 8, 2018
Merged

Added support for multiple selections in Open Link action#41242
jrieken merged 3 commits intomicrosoft:masterfrom
mlewand:open-link-multi-selections

Conversation

@mlewand
Copy link
Contributor

@mlewand mlewand commented Jan 7, 2018

Fixes #41231.

It checks for links in each selection, rather than limiting to a single one.

Unit Tests

tl;dr Unfortunately I was unable to integrate all deps to make tests together.

I'm a fan of TDD, however I had to gave up during unit tests development. As there were many dependencies going on there.

Based on other tests I was able to somehow register LinkDetector contribution to the editor, but that wasn't enough, as it relies on currentOccurrences which is set in updateDecorations and I wasn't able to figure out api to hook it up to the editor. I guess I should try to hook LinkProviderRegistry but I wasn't able to.

Then as a last resort I wanted to stub these dependencies using Sinon, but again, even stubbed methods had quite a few dependencies (getLinkOccurrence method), which would require me to manually create ILink compatible instances - and I don't think this is the best idea.

All the work is available at my open-link-multi-selections-tests branch. Feel free to pull it if you find it helpful to do final touches, or you could point me to how to make it work together.

@jrieken jrieken added this to the December 2017/January 2018 milestone Jan 8, 2018
@jrieken
Copy link
Member

jrieken commented Jan 8, 2018

@mlewand Changes look good but it seems that it needs to be formatted: https://travis-ci.org/Microsoft/vscode/jobs/326035552#L393. Please run 'Format Document' and push those changes. Thanks

@mlewand
Copy link
Contributor Author

mlewand commented Jan 8, 2018

@jrieken oh, sorry that's embarrassing. I have pushed reformatted branch. Feel free to squash.

Any hints on unit tests? I'd feel better if that stuff could be covered with unit tests. We could extract unit tests to a followup PR though.

@jrieken
Copy link
Member

jrieken commented Jan 8, 2018

Thanks, passes the hygiene tests now. Wrt tests I'd say we are OK because the changes aren't risky IMO.

@jrieken jrieken merged commit 5f3a2e8 into microsoft:master Jan 8, 2018
@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.

Open link command does not support multiple selections

2 participants