OffsetsInFile (@NotNull TemplateActionContext templateActionContext) { ProperTextRange editRange = ProperTextRange.create(templateActionContext.getStartOffset(), templateActionContext.getEndOffset()); PsiFile file = templateActionContext.getFile(); assertRangeWithinDocument(editRange, Objects.requireNonNull(file.getViewProvider().getDocument())); ConcurrentMap<Pair<ProperTextRange, String>, OffsetsInFile> map = CachedValuesManager.getCachedValue(file, () -> CachedValueProvider.Result.create( ConcurrentFactoryMap.createMap( key -> copyWithDummyIdentifier(new OffsetsInFile(file), key.first.getStartOffset(), key.first.getEndOffset(), key.second)), file, file.getViewProvider().getDocument())); return map.get(Pair.create(editRange, CompletionUtil.DUMMY_IDENTIFIER_TRIMMED)); }