How the insertion of closing quote works in Javascript plugin.

Hi,

When typing " in JavaScript IDEA automatically inserts the closing ". Unfortunately this doesn't work in my language plugin and I can't find how to configure it. Any idea how it is done in JavaScript?

Is there any other support for pairs of characters than PairedBraceMatcher?

Thanks,
galiley

2 comments

The JavaScript plugin uses the JSHtmlBridge cheater to do the cool things. See com.intellij.codeInsight.editorActions.TypedHandler#registerQuoteHandler(), but be aware, it's not part of the OpenAPI.

Sascha

0

It's as easy as implementing QuoteHandler EP, like this:

https://www.javatips.net/api/Grammar-Kit-master/src/org/intellij/grammar/editor/BnfQuoteHandler.java

Pay attention, that you need to include BAD_CHARACTER in the token set as well.

/**
* @author gregsh
*/
public class BnfQuoteHandler extends SimpleTokenSetQuoteHandler {
public BnfQuoteHandler() {
super(BnfTypes.BNF_STRING, TokenType.BAD_CHARACTER);
}
}
0

Please sign in to leave a comment.