Open AngryCarrot789 opened 3 years ago
Sorry for getting back so late! I've given it multiple attempts myself awhile back and again just recently. With the way the extension currently works, I'm not sure if it's possible to do this (as much as I also want the same). I'll leave this issue open in case someone manages to figure this one out/ a future change makes this doable.
I might give this one a shot soon. Hints to where I should start looking would be very much appreciated.
These might be a good starting point: https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.text.editor.iwpftextview?view=visualstudiosdk-2022
The extension logic currently is roughly as follows:
(
,[
,{
), the "wrapping" occurs. Wrapping is actually just taking the "left" char, getting the matching "right" char (e.g. )
,]
,}
), appending the right char to the previously captured selected text, and pasting the result right where the caret is.There is an API (IWpfTextView->GetMultiSelectionBroker->AddSelection) to select text, but I couldn't get it to work. My guess is that the default selection clearing that occurs is happening after the event handler defined in this extension. It's been half a year since I last tried so I might be misremembering.
There's also https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.text.editor.keyprocessor?view=visualstudiosdk-2022 which would probably be a better way to go about the triggering the wrap, but I couldn't figure this out either.
If you decide to give it a try, good luck! PRs are welcome
Awesome! I'm a bit busy right now but I'll keep this one saved. I def want to try doing it soon.
so if you select some code and wrap it in ( )s, it wont deselect the code, allowing you to move the caret to the start of the brackets (like what you can do in intellij for example).
great plugin btw :)