PsiReference (@NotNull PsiElement element, String text) { if (!isAdvancedSettingKey(text)) return null; String s = StringUtil.notNullize(StringUtil.substringAfter(text, ADVANCED_SETTING)); String id = s.endsWith(DESCRIPTION) ? StringUtil.trimEnd(s, DESCRIPTION) : (s.endsWith(TRAILING_LABEL) ? StringUtil.trimEnd(s, TRAILING_LABEL) : s); TextRange range = TextRange.allOf(id).shiftRight(ADVANCED_SETTING.length()); return new AdvancedSettingsIdContributor.AdvancedSettingReference(element, range); }