Initial implementation of case splitting
- It doesn't handle vars correctly yet
This commit is contained in:
@@ -38,6 +38,7 @@ usage = progVersion
|
||||
++ "\t ghc-mod debug" ++ ghcOptHelp ++ "\n"
|
||||
++ "\t ghc-mod info" ++ ghcOptHelp ++ "<HaskellFile> <module> <expression>\n"
|
||||
++ "\t ghc-mod type" ++ ghcOptHelp ++ "<HaskellFile> <module> <line-no> <column-no>\n"
|
||||
++ "\t ghc-mod split" ++ ghcOptHelp ++ "<HaskellFile> <module> <line-no> <column-no>\n"
|
||||
++ "\t ghc-mod find <symbol>\n"
|
||||
++ "\t ghc-mod lint [-h opt] <HaskellFile>\n"
|
||||
++ "\t ghc-mod root\n"
|
||||
@@ -119,6 +120,7 @@ main = flip E.catches handlers $ do
|
||||
"debug" -> debugInfo opt cradle
|
||||
"info" -> nArgs 3 infoExpr opt cradle cmdArg1 cmdArg3
|
||||
"type" -> nArgs 4 $ typeExpr opt cradle cmdArg1 (read cmdArg3) (read cmdArg4)
|
||||
"split" -> nArgs 4 $ splitVar opt cradle cmdArg1 (read cmdArg3) (read cmdArg4)
|
||||
"find" -> runGhcMod opt $ nArgs 1 $ findSymbol cmdArg1
|
||||
"lint" -> nArgs 1 withFile (lintSyntax opt) cmdArg1
|
||||
"root" -> rootInfo opt cradle
|
||||
|
||||
@@ -144,6 +144,7 @@ loop opt set mvar = do
|
||||
"lint" -> toGhcMod $ lintStx opt set arg
|
||||
"info" -> toGhcMod $ showInfo opt set arg
|
||||
"type" -> toGhcMod $ showType opt set arg
|
||||
"split" -> toGhcMod $ doSplit opt set arg
|
||||
"boot" -> bootIt set
|
||||
"browse" -> browseIt set arg
|
||||
"quit" -> return ("quit", False, set)
|
||||
@@ -254,6 +255,16 @@ showType opt set fileArg = do
|
||||
ret <- types opt file (read line) (read column)
|
||||
return (ret, True, set')
|
||||
|
||||
doSplit :: Options
|
||||
-> Set FilePath
|
||||
-> FilePath
|
||||
-> Ghc (String, Bool, Set FilePath)
|
||||
doSplit opt set fileArg = do
|
||||
let [file, line, column] = words fileArg
|
||||
set' <- newFileSet set file
|
||||
ret <- splits opt file (read line) (read column)
|
||||
return (ret, True, set')
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
bootIt :: Set FilePath
|
||||
|
||||
Reference in New Issue
Block a user