boolean (@Nullable PsiElement context) { if (context == null) return false; ASTNode astNode = context.getNode(); if (astNode == null) { return false; } ASTNode child = null; if (astNode instanceof CompositeElement) { // in some languages token nodes are wrapped within a single-child composite ASTNode[] children = astNode.getChildren(null); if (children.length == 1) { child = children[0]; } } final ParserDefinition parserDefinition = LanguageParserDefinitions.INSTANCE.forLanguage(context.getLanguage()); final TokenSet literalElements = parserDefinition.getStringLiteralElements(); return literalElements.contains(astNode.getElementType()) || child != null && literalElements.contains(child.getElementType()); }