void (@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, @NotNull CompletionResultSet result) { final PsiFile file = parameters.getOriginalFile(); DocStringFormat format = DocStringUtil.getConfiguredDocStringFormat(file); if (format == DocStringFormat.EPYTEXT || format == DocStringFormat.REST) { int offset = parameters.getOffset(); final String text = file.getText(); char prefix = format == DocStringFormat.EPYTEXT ? '@' : ':'; if (offset > 0) { offset--; } StringBuilder prefixBuilder = new StringBuilder(); while (offset > 0 && (Character.isLetterOrDigit(text.charAt(offset)) || text.charAt(offset) == prefix)) { prefixBuilder.insert(0, text.charAt(offset)); if (text.charAt(offset) == prefix) { offset--; break; } offset--; } while (offset > 0) { offset--; if (text.charAt(offset) == '\n' || text.charAt(offset) == '\"' || text.charAt(offset) == '\'') { break; } if (!Character.isWhitespace(text.charAt(offset))) { return; } } String[] allTags = format == DocStringFormat.EPYTEXT ? EpydocString.ALL_TAGS : SphinxDocString.ALL_TAGS; if (prefixBuilder.length() > 0) { result = result.withPrefixMatcher(prefixBuilder.toString()); } for (String tag : allTags) { result.addElement(LookupElementBuilder.create(tag)); } } }