void (@NotNull final String name) { for (Section section : myOriginalDocString.getParameterSections()) { final List<SectionField> sectionFields = section.getFields(); for (SectionField field : sectionFields) { final Substring nameSub = ContainerUtil.find(field.getNamesAsSubstrings(), substring -> substring.toString().equals(name)); if (nameSub != null) { if (field.getNamesAsSubstrings().size() == 1) { final int endLine = getFieldEndLine(field); if (sectionFields.size() == 1) { removeLinesAndSpacesAfter(getSectionStartLine(section), endLine + 1); } else { final int startLine = getFieldStartLine(field); if (ContainerUtil.getLastItem(sectionFields) == field) { removeLines(startLine, endLine + 1); } else { removeLinesAndSpacesAfter(startLine, endLine + 1); } } } else { final Substring wholeParamName = expandParamNameSubstring(nameSub); remove(wholeParamName.getStartOffset(), wholeParamName.getEndOffset()); } break; } } } }