# Enclosing inner parens produces unwanted grab of outer parens

Hi, In Wing IDE Personal, if you want to enclose [] within () (or other way around), then instead of ([]), it produces ([)], regardless if it's done using keybindings or selecting manually Source -> Enclose.

It only happens if you want to enclose two different types of brackets/parens. Using it on the same type works normally.

Is there a way to fix it/work around this other than first typing (, then enclosing [], then manually closing with )?

edit retag close merge delete

Sort by » oldest newest most voted

To summarize the useful bits from the other answer that made an incorrect assumption: The Enclose feature requires selecting the text that should be enclosed.

Also, In Wing Pro with the Editor > Auto-Editing > Apply (), [], {} to Selection preference enabled, you can just select and press ( or [ or { to enclose. Or, since Wing Pro auto-closes those by default typing ( following by [ would get you ([|]) where | is the caret. But the auto-editing suite of functionality is not present in Wing Personal.

more

Are you using vi mode? If so, I suspect you need to select one more character to the right since it's not considering the character the block cursor is on to be included in the selection. This is probably a bug. Sometimes we do that sort of thing to match what people have in their finger memories, but I suspect this isn't a case where that would be an issue.

more

Yes, I'm using vi mode. I was not selecting anything, you can get it when you run enclose with (), then right after that enclose with [] :)

PS. I always use vi mode in every editor I use :)

( 2022-05-05 06:57:44 -0500 )edit

Ah, I see. You have to select what you want to enclose. I checked and I think vi mode is doing the right thing, in that the character under the block cursor is considered part of the selection for this. So I think it's just the need to select. Are you expecting it to automatically enclose to the matching ) or ] etc if you are before ( or [ etc? Or find the innermost [] or () etc and enclose that? The implementation currently assumes selection but it might make sense to have a default action if there is no selection.

( 2022-05-05 07:02:02 -0500 )edit
1

BTW, for clarity for others that might see this: In Wing Pro with the Editor > Auto-Editing > Apply (), [], {} to Selection preference enabled, you can just select and press ( or [ or { to enclose. But the auto-editing suite of functionality is not present in Wing Personal.

( 2022-05-05 07:04:03 -0500 )edit

I'm expecting it to automatically enclose right after creation as default behavior when nothing is selected. Example:

test-enclose_with_()--enclose_with_[]- should give me test([*cursor]) instead of test([)*cursor]


I hope that everything what I propose/say is in the right tone :)

( 2022-05-05 07:11:26 -0500 )edit

We'll consider adding that for the case where there is no selection. It's what you would get by default in Wing Pro using the auto-editing features that auto-close (, [, and {.

( 2022-05-05 07:41:57 -0500 )edit