eclipse.platform.ui icon indicating copy to clipboard operation
eclipse.platform.ui copied to clipboard

[Feature Request] Surround a selection with brackets and quotes in all kind of text editors

Open sergeniously opened this issue 2 years ago • 9 comments

({[<"'Hello'">]})

The greeting above was texted in VSCode's default text editor by typing the word Hello, selecting it and sequentially pressing each opening bracket and quote. Is not it amazing?

In all modern and self-respecting IDEs (aka VSCode, CLion, etc) there is a feature that surrounds a selected text with brackets or quotes when you type an opening bracket or quote: (, {, [, <, ", '. It is an extremely useful feature for those people who value their time.

I would say it is the only thing I'm missing in Eclipse since Eclipse CDT has a Bug 431534 in its Surround with... feature which prepends unwanted spaces for ${word_selection} and so that cannot be considered as an applicable feature.

I've come here with the feature request from eclipse-cdt because I think it would be better implement it in the general TextEditor base class so that every Eclipse plugin will automatically support the feature (which could be optionally enabled/disabled in General / Text Editors preferences).

Furthermore, this feature together with another excellent and unique Eclipse feature of selecting text between brackets by double-click could make Eclipse the currently best IDE in the World!

Thank you in advance.

sergeniously avatar Sep 19 '23 20:09 sergeniously

@sergeniously

Probably you have plans to contribute. All modern self-respecting developers contribute to open source:

https://github.com/eclipse-platform/.github/blob/main/CONTRIBUTING.md

merks avatar Sep 19 '23 20:09 merks

@merks I would be glad to try to contribute if you at least guided me to source files I have to consider to implement the feature.

sergeniously avatar Sep 20 '23 09:09 sergeniously

If you create an development environment with all the source (as in the link), then you can determine something similar in the editor as it currently functions, and search the source to find out how that's implemented, and, using the debugger to set breakpoints, to see how it's really working at runtime. Unfortunately few are likely to have much time to offer detailed guidance; I'm personally not familiar with the editor implementation to provide such guidance. Perhaps some other other contributor will see this exchange and offer better suggestions.

merks avatar Sep 20 '23 09:09 merks

org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.BracketInserter might be a good starting point

sratz avatar Sep 20 '23 11:09 sratz

How is this basic feature not implemented yet ^^

codeofandrin avatar Aug 30 '24 11:08 codeofandrin

https://github.com/eclipse-platform/eclipse.platform.ui/pull/1718 is work in progress towards that.

mickaelistria avatar Aug 30 '24 11:08 mickaelistria

Sorry, my message was innapropriate, it just drives me crazy that this isn't implemented since years 😄. It's an asked feature since over 9 years (at least this SO question suggests so) which every other recognized IDE has implemented by default (and it's not the only basic feature that is missing in Eclipse).

codeofandrin avatar Aug 30 '24 13:08 codeofandrin

It's an asked feature since over 9 years

If people would not just asking for features but help implementing them it would probably already be there, 9 years seem enough time for that ;-)

and it's not the only basic feature that is missing in Eclipse

I'm working with Eclipse for > 10 yeas (and others even more) even without the "basic features missing" so at least it seem to offer some useful things for a while.

laeubi avatar Aug 30 '24 13:08 laeubi

Contributions are welcome to the project. Random comments which do not provide anything constructive are actually wasting everyone's time.

mickaelistria avatar Aug 30 '24 13:08 mickaelistria

Fixed with #2051 (some fixes yet to be implemented though, but feature is here and following issues are tracked in different tickets)

mickaelistria avatar Dec 09 '24 17:12 mickaelistria