   ;; Pre-parse source code.
   (ac-fsharp-send-script-file ac-fsharp-completion-process)
 
+  (setq ac-fsharp-status 'complete)
+  
   ;(add-hook 'kill-buffer-hook 'ac-fsharp-shutdown-process nil t)
   ;(add-hook 'before-save-hook 'ac-fsharp-reparse-buffer)
 


    (acknowledged
     (message "ac-fsharp-candidate triggered - ack")
     (setq ac-fsharp-status 'idle)
     ac-fsharp-current-candidate)

    (preempted
     (message "fsharp-async is preempted by a critical request")
     nil)))


(defun ac-fsharp-stash-partial (str)

           (ac-start :force-init t)
           ;(ac-update)
           ;(setq ac-fsharp-status 'idle)
           ))
        (otherwise
         message "filter output called and found <<EOF>> while not waiting")
        )))

(defun ac-fsharp-async-preemptive ()
  (interactive)
;  (self-insert-command 1)
  (if (eq ac-fsharp-status 'idle)
      (ac-start)
    (setq ac-fsharp-status 'preempted)))

(defvar ac-source-fsintellisense
  '((candidates . ac-fsharp-candidate)
    (cache)))

(defun ac-fsharp-config ()
  (setq ac-sources '(ac-source-fsintellisense))
  (setq ac-use-fuzzy nil)
  (setq ac-auto-start nil)
  (local-set-key (kbd "C-c .") 'ac-fsharp-async-preemptive))

(add-hook 'fsharp-mode-hook 'ac-fsharp-config)
;(add-hook 'fsharp-mode-hook (lambda () (auto-complete-mode)))
;(setq fsharp-mode-hook '())

(defun ac-complete-fsintellisense ()
  (interactive)
  ; Must have finished previous request
  (if (eq ac-fsharp-status 'complete)
      (progn
        (setq ac-fsharp-status 'idle)
        (ac-start))
    (message "Attempted to autocomplete when not status!=complete, ignoring")))

;(setq ac-fsharp-status 'complete)

;(global-set-key (kbd "C-c .") 'ac-complete-fsintellisense)

(defun attempt-completion ()
  (interactive)
