 	 (ro    (gethash-nil r tys)))
     (gethash-nil "ann" (gethash-nil c ro))))
 
-;; -- Display --------------------------------------------------------------
-
-;; If you want the separate balloon-popup
-(defun liquid-tip-popup (text)
-  "Display text in a window popup"
+;; ------------------------------------------------------------------------
+;; Display Annot in Tooltip 
+;; ------------------------------------------------------------------------
+
+;; For simple, ascii popups, use:
+;;    (setq liquid-tip-mode 'ascii) 
+;;
+;; For emacs', balloon based popups, use:
+;;    (setq liquid-tip-mode 'balloon)
+
+(defvar liquid-tip-mode 'balloon)
+
+(defun pad-line (str)
+  (concat " " str " "))
+
+(defun popup-tip-pad (text)
+  (let* ((lines     (split-string text "\n"))
+         (pad-lines (mapcar 'pad-line lines))
+	 (pad-text  (concat "\n" (mapconcat 'identity pad-lines "\n") "\n")))
+    (popup-tip pad-text)))
+
+(defun liquid-tip-popup-balloon (text)
+  "Display text in a balloon popup"
   (if (and (functionp 'ac-quick-help-use-pos-tip-p)
            (ac-quick-help-use-pos-tip-p))
       (pos-tip-show text 'popup-tip-face nil nil 300 popup-tip-max-width)
-    (popup-tip text)))
-
-;; If you just want the ascii-popup
-;; (defun liquid-tip-popup (text)
-;;  "Display text in ascii popup"
-;;   (popup-tip text))
-
+    (popup-tip-pad text)))
+
+(defun liquid-tip-popup-ascii (text)
+ "Display text in ascii popup"
+  (popup-tip-pad text))
+
+(defun liquid-tip-popup (text)
+  (if (equal liquid-tip-mode 'ascii)
+      (liquid-tip-popup-ascii   text)
+      (liquid-tip-popup-balloon text)))
 
 ;; -- Compute range ---------------------------------------------------------
 

  (interactive)
  (let* ((pos    (liquid-get-position))
	 (ident  (liquid-ident-at-pos pos))
         (annot  (liquid-annot-at-pos pos)))
    (if annot 
	(liquid-tip-popup annot)
        (liquid-tip-popup (format "No annotation for %s at %s" ident (position-string pos))))))


;;;###autoload
(defun liquid-tip-init ()
  "Initialize liquid-tip by making all identifiers buttons"
  (interactive)
  (progn (button-lock-mode 1)
	 (button-lock-set-button liquid-id-regexp 'liquid-tip-show)
	 ;; (button-lock-set-button "yoga" 'liquid-tip-show)
	 ;; (button-lock-set-button "mydiv" 'liquid-tip-show)
	 ))

;;;###autoload
(defun liquid-tip-update ()
  "Update liquid-annot-table by reloading annot file for buffer"
  (interactive)
  42)


;; DEBUG (defface my-tooltip
;; DEBUG   '((t

;;; Code:
(eval-when-compile (require 'cl))
(require 'auto-complete)
(require 'json)
(require 'pos-tip nil t)
(require 'thingatpt)
(require 'button-lock)

;; (require 'json-mode)
;; (require 'ring)
;; (require 'etags)
;; (require 'flymake)
;; (require 'eldoc)
;; (require 'log4e)
;; (require 'yaxception)

;; ------------------------------------------------------------------------
;; A structure to represent positions 
;; ------------------------------------------------------------------------

(cl-defstruct position file row col)

;; ------------------------------------------------------------------------
;; Utilities for reading json/files
;; ------------------------------------------------------------------------

(defun get-string-from-file (filePath)
  "Return filePath's file content."
