FoldRegion (@NotNull EditorEx editor, int start, int end, boolean expanded) { DocumentEx document = editor.getDocument(); final int startOffset = document.getLineStartOffset(start); final int endOffset = document.getLineEndOffset(end - 1); FoldRegion region = editor.getFoldingModel().addFoldRegion(startOffset, endOffset, PLACEHOLDER); if (region != null) { region.setExpanded(expanded); region.setInnerHighlightersMuted(true); FoldingModelImpl.hideGutterRendererForCollapsedRegion(region); } return region; }