Upgrading to v5 and making completion work

This commit is contained in:
Andrew Gibiansky 2015-03-16 23:34:42 -07:00
parent 9cd9cfb1b8
commit 3c8b634806
5 changed files with 8 additions and 6 deletions

View File

@ -15,8 +15,6 @@ import Data.Text (Text)
import qualified Data.ByteString.Lazy as Lazy
import IHaskell.IPython.Types
import Debug.Trace (traceShow)
type LByteString = Lazy.ByteString
----- External interface -----
@ -120,7 +118,7 @@ executeRequestParser content =
requestParser parser content = parsed
where
Success parsed = traceShow decoded $ parse parser decoded
Success parsed = parse parser decoded
Just decoded = decode content
historyRequestParser :: LByteString -> Message

View File

@ -20,7 +20,7 @@ import IHaskell.IPython.Types
-- Convert message bodies into JSON.
instance ToJSON Message where
toJSON KernelInfoReply{ versionList = vers, language = language } = object [
"protocol_version" .= ints [4, 0], -- current protocol version, major and minor
"protocol_version" .= string "5.0", -- current protocol version, major and minor
"language_version" .= vers,
"language" .= language
]

View File

@ -144,6 +144,7 @@ instance ToJSON MessageHeader where
"msg_id" .= messageId header,
"session" .= sessionId header,
"username" .= username header,
"version" .= ("5.0" :: String),
"msg_type" .= showMessageType (msgType header)
]

View File

@ -217,7 +217,10 @@ completionType line loc target
| otherwise = last target
dots = intercalate "." . init
isModName = all isCapitalized (init target)
isCapitalized = isUpper . head
isCapitalized [] = False
isCapitalized (x:_) = isUpper x
lineUpToCursor = take loc line
fileComplete filePath = case parseShell lineUpToCursor of
Right xs -> filePath lineUpToCursor $

View File

@ -65,7 +65,7 @@ parseFlags flags =
-- Treat no mode as 'console'.
if "--help" `elem` flags
then Left $ pack (showText (Wrap 100) $ helpText [] HelpFormatAll ihaskellArgs)
else process ihaskellArgs $ "console" : flags
else process ihaskellArgs flags
Just 0 -> process ihaskellArgs flags
Just idx ->