intero 0.1.11 → 0.1.12
raw patch · 6 files changed
+114/−34 lines, 6 files
Files
- CHANGELOG +7/−0
- README.md +12/−6
- elisp/intero.el +47/−11
- intero.cabal +5/−4
- src/Main.hs +11/−0
- src/test/Main.hs +32/−13
CHANGELOG view
@@ -1,3 +1,10 @@+0.1.12:+ * Emacs mode automatically installs latest intero.+ * intero-list-buffers command.+ * Fix cl-case reference+ * Add warning when used outside of stack exec/stack ghci+ * Transfer to commercialhaskell+ 0.1.11: * Support --version
README.md view
@@ -1,4 +1,4 @@-# <img src="https://github.com/chrisdone/intero/raw/master/images/intero.svg" height=25> intero [](https://travis-ci.org/chrisdone/intero)+# <img src="https://github.com/commercialhaskell/intero/raw/master/images/intero.svg" height=25> intero [](https://travis-ci.org/commercialhaskell/intero) Complete interactive development program for Haskell @@ -15,10 +15,11 @@ It's basically GHCi plus extra features. Those are: -* [Find uses of an identifier in a module.](https://github.com/chrisdone/intero/blob/28609611c9f7c7d63370ce66e8ebb97676a8374e/src/test/Main.hs#L118)-* [Find definition of an identifier in a module.](https://github.com/chrisdone/intero/blob/28609611c9f7c7d63370ce66e8ebb97676a8374e/src/test/Main.hs#L143)-* [Show the type of an expression or identifier](https://github.com/chrisdone/intero/blob/28609611c9f7c7d63370ce66e8ebb97676a8374e/src/test/Main.hs#L82).-* [List all types of all expressions of all modules loaded.](https://github.com/chrisdone/intero/blob/28609611c9f7c7d63370ce66e8ebb97676a8374e/src/test/Main.hs#L98)+* [Find uses of an identifier in a module.](https://github.com/commercialhaskell/intero/blob/28609611c9f7c7d63370ce66e8ebb97676a8374e/src/test/Main.hs#L118)+* [Find definition of an identifier in a module.](https://github.com/commercialhaskell/intero/blob/28609611c9f7c7d63370ce66e8ebb97676a8374e/src/test/Main.hs#L143)+* [Show the type of an expression or identifier](https://github.com/commercialhaskell/intero/blob/28609611c9f7c7d63370ce66e8ebb97676a8374e/src/test/Main.hs#L82).+* [List all types of all expressions of all modules loaded.](https://github.com/commercialhaskell/intero/blob/28609611c9f7c7d63370ce66e8ebb97676a8374e/src/test/Main.hs#L98)+* [Completion of identifiers within a module's scope.](https://github.com/commercialhaskell/intero/blob/bbd71951edb89f06a939910024f85cc44c11c16e/src/test/Main.hs#L242) Probably more to come. @@ -36,13 +37,18 @@ ## Installing +Use `stack build` (not `install`) for each of your package sets. Each+LTS or nightly should have a separate `stack build`. **If you use**+`stack install` **you will run into incompatibility issues+between package sets.**+ Standard: $ stack build intero From source: - $ git clone https://github.com/chrisdone/intero.git+ $ git clone https://github.com/commercialhaskell/intero.git $ cd intero $ stack build intero
elisp/intero.el view
@@ -45,7 +45,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Configuration -(defconst intero-package-version "intero-0.1.8"+(defconst intero-package-version "0.1.11" "Package version to auto-install.") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;@@ -100,6 +100,22 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Interactive commands +(defun intero-list-buffers ()+ "List hidden process buffers created by intero.++You can use this to kill them or look inside."+ (interactive)+ (let ((buffers (cl-remove-if-not+ (lambda (buffer)+ (string-match " intero:" (buffer-name buffer)))+ (buffer-list))))+ (if buffers+ (display-buffer+ (list-buffers-noselect+ nil+ buffers))+ (error "There are no Intero process buffers."))))+ (defun intero-cd () "Change directory in the backend process." (interactive)@@ -712,22 +728,34 @@ (let* ((buffer (intero-get-buffer-create worker))) (if (get-buffer-process buffer) buffer- (if (intero-installed-p)- (intero-start-process-in-buffer buffer targets source-buffer)- (intero-auto-install buffer targets source-buffer)))))+ (let ((install-status (intero-installed-p)))+ (if (eq install-status 'installed)+ (intero-start-process-in-buffer buffer targets source-buffer)+ (intero-auto-install buffer install-status targets source-buffer)))))) -(defun intero-auto-install (buffer &optional targets source-buffer)+(defun intero-auto-install (buffer install-status &optional targets source-buffer) "Automatically install Intero." (let ((source-buffer (or source-buffer (current-buffer)))) (switch-to-buffer buffer) (erase-buffer)- (insert "Intero is not installed in the Stack environment.+ (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 " -Installing automatically ...+Installing intero-%s automatically ... -")+" intero-package-version)) (redisplay)- (cl-case (call-process "stack" nil (current-buffer) t "build" intero-package-version)+ (cl-case (call-process "stack" nil (current-buffer) t "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))))) (0 (message "Installed successfully! Starting Intero in a moment ...") (bury-buffer buffer)@@ -806,9 +834,17 @@ (intero-show-process-problem process change))))) (defun intero-installed-p ()- "Is intero installed in the stack environment?"+ "Is intero (of the right version) installed in the stack environment?" (redisplay)- (= 0 (call-process "stack" nil nil nil "exec" "--" "intero" "--version")))+ (with-temp-buffer+ (if (= 0 (call-process "stack" nil t nil "exec" "--" "intero" "--version"))+ (progn+ (goto-char (point-min))+ (if (string= (buffer-substring (point-min) (line-end-position))+ intero-package-version)+ 'installed+ 'wrong-version))+ 'not-installed))) (defun intero-show-process-problem (process change) "Show the user that a CHANGE occurred on PROCESS, causing it to
intero.cabal view
@@ -1,20 +1,21 @@ name: intero version:- 0.1.11+ 0.1.12 synopsis: Complete interactive development program for Haskell license: BSD3 homepage:- https://github.com/chrisdone/intero+ https://github.com/commercialhaskell/intero license-file: LICENSE author: Chris Done, The University of Glasgow maintainer:- chrisdone@gmail.com+ chrisdone@fpcomplete.com copyright:+ 2016 FP Complete, 2016 Chris Done, 2012 Kazu Yamamoto, 2008 Claus Reinke,@@ -38,7 +39,7 @@ type: git location:- git://github.com/chrisdone/intero.git+ git://github.com/commercialhaskell/intero.git executable intero default-language:
src/Main.hs view
@@ -88,6 +88,7 @@ main :: IO () main = do+ env <- getEnvironment initGCStatistics -- See Note [-Bsymbolic and hooks] hSetBuffering stdout LineBuffering hSetBuffering stderr LineBuffering@@ -98,6 +99,16 @@ then do putStrLn (Data.Version.showVersion Paths_intero.version) exitSuccess else return ()+ case lookup "STACK_EXE" env of+ Just{} -> return ()+ Nothing ->+ hPutStr stderr ("WARNING: it is HIGHLY RECOMMENDED to use intero with stack:\n\n"+ ++ " To install:\n"+ ++ " stack build intero\n\n"+ ++ " To run with no project:\n"+ ++ " stack exec intero\n"+ ++ " To run with your project:\n"+ ++ " stack ghci --with-ghc intero\n\n") let argv0 = ("-B" ++ GHC.Paths.libdir) : if any (`elem` argv00) ["--info", "--interactive", "--make", "-c"] then argv00 -- needed for "cabal repl --with-ghc=ghci-ng"
src/test/Main.hs view
@@ -37,7 +37,7 @@ argsparser = describe "Arguments parser" (do issue ":type-at \"Foo Bar.hs\" 1 1 1 1"- "https://github.com/chrisdone/intero/issues/25"+ "https://github.com/commercialhaskell/intero/issues/25" (atFile ":type-at" "Foo Bar.hs" "x = 'a'"@@ -45,7 +45,7 @@ id "x :: Char\n") issue ":type-at"- "https://github.com/chrisdone/intero/issues/28"+ "https://github.com/commercialhaskell/intero/issues/28" (eval ":type-at" "\n<no location info>: Expected a span: \"<module-name/filepath>\" <start line> <start column> <end line> <end column> \"<sample string>\"\n")) @@ -121,32 +121,32 @@ it ":type-at X.hs 1 11 1 12 y -- [Char] (internal variable)" (typeAt "x = 'a' : y where y = x" (1,11,1,12,"y") "y :: [Char]\n") issue ":type-at X.hs 1 1 1 1 f -- Num a => a"- "https://github.com/chrisdone/intero/issues/14"+ "https://github.com/commercialhaskell/intero/issues/14" (typeAt "f x = x * 2" (1,1,1,2,"f") "f :: Num a => a -> a\n") issue ":type-at X.hs 1 1 1 1 x -- Char (oddly bounded selection)"- "https://github.com/chrisdone/intero/issues/29"+ "https://github.com/commercialhaskell/intero/issues/29" (typeAt "foo = 'a'" (1,1,1,1,"f") "f :: Char\n") issue ":type-at half of 2 arguments within function call"- "https://github.com/chrisdone/intero/issues/29"+ "https://github.com/commercialhaskell/intero/issues/29" (typeAt testFile (1,29,1,32,"\" \"") "\" \" :: [Char] -> [Char]\n") issue ":type-at funtion + half of its first argument"- "https://github.com/chrisdone/intero/issues/29"+ "https://github.com/commercialhaskell/intero/issues/29" (typeAt testFile (1,18,1,28,"concat3 \"a") "concat3 \"a :: [Char] -> [Char] -> [Char]\n") issue ":type-at 2 arguments within a function call"- "https://github.com/chrisdone/intero/issues/29"+ "https://github.com/commercialhaskell/intero/issues/29" (typeAt testFile (1,26,1,35,"\"aa\" \"bb\"") "\"aa\" \"bb\" :: [Char] -> [Char]\n") issue ":type-at 2 lines within a do bloc"- "https://github.com/chrisdone/intero/issues/29"+ "https://github.com/commercialhaskell/intero/issues/29" (typeAt testFile (4,8,5,10,"{{multiline}}") "{{multiline}} :: IO ()\n") issue ":type-at part of a line within a do bloc (1)"- "https://github.com/chrisdone/intero/issues/29"+ "https://github.com/commercialhaskell/intero/issues/29" (typeAt testFile (4,8,4,10," 1") " 1 :: IO ()\n") issue ":type-at part of a line within a do bloc (2)"- "https://github.com/chrisdone/intero/issues/29"+ "https://github.com/commercialhaskell/intero/issues/29" (typeAt testFile (4,9,4,10,"1") "1 :: Integer\n")) where testFile :: String testFile =@@ -197,7 +197,8 @@ it ":uses X.hs 1 5 1 6 id -- package definition" (uses "x = id" (1,5,1,6,"id")- (\i -> subRegex (mkRegex "-[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+") i "")+ (\i ->+ subRegex (mkRegex "-[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+") i "") (unlines ["base:GHC.Base"])) it ":uses X.hs 1 5 1 6 id -- shadowed package definition" (uses "x = id where id = ()"@@ -205,7 +206,25 @@ id (unlines ["X.hs:(1,14)-(1,16)" ,"X.hs:(1,14)-(1,16)"- ,"X.hs:(1,5)-(1,7)"])))+ ,"X.hs:(1,5)-(1,7)"]))+ issue ":uses on type constructor (in data decl)"+ "https://github.com/commercialhaskell/intero/issues/3"+ (uses (unlines ["data X = X","foo :: X -> X","foo x = X"])+ (1,6,1,7,"X")+ lines+ ["X.hs:(1,1)-(1,11)"])+ issue ":uses on type constructor (in sig)"+ "https://github.com/commercialhaskell/intero/issues/3"+ (uses (unlines ["data X = X","foo :: X -> X","foo x = X"])+ (2,8,2,9,"X")+ lines+ ["X.hs:(1,1)-(1,11)"])+ issue ":uses on data constructor (in expression)"+ "https://github.com/commercialhaskell/intero/issues/3"+ (uses (unlines ["data X = X","foo :: X -> X","foo x = X"])+ (3,9,3,10,"X")+ lines+ ["X.hs:(1,10)-(1,11)","X.hs:(3,9)-(3,10)"])) -- | Find loc-ats of a variable. definition :: Spec@@ -233,7 +252,7 @@ completion = do describe "Complete basic Prelude identifiers" (issue ":complete repl \"put\""- "https://github.com/chrisdone/intero/issues/34"+ "https://github.com/commercialhaskell/intero/issues/34" (eval ":complete repl \"put\"" (unlines ["3 3 \"\"" ,"\"putChar\""