+
 
 ;; edit path
-(setq intellisense-wrapper "fsintellisense.exe")
+(setq ac-fsharp-complete-executable
+      (concat (file-name-directory (or load-file-name buffer-file-name))
+              "../bin/fsautocomplete.sh"))
 
 ;; few bindings for the tests
 (global-set-key (kbd "<f1>") 'tool-tip)

    ))


; This function is called whenever fsintellisense.exe writes something on stdout
(defun filter (proc str)

  (when (buffer-live-p (process-buffer proc))
    (with-current-buffer (process-buffer proc)
      (let ((moving (= (point) (process-mark proc))))
        (save-excursion
          ;; Insert the text, advancing the process marker.
          (goto-char (process-mark proc))
          (insert str)
          (set-marker (process-mark proc) (point)))
        (if moving (goto-char (process-mark proc))))))
  
  ; cleanup hack
  (setq str (replace-regexp-in-string "<<EOF>>" "" str))
  (setq str (replace-regexp-in-string "DONE: Background parsing started" "" str))
  (setq str (replace-regexp-in-string "\n\n" "\n" str))

  (let ((help (split-string str "[\n]+" t)))

      (if (= mode 0)
          (or (eq str "\n") (eq str "\n") (eq str "")
              (th-show-tooltip-for-point str))

        (if (= mode 2)
            (show-doc str)

        (if esense-completion-list (esense-abort-completion))
        (unless (eq nil help)
          (let ((p (save-excursion (skip-syntax-backward "w_"))))
            (esense-start-completion (+ p (point)) help)))
          )))
)

(defun start-intellisense ()
  (interactive)
  (esense-mode t)
  (setq mode 0)
  (setq proc (start-process "fsharp-intellisense" "intelli-buffer"
                            intellisense-wrapper))
  (set-process-filter proc 'filter)     
