   "Compute the prefix of IDENT.  The prefix of `Foo.bar' is `Foo.' and the prefix of `bar' is `'."
   (car (merlin--completion-split-ident ident)))
 
-(defun merlin--completion-full-entry-name (prefix compl-prefix entry)
-  (let* ((short-name (cdr (assoc 'name entry)))
-         (long-name  (concat compl-prefix short-name)))
-    (if (string-prefix-p prefix long-name) long-name short-name)))
+(defvar-local dwimed nil
+  "Remember if we used dwim for the current completion or not")
+
+(defun merlin--completion-full-entry-name (compl-prefix entry)
+  (let ((entry-name (cdr (assoc 'name entry))))
+    (if dwimed entry-name (concat compl-prefix entry-name))))
 
 (defun merlin--completion-prepare-labels (labels suffix)
   ; Remove non-matching entry, adjusting optional labels if needed

      (setq merlin-completion-annotation-table
            (mapcar
              (lambda (a)
                (cons (merlin--completion-full-entry-name prefix compl-prefix a)
                      (concat ": " (merlin--completion-format-entry a))))
              (merlin--completion-data prefix))))
    (list start end #'merlin--completion-table

    (popup-make-item
      ; Note: ac refuses to display an item if merlin-ac-ac-prefix is not a
      ; prefix the item. So "dwim" completion won't work with ac.
      (merlin--completion-full-entry-name merlin-ac-prefix data)
      :summary (when (and merlin-completion-types merlin-ac-use-summary) typ)
      :symbol (format "%c" (elt (cdr (assoc 'kind data)) 0))
      :document (if (and merlin-completion-types merlin-ac-use-document) typ))))
