OpenFileDescriptor () { VirtualFile file = getFile(); if(file == null) return null; Segment range = getNavigationRange(); if (range != null && file instanceof VirtualFileWindow && range.getStartOffset() >= 0) { // have to use injectedToHost(TextRange) to calculate right offset in case of multiple shreds range = ((VirtualFileWindow)file).getDocumentWindow().injectedToHost(TextRange.create(range)); file = ((VirtualFileWindow)file).getDelegate(); } return new OpenFileDescriptor(getProject(), file, range == null ? getNavigationOffset() : range.getStartOffset()); }