When using a tool like Resharper in Visual Studio, it has the ability to auto insert delimiters. Furthermore, if you insert a closing delimiter but then type it, Resharper doesn't add the second one.
To be clear, let's say I type: (
An end parenthesis is inserted: () with the caret between them.
If I then type ), it's ignored since the matching end parenthesis is already present.
While I have the auto-insert delimiter behavior implemented locally, I also want to skip an end delimiter when it's typed immediately after an auto-insert. As I don't see that implemented in a sample in the Sample Browser, I was wondering if you have a recommendation for the best way to implement this.
One option would be to delete the end parenthesis and replace it with the typed character. But that will create an extra undo item on the stack. I'd like to simply listen for the appropriate text change and ignore it (so the extra keypress isn't inserted at all). Can that be done? Is there a better approach I'm missing?
Thanks,
-Craig
To be clear, let's say I type: (
An end parenthesis is inserted: () with the caret between them.
If I then type ), it's ignored since the matching end parenthesis is already present.
While I have the auto-insert delimiter behavior implemented locally, I also want to skip an end delimiter when it's typed immediately after an auto-insert. As I don't see that implemented in a sample in the Sample Browser, I was wondering if you have a recommendation for the best way to implement this.
One option would be to delete the end parenthesis and replace it with the typed character. But that will create an extra undo item on the stack. I'd like to simply listen for the appropriate text change and ignore it (so the extra keypress isn't inserted at all). Can that be done? Is there a better approach I'm missing?
Thanks,
-Craig