private static OffsetMap translateOffsetMapToInjected(
     OffsetMap hostMap, DocumentWindow injectedDocument) {
   final OffsetMap map = new OffsetMap(injectedDocument);
   for (final OffsetKey key : hostMap.getAllOffsets()) {
     map.addOffset(key, injectedDocument.hostToInjected(hostMap.getOffset(key)));
   }
   return map;
 }
 private static OffsetMap translateOffsetMapToHost(
     CompletionInitializationContext initContext,
     PsiFile context,
     PsiFile hostFile,
     Editor hostEditor) {
   final InjectedLanguageManager injectedLanguageManager =
       InjectedLanguageManager.getInstance(hostFile.getProject());
   final OffsetMap hostMap = new OffsetMap(hostEditor.getDocument());
   final OffsetMap original = initContext.getOffsetMap();
   for (final OffsetKey key : original.getAllOffsets()) {
     hostMap.addOffset(
         key, injectedLanguageManager.injectedToHost(context, original.getOffset(key)));
   }
   return hostMap;
 }