eclipse-platform / eclipse.platform.ui

Eclipse Platform
https://projects.eclipse.org/projects/eclipse.platform
Eclipse Public License 2.0
81 stars 182 forks source link

Provide shortcuts/commands for incremental multiselection/multiple carets in text editors #2410

Open Adrodoc55 opened 1 week ago

Adrodoc55 commented 1 week ago

Let's make sure issue is not already fixed in latest builds first.

Suggestion

It seems to me like this issue has been forgotten for a few years even though development was already started: https://bugs.eclipse.org/bugs/show_bug.cgi?id=576377 I am working with eclipse almost every day and for me this is one of the (if not the) most important missing features of the text editor. With "Search All" and the commands "Multi caret down" and "Multi caret up" eclipse is already soo close to supporting this. It would be a blessing if this feature got added and searching though the internet I came across alot of people wishing for this feature.

Since Bugzilla is deprecated and I couldn't find this issue here on GitHub I figured it might be helpful to post this here.

Community

mickaelistria commented 1 week ago

Feel free to make a suggestion, and even to submit a PR for it. Note that it must not conflict with an already attributed shortcut (in Preferences > General > Keys). You can try adding your suggestions for the Multi Caret Up/Down commands in that page to ensure they work fine.

Wittmaxi commented 1 week ago

This can be implemented easily with the use of the FindReplaceLogic class. This action should be modeled after the FindNextAction

mickaelistria commented 1 week ago

Ah, it seems like I misunderstood, what you'd like is basically a "Also select next occurrence" ?

Adrodoc55 commented 1 week ago

Ah, it seems like I misunderstood, what you'd like is basically a "Also select next occurrence" ?

Yes, after maybe rename and autocomplete, this is probably my most used shortcut in VSCode, because it is soo useful. There it's called editor.action.addSelectionToNextFindMatch and has the shortcut CTRL+D: https://code.visualstudio.com/docs/editor/codebasics#_multiple-selections-multicursor

In VSCode it works like this:

I hope I covered all edge cases.

Adrodoc55 commented 1 week ago

For reference if anyone finds this helpful here is the implementation of this feature in VSCode: https://github.com/microsoft/vscode/blob/3b82f2a5ec39744f0461824fc3fcde33e3eb6547/src/vs/editor/contrib/multicursor/browser/multicursor.ts#L338

Adrodoc55 commented 1 week ago

I'm wondering: if I were to implement this feature (not sure yet if I'll find the time) I am not sure if I would be able to open a PR on GitHub, because GitHub requires 2FA which I won't activate for various reasons. Would you accept a change that I provide via a fork hosted on another host such as https://codeberg.org?

mickaelistria commented 1 week ago

Would you accept a change that I provide via a fork hosted on another host such as https://codeberg.org/?

I don't think we could do this easily. 2FA is required to prevent from some supply-chain attacks; workflows that bypass 2FA are considered unsafe by the Eclipse Foundation.