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

Typing open bracket should surround the selected text with brackets

Open lathapatil opened this issue 1 year ago • 3 comments

Surround the selected text with brackets in all editors when an opening bracket is inserted. Brackets included are (,<,[,{,",',`

Fixes https://github.com/eclipse-platform/eclipse.platform.ui/issues/865 #1141

Linked to #1718

lathapatil avatar Jul 08 '24 06:07 lathapatil

Test Results

 1 818 files  +  483   1 818 suites  +483   1h 53m 11s :stopwatch: + 50m 49s  7 712 tests +    1   7 483 :white_check_mark: ±    0  228 :zzz: ±  0  1 :x: +1  24 297 runs  +4 430  23 549 :white_check_mark: +4 197  747 :zzz: +232  1 :x: +1 

For more details on these failures, see this check.

Results for commit 284107e1. ± Comparison against base commit 54479d7a.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Jul 08 '24 07:07 github-actions[bot]

@mickaelistria @laeubi is there an issue with this approach or this issue fix is not required now?

lathapatil avatar Sep 18 '24 05:09 lathapatil

I have some concern that changing selection that way is likely to conflict with some other auto editor strategies that would run after this one for the same event and alter the command changing the size of the inserted text, or that would implement a similar strategy to also change the selection. But both are minor and I think the best way to figure it out is to merge. Another thing I noticed, which is not related and is deeper in the editor, is that this very convenient feature wouldn't work for multiple or block text selection. But this seems out of the scope for this change.

So IMO, please just rebase to get the MANIFEST.MF compatible with current master branch and we can merge.

mickaelistria avatar Sep 18 '24 07:09 mickaelistria

Content of this PR is plain wrong as it contains many other unrelated changes.

akurtakov avatar Oct 21 '24 08:10 akurtakov

Content of this PR is plain wrong as it contains many other unrelated changes.

Its my mistake. I am checking on it.

lathapatil avatar Oct 21 '24 08:10 lathapatil

this very convenient feature wouldn't work for multiple or block text selection

@mickaelistria It works in generic editor for all cases but works in Java editor only if text blocks surrounds with { and ` Is it expected or is further analysis required to fix this in java editor as well?

https://github.com/user-attachments/assets/4604c702-c1fc-4eb8-9fe2-3804008bad7c

lathapatil avatar Oct 21 '24 09:10 lathapatil

The Java editor has some extra configuration here and there to tweak the edition experience. I don't mind merging it if it works for the generic editor and most text editors. The JDT part will probably have to be investigated in JDT directly anyway, without need to fix anything here. I'm sorry we missed to merge this change earlier, since we're in RC phase, it's most likely better to wait until next stream starts (so we have time to get feedback and improve it if necessary).

mickaelistria avatar Nov 19 '24 08:11 mickaelistria

Now is a good time to merge. Thank you! Please add a note to the noteworthy documentation about this new feature.

mickaelistria avatar Dec 06 '24 15:12 mickaelistria

Thank you for this PR! @mickaelistria the next time please make sure that such long standing PRs are rebased so that the version-bump bot can do it's duty. This is now missing, but I have created https://github.com/eclipse-platform/eclipse.platform.ui/pull/2598, to apply it.

HannesWell avatar Dec 06 '24 17:12 HannesWell

Oops, sorry and thank you for addressing it!

mickaelistria avatar Dec 06 '24 19:12 mickaelistria

@mickaelistria you suggest that JDT can tweak this, but the way it is configured doesn't allow subclasses to override the behavior. What did you have in mind when you gave green light to merge?

szarnekow avatar Dec 08 '24 12:12 szarnekow

please fix https://github.com/eclipse-jdt/eclipse.jdt.ui/issues/1843

jukzi avatar Dec 09 '24 07:12 jukzi

please fix eclipse-jdt/eclipse.jdt.ui#1843

Please also consider comments from @szarnekow and do not fix JDT UI, but improve platform code - the change here shouldn't break clients!

iloveeclipse avatar Dec 09 '24 07:12 iloveeclipse

Just discovered that this change also broke source hover functionality in Java editor (Shift + Hover over method to see implementation) => https://github.com/eclipse-platform/eclipse.platform.ui/issues/2600

iloveeclipse avatar Dec 09 '24 08:12 iloveeclipse

I will check the root cause and fix it ASAP . Thanks for reviewing .

lathapatil avatar Dec 09 '24 08:12 lathapatil

Where is the feature? The option is lost in the last Eclipse builds. What happened?

sergeniously avatar Feb 20 '25 14:02 sergeniously

The feature seems available by default in most text ediors; but the Java Editor seems to override it so it's not available for Java files. An issue should be opened to eclipse-jdt (if not already done) to make this work there too.

mickaelistria avatar Feb 20 '25 15:02 mickaelistria

I use CDT and there are no editors that supports this features. But a few updates ago it'd been working. I'm pretty sure there was an option in General/Text Editors preferences. And now it's gone. What am I doing wrong?

eclipse1 eclipse2

sergeniously avatar Feb 23 '25 06:02 sergeniously