mirror of
https://github.com/IHaskell/IHaskell.git
synced 2025-04-16 11:26:08 +00:00
Upgrading to v5 and making completion work
This commit is contained in:
parent
9cd9cfb1b8
commit
3c8b634806
@ -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
|
||||
|
@ -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
|
||||
]
|
||||
|
@ -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)
|
||||
]
|
||||
|
||||
|
@ -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 $
|
||||
|
@ -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 ->
|
||||
|
Loading…
x
Reference in New Issue
Block a user