automatically insert closing quote

Hallo,
is there an easy way to automatically insert closing quote in a custom language. I tried to implement a PairedBraceMatcher, which works fine for '{}' and '[]'. However using the same technique with quotes  doesn't work. The pairs of quotes are recognized and highlighted but not completed. I also tried to register a QuoteHandler without success. I also wondered because in Settings->Editor->Smart Keys "Insert Pair Quote" is selected what made me think it should work out of the box.
It is not a huge problem but I would be thankful for help to get rid of it.
Regards,
Sebastian

1 comment
Comment actions Permalink

Indeed the QuoteHandler EP is what is responsible for this behavior, and it is controlled by the "Insert Pair Quote" setting. So, you just need to write one.

A simple one can be made by subclassing

https://github.com/JetBrains/intellij-community/blob/master/platform/lang-impl/src/com/intellij/codeInsight/editorActions/SimpleTokenSetQuoteHandler.java

And supplying the the same token type you give to your parser definiton for string tokens. Its a crude solution but works for simple quote characters

0

Please sign in to leave a comment.