packages feed

intero 0.1.31 → 0.1.32

raw patch · 5 files changed

+212/−96 lines, 5 filesdep ~ghc

Dependency ranges changed: ghc

Files

CHANGELOG view
@@ -1,3 +1,6 @@+0.1.32:+	* Support for GHC 8.4.3+ 0.1.31: 	* Collecting type info no longer prints messages 
README.md view
@@ -48,10 +48,17 @@ projects unless they are whitelisted.  -## Intero for IDE writers+## Intero support for other editors and IDEs -Please see-[the TOOLING.md file for how to use Intero to integrate your own editor.](https://github.com/commercialhaskell/intero/blob/master/TOOLING.md).+Although not supported by the Intero maintainers, integrations with other editors exist:++* [intero-neovim](https://github.com/parsonsmatt/intero-neovim)+* [haskero](https://gitlab.com/vannnns/haskero) (vscode)+* [Haskelly](https://github.com/haskelly-dev/Haskelly) (vscode)+* [sublime-intero](https://github.com/dariusf/sublime-intero)++If you would like to build support into a new editor or IDE, please see+[TOOLING.md](https://github.com/commercialhaskell/intero/blob/master/TOOLING.md).  ## Issues 
elisp/intero.el view
@@ -112,7 +112,8 @@ It should be a list of directories.  To use this, use the following mode hook:-  (add-hook 'haskell-mode-hook 'intero-mode-whitelist)"+  (add-hook 'haskell-mode-hook 'intero-mode-whitelist)+or use `intero-global-mode' and add \"/\" to `intero-blacklist'."   :group 'intero   :type 'string) @@ -123,7 +124,8 @@ It should be a list of directories.  To use this, use the following mode hook:-  (add-hook 'haskell-mode-hook 'intero-mode-blacklist)"+  (add-hook 'haskell-mode-hook 'intero-mode-blacklist)+or use `intero-global-mode'."   :group 'intero   :type 'string) @@ -429,7 +431,8 @@          when (string-match                "\\(.*?\\):(\\([0-9]+\\),\\([0-9]+\\))-(\\([0-9]+\\),\\([0-9]+\\))$"                use)-         do (let* ((fp (match-string 1 use))+         do (let* ((returned-file (match-string 1 use))+                   (loaded-file (intero-extend-path-by-buffer-host returned-file))                    (sline (string-to-number (match-string 2 use)))                    (scol (string-to-number (match-string 3 use)))                    (eline (string-to-number (match-string 4 use)))@@ -438,7 +441,7 @@                                           (forward-line (1- sline))                                           (forward-char (1- scol))                                           (point))))-              (when (string= fp (intero-temp-file-name))+              (when (intero-temp-file-p loaded-file)                 (unless highlighted                   (intero-highlight-uses-mode))                 (setq highlighted t)@@ -514,8 +517,10 @@ Returns nil when unable to find definition."   (interactive)   (let ((result (apply #'intero-get-loc-at (intero-thing-at-point))))-    (when (string-match "\\(.*?\\):(\\([0-9]+\\),\\([0-9]+\\))-(\\([0-9]+\\),\\([0-9]+\\))$"-                        result)++    (if (not (string-match "\\(.*?\\):(\\([0-9]+\\),\\([0-9]+\\))-(\\([0-9]+\\),\\([0-9]+\\))$"+                       result))+        (message "%s" result)       (if (fboundp 'xref-push-marker-stack) ;; Emacs 25           (xref-push-marker-stack)         (with-no-warnings@@ -530,7 +535,10 @@                   (switch-to-buffer original-buffer)                 (error "Attempted to load temp file.  Try restarting Intero. If the problem persists, please report this as a bug!")))-          (find-file loaded-file))+          (find-file+           (expand-file-name+            returned-file+            (intero-extend-path-by-buffer-host (intero-project-root)))))         (pop-mark)         (goto-char (point-min))         (forward-line (1- line))@@ -1665,10 +1673,11 @@   (with-current-buffer (or buffer (current-buffer))     (if (or (eq nil (intero-buffer-host)) (eq "" (intero-buffer-host)))         path-      (concat "/"-              (intero-buffer-host)-              ":"-              path))))+      (expand-file-name+       (concat "/"+               (intero-buffer-host)+               ":"+               path)))))  (defvar-local intero-temp-file-name nil   "The name of a temporary file to which the current buffer's content is copied.")@@ -2080,29 +2089,31 @@   "Send WORKER the command string CMD, via a network connection. The result, along with the given STATE, is passed to CALLBACK as (CALLBACK STATE REPLY)."-  (let ((buffer (intero-buffer worker)))-    (if (and buffer (process-live-p (get-buffer-process buffer)))-        (with-current-buffer buffer-          (if intero-service-port-              (let* ((buffer (generate-new-buffer (format " intero-network:%S" worker)))-                     (process-                      (make-network-process-                       :name (format "%S" worker)-                       :buffer buffer-                       :host 'local-                       :service intero-service-port-                       :family 'ipv4-                       :nowait t-                       :noquery t-                       :sentinel 'intero-network-call-sentinel)))-                (with-current-buffer buffer-                  (setq intero-async-network-cmd cmd)-                  (setq intero-async-network-state state)-                  (setq intero-async-network-worker worker)-                  (setq intero-async-network-callback callback)))-            (progn (when intero-debug (message "No `intero-service-port', falling back ..."))-                   (intero-async-call worker cmd state callback))))-      (error "Intero process is not running: run M-x intero-restart to start it"))))+  (if (file-remote-p default-directory)+      (intero-async-call worker cmd state callback)+      (let ((buffer (intero-buffer worker)))+        (if (and buffer (process-live-p (get-buffer-process buffer)))+            (with-current-buffer buffer+              (if intero-service-port+                  (let* ((buffer (generate-new-buffer (format " intero-network:%S" worker)))+                         (process+                          (make-network-process+                           :name (format "%S" worker)+                           :buffer buffer+                           :host 'local+                           :service intero-service-port+                           :family 'ipv4+                           :nowait t+                           :noquery t+                           :sentinel 'intero-network-call-sentinel)))+                    (with-current-buffer buffer+                      (setq intero-async-network-cmd cmd)+                      (setq intero-async-network-state state)+                      (setq intero-async-network-worker worker)+                      (setq intero-async-network-callback callback)))+                (progn (when intero-debug (message "No `intero-service-port', falling back ..."))+                       (intero-async-call worker cmd state callback))))+          (error "Intero process is not running: run M-x intero-restart to start it")))))  (defun intero-network-call-sentinel (process event)   (pcase event@@ -2159,10 +2170,11 @@  (defun intero-buffer (worker)   "Get the WORKER buffer for the current directory."-  (let ((buffer (intero-get-buffer-create worker)))+  (let ((buffer (intero-get-buffer-create worker))+        (targets (buffer-local-value 'intero-targets (current-buffer))))     (if (get-buffer-process buffer)         buffer-      (intero-get-worker-create worker nil (current-buffer)+      (intero-get-worker-create worker targets (current-buffer)                                 (buffer-local-value                                  'intero-stack-yaml (current-buffer)))))) @@ -2192,34 +2204,86 @@       (erase-buffer)       (insert (cl-case install-status                 (not-installed "Intero is not installed in the Stack environment.")-                (wrong-version "The wrong version of Intero is installed for this Emacs package."))-              (format "+                (wrong-version "The wrong version of Intero is installed for this Emacs package.")))+      (if (intero-version>= (intero-stack-version) '(1 6 1))+          (intero-copy-compiler-tool-auto-install source-buffer targets buffer)+        (intero-old-auto-install source-buffer targets buffer stack-yaml))))) +(defun intero-copy-compiler-tool-auto-install (source-buffer targets buffer)+  "Automatically install Intero appropriately for BUFFER.+Use the given TARGETS, SOURCE-BUFFER and STACK-YAML."+  (let ((ghc-version (intero-ghc-version-raw)))+    (insert+     (format "++Installing intero-%s for GHC %s ...++" intero-package-version ghc-version))+    (redisplay)+    (cl-case+        (let ((default-directory (make-temp-file "intero" t)))+          (intero-call-stack+           nil (current-buffer) t nil "build"+           "--copy-compiler-tool"+           (concat "intero-" intero-package-version)+           "--flag" "haskeline:-terminfo"+           "--resolver" (concat "ghc-" ghc-version)+           "ghc-paths-0.1.0.9" "mtl-2.2.2" "network-2.7.0.0" "random-1.1" "syb-0.7"))+      (0+       (message "Installed successfully! Starting Intero in a moment ...")+       (bury-buffer buffer)+       (switch-to-buffer source-buffer)+       (intero-start-process-in-buffer buffer targets source-buffer))+      (1+       (with-current-buffer buffer (setq-local intero-give-up t))+       (insert (propertize "Could not install Intero!++We don't know why it failed. Please read the above output and try+installing manually. If that doesn't work, report this as a+problem.++WHAT TO DO NEXT++If you don't want to Intero to try installing itself again for+this project, just keep this buffer around in your Emacs.++If you'd like to try again next time you try use an Intero+feature, kill this buffer.+"+                           'face 'compilation-error))+       nil))))++(defun intero-old-auto-install (source-buffer targets buffer stack-yaml)+  "Automatically install Intero appropriately for BUFFER.+Use the given TARGETS, SOURCE-BUFFER and STACK-YAML."+  (insert+   "+ Installing intero-%s automatically ... -" intero-package-version))-      (redisplay)-      (cl-case (intero-call-stack-                nil (current-buffer) t stack-yaml-                "build"-                (with-current-buffer buffer-                  (let* ((cabal-file (intero-cabal-find-file))-                         (package-name (intero-package-name cabal-file)))-                    ;; For local development. Most users'll-                    ;; never hit this behaviour.-                    (if (string= package-name "intero")-                        "intero"-                      (concat "intero-" intero-package-version))))-                "ghc-paths" "syb"-                "--flag" "haskeline:-terminfo")-        (0-         (message "Installed successfully! Starting Intero in a moment ...")-         (bury-buffer buffer)-         (switch-to-buffer source-buffer)-         (intero-start-process-in-buffer buffer targets source-buffer))-        (1-         (with-current-buffer buffer (setq-local intero-give-up t))-         (insert (propertize "Could not install Intero!+" intero-package-version)+  (redisplay)+  (cl-case (intero-call-stack+            nil (current-buffer) t stack-yaml+            "build"+            (with-current-buffer buffer+              (let* ((cabal-file (intero-cabal-find-file))+                     (package-name (intero-package-name cabal-file)))+                ;; For local development. Most users'll+                ;; never hit this behaviour.+                (if (string= package-name "intero")+                    "intero"+                  (concat "intero-" intero-package-version))))+            "ghc-paths" "syb"+            "--flag" "haskeline:-terminfo")+    (0+     (message "Installed successfully! Starting Intero in a moment ...")+     (bury-buffer buffer)+     (switch-to-buffer source-buffer)+     (intero-start-process-in-buffer buffer targets source-buffer))+    (1+     (with-current-buffer buffer (setq-local intero-give-up t))+     (insert (propertize "Could not install Intero!  We don't know why it failed. Please read the above output and try installing manually. If that doesn't work, report this as a@@ -2233,8 +2297,8 @@ If you'd like to try again next time you try use an Intero feature, kill this buffer. "-                             'face 'compilation-error))-         nil)))))+                         'face 'compilation-error))+     nil)))  (defun intero-start-process-in-buffer (buffer &optional targets source-buffer stack-yaml)   "Start an Intero worker in BUFFER.@@ -2245,7 +2309,7 @@       buffer     (let* ((options             (intero-make-options-list-             "intero"+             (intero-executable-path stack-yaml)              (or targets                  (let ((package-name (buffer-local-value 'intero-package-name buffer)))                    (unless (equal "" package-name)@@ -2348,11 +2412,6 @@           (when ignore-dot-ghci             (list "--ghci-options" "-ignore-dot-ghci"))           (cl-mapcan (lambda (x) (list "--ghci-options" x)) intero-extra-ghc-options)-          (let ((dir (intero-localize-path (intero-make-temp-file "intero" t))))-            (list "--ghci-options"-                  (concat "-odir=" dir)-                  "--ghci-options"-                  (concat "-hidir=" dir)))           targets))  (defun intero-sentinel (process change)@@ -2380,14 +2439,26 @@       (goto-char (point-min))       (search-forward-regexp "cannot satisfy -package" nil t 1)))) +(defun intero-executable-path (stack-yaml)+  "The path for the intero executable."+  (intero-with-temp-buffer+    (cl-case (save-excursion+               (intero-call-stack+                nil (current-buffer) t intero-stack-yaml "path" "--compiler-tools-bin"))+      (0 (replace-regexp-in-string "[\r\n]+$" "/intero" (buffer-string)))+      (1 "intero"))))+ (defun intero-installed-p ()   "Return non-nil if intero (of the right version) is installed in the stack environment."   (redisplay)   (intero-with-temp-buffer-    (if (= 0 (intero-call-stack nil t nil intero-stack-yaml-                                "exec"-                                "--verbosity" "silent"-                                "--" "intero" "--version"))+    (if (= 0 (intero-call-stack+              nil t nil intero-stack-yaml+              "exec"+              "--verbosity" "silent"+              "--"+              (intero-executable-path intero-stack-yaml)+              "--version"))         (progn           (goto-char (point-min))           ;; This skipping comes due to https://github.com/commercialhaskell/intero/pull/216/files@@ -2554,19 +2625,51 @@                    nil)))))))  (defun intero-ghc-version ()-  "Get the GHC version used by the project."+  "Get the GHC version used by the project, calls only once per backend."   (with-current-buffer (intero-buffer 'backend)     (or intero-ghc-version         (setq intero-ghc-version-              (intero-with-temp-buffer-                (cl-case (save-excursion-                           (intero-call-stack-                            nil (current-buffer) t intero-stack-yaml-                            "ghc" "--" "--numeric-version"))-                  (0-                   (buffer-substring (line-beginning-position) (line-end-position)))-                  (1 nil)))))))+              (intero-ghc-version-raw))))) +(defun intero-ghc-version-raw ()+  "Get the GHC version used by the project."+  (intero-with-temp-buffer+    (cl-case (save-excursion+               (intero-call-stack+                nil (current-buffer) t intero-stack-yaml+                "ghc" "--" "--numeric-version"))+      (0+       (buffer-substring (line-beginning-position) (line-end-position)))+      (1 nil))))++(defun intero-version>= (new0 old0)+  "Is the version NEW >= OLD?"+  (or (and (null new0) (null old0))+      (let ((new (or new0 (list 0)))+            (old (or old0 (list 0))))+        (or (> (car new)+               (car old))+            (and (= (car new)+                    (car old))+                 (intero-version>= (cdr new)+                                   (cdr old)))))))++(defun intero-stack-version ()+  "Get the version components of stack."+  (let* ((str (intero-stack-version-raw))+         (parts (mapcar #'string-to-number (split-string str "\\."))))+    parts))++(defun intero-stack-version-raw ()+  "Get the Stack version in PATH."+  (intero-with-temp-buffer+    (cl-case (save-excursion+               (intero-call-stack+                nil (current-buffer) t intero-stack-yaml "--numeric-version"))+      (0+       (buffer-substring (line-beginning-position) (line-end-position)))+      (1 nil))))+ (defun intero-get-targets ()   "Get all available targets."   (with-current-buffer (intero-buffer 'backend)@@ -3061,13 +3164,16 @@   (with-current-buffer (intero-buffer 'backend)     (or intero-extensions         (setq intero-extensions-              (split-string-               (shell-command-to-string-                (concat intero-stack-executable-                        (if intero-stack-yaml-                            (concat "--stack-yaml " intero-stack-yaml)-                          "")-                        " exec --verbosity silent -- ghc --supported-extensions")))))))+              (cl-remove-if-not+               (lambda (str) (let ((case-fold-search nil))+                               (string-match "^[A-Z][A-Za-z0-9]+$" str)))+               (split-string+                (shell-command-to-string+                 (concat intero-stack-executable+                         (if intero-stack-yaml+                             (concat "--stack-yaml " intero-stack-yaml)+                           "")+                         " exec --verbosity silent -- ghc --supported-extensions"))))))))  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Auto actions
intero.cabal view
@@ -1,7 +1,7 @@ name:   intero version:-  0.1.31+  0.1.32 synopsis:   Complete interactive development program for Haskell license:@@ -74,7 +74,7 @@     directory,     filepath,     -- We permit any 8.0.1.* or 8.0.2.* or 8.2.1-    ghc >= 7.8 && <= 8.4.1,+    ghc >= 7.8 && <= 8.4.3,     ghc-paths,     haskeline,     process,
src/GhciInfo.hs view
@@ -105,7 +105,7 @@         }     }   where-    nullLogAction _df _reason _sev _span _style _msgdoc = pure ()+    nullLogAction _df _reason _sev _span _style _msgdoc = return () #else typecheckModuleSilent parsed = do   typecheckModule@@ -118,7 +118,7 @@         }     }   where-    nullLogAction _df _reason _sev _span _style = pure ()+    nullLogAction _df _reason _sev _span _style = return () #endif  getModuleLocation :: ParsedSource -> SrcSpan