mirror of
https://github.com/github/semantic.git
synced 2024-12-22 22:31:36 +03:00
752c923a94
As @mpickering pointed out, this breaks `new-repl` if you have multiple versions of `pretty-show` in your package store.
32 lines
1.2 KiB
Plaintext
32 lines
1.2 KiB
Plaintext
-- See docs/💡ProTip!.md
|
|
:def! pretty \ _ -> return ":set -interactive-print Semantic.Util.Pretty.prettyShow"
|
|
:def! no-pretty \_ -> return ":set -interactive-print System.IO.print"
|
|
:def! r \_ -> return (unlines [":reload", ":pretty"])
|
|
|
|
-- See docs/💡ProTip!.md for documentation & examples.
|
|
:{
|
|
assignmentExample lang = case lang of
|
|
"Python" -> mk "py" "python"
|
|
"Go" -> mk "go" "go"
|
|
"Ruby" -> mk "rb" "ruby"
|
|
"JavaScript" -> mk "js" "typescript"
|
|
"TypeScript" -> mk "ts" "typescript"
|
|
"Haskell" -> mk "hs" "haskell"
|
|
"Markdown" -> mk "md" "markdown"
|
|
"JSON" -> mk "json" "json"
|
|
"Java" -> mk "java" "java"
|
|
"PHP" -> mk "php" "php"
|
|
_ -> mk "" ""
|
|
where mk fileExtension parser = putStrLn ("example: fmap (() <$) . runTask . parse " ++ parser ++ "Parser =<< Semantic.Util.blob \"example." ++ fileExtension ++ "\"") >> return ("import Parsing.Parser\nimport Semantic.Task\nimport Semantic.Util")
|
|
:}
|
|
:def! assignment assignmentExample
|
|
|
|
-- Enable breaking on errors for code written in the repl.
|
|
:seti -fbreak-on-error
|
|
|
|
-- Continue loading after warnings when in the repl.
|
|
:set -Wwarn
|
|
|
|
-- Use a cyan lambda as the prompt.
|
|
:set prompt "\ESC[1;36m\STXλ \ESC[m\STX"
|