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

Command and Keybinding for adding multi cursor from search result #82510

Merged
merged 6 commits into from Nov 26, 2019
Merged

Command and Keybinding for adding multi cursor from search result #82510

merged 6 commits into from Nov 26, 2019

Conversation

njkevlani
Copy link
Contributor

This PR fixes #81407

options: {
preserveFocus: false,
pinned: true,
selection,
Copy link
Member

Choose a reason for hiding this comment

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

Is this selection necessary since you select everything in the next block?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this selection is necessary, because the next block that selects everything uses this selection (via let findController = CommonFindController.get(codeEditor)).

What that block does is, select all occurrences of what is selected right now.

Copy link
Member

Choose a reason for hiding this comment

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

I see, I was misunderstanding. I think this isn't exactly what we want then because it should select all of the matches from the search view, not "all occurrences of what is selected right now".

For example, all the matches could be different if you are matching a regex, and some identical text in a different place in the document may not actually match. Does this work without the second block at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This does not work for regex. I'll fix it with a commit in a few days :)

Copy link
Contributor Author

@njkevlani njkevlani left a comment

Choose a reason for hiding this comment

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

options: {
preserveFocus: false,
pinned: true,
selection,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this selection is necessary, because the next block that selects everything uses this selection (via let findController = CommonFindController.get(codeEditor)).

What that block does is, select all occurrences of what is selected right now.

Created function selectAllUsingString for this purpose.
@njkevlani
Copy link
Contributor Author

@roblourens Review please :)

@roblourens roblourens added this to the November 2019 milestone Oct 29, 2019
@njkevlani
Copy link
Contributor Author

njkevlani commented Nov 4, 2019

@roblourens Any idea why did check fail?

let isRegex = this.searchWidget.searchInput.getRegex();
let isWholeWords = this.searchWidget.searchInput.getWholeWords();
let isCaseSensitive = this.searchWidget.searchInput.getCaseSensitive();
let contentPattern = this.searchWidget.searchInput.getValue();
Copy link
Member

Choose a reason for hiding this comment

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

This is coming from the search input, not the query, so the user could have changed this without rerunning the search, then it won't be the same, right?

Actually, can we avoid triggering a find, and just select the exact ranges that are in the actual match?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Two questions:

  1. How do I get all the matches in searchView.ts?
  2. Should I create a public wrapper method for _setSelections method and use that in searchView.ts or this task need to be done in some other way?

Copy link
Member

Choose a reason for hiding this comment

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

You have the matches right here in the FileMatchOrMatch

Copy link
Contributor Author

@njkevlani njkevlani Nov 24, 2019

Choose a reason for hiding this comment

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

Review please @roblourens

@roblourens
Copy link
Member

roblourens commented Nov 12, 2019

Sorry for the slow review, I was at a conference

Copy link
Member

@roblourens roblourens left a comment

Choose a reason for hiding this comment

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

Looks good now, but pleae fix the merge conflicts

@roblourens roblourens merged commit 15fea5e into microsoft:master Nov 26, 2019
@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.

[FR] Place Multi-Cursor before every search result
2 participants