Skip to content

Commit

Permalink
Add debug command for printing the module graph.
Browse files Browse the repository at this point in the history
  • Loading branch information
nominolo committed Aug 29, 2009
1 parent 0a171ed commit d1f3007
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions emacs/scion.el
Original file line number Diff line number Diff line change
Expand Up @@ -2282,6 +2282,10 @@ forces it to be off. NIL toggles the current state."
(interactive)
(scion-eval '(dump-defined-names)))

(defun scion-dump-module-graph ()
(interactive)
(scion-eval '(dump-module-graph)))

(define-key scion-mode-map "\C-c\C-t" 'scion-thing-at-point)

(provide 'scion)
Expand Down
12 changes: 11 additions & 1 deletion server/Scion/Server/Commands.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import FastString
import GHC
import PprTyThing ( pprTypeForUser )
import Outputable ( ppr, showSDoc, showSDocDump, dcolon, showSDocForUser,
showSDocDebug )
showSDocDebug, printDump )
import qualified Outputable as O ( (<+>), ($$) )

import Control.Applicative
Expand Down Expand Up @@ -173,6 +173,7 @@ allCommands =
, cmdDefinedNames
, cmdNameDefinitions
, cmdIdentify
, cmdDumpModuleGraph
]

------------------------------------------------------------------------------
Expand Down Expand Up @@ -586,3 +587,12 @@ cmdIdentify :: Cmd
cmdIdentify =
Cmd "client-identify" $ reqArg' "name" fromJSString $ cmd
where cmd c = modifySessionState $ \s -> s { client = c }

cmdDumpModuleGraph :: Cmd
cmdDumpModuleGraph =
Cmd "dump-module-graph" $ noArgs $ cmd
where
cmd = do
mg <- getModuleGraph
liftIO $ printDump (ppr mg)
return ()

0 comments on commit d1f3007

Please sign in to comment.