packages feed

intero 0.1.15 → 0.1.16

raw patch · 5 files changed

+100/−19 lines, 5 files

Files

CHANGELOG view
@@ -1,3 +1,6 @@+0.1.16:+	* Re-add back collecting type info after any load+ 0.1.14: 	* Bring back :completion 
README.md view
@@ -14,6 +14,7 @@ `M-.` | Jump to definition `C-c C-i` | Show information of identifier at point `C-c C-t` | Show the type of thing at point, or the selection+`C-u C-c C-t` | Insert a type signature for the thing at point `C-c C-l` | Load this module in the REPL  ## Intero for IDE writers
elisp/intero.el view
@@ -50,11 +50,14 @@ (require 'cl-lib) (require 'company) (require 'comint)+(require 'widget)+(eval-when-compile+  (require 'wid-edit))  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Configuration -(defconst intero-package-version "0.1.15"+(defconst intero-package-version "0.1.16"   "Package version to auto-install.")  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;@@ -182,7 +185,10 @@            (read-directory-name "Change Intero directory: "))))  (defun intero-type-at (insert)-  "Get the type of the thing or selection at point."+  "Get the type of the thing or selection at point.++With universal-argument (C-u), inserts the type above the current+line as a type signature."   (interactive "P")   (let ((ty (apply #'intero-get-type-at (intero-thing-at-point))))     (if insert@@ -249,9 +255,21 @@ (defun intero-targets ()   "Set the targets to use for stack ghci."   (interactive)-  (let ((targets (split-string (read-from-minibuffer "Targets: ")-                               " "-                               t)))+  (let* ((old-targets+          (with-current-buffer (intero-buffer 'backend)+            intero-targets))+         (available-targets (intero-get-targets))+         (targets (if available-targets+                      (intero-multiswitch+                       "Targets:"+                       (mapcar (lambda (target)+                                 (list :key target+                                       :title target+                                       :default (member target old-targets)))+                               available-targets))+                    (split-string (read-from-minibuffer "Targets: " nil nil nil nil old-targets)+                                  " "+                                  t))))     (intero-destroy)     (intero-get-worker-create 'backend targets (current-buffer)))) @@ -341,8 +359,7 @@   "A syntax and type checker for Haskell using an Intero worker process."   :start 'intero-check-  :modes '(haskell-mode literate-haskell-mode)-  :next-checkers '((warning . haskell-hlint)))+  :modes '(haskell-mode literate-haskell-mode))  (add-to-list 'flycheck-checkers 'intero) @@ -1285,6 +1302,14 @@                             "--verbosity" "silent"))             (buffer-substring (line-beginning-position) (line-end-position)))))) +(defun intero-get-targets ()+  "Get all available targets."+  (with-temp-buffer+    (cl-case (call-process "stack" nil (current-buffer) t "ide" "targets")+      (0+       (split-string (buffer-string) nil t))+      (1 nil))))+ (defun intero-package-name (&optional cabal-file)   "Get the current package name from a nearby .cabal file. If there is none, return empty string."@@ -1340,6 +1365,62 @@      ((= (length cabal-files) 1) (car cabal-files)) ;; exactly one candidate found      (allow-multiple cabal-files) ;; pass-thru multiple candidates      (t nil))))++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+;; Multiselection++(defun intero-multiswitch (title options)+  "Read multiple flags from a list of OPTIONS each of which is a+  plist of (:key :default :title). :key should be something+  comparable with EQUAL, :title should be a+  string, :default (boolean) specifies the default checkedness."+  (let ((available-width (window-total-width)))+    (save-window-excursion+      (with-temp-buffer+        (rename-buffer (generate-new-buffer-name "multiswitch"))+        (widget-insert (concat title "\n\n"))+        (widget-insert (propertize "Hit " 'face 'font-lock-comment-face))+        (widget-create 'push-button :notify+                       (lambda (&rest ignore)+                         (exit-recursive-edit))+                       "C-c C-c")+        (widget-insert (propertize " to apply these choices.\n\n" 'face 'font-lock-comment-face))+        (let* ((me (current-buffer))+               (choices (mapcar (lambda (option)+                                  (append option (list :value (plist-get option :default))))+                                options)))+          (cl-loop for option in choices+                   do (widget-create+                       'toggle+                       :notify (lambda (widget &rest ignore)+                                 (setq choices+                                       (mapcar (lambda (choice)+                                                 (if (equal (plist-get choice :key)+                                                            (plist-get (cdr widget) :key))+                                                     (plist-put choice :value (plist-get (cdr widget) :value))+                                                   choice))+                                               choices)))+                       :on (concat "[x] " (plist-get option :title))+                       :off (concat "[ ] " (plist-get option :title))+                       :value (plist-get option :default)+                       :key (plist-get option :key)))+          (let ((lines (line-number-at-pos)))+            (select-window (split-window-below))+            (switch-to-buffer me)+            (goto-char (point-min)))+          (use-local-map+           (let ((map (copy-keymap widget-keymap)))+             (define-key map (kbd "C-c C-c") 'exit-recursive-edit)+             (define-key map (kbd "C-g") 'abort-recursive-edit)+             map))+          (widget-setup)+          (recursive-edit)+          (kill-buffer me)+          (mapcar (lambda (choice)+                    (plist-get choice :key))+                  (cl-remove-if-not (lambda (choice)+                                      (plist-get choice :value))+                                    choices)))))))  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
intero.cabal view
@@ -1,7 +1,7 @@ name:   intero version:-  0.1.15+  0.1.16 synopsis:   Complete interactive development program for Haskell license:
src/InteractiveUI.hs view
@@ -1493,15 +1493,7 @@   _ <- GHC.load LoadAllTargets    GHC.setTargets targets-  flag <- doLoad False LoadAllTargets-  case flag of-    Succeeded -> do-      loaded <- getModuleGraph >>= filterM GHC.isLoaded . map GHC.ms_mod_name-      v <- lift (fmap mod_infos getGHCiState)-      !newInfos <- collectInfo v loaded-      lift (modifyGHCiState (\s -> s { mod_infos = newInfos }))-    _ -> return ()-  return flag+  doLoad False LoadAllTargets  -- :add addModule :: [FilePath] -> InputT GHCi ()@@ -1543,8 +1535,12 @@       afterLoad ok retain_context       return ok   case wasok of-    Succeeded -> do names <- GHC.getRdrNamesInScope-                    lift (modifyGHCiState (\s -> s { rdrNamesInScope = names }))+    Succeeded -> do+      names <- GHC.getRdrNamesInScope+      loaded <- getModuleGraph >>= filterM GHC.isLoaded . map GHC.ms_mod_name+      v <- lift (fmap mod_infos getGHCiState)+      !newInfos <- collectInfo v loaded+      lift (modifyGHCiState (\s -> s { mod_infos = newInfos, rdrNamesInScope = names }))     _ -> return ()   return wasok