public interface QuoteHandler
QuoteHandlerEP
to provide "Insert pair quote" functionality
for your language (controlled by CodeInsightSettings.AUTOINSERT_PAIR_QUOTE
).
All the checks are triggered on typing/removal of a single quote and out of the box the aforementioned
functionality is supported only for ordinary strings enclosed in a single pair of quotes.
In order to support string literals that start and end with multiple quotes see MultiCharQuoteHandler
and BackspaceHandlerDelegate
.
Modifier and Type | Method and Description |
---|---|
boolean |
hasNonClosedLiteral(Editor editor,
HighlighterIterator iterator,
int offset)
Called after the quote has been inserted in the editor to check that it belongs
to an empty string literal that has only the opening quote and therefore, can be completed
by inserting the respective closing one.
|
boolean |
isClosingQuote(HighlighterIterator iterator,
int offset)
Checks whether there is the closing quote or the last one of the set of closing quotes
of a string literal at the given offset.
|
boolean |
isInsideLiteral(HighlighterIterator iterator) |
boolean |
isOpeningQuote(HighlighterIterator iterator,
int offset)
Checks whether there is the opening quote or the last one of the set of opening quotes
of a string literal at the given offset.
|
boolean isClosingQuote(HighlighterIterator iterator, int offset)
Upon insertion, this method is called before the quote is actually inserted in the editor in order to check whether it's going to be typed over an existing one closing a string literal and, thus, should be omitted (only the caret position will be adjusted in this case).
iterator
- highlighting iterator at the state corresponding to the offset
offset
- the offset at which the quote is going to be inserted/deletedboolean isOpeningQuote(HighlighterIterator iterator, int offset)
iterator
- highlighting iterator at the state corresponding to the offset
offset
- the offset at which the quote was insertedboolean hasNonClosedLiteral(Editor editor, HighlighterIterator iterator, int offset)
If both this method and isOpeningQuote(HighlighterIterator, int)
return true, the respective closing quote will be inserted automatically.
editor
- an editor instance where the quote was insertediterator
- highlighting iterator at the state corresponding to the offset
offset
- the offset at which the quote was insertedisOpeningQuote(HighlighterIterator, int)
boolean isInsideLiteral(HighlighterIterator iterator)