void (@NotNull Disposable parent, @NotNull final Project project, final Language language, @NotNull @NonNls final String varName, @NonNls final String prefix, @NonNls final String suffix) { if (language == null) return; final ConcatenationAwareInjector injector = (injectionPlacesRegistrar, operands) -> { if (operands[0].getParent() instanceof PsiNameValuePair) return; // do not inject into @SupressWarnings PsiVariable variable = PsiTreeUtil.getParentOfType(operands[0], PsiVariable.class); if (variable == null) return; if (!varName.equals(variable.getName())) return; if (!(operands[0] instanceof PsiLiteralExpression)) return; boolean started = false; String prefixFromPrev=""; for (int i = 0; i < operands.length; i++) { PsiElement operand = operands[i]; if (!(operand instanceof PsiLiteralExpression)) { continue; } Object value = ((PsiLiteralExpression)operand).getValue(); if (!(value instanceof String)) { prefixFromPrev += value; continue; } TextRange textRange = textRangeToInject((PsiLanguageInjectionHost)operand); if (!started) { injectionPlacesRegistrar.startInjecting(language); started = true; } injectionPlacesRegistrar.addPlace(prefixFromPrev + (i == 0 ? "" : prefix==null?"":prefix), i == operands.length - 1 ? null : suffix, (PsiLanguageInjectionHost)operand, textRange); prefixFromPrev = ""; } if (started) { injectionPlacesRegistrar.doneInjecting(); } }; ConcatenationInjectorManager.EP_NAME.getPoint(project).registerExtension(injector, parent); }