leksah 0.15.0.1 → 0.15.0.2
raw patch · 24 files changed
+285/−244 lines, 24 filesdep −gtkdep −gtk-mac-integrationdep −gtksourceview2dep ~leksahdep ~leksah-serverdep ~webkitgtk3PVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies removed: gtk, gtk-mac-integration, gtksourceview2, webkit, webkit-javascriptcore
Dependency ranges changed: leksah, leksah-server, webkitgtk3
API changes (from Hackage documentation)
+ IDE.Pane.Files: instance Ord FileRecord
- IDE.Package: packageTest' :: IDEPackage -> Bool -> (Bool -> IDEAction) -> IDEAction
+ IDE.Package: packageTest' :: Bool -> Bool -> IDEPackage -> Bool -> (Bool -> IDEAction) -> IDEAction
Files
- data/leksah-welcome/LICENSE +21/−0
- data/leksah-welcome/leksah-welcome.cabal +15/−15
- data/leksah-welcome/src/Main.hs +18/−43
- data/leksah-welcome/test/Main.hs +10/−0
- data/main.lksht +3/−25
- data/prefs.lkshp +2/−2
- data/testmain.lksht +23/−0
- leksah.cabal +39/−42
- osx/launcher.sh +13/−9
- osx/leksah.bundle +4/−0
- osx/makedmg.sh +1/−1
- osx/makedmgs.sh +1/−16
- scripts/stage.sh +1/−1
- src/IDE/Build.hs +1/−1
- src/IDE/Leksah.hs +2/−0
- src/IDE/Metainfo/Provider.hs +32/−26
- src/IDE/Package.hs +10/−8
- src/IDE/Pane/Files.hs +20/−9
- src/IDE/Pane/Modules.hs +12/−3
- src/IDE/Pane/PackageEditor.hs +20/−14
- src/IDE/Pane/Preferences.hs +4/−4
- src/IDE/Pane/SourceBuffer.hs +23/−18
- src/IDE/Workspaces.hs +5/−5
- win32/makeinstaller.sh +5/−2
+ data/leksah-welcome/LICENSE view
@@ -0,0 +1,21 @@+Copyright (c) 2015 Hamish Mackenzie++Permission is hereby granted, free of charge, to any person obtaining+a copy of this software and associated documentation files (the+"Software"), to deal in the Software without restriction, including+without limitation the rights to use, copy, modify, merge, publish,+distribute, sublicense, and/or sell copies of the Software, and to+permit persons to whom the Software is furnished to do so, subject to+the following conditions:++The above copyright notice and this permission notice shall be+included in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.+
data/leksah-welcome/leksah-welcome.cabal view
@@ -1,26 +1,26 @@ name: leksah-welcome-version: 0.12.0.3-cabal-version: >=1.2+version: 0.15.0.0+cabal-version: 1.12 build-type: Simple-license: AllRightsReserved-license-file: ""+license: MIT+license-file: LICENSE description:- .- .- .- .-data-dir: ""+ Example package you can use to try out some of Leksah's features executable leksah-welcome- build-depends: QuickCheck -any, base -any main-is: Main.hs- buildable: True+ build-depends:+ QuickCheck -any,+ base -any+ default-language: Haskell2010 hs-source-dirs: src test-suite test-leksah-welcome- build-depends: QuickCheck -any, base -any type: exitcode-stdio-1.0 main-is: Main.hs- buildable: True- cpp-options: -DMAIN_FUNCTION=testMain- hs-source-dirs: src+ build-depends:+ QuickCheck -any,+ base -any,+ doctest -any+ default-language: Haskell2010+ hs-source-dirs: test
data/leksah-welcome/src/Main.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP, TemplateHaskell #-} -- Welcome to Leksah. This is a quick sample package for you to -- try things out with. We hope it will be useful for those new -- to Haskell or just new to Leksah.@@ -15,61 +14,37 @@ -- When you are ready to create your own workspace and package. -- * Package -> New--- * When asked for a root folder for your package select a new folder--- with the desired name of your package --- This is the "Main" module and it exports a "main" function-module Main (- main-) where- -- Next we are importing some things from other modules. -- Leksah can normally addd these imports for you, just -- press Ctrl+R (OS X Command+R)-import Control.Monad (unless) import Data.List (stripPrefix)-import System.Exit (exitFailure)-import Test.QuickCheck.All (quickCheckAll) --- Simple function to create a hello message.-hello s = "Hello " ++ s---- QuickCheck is a great tool for writing tests.--- The following tells QuickCheck that if you strip "Hello "--- from the start of hello s you will be left with s (for any s).+-- | Simple function to create a hello message.+--+-- The following tells doctest & QuickCheck that if you strip "Hello "+-- from the start of `hello s` you will be left with `s` (for any `s`). -- QuickCheck will create the test data needed to run this test.-prop_hello s = stripPrefix "Hello " (hello s) == Just s+--+-- To automatically run the tests when the package is built, click on+-- the green tick on the tool leksah tool bar.+--+-- To see how this is configured take a look in leksah-welecome.cabal+-- (you can open it with Package -> Edit).+--+-- The code that runs the tests is in the file test/Main.hs.+--+-- prop> stripPrefix "Hello " (hello s) == Just s+hello s = "Hello " ++ s --- exeMain : Executable Entry Point--- --------------------------------+-- | Executable Entry Point+-- -- Here is the entry point for the leksah-welcome executable -- -- To run it -- * Select Leksah menu item Package -> Run (or the cogs on the toolbar) -- * Select "exeMain" and press Ctrl+Enter to run them in ghci -- * Run "leksah-wellcome" from the command line-exeMain = do+main = do putStrLn (hello "World")---- testMain : Unit Testing Entry Point--- -------------------------------------- This is the main function uses by the cabal test------ To run these tests--- * Select Leksah menu item Package -> Test--- * Select the tick icon on the Leksa toolbar (to enable "cabal test" during builds)--- * Select "testMain" and press Ctrl+Enter to run them in ghci--- * Run "cabal test" from the command line in the package directory-testMain = do- allPass <- $quickCheckAll -- Run QuickCheck on all prop_ functions- unless allPass exitFailure---- This is a clunky, but portable, way to use the same Main module file--- for both an application and for unit tests.--- MAIN_FUNCTION is preprocessor macro set to exeMain or testMain.--- That way we can use the same file for both an application and for tests.-#ifndef MAIN_FUNCTION-#define MAIN_FUNCTION exeMain-#endif-main = MAIN_FUNCTION
+ data/leksah-welcome/test/Main.hs view
@@ -0,0 +1,10 @@+import Test.DocTest++-- Unit Testing Entry Point+-- ------------------------+-- This is the main function uses by the cabal test+--+-- To run these tests+-- * Select Leksah menu item Package -> Test+-- * Select the tick icon on the Leksah toolbar (to enable "cabal test" during builds)+main = doctest ["-isrc", "src/Main.hs"]
data/main.lksht view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP, TemplateHaskell #-} ----------------------------------------------------------------------------- -- -- Module : @ModuleName@@@ -17,33 +16,12 @@ main ) where -import Control.Monad (unless) import Data.List (stripPrefix)-import System.Exit (exitFailure)-import Test.QuickCheck.All (quickCheckAll) --- Simple function to create a hello message.+-- | Simple function to create a hello message.+-- prop> stripPrefix "Hello " (hello s) == Just s hello s = "Hello " ++ s --- Tell QuickCheck that if you strip "Hello " from the start of--- hello s you will be left with s (for any s).-prop_hello s = stripPrefix "Hello " (hello s) == Just s---- Hello World-exeMain = do+main = do putStrLn (hello "World")---- Entry point for unit tests.-testMain = do- allPass <- $quickCheckAll -- Run QuickCheck on all prop_ functions- unless allPass exitFailure---- This is a clunky, but portable, way to use the same Main module file--- for both an application and for unit tests.--- MAIN_FUNCTION is preprocessor macro set to exeMain or testMain.--- That way we can use the same file for both an application and for tests.-#ifndef MAIN_FUNCTION-#define MAIN_FUNCTION exeMain-#endif-main = MAIN_FUNCTION
data/prefs.lkshp view
@@ -83,5 +83,5 @@ False Browser: "firefox" URL for searching documentation:- "http://www.holumbus.org/hayoo/hayoo.html?query="- --e.g Hoogle: http://www.haskell.org/hoogle/?q= or Hayoo: http://www.holumbus.org/hayoo/hayoo.html?query=+ "https://www.haskell.org/hoogle/?q="+ --e.g Hoogle: https://www.haskell.org/hoogle/?q= or Hayoo: http://hayoo.fh-wedel.de/?query=
+ data/testmain.lksht view
@@ -0,0 +1,23 @@+-----------------------------------------------------------------------------+--+-- Module : @ModuleName@+-- Copyright : @Copyright@+-- License : @License@+--+-- Maintainer : @Maintainer@+-- Stability : @Stability@+-- Portability : @Portability@+--+-- |+--+-----------------------------------------------------------------------------++module @ModuleName@ (+ main+) where++import Test.DocTest++main = doctest ["-isrc", "src/Main.hs"]++
leksah.cabal view
@@ -1,5 +1,5 @@ name: leksah-version: 0.15.0.1+version: 0.15.0.2 cabal-version: >=1.18 build-type: Simple license: GPL@@ -30,11 +30,14 @@ data/emacs.lkshk data/LICENSE data/main.lksht+ data/testmain.lksht data/module.lksht data/welcome.txt data/leksah-welcome/Setup.lhs data/leksah-welcome/leksah-welcome.cabal+ data/leksah-welcome/LICENSE data/leksah-welcome/src/Main.hs+ data/leksah-welcome/test/Main.hs data/empty.lkshs data/.gtkrc-2.0 data/styles/leksah.xml@@ -186,10 +189,6 @@ description: Build with support for multithreaded execution default: False -flag gtk3- Description: Use GTK3 rather than GTK2- Default: True- flag loc Description: Experimental localization support Default: False@@ -206,10 +205,7 @@ build-depends: unix >=2.3.1.0 && <2.8 if os(osx)- if flag(gtk3)- build-depends: gtk3-mac-integration >= 0.3.0.0 && <0.4- else- build-depends: gtk-mac-integration >= 0.3.0.0 && <0.4+ build-depends: gtk3-mac-integration >= 0.3.0.0 && <0.4 if flag(yi) build-depends: yi >=0.11.2 && <0.12,@@ -221,16 +217,12 @@ build-depends: dyre >= 0.8.3 && <0.9 cpp-options: -DLEKSAH_WITH_YI_DYRE - if flag(gtk3)- build-depends: gtk3 >=0.13.2 && <0.14, gtksourceview3 >=0.13.1.0 && <0.14- cpp-options: -DMIN_VERSION_gtk=MIN_VERSION_gtk3- else- build-depends: gtk >=0.13.2 && <0.14, gtksourceview2 >=0.13.1.0 && <0.14+ build-depends: gtk3 >=0.13.2 && <0.14,+ gtksourceview3 >=0.13.1.0 && <0.14,+ webkitgtk3 >=0.13 && <0.14,+ webkitgtk3-javascriptcore -any+ cpp-options: -DMIN_VERSION_gtk=MIN_VERSION_gtk3 - if flag(gtk3)- build-depends: webkitgtk3 -any, webkitgtk3-javascriptcore -any- else- build-depends: webkit -any, webkit-javascriptcore -any build-depends: jsaddle -any, ghcjs-codemirror -any, hamlet -any, blaze-html -any, lens -any, pretty-show >=1.6.3 && <1.7 cpp-options: -DWEBKITGTK -DLEKSAH_WITH_CODE_MIRROR@@ -254,7 +246,7 @@ parsec >=2.1.0.1 && <3.2, pretty >=1.0.1.0 && <1.2, regex-tdfa >=1.1 && <1.3, regex-tdfa-text, regex-base ==0.93.*, utf8-string >=0.3.1.1 && <1.1, array >=0.2.0.0 && <0.6, time >=0.1 && <1.6, ltk >= 0.15.0.1 && <0.16, binary-shared >= 0.8 && <0.9, deepseq >= 1.1.0.0 && <1.5,- hslogger >= 1.0.7 && <1.3, leksah-server >=0.15.0.1 && <0.16,+ hslogger >= 1.0.7 && <1.3, leksah-server >=0.15.0.2 && <0.16, ghc >=6.10.1 && <7.11, strict >= 0.3.2 && <0.4, conduit >= 1.0.8 && <1.3, text >= 0.11.1.5 && < 1.3, gio >=0.13.0.0 && <0.14, transformers >=0.2.2.0 && <0.5, executable-path >=0.0.3 && <0.1,@@ -304,11 +296,9 @@ ghc-options: -threaded hs-source-dirs: main- build-depends: leksah == 0.15.0.1, base >= 4.0.0.0 && <=4.9- if flag(gtk3)- build-depends: gtk3 >=0.13.2 && <0.14- else- build-depends: gtk >=0.13.2 && <0.14+ build-depends: leksah == 0.15.0.2,+ base >= 4.0.0.0 && <=4.9,+ gtk3 >=0.13.2 && <0.14 if os(linux) && flag(loc) cpp-options: -DLOCALIZATION build-depends: hgettext, setlocale@@ -322,15 +312,15 @@ ghc-options: -rtsopts -fwarn-missing-fields -fwarn-incomplete-patterns -ferror-spans executable bewleksah- build-depends: leksah ==0.15.0.1, base >=4.0.0.0 && <=4.9,- jsaddle -any, ghcjs-dom -any- if flag(gtk3)- build-depends: gtk3 >=0.13.2 && <0.14, gtksourceview3 >=0.13.1.0 && <0.14,- webkitgtk3 -any, webkitgtk3-javascriptcore -any- cpp-options: -DMIN_VERSION_gtk=MIN_VERSION_gtk3- else- build-depends: gtk >=0.13.2 && <0.14, gtksourceview2 >=0.13.1.0 && <0.14,- webkit -any, webkit-javascriptcore -any+ build-depends: leksah ==0.15.0.2,+ base >=4.0.0.0 && <=4.9,+ jsaddle -any,+ ghcjs-dom -any,+ gtk3 >=0.13.2 && <0.14,+ gtksourceview3 >=0.13.1.0 && <0.14,+ webkitgtk3 >=0.13 && <0.14,+ webkitgtk3-javascriptcore -any+ cpp-options: -DMIN_VERSION_gtk=MIN_VERSION_gtk3 main-is: Main.hs buildable: True@@ -338,15 +328,22 @@ hs-source-dirs: bew test-suite tests- build-depends: base >=4.0.0.0 && <4.9, Cabal >=1.10.2.0 && <1.23,- QuickCheck >=2.4.2 && <2.9, leksah ==0.15.0.1,- containers, ltk, leksah-server, hslogger,- transformers, glib, monad-loops, text- if flag(gtk3)- build-depends: gtk3 >=0.13.2 && <0.14, gtksourceview3 >=0.13.1.0 && <0.14, webkitgtk3 -any- cpp-options: -DMIN_VERSION_gtk=MIN_VERSION_gtk3- else- build-depends: gtk >=0.13.2 && <0.14, gtksourceview2 >=0.13.1.0 && <0.14, webkit -any+ build-depends: base >=4.0.0.0 && <4.9,+ Cabal >=1.10.2.0 && <1.23,+ QuickCheck >=2.4.2 && <2.9,+ leksah ==0.15.0.2,+ containers,+ ltk,+ leksah-server,+ hslogger,+ transformers,+ glib,+ monad-loops,+ text,+ gtk3 >=0.13.2 && <0.14,+ gtksourceview3 >=0.13.1.0 && <0.14,+ webkitgtk3 -any+ cpp-options: -DMIN_VERSION_gtk=MIN_VERSION_gtk3 if flag(yi) build-depends: yi type: exitcode-stdio-1.0
osx/launcher.sh view
@@ -1,7 +1,9 @@ #!/bin/sh -if test -e ~/.profile; then- export PATH=`. ~/.profile;echo $PATH`+if test -e ~/.bash_profile; then+ . ~/.bash_profile+elif test -e ~/.profile; then+ . ~/.profile fi if test "x$GTK_DEBUG_LAUNCHER" != x; then@@ -52,6 +54,8 @@ export hlint_datadir="$bundle_data/hlint" +export vcsgui_datadir="$bundle_data/vcsgui"+ APP=name I18NDIR="$bundle_data/locale" # Set the locale-related variables appropriately:@@ -86,7 +90,7 @@ export LANG=$L break fi;- done + done fi unset APPLELANGUAGES L @@ -106,7 +110,7 @@ APPLELOCALE=`defaults read .GlobalPreferences AppleLocale` if test -f "$I18NDIR/${APPLELOCALE:0:5}/LC_MESSAGES/$APP.mo"; then- if test -z $LANG; then + if test -z $LANG; then export LANG="${APPLELOCALE:0:5}" fi @@ -118,7 +122,7 @@ #5-character locale to avoid the "Locale not supported by C library" #warning from Gtk -- even though Gtk will translate with a #two-character code.-if test -n $LANG; then +if test -n $LANG; then #If the language code matches the applelocale, then that's the message #locale; otherwise, if it's longer than two characters, then it's #probably a good message locale and we'll go with it.@@ -135,7 +139,7 @@ export LC_MESSAGES="en_US" else LOC=`find $PREFIX/share/locale -name $LANG???`- for L in $LOC; do + for L in $LOC; do export LC_MESSAGES=$L done fi@@ -145,16 +149,16 @@ export LC_MESSAGES="en_US" fi CURRENCY=`echo $APPLELOCALE | sed -En 's/.*currency=([[:alpha:]]+).*/\1/p'`-if test "x$CURRENCY" != "x"; then +if test "x$CURRENCY" != "x"; then #The user has set a special currency. Gtk doesn't install LC_MONETARY files, but Apple does in /usr/share/locale, so we're going to look there for a locale to set LC_CURRENCY to. if test -f /usr/local/share/$LC_MESSAGES/LC_MONETARY; then if test -a `cat /usr/local/share/$LC_MESSAGES/LC_MONETARY` == $CURRENCY; then export LC_MONETARY=$LC_MESSAGES fi fi- if test -z "$LC_MONETARY"; then + if test -z "$LC_MONETARY"; then FILES=`find /usr/share/locale -name LC_MONETARY -exec grep -H $CURRENCY {} \;`- if test -n "$FILES"; then + if test -n "$FILES"; then export LC_MONETARY=`echo $FILES | sed -En 's%/usr/share/locale/([[:alpha:]_]+)/LC_MONETARY.*%\1%p'` fi fi
osx/leksah.bundle view
@@ -137,6 +137,10 @@ ${prefix:hlint}/share </data> + <data dest="${bundle}/Contents/Resources/share/vcsgui">+ ${prefix:vcsgui}/share+ </data>+ <!-- Copy in the themes data. You may want to trim this to save space in your bundle. --> <data>
osx/makedmg.sh view
@@ -10,7 +10,7 @@ export LEKSAH_SERVER_BIN_DIR=$GHC_USER_PREFIX/$LEKSAH_SERVER_X_X_X_X export LEKSAH_SERVER_PREFIX=$GHC_USER_PREFIX/$LEKSAH_SERVER_X_X_X_X/share export VCSGUI_BIN_DIR=$GHC_USER_PREFIX/`ghc-pkg$GHCVERSION list |grep '^ *vcsgui-' | head -n1 | tr -d ' \n'`-export VCSGUI_PREFIX=$GHC_USER_PREFIX/`ghc-pkg$GHCVERSION list |grep '^ *vcsgui-' | head -n1 | tr -d ' \n'`/share+export VCSGUI_PREFIX=$GHC_USER_PREFIX/`ghc-pkg$GHCVERSION list |grep '^ *vcsgui-' | head -n1 | tr -d ' \n'` export HLINT_PREFIX=$GHC_USER_PREFIX/`ghc-pkg$GHCVERSION list |grep '^ *hlint-' | head -n1 | tr -d ' \n'` #export SANDBOX_BIN_DIR=$PWD/.cabal-sandbox
osx/makedmgs.sh view
@@ -1,21 +1,6 @@ #!/bin/sh -ex -#export PATH=/Users/hamish/Library/Haskell/bin:/Library/Frameworks/GHC.framework/Versions/7.0.3-i386/usr/bin:$PATH-#scripts/clean.sh-#osx/makedmg.sh-#export PATH=/Users/hamish/Library/Haskell/bin:/Library/Frameworks/GHC.framework/Versions/7.0.4-i386/usr/bin:$PATH-#scripts/clean.sh-#osx/makedmg.sh-#export PATH=/Users/hamish/Library/Haskell/bin:/Library/Frameworks/GHC.framework/Versions/7.4.1-i386/usr/bin:$PATH-#scripts/clean.sh-#osx/makedmg.sh-#export PATH=/Users/hamish/Library/Haskell/bin:/Library/Frameworks/GHC.framework/Versions/7.4.2-i386/usr/bin:$PATH-#scripts/clean.sh-#osx/makedmg.sh-#export PATH=/Users/hamish/Library/Haskell/bin:/Library/Frameworks/GHC.framework/Versions/7.6.3-i386/usr/bin:$PATH-#scripts/clean.sh-#osx/makedmg.sh-export GHCVERSION=-7.6.3+export GHCVERSION=-7.8.3 scripts/clean.sh osx/makedmg.sh export GHCVERSION=
scripts/stage.sh view
@@ -35,7 +35,7 @@ cd ../leksah-server || exit cabal install --enable-tests -j4 --with-ghc=ghc$GHCVERSION || exit cabal test || exit- cd ../yi || exit+# cd ../yi || exit # cabal install -j4 -fpango --with-ghc=ghc$GHCVERSION || exit cd ../.. || exit cabal install -j4 -fwebkit -f-yi --with-ghc=ghc$GHCVERSION || exit
src/IDE/Build.hs view
@@ -206,7 +206,7 @@ doBuildChain ms chain@Chain{mcAction = MoDocu} = packageDoc' (msBackgroundBuild ms) (msJumpToWarnings ms) (mcEle chain) (constrCont ms (mcPos chain) (mcNeg chain)) doBuildChain ms chain@Chain{mcAction = MoTest} =- packageTest' (mcEle chain) False (constrCont ms (mcPos chain) (mcNeg chain))+ packageTest' (msBackgroundBuild ms) (msJumpToWarnings ms) (mcEle chain) False (constrCont ms (mcPos chain) (mcNeg chain)) doBuildChain ms chain@Chain{mcAction = MoCopy} = packageCopy' (mcEle chain) (constrCont ms (mcPos chain) (mcNeg chain)) doBuildChain ms chain@Chain{mcAction = MoRegister} =
src/IDE/Leksah.hs view
@@ -448,7 +448,9 @@ createDirectoryIfMissing True $ welcomePath</>"src" copyFile (welcomeSource</>"Setup.lhs") (welcomePath</>"Setup.lhs") copyFile (welcomeSource</>"leksah-welcome.cabal") (welcomeCabal)+ copyFile (welcomeSource</>"LICENSE") (welcomePath</>"LICENSE") copyFile (welcomeSource</>"src"</>"Main.hs") (welcomeMain)+ copyFile (welcomeSource</>"test"</>"Main.hs") (welcomePath</>"test"</>"Main.hs") defaultWorkspace <- liftIO $ (</> "leksah.lkshw") <$> getHomeDirectory defaultExists <- liftIO $ doesFileExist defaultWorkspace reflectIDE (do
src/IDE/Metainfo/Provider.hs view
@@ -141,15 +141,18 @@ loadSystemInfo :: IDEAction loadSystemInfo = do collectorPath <- liftIO getCollectorPath- packageIds <- liftM nub $ liftIO getInstalledPackageIds- packageList <- liftIO $ mapM (loadInfosForPackage collectorPath)- packageIds- let scope = foldr buildScope (PackScope Map.empty getEmptyDefaultScope)- $ catMaybes packageList--- liftIO performGC- modifyIDE_ (\ide -> ide{systemInfo = Just (GenScopeC (addOtherToScope scope False))})+ mbPackageIds <- liftIO getInstalledPackageIds'+ case mbPackageIds of+ Left e -> logMessage ("Please check that ghc-pkg is in your PATH and restart leksah:\n " <> e) ErrorTag+ Right packageIds -> do+ packageList <- liftIO $ mapM (loadInfosForPackage collectorPath)+ (nub packageIds)+ let scope = foldr buildScope (PackScope Map.empty getEmptyDefaultScope)+ $ catMaybes packageList+ -- liftIO performGC+ modifyIDE_ (\ide -> ide{systemInfo = Just (GenScopeC (addOtherToScope scope False))}) - return ()+ return () -- -- | Updates the system info@@ -161,24 +164,27 @@ case wi of Nothing -> loadSystemInfo Just (GenScopeC (PackScope psmap psst)) -> do- packageIds <- liftIO getInstalledPackageIds- let newPackages = filter (`Map.member` psmap) packageIds- let trashPackages = filter (`notElem` packageIds) (Map.keys psmap)- if null newPackages && null trashPackages- then continuation True- else- callCollector rebuild True True $ \ _ -> do- collectorPath <- lift getCollectorPath- newPackageInfos <- liftIO $ mapM (loadInfosForPackage collectorPath)- newPackages- let psmap2 = foldr ((\ e m -> Map.insert (pdPackage e) e m) . fromJust) psmap- (filter isJust newPackageInfos)- let psmap3 = foldr Map.delete psmap2 trashPackages- let scope :: PackScope (Map Text [Descr])- = foldr buildScope (PackScope Map.empty symEmpty)- (Map.elems psmap3)- modifyIDE_ (\ide -> ide{systemInfo = Just (GenScopeC (addOtherToScope scope False))})- continuation True+ mbPackageIds <- liftIO getInstalledPackageIds'+ case mbPackageIds of+ Left e -> logMessage ("Please check that ghc-pkg is in your PATH and restart leksah:\n " <> e) ErrorTag+ Right packageIds -> do+ let newPackages = filter (`Map.member` psmap) packageIds+ let trashPackages = filter (`notElem` packageIds) (Map.keys psmap)+ if null newPackages && null trashPackages+ then continuation True+ else+ callCollector rebuild True True $ \ _ -> do+ collectorPath <- lift getCollectorPath+ newPackageInfos <- liftIO $ mapM (loadInfosForPackage collectorPath)+ newPackages+ let psmap2 = foldr ((\ e m -> Map.insert (pdPackage e) e m) . fromJust) psmap+ (filter isJust newPackageInfos)+ let psmap3 = foldr Map.delete psmap2 trashPackages+ let scope :: PackScope (Map Text [Descr])+ = foldr buildScope (PackScope Map.empty symEmpty)+ (Map.elems psmap3)+ modifyIDE_ (\ide -> ide{systemInfo = Just (GenScopeC (addOtherToScope scope False))})+ continuation True ideMessage Normal "Finished updating system metadata" getEmptyDefaultScope :: Map Text [Descr]
src/IDE/Package.hs view
@@ -503,10 +503,10 @@ packageTest :: PackageAction packageTest = do package <- ask- liftIDE $ packageTest' package True (\ _ -> return ())+ liftIDE $ packageTest' False True package True (\ _ -> return ()) -packageTest' :: IDEPackage -> Bool -> (Bool -> IDEAction) -> IDEAction-packageTest' package shallConfigure continuation =+packageTest' :: Bool -> Bool -> IDEPackage -> Bool -> (Bool -> IDEAction) -> IDEAction+packageTest' backgroundBuild jumpToWarnings package shallConfigure continuation = if "--enable-tests" `elem` ipdConfigFlags package then do logLaunch <- getDefaultLogLaunch@@ -519,13 +519,13 @@ (mbLastOutput, isConfigErr, _) <- C.getZipSink $ (,,) <$> C.ZipSink sinkLast <*> C.ZipSink isConfigError- <*> (C.ZipSink $ logOutputForBuild package False True)+ <*> (C.ZipSink $ logOutputForBuild package backgroundBuild jumpToWarnings) lift $ do errs <- readIDE errorRefs if shallConfigure && isConfigErr then packageConfig' package (\ b ->- when b $ packageTest' package shallConfigure continuation)+ when b $ packageTest' backgroundBuild jumpToWarnings package shallConfigure continuation) else do continuation (mbLastOutput == Just (ToolExit ExitSuccess)) return ())@@ -850,10 +850,12 @@ return ()) ideR return () +-- Includes non buildable allBuildInfo' :: PackageDescription -> [BuildInfo]-allBuildInfo' pkg_descr = [ libBuildInfo lib | Just lib <- [library pkg_descr] ]- ++ [ buildInfo exe | exe <- executables pkg_descr ]- ++ [ testBuildInfo tst | tst <- testSuites pkg_descr ]+allBuildInfo' pkg_descr = [ libBuildInfo lib | Just lib <- [library pkg_descr] ]+ ++ [ buildInfo exe | exe <- executables pkg_descr ]+ ++ [ testBuildInfo tst | tst <- testSuites pkg_descr ]+ ++ [ benchmarkBuildInfo tst | tst <- benchmarks pkg_descr ] testMainPath (TestSuiteExeV10 _ f) = [f] testMainPath _ = []
src/IDE/Pane/Files.hs view
@@ -43,7 +43,7 @@ treeViewNew, treeStoreNew, castToWidget, TreeStore, TreeView, ScrolledWindow) import Data.Maybe (isJust)-import Control.Monad (void, forM_, when)+import Control.Monad (forM, void, forM_, when) import Data.Typeable (Typeable) import IDE.Core.State (MessageLevel(..), ipdBuildDir, ipdPackageId, wsPackages,@@ -71,6 +71,9 @@ import Data.Text (Text) import qualified Data.Text as T (pack) import Data.Monoid ((<>))+import Data.List (sortBy, sort)+import Data.Ord (comparing)+import Data.Char (toLower) data FileRecord = FileRecord FilePath@@ -78,6 +81,14 @@ | PackageRecord IDEPackage | PlaceHolder deriving(Eq) +instance Ord FileRecord where+ -- | The ordering used for displaying the records in the filetree+ compare (DirRecord _) (FileRecord _) = LT+ compare (FileRecord _) (DirRecord _) = GT+ compare (FileRecord p1) (FileRecord p2) = comparing (map toLower) p1 p2+ compare (DirRecord p1) (DirRecord p2) = comparing (map toLower) p1 p2+ compare _ _ = LT+ file :: FileRecord -> Text file (FileRecord f) = T.pack $ takeFileName f file (DirRecord f) = T.pack $ takeFileName f@@ -190,14 +201,14 @@ liftIO $ setDirectories store Nothing $ map PackageRecord $ maybe [] wsPackages mbWS dirContents :: FilePath -> IO [FileRecord]-dirContents dir =- (filter ((/= '.') . head) <$> getDirectoryContents dir >>=- mapM- (\ f ->- do let full = dir </> f- isDir <- doesDirectoryExist full- return $ if isDir then DirRecord full else FileRecord full))- `catch` \ (e :: IOError) -> return []+dirContents dir = do+ contents <- filter ((/= '.') . head) <$> getDirectoryContents dir+ `catch` \ (e :: IOError) -> return []+ records <- forM contents $ \f -> do+ let full = dir </> f+ isDir <- doesDirectoryExist full+ return $ if isDir then DirRecord full else FileRecord full+ return (sort records) refreshPackage :: TreeStore FileRecord -> TreePath -> IDEPackage -> IO () refreshPackage store path p = do
src/IDE/Pane/Modules.hs view
@@ -56,8 +56,10 @@ import Control.Applicative ((<$>)) import IDE.Package (packageConfig,addModuleToPackageDescr,delModuleFromPackageDescr,getEmptyModuleTemplate,getPackageDescriptionAndPath, ModuleLocation(..)) import Distribution.PackageDescription- (allBuildInfo, hsSourceDirs, hasLibs, executables, testSuites, exeName, testName,- benchmarks, benchmarkName)+ (PackageDescription, BuildInfo, hsSourceDirs,+ hasLibs, executables, testSuites, exeName, testName, benchmarks,+ benchmarkName, libBuildInfo, library, buildInfo, testBuildInfo,+ benchmarkBuildInfo) import System.FilePath (takeBaseName, (</>),dropFileName) import System.Directory (doesFileExist,createDirectoryIfMissing, removeFile) import Graphics.UI.Editor.MakeEditor (buildEditor,FieldDescription(..),mkField)@@ -1117,13 +1119,20 @@ $ map (\n -> take n treePath) [1 .. length treePath] addModule categories +-- Includes non buildable+allBuildInfo' :: PackageDescription -> [BuildInfo]+allBuildInfo' pkg_descr = [ libBuildInfo lib | Just lib <- [library pkg_descr] ]+ ++ [ buildInfo exe | exe <- executables pkg_descr ]+ ++ [ testBuildInfo tst | tst <- testSuites pkg_descr ]+ ++ [ benchmarkBuildInfo tst | tst <- benchmarks pkg_descr ]+ addModule :: [ModuleRecord] -> PackageAction addModule categories = do liftIO $ debugM "leksah" "selectIdentifier" mbPD <- liftIDE $ getPackageDescriptionAndPath case mbPD of Nothing -> liftIDE $ ideMessage Normal (__ "No package description")- Just (pd,cabalPath) -> let srcPaths = nub $ concatMap hsSourceDirs $ allBuildInfo pd+ Just (pd,cabalPath) -> let srcPaths = nub $ concatMap hsSourceDirs $ allBuildInfo' pd rootPath = dropFileName cabalPath modPath = foldr (\a b -> a <> "." <> b) "" (map fst categories)
src/IDE/Pane/PackageEditor.hs view
@@ -112,6 +112,8 @@ import qualified Text.Printf as S (printf) import Text.Printf (PrintfType) import MyMissing (forceJust)+import Language.Haskell.Extension (Language(..))+import Distribution.License (License(..)) printf :: PrintfType r => Text -> r printf = S.printf . T.unpack@@ -234,7 +236,7 @@ data NewPackage = NewPackage { newPackageName :: Text, newPackageParentDir :: FilePath,- templatePackage :: Text}+ templatePackage :: Maybe Text} packageFields :: FilePath -> FieldDescription NewPackage packageFields workspaceDir = VFD emptyParams [@@ -252,11 +254,11 @@ (\ a b -> b{newPackageParentDir = a}) (fileEditor (Just workspaceDir) FileChooserActionSelectFolder "Select"), mkField- (paraName <<<- ParaName ((__ "Existing package to copy"))+ (paraName <<<- ParaName ((__ "Copy existing package")) $ emptyParams) templatePackage (\ a b -> b{templatePackage = a})- (comboEntryEditor examplePackages)]+ (maybeEditor (comboEntryEditor examplePackages, emptyParams) True "")] examplePackages = [ "hello" , "gtk2hs-hello"@@ -275,7 +277,7 @@ #endif lower <- dialogGetActionArea dia (widget,inj,ext,_) <- buildEditor (packageFields workspaceDir)- (NewPackage "" workspaceDir "hello")+ (NewPackage "" workspaceDir Nothing) okButton <- dialogAddButton dia (__"Create Package") ResponseOk dialogAddButton dia (__"Cancel") ResponseCancel boxPackStart (castToBox upper) widget PackGrow 7@@ -283,7 +285,7 @@ widgetGrabDefault okButton widgetShowAll dia resp <- dialogRun dia- value <- ext (NewPackage "" workspaceDir "hello")+ value <- ext (NewPackage "" workspaceDir Nothing) widgetDestroy dia --find case resp of@@ -296,7 +298,7 @@ mbNewPackage <- liftIO $ newPackageDialog (head windows) workspaceDir case mbNewPackage of Nothing -> return ()- Just NewPackage{..} | T.null templatePackage -> do+ Just NewPackage{..} | templatePackage == Nothing -> do let dirName = newPackageParentDir </> T.unpack newPackageName mbCabalFile <- liftIO $ cabalFileName dirName window <- getMainWindow@@ -337,25 +339,29 @@ package = PackageIdentifier (PackageName $ T.unpack newPackageName) initialVersion , buildType = Just Simple- , specVersionRaw = Right (orLaterVersion (Version [1,2] []))- , buildDepends = [- Dependency (PackageName "base") anyVersion- , Dependency (PackageName "QuickCheck") anyVersion]+ , specVersionRaw = Right (orLaterVersion (Version [1,12] []))+ , license = AllRightsReserved , executables = [emptyExecutable { exeName = T.unpack newPackageName , modulePath = "Main.hs" , buildInfo = emptyBuildInfo {- hsSourceDirs = ["src"]}}]+ hsSourceDirs = ["src"]+ , targetBuildDepends = [Dependency (PackageName "base") anyVersion]+ , defaultLanguage = Just Haskell2010}}] , testSuites = [emptyTestSuite { testName = "test-" ++ T.unpack newPackageName , testInterface = (TestSuiteExeV10 (Version [1,0] []) "Main.hs") , testBuildInfo = emptyBuildInfo {- hsSourceDirs = ["src"]- , cppOptions = ["-DMAIN_FUNCTION=testMain"]}}]+ hsSourceDirs = ["test"]+ , targetBuildDepends = [+ Dependency (PackageName "base") anyVersion+ , Dependency (PackageName "QuickCheck") anyVersion+ , Dependency (PackageName "doctest") anyVersion]+ , defaultLanguage = Just Haskell2010}}] , benchmarks = [] } dirName modules (activateAction True) return ()- Just NewPackage{..} -> cabalUnpack newPackageParentDir templatePackage False (Just newPackageName) log (activateAction False)+ Just NewPackage{..} -> cabalUnpack newPackageParentDir (fromJust templatePackage) False (Just newPackageName) log (activateAction False) standardSetup :: Text standardSetup = "#!/usr/bin/runhaskell \n"
src/IDE/Pane/Preferences.hs view
@@ -743,8 +743,8 @@ , mkFieldPP (paraName <<<- ParaName (__ "URL for searching documentation") $ paraSynopsis <<<- ParaSynopsis- ("e.g Hoogle: http://www.haskell.org/hoogle/?q= or " <>- "Hayoo: http://holumbus.fh-wedel.de/hayoo/hayoo.html?query=")+ ("e.g https://www.haskell.org/hoogle/?q= or " <>+ "Hayoo: http://hayoo.fh-wedel.de/?query=") $ emptyParams) (PP.text . show) stringParser@@ -777,7 +777,7 @@ , forceLineEnds = True , removeTBlanks = True , textviewFont = Nothing- , sourceStyle = (False,"classic")+ , sourceStyle = (True,"leksah") , foundBackground = Color 65535 65535 32768 , matchBackground = Color 32768 32768 32768 , contextBackground = Color 65535 49152 49152@@ -820,7 +820,7 @@ , retrieveURL = "http://www.leksah.org" , retrieveStrategy = SP.RetrieveThenBuild , useCtrlTabFlipping = True- , docuSearchURL = "http://www.holumbus.org/hayoo/hayoo.html?query="+ , docuSearchURL = "https://www.haskell.org/hoogle/?q=" , completeRestricted = False , saveAllBeforeBuild = True , jumpToWarnings = True
src/IDE/Pane/SourceBuffer.hs view
@@ -143,6 +143,7 @@ null, pack, unpack) import Data.Monoid ((<>)) import qualified Data.Text.IO as T (writeFile, readFile)+import Data.Time (UTCTime(..)) allBuffers :: MonadIDE m => m [IDEBuffer] allBuffers = liftIDE getPanes@@ -428,22 +429,31 @@ return False return () +-- | Tries to create a new text buffer, fails when the given filepath+-- does not exist or when it is not a text file. newTextBuffer :: PanePath -> Text -> Maybe FilePath -> IDEM (Maybe IDEBuffer) newTextBuffer panePath bn mbfn = do- cont <- case mbfn of- Nothing -> return True- Just fn -> liftIO $ doesFileExist fn- if cont- then do+ case mbfn of+ Nothing -> buildPane "" Nothing+ Just fn ->+ do eErrorContents <- liftIO $ do+ catch (Right <$> T.readFile fn)+ (\e -> return $ Left (show (e :: IOError)))+ case eErrorContents of+ Right contents -> do+ modTime <- liftIO $ getModificationTime fn+ buildPane contents (Just modTime)+ Left err -> do+ ideMessage Normal (__ "Error reading file " <> T.pack err)+ return Nothing++ where buildPane contents mModTime = do nb <- getNotebook panePath prefs <- readIDE prefs bs <- getCandyState ct <- readIDE candy (ind,rbn) <- figureOutPaneName bn 0- buildThisPane panePath nb (builder' bs mbfn ind bn rbn ct prefs)- else do- ideMessage Normal ((__ "File does not exist ") <> (T.pack $ fromJust mbfn))- return Nothing+ buildThisPane panePath nb (builder' bs mbfn ind bn rbn ct prefs contents mModTime) data CharacterCategory = IdentifierCharacter | SpaceCharacter | SyntaxCharacter deriving (Eq)@@ -461,19 +471,14 @@ Text -> CandyTable -> Prefs ->+ Text ->+ Maybe UTCTime -> PanePath -> Gtk.Notebook -> Gtk.Window -> IDEM (Maybe IDEBuffer,Connections)-builder' bs mbfn ind bn rbn ct prefs pp nb windows = do- -- load up and display a file- (fileContents,modTime) <- case mbfn of- Just fn -> do- fc <- liftIO $ T.readFile fn- mt <- liftIO $ getModificationTime fn- return (fc,Just mt)- Nothing -> return ("\n",Nothing)-+builder' bs mbfn ind bn rbn ct prefs fileContents modTime pp nb windows = do+ -- display a file case textEditorType prefs of "GtkSourceView" -> newGtkBuffer mbfn fileContents >>= makeBuffer modTime "Yi" -> newYiBuffer mbfn fileContents >>= makeBuffer modTime
src/IDE/Workspaces.hs view
@@ -247,7 +247,7 @@ workspaceTry $ void (workspaceAddPackage' fp) when isNew $ do mbPack <- idePackageFromPath logOutputDefault fp- constructAndOpenMainModule mbPack+ constructAndOpenMainModules mbPack void (triggerEventIDE UpdateWorkspaceInfo)) workspacePackageClone :: WorkspaceAction@@ -259,9 +259,9 @@ workspaceTry $ void (workspaceAddPackage' fp) void (triggerEventIDE UpdateWorkspaceInfo)) -constructAndOpenMainModule :: Maybe IDEPackage -> IDEAction-constructAndOpenMainModule Nothing = return ()-constructAndOpenMainModule (Just idePackage) =+constructAndOpenMainModules :: Maybe IDEPackage -> IDEAction+constructAndOpenMainModules Nothing = return ()+constructAndOpenMainModules (Just idePackage) = forM_ (ipdMain idePackage) $ \(target, bi, isTest) -> do mbPD <- getPackageDescriptionAndPath case mbPD of@@ -271,7 +271,7 @@ liftIO $ createDirectoryIfMissing True path alreadyExists <- liftIO $ doesFileExist (path </> target) unless alreadyExists $ do- template <- liftIO $ getModuleTemplate "main" pd "Main" "" ""+ template <- liftIO $ getModuleTemplate (if isTest then "testmain" else "main") pd "Main" "" "" liftIO $ T.writeFile (path </> target) template fileOpenThis (path </> target) _ -> return ()
win32/makeinstaller.sh view
@@ -41,8 +41,11 @@ $LN "$LEKSAH_PREFIX/$LEKSAH_X_X_X_X"/Readme.md SourceDir/leksah mkdir -p SourceDir/hlint $LNDIR "$LEKSAH_PREFIX/$HLINT_X_X_X_X"/* SourceDir/hlint-mkdir -p SourceDir/pretty-show-$LNDIR "$LEKSAH_PREFIX/$PRETTY_SHOW_X_X"/style SourceDir/pretty-show+# TODO put this back once JavaScriptCore works win mingw webkitgtk+# mkdir -p SourceDir/pretty-show+# $LNDIR "$LEKSAH_PREFIX/$PRETTY_SHOW_X_X"/style SourceDir/pretty-show+mkdir -p SourceDir/pretty-show/style+$LN "$LEKSAH_PREFIX/$PRETTY_SHOW_X_X"/style/pretty-show.css SourceDir/pretty-show/style mkdir -p SourceDir/ghcjs-codemirror $LNDIR "$LEKSAH_PREFIX/$GHCJS_CODEMIRROR_X_X_X_X"/mode SourceDir/ghcjs-codemirror $LNDIR "$LEKSAH_PREFIX/$GHCJS_CODEMIRROR_X_X_X_X"/lib SourceDir/ghcjs-codemirror