phoityne-vscode 0.0.8.0 → 0.0.9.0
raw patch · 15 files changed
+426/−115 lines, 15 files
Files
- Changelog.md +23/−16
- README.md +47/−43
- app/Phoityne/GHCi/IO/Command.hs +25/−6
- app/Phoityne/VSCode/IO/Core.hs +105/−32
- app/Phoityne/VSCode/TH/CompletionsArgumentsJSON.hs +22/−0
- app/Phoityne/VSCode/TH/CompletionsItemJSON.hs +25/−0
- app/Phoityne/VSCode/TH/CompletionsRequestJSON.hs +24/−0
- app/Phoityne/VSCode/TH/CompletionsResponseBodyJSON.hs +26/−0
- app/Phoityne/VSCode/TH/CompletionsResponseJSON.hs +40/−0
- app/Phoityne/VSCode/TH/ConfigurationDoneRequestJSON.hs +21/−0
- app/Phoityne/VSCode/TH/ConfigurationDoneResponseJSON.hs +43/−0
- app/Phoityne/VSCode/TH/SetBreakpointsResponseBodyJSON.hs +1/−1
- app/Phoityne/VSCode/TH/SetFunctionBreakpointsResponseBodyJSON.hs +1/−1
- app/Phoityne/VSCode/TH/StoppedEventBodyJSON.hs +1/−1
- phoityne-vscode.cabal +22/−15
Changelog.md view
@@ -1,43 +1,50 @@ +20160919 phoityne-vscode-0.0.9.0+ * [ADD] ConfigurationDoneRequestに対応した。+ * [ADD] CompletionsRequestに対応した。+ * [MODIFY] Hover時の型表示を改善した。+ * [MODIFY] Hover時のforce実行を止めた。+ * [FIX] setBreakpointsResponse, setFunctionBreakpointsResponseのBodyデータにおいて、キー名を修正した。+ 20160804 phoityne-vscode-0.0.8.0- * [Modify] モジュール構成の変更。- * [Modify] debugger adopter interface Capabilitiesの変更に対応した。+ * [MODIFY] モジュール構成の変更。+ * [MODIFY] debugger adopter interface Capabilitiesの変更に対応した。 20160704 phoityne-vscode-0.0.7.0- * [Modify] debugger adopter interface Capabilitiesの変更に対応した。- * [Modify] debugger adopter interface StackFrameの変更に対応した。(endLin, endColumnの追加)- * [Modify] debugger adopter interface Variableの変更に対応した。(typeの追加)+ * [MODIFY] debugger adopter interface Capabilitiesの変更に対応した。+ * [MODIFY] debugger adopter interface StackFrameの変更に対応した。(endLin, endColumnの追加)+ * [MODIFY] debugger adopter interface Variableの変更に対応した。(typeの追加) 20160626 phoityne-vscode-0.0.6.0 - * [Modify] launchリクエストのghciCmdパラメータで指定したghci起動コマンドを使用するように変更した。- * [Modify] ghciの起動に失敗した場合、デバッグを終了するように修正した。+ * [MODIFY] launchリクエストのghciCmdパラメータで指定したghci起動コマンドを使用するように変更した。+ * [MODIFY] ghciの起動に失敗した場合、デバッグを終了するように修正した。 20160605 phoityne-vscode-0.0.5.0 - * [Modify] launchリクエストのnoDebugパラメータをMaybeに変更した。+ * [MODIFY] launchリクエストのnoDebugパラメータをMaybeに変更した。 20160601 phoityne-vscode-0.0.4.0 - * [Modify] スタックトレースの表示を番号から関数名に変更した。- * [Modify] GHC-8.0.1のghciにおいて、:step結果の出力変更(Stopped in)に対応した。+ * [MODIFY] スタックトレースの表示を番号から関数名に変更した。+ * [MODIFY] GHC-8.0.1のghciにおいて、:step結果の出力変更(Stopped in)に対応した。 20160515 phoityne-vscode-0.0.3.0 - * [Add] tasks.jsonが存在しない場合は、作成するようにした。- * [Add] package.json にキーバインディング設定を追加した。(stack build, stack clean, stack test, stack watch)- * [Add] hover requestに対して、:info結果を返すようにした。+ * [ADD] tasks.jsonが存在しない場合は、作成するようにした。+ * [ADD] package.json にキーバインディング設定を追加した。(stack build, stack clean, stack test, stack watch)+ * [ADD] hover requestに対して、:info結果を返すようにした。 20160508 phoityne-vscode-0.0.2.0 - * [Add] デバッガ起動後、ファイル保存時にghciにリロードするようにした。- * [Add] 条件付きブレークポイントに対応した。+ * [ADD] デバッガ起動後、ファイル保存時にghciにリロードするようにした。+ * [ADD] 条件付きブレークポイントに対応した。 20160504 phoityne-vscode-0.0.1.0 - * [Info] Initial release.+ * [INFO] Initial release.
README.md view
@@ -2,9 +2,20 @@ # Phoityne VSCode -Phoityne is a ghci debug viewer for Visual Studio Code. (on Windows)+[Phoityne](https://sites.google.com/site/phoityne/vscode) is a ghci debug viewer for Visual Studio Code. +## Information++* [2016/09/19] phoityne-vscode released. + for VSCode-1.5, updated vscode extension and haskell library. Please use new versions.+ * Marketplace [phoityne-vscode-0.0.7](https://marketplace.visualstudio.com/items?itemName=phoityne.phoityne-vscode)+ * hackage [phoityne-vscode-0.0.9.0](https://hackage.haskell.org/package/phoityne-vscode) +* Release Summary+ * Implemented the completions request to provide suggestion proposals for ghci repl in the Debug Console. + * Some improvements and bug fixes.++ ## Debug on VSCode 1. Start VSCode@@ -14,7 +25,7 @@ 5. Set startup source file. Default file is test/Spec.hs 6. Run debug(F5) -[](https://sites.google.com/site/phoityne/doc_jp/demo01.gif?attredirects=0)+[](https://raw.githubusercontent.com/phoityne/docs/master/demo01.gif) ## Key Bindings@@ -55,61 +66,54 @@ 1. ctrlr + p on Visual Studio Code 2. ext install haskell ... 3. select "[Haskell GHCi debug viewer Phoityne](https://marketplace.visualstudio.com/items?itemName=phoityne.phoityne-vscode)"+ ## Capabilites -* supportsConfigurationDoneRequest : no-* supportsFunctionBreakpoints : no+* supportsConfigurationDoneRequest : yes+* supportsFunctionBreakpoints : yes * supportsConditionalBreakpoints : yes * supportsEvaluateForHovers : yes * exceptionBreakpointFilters : no * supportsStepBack : no * supportsSetVariable : no * supportsRestartFrame : no+* supportsGotoTargetsRequest : no+* supportsStepInTargetsRequest : no+* supportsCompletionsRequest : yes ## Configuration -### .vscode/launch.json+### __.vscode/launch.json__ -* startup- * required- * default : ${workspaceRoot}/test/Spec.hs- * debug startup file, will be loaded automatically.-* ghciCmd- * required- * default: stack ghci --test --no-load --no-build- * launch ghci command, must be Prelude module loaded. - For example, "ghci -i${workspaceRoot}/src", "cabal exec -- ghci -i${workspaceRoot}/src"-* ghciPrompt- * required- * default: H>>= - * ghci command prompt string.-* logFile- * required- * default: ${workspaceRoot}/.vscode/phoityne.log- * internal log file.-* logLevel- * required- * default: WARNING- * internal log level.+|NAME|REQUIRED OR OPTIONAL|DEFAULT SETTING|DESCRIPTION|+|:--|:--:|:--|:--|+|startup|required|${workspaceRoot}/test/Spec.hs|debug startup file, will be loaded automatically.|+|ghciCmd|required|stack ghci --test --no-load --no-build --main-is TARGET|launch ghci command, must be Prelude module loaded. For example, "ghci -i${workspaceRoot}/src", "cabal exec -- ghci -i${workspaceRoot}/src"|+|ghciPrompt|required|H>>=|ghci command prompt string.|+|logFile|required|${workspaceRoot}/.vscode/phoityne.log|internal log file.|+|logLevel|required|WARNING|internal log level.| -### .vscode/tasks.json+### __.vscode/tasks.json__ -* stack build- * required- * default: stack build- * task definition for F6 shortcut key.-* stack clean & build- * required- * default: stack clean && stack build- * task definition for F7 shortcut key.-* stack test- * required- * default: stack test- * task definition for F8 shortcut key.-* stack watch- * required- * default: stack build --test --no-run-tests --file-watch- * task definition for F6 shortcut key.+|TASK NAME|REQUIRED OR OPTIONAL|DEFAULT SETTING|DESCRIPTION|+|:--|:--:|:--|:--|+|stack build|required|stack build|task definition for F6 shortcut key.|+|stack clean & build|required|stack clean && stack build|task definition for F7 shortcut key.|+|stack test|required|stack test|task definition for F8 shortcut key.|+|stack watch|required|stack build --test --no-run-tests --file-watch|task definition for F6 shortcut key.| +## Version history++* [2016/08/07] for VSCode-1.4, updated vscode extension and haskell library. Please use new versions.+ * Marketplace [phoityne-vscode-0.0.6](https://marketplace.visualstudio.com/items?itemName=phoityne.phoityne-vscode)+ * hackage [phoityne-vscode-0.0.8.0](https://hackage.haskell.org/package/phoityne-vscode)++* [2016/07/10] for VSCode-1.3, updated vscode extension and haskell library. Please use new versions.+ * Marketplace [phoityne-vscode-0.0.5](https://marketplace.visualstudio.com/items?itemName=phoityne.phoityne-vscode)+ * hackage [phoityne-vscode-0.0.6.0](https://hackage.haskell.org/package/phoityne-vscode)++* [2016/06/06] for VSCode-1.2, updated vscode extension and haskell library. Please use new versions.+ * Marketplace [phoityne-vscode-0.0.4](https://marketplace.visualstudio.com/items?itemName=phoityne.phoityne-vscode)+ * hackage [phoityne-vscode-0.0.5.0](https://hackage.haskell.org/package/phoityne-vscode)
app/Phoityne/GHCi/IO/Command.hs view
@@ -32,6 +32,7 @@ , showKind , execBool , exec+ , complete ) where import Phoityne.GHCi.IO.Process@@ -218,7 +219,7 @@ -- loadModule :: GHCiProcess -> OutputHandler -> [ModuleName] -> IO (Either ErrorData ()) loadModule ghci outHdl mods = do- let cmd = ":module +" ++ U.join " " mods+ let cmd = ":module + *" ++ U.join " *" mods exec ghci outHdl cmd >>= \case Left err -> return $ Left err Right _ -> return $ Right ()@@ -407,12 +408,7 @@ | U.startswith "False" res = Right False | otherwise = Left $ "invalid condition result. " ++ res - -- |--- Private Utility------- | -- run command and return result string. -- exec :: GHCiProcess -> OutputHandler -> String -> IO (Either ErrorData String)@@ -426,6 +422,29 @@ Right msg -> do outHdl msg return $ Right msg++-- |+--+complete :: GHCiProcess -> OutputHandler -> String -> Int -> IO (Either ErrorData [String])+complete ghci outHdl key size = do+ let cmd = ":complete repl 0-" ++ (show size) ++ " \"" ++ key ++ "\""+ exec ghci outHdl cmd >>= \case+ Left err -> return $ Left err+ Right msg -> return $ Right $ map normalize $ extracCompleteList $ lines msg ++ where+ extracCompleteList [] = []+ extracCompleteList (_:[]) = []+ extracCompleteList (_:_:[]) = []+ extracCompleteList xs = tail . init $ xs++ normalize xs+ | 2 < length xs = tail . init $ xs+ | otherwise = xs++-- |+-- Private Utility+-- -- | --
app/Phoityne/VSCode/IO/Core.hs view
@@ -18,6 +18,13 @@ import Phoityne.VSCode.Utility import Phoityne.VSCode.IO.Utility import qualified Phoityne.VSCode.TH.BreakpointJSON as J+import qualified Phoityne.VSCode.TH.CompletionsItemJSON as J+import qualified Phoityne.VSCode.TH.CompletionsArgumentsJSON as J+import qualified Phoityne.VSCode.TH.CompletionsResponseBodyJSON as J+import qualified Phoityne.VSCode.TH.CompletionsRequestJSON as J+import qualified Phoityne.VSCode.TH.CompletionsResponseJSON as J+import qualified Phoityne.VSCode.TH.ConfigurationDoneRequestJSON as J+import qualified Phoityne.VSCode.TH.ConfigurationDoneResponseJSON as J import qualified Phoityne.VSCode.TH.ContinueRequestJSON as J import qualified Phoityne.VSCode.TH.ContinueResponseJSON as J import qualified Phoityne.VSCode.TH.DisconnectRequestJSON as J@@ -275,7 +282,6 @@ resSeq <- getIncreasedResponseSequence mvarDat sendResponse $ J.encode $ J.parseErrorInitializeResponse resSeq msg - handle contLenStr jsonStr "launch" = case J.eitherDecode jsonStr :: Either String J.LaunchRequest of Right req -> launchRequestHandler mvarDat req Left err -> do@@ -291,6 +297,13 @@ sendEventL terminatedEvtStr + handle contLenStr jsonStr "configurationDone" = case J.eitherDecode jsonStr :: Either String J.ConfigurationDoneRequest of+ Right req -> configurationDoneRequestHandler mvarDat req+ Left err -> do+ let msg = L.intercalate " " ["configurationDone request parce error.", lbs2str contLenStr, lbs2str jsonStr, show err]+ ++ L.intercalate "\n" ("" : "" : _ERR_MSG_URL) ++ "\n"+ sendErrorEvent mvarDat msg+ handle contLenStr jsonStr "disconnect" = case J.eitherDecode jsonStr :: Either String J.DisconnectRequest of Right req -> disconnectRequestHandler mvarDat req Left err -> do@@ -429,6 +442,12 @@ ++ L.intercalate "\n" ("" : "" : _ERR_MSG_URL) ++ "\n" sendErrorEvent mvarDat msg + handle contLenStr jsonStr "completions" = case J.eitherDecode jsonStr :: Either String J.CompletionsRequest of+ Right req -> completionsRequestHandler mvarDat req+ Left err -> do+ let msg = L.intercalate " " ["completions request parce error.", lbs2str contLenStr, lbs2str jsonStr, show err]+ ++ L.intercalate "\n" ("" : "" : _ERR_MSG_URL) ++ "\n"+ sendErrorEvent mvarDat msg handle contLenStr jsonStr cmd = do let msg = L.intercalate " " ["unknown request command.", cmd, lbs2str contLenStr, lbs2str jsonStr]@@ -466,7 +485,9 @@ sendResponse2 :: MVar DebugContextData -> BSL.ByteString -> IO () sendResponse2 mvarCtx str = do ctx <- readMVar mvarCtx- responseHandlerDebugContextData ctx $ str+ responseHandlerDebugContextData ctx str+ -- "{\"seq\":1,\"type\":\"response\",\"request_seq\":1,\"success\":true,\"command\":\"initialize\",\"message\":\"\",\"body\":{\"supportsCompletionsRequest\":true}}"+ -- responseHandlerDebugContextData ctx $ "{\"seq\":1,\"type\":\"response\",\"request_seq\":1,\"success\":true,\"command\":\"initialize\",\"message\":\"\",\"body\":{\"supportsConfigurationDoneRequest\":true,\"supportsFunctionBreakpoints\":false,\"supportsConditionalBreakpoints\":true,\"supportsEvaluateForHovers\":true,\"exceptionBreakpointFilters\":[],\"supportsStepBack\":false,\"supportsSetVariable\":false,\"supportsRestartFrame\":false,\"supportsGotoTargetsRequest\":false,\"supportsStepInTargetsRequest\":false,\"supportsCompletionsRequest\":false}}" -- | --@@ -516,7 +537,7 @@ initializeRequestHandler :: MVar DebugContextData -> J.InitializeRequest -> IO () initializeRequestHandler mvarCtx req@(J.InitializeRequest seq _ _ _) = flip E.catches handlers $ do resSeq <- getIncreasedResponseSequence mvarCtx- let capa = J.InitializeResponseCapabilites False True True True [] False False False False False False+ let capa = J.InitializeResponseCapabilites True True True True [] False False False False False True res = J.InitializeResponse resSeq "response" seq True "initialize" "" capa sendResponse2 mvarCtx $ J.encode res@@ -612,21 +633,51 @@ resSeq <- getIncreasedResponseSequence mvarCtx sendEventL $ J.encode $ J.defaultInitializedEvent resSeq + resSeq <- getIncreasedResponseSequence mvarCtx+ let stopEvt = J.defaultStoppedEvent resSeq+ stopEvtStr = J.encode stopEvt+ sendEventL stopEvtStr+ -- ファイル変更ウォッチの開始 watch mvarCtx - sendConsoleEvent mvarCtx $ L.intercalate "\n" infoMsg- sendStdoutEvent mvarCtx $ J.ghciPromptLaunchRequestArguments args- - -- ランチ完了後のメッセージ出力+ --sendStdoutEvent mvarCtx $ J.ghciPromptLaunchRequestArguments args++-- |+--+configurationDoneRequestHandler :: MVar DebugContextData -> J.ConfigurationDoneRequest -> IO ()+configurationDoneRequestHandler mvarCtx req = flip E.catches handlers $ do+ logRequest $ show req+ ghciProcessDebugContextData <$> (readMVar mvarCtx) >>= withProcess++ where+ handlers = [ E.Handler someExcept ]+ someExcept (e :: E.SomeException) = do+ let msg = L.intercalate " " ["configurationDone request error.", show req, show e]+ resSeq <- getIncreasedResponseSequence mvarCtx+ sendResponseL $ J.encode $ J.errorConfigurationDoneResponse resSeq req msg + sendErrorEvent mvarCtx msg+ infoMsg = [ ""- , " Now, ghci initialized."+ , " Now, ghci launched and configuration done." , " Press F5 to start debugging." , " Or modify source code. it will be loaded to ghci automatically." , " " ] + withProcess Nothing = do+ errorM _LOG_NAME "[disconnectRequestHandler] ghci not started."+ sendErrorEvent mvarCtx "[disconnectRequestHandler] ghci not started."++ withProcess (Just ghciProc) = do+ sendConsoleEvent mvarCtx $ L.intercalate "\n" infoMsg+ sendStdoutEvent mvarCtx $ G.promptGHCiProcess ghciProc++ resSeq <- getIncreasedResponseSequence mvarCtx+ sendResponseL $ J.encode $ J.defaultConfigurationDoneResponse resSeq req++ -- | -- disconnectRequestHandler :: MVar DebugContextData -> J.DisconnectRequest -> IO ()@@ -685,12 +736,6 @@ resStr = J.encode res{J.bodySetBreakpointsResponse = J.SetBreakpointsResponseBody resBody} sendResponseL resStr - resSeq <- getIncreasedResponseSequence mvarCtx- let stopEvt = J.defaultStoppedEvent resSeq- stopEvtStr = J.encode stopEvt- sendEventL stopEvtStr-- where handlers = [ E.Handler someExcept ] someExcept (e :: E.SomeException) = do@@ -769,12 +814,6 @@ resStr = J.encode res{J.bodySetFunctionBreakpointsResponse = J.SetFunctionBreakpointsResponseBody resBody} sendResponseL resStr - resSeq <- getIncreasedResponseSequence mvarCtx- let stopEvt = J.defaultStoppedEvent resSeq- stopEvtStr = J.encode stopEvt- sendEventL stopEvtStr-- where handlers = [ E.Handler someExcept ] someExcept (e :: E.SomeException) = do@@ -1143,9 +1182,6 @@ evaluateRequestHandler mvarCtx req = flip E.catches handlers $ do logRequest $ show req - -- let (J.EvaluateArguments exp frameId ctx) = J.argumentsEvaluateRequest req- -- moveFrame mvarCtx $ if isJust frameId then fromJust frameId else 0- let (J.EvaluateArguments exp _ ctx) = J.argumentsEvaluateRequest req ghciProcessDebugContextData <$> (readMVar mvarCtx) >>= withProcess ctx exp @@ -1176,12 +1212,7 @@ Left err -> do errorM _LOG_NAME $ show err evaluateResponse err ""-- Right typeStr -> case isFunction typeStr of - True -> evaluateResponse (getOnlyType typeStr) (getOnlyType typeStr)- False -> G.force ghciProc outHdl exp >>= \case- Right valStr -> evaluateResponse ((getOnlyValue valStr) ++ " :: " ++ (getOnlyType typeStr)) (getOnlyType typeStr)- Left _ -> evaluateResponse (getOnlyType typeStr) (getOnlyType typeStr)+ Right typeStr -> evaluateResponse typeStr (getOnlyType typeStr) withProcess _ exp (Just ghciProc) = G.exec ghciProc outHdl exp >>= \case Left err -> do@@ -1210,7 +1241,6 @@ res = J.defaultEvaluateResponse resSeq req resStr = J.encode res{J.bodyEvaluateResponse = body} sendResponseL resStr- -- | -- force結果のパーサ@@ -1247,11 +1277,54 @@ manyTill anyChar eof --- |=====================================================================+-- | ----- utility+--+completionsRequestHandler :: MVar DebugContextData -> J.CompletionsRequest -> IO ()+completionsRequestHandler mvarCtx req = flip E.catches handlers $ do+ logRequest $ show req + let (J.CompletionsArguments _ key _ _) = J.argumentsCompletionsRequest req+ ghciProcessDebugContextData <$> (readMVar mvarCtx) >>= withProcess key + where+ handlers = [ E.Handler someExcept ]+ someExcept (e :: E.SomeException) = do+ let msg = L.intercalate " " ["completions request error.", show req, show e]+ resSeq <- getIncreasedResponseSequence mvarCtx+ sendResponseL $ J.encode $ J.errorCompletionsResponse resSeq req msg + sendErrorEvent mvarCtx msg++ withProcess _ Nothing = do+ errorM _LOG_NAME "[completionsRequestHandler] ghci not started."+ sendErrorEvent mvarCtx "[completionsRequestHandler] ghci not started."++ withProcess key (Just ghciProc) = G.complete ghciProc outHdl key 50 >>= \case+ Left err -> do+ errorM _LOG_NAME $ show err+ resSeq <- getIncreasedResponseSequence mvarCtx+ let resStr = J.encode $ J.errorCompletionsResponse resSeq req $ show err+ sendResponseL resStr++ Right xs -> do+ resSeq <- getIncreasedResponseSequence mvarCtx+ let bd = J.CompletionsResponseBody $ map createItem xs+ res = J.defaultCompletionsResponse resSeq req + + let resStr = J.encode $ res {J.bodyCompletionsResponse = bd}+ sendResponseL resStr++ createItem (':':xs) = J.CompletionsItem xs+ createItem xs = J.CompletionsItem xs++ outHdl msg = do+ --sendStdoutEvent mvarCtx msg+ infoM _LOG_NAME msg+++-- |=====================================================================+--+-- utility -- |
+ app/Phoityne/VSCode/TH/CompletionsArgumentsJSON.hs view
@@ -0,0 +1,22 @@+{-# LANGUAGE TemplateHaskell #-}+++module Phoityne.VSCode.TH.CompletionsArgumentsJSON where++import Data.Aeson.TH++import Phoityne.VSCode.Utility++-- |+-- Arguments for 'completions' request. +--+data CompletionsArguments =+ CompletionsArguments {+ frameIdCompletionsArguments :: Maybe Int -- Returns completions in the scope of this stack frame. If not specified, the completions are returned for the global scope. + , textCompletionsArguments :: String -- One or more source lines. Typically this is the text a user has typed into the debug console before he asked for completion.+ , columnCompletionsArguments :: Int -- The character position for which to determine the completion proposals. + , lineCompletionsArguments :: Maybe Int -- An optional line for which to determine the completion proposals. If missing the first line of the text is assumed.+ } deriving (Show, Read, Eq)+++$(deriveJSON defaultOptions { fieldLabelModifier = rdrop (length "CompletionsArguments") } ''CompletionsArguments)
+ app/Phoityne/VSCode/TH/CompletionsItemJSON.hs view
@@ -0,0 +1,25 @@+{-# LANGUAGE TemplateHaskell #-}+++module Phoityne.VSCode.TH.CompletionsItemJSON where++import Data.Aeson.TH++import Phoityne.VSCode.Utility++-- |+-- CompletionItems are the suggestions returned from the CompletionsRequest.+--+data CompletionsItem =+ CompletionsItem {+ labelCompletionsItem :: String -- The label of this completion item. By default this is also the text that is inserted when selecting this completion.+ {-+ , textCompletionsItem :: String -- If text is not falsy then it is inserted instead of the label.+ , typeCompletionsItem :: CompletionItemType -- The item's type. Typically the client uses this information to render the item in the UI with an icon.+ , startCompletionsItem :: Int -- When a completion is selected it replaces 'length' characters starting at 'start' in the text passed to the CompletionsRequest.+ , lengthCompletionsItem :: Int --If missing the frontend will try to determine these values heuristically.+ -}+ } deriving (Show, Read, Eq)+++$(deriveJSON defaultOptions { fieldLabelModifier = rdrop (length "CompletionsItem") } ''CompletionsItem)
+ app/Phoityne/VSCode/TH/CompletionsRequestJSON.hs view
@@ -0,0 +1,24 @@+{-# LANGUAGE TemplateHaskell #-}+++module Phoityne.VSCode.TH.CompletionsRequestJSON where++import Data.Aeson.TH++import Phoityne.VSCode.Utility+import Phoityne.VSCode.TH.CompletionsArgumentsJSON++-- |+-- CompletionsRequest request; value of command field is 'completions'.+-- Returns a list of possible completions for a given caret position and text.+-- The CompletionsRequest may only be called if the 'supportsCompletionsRequest' capability exists and is true.+--+data CompletionsRequest =+ CompletionsRequest {+ seqCompletionsRequest :: Int -- Sequence number+ , typeCompletionsRequest :: String -- One of "request", "response", or "event"+ , commandCompletionsRequest :: String -- The command to execute+ , argumentsCompletionsRequest :: CompletionsArguments -- Arguments for "completions" request.+ } deriving (Show, Read, Eq)++$(deriveJSON defaultOptions { fieldLabelModifier = rdrop (length "CompletionsRequest") } ''CompletionsRequest)
+ app/Phoityne/VSCode/TH/CompletionsResponseBodyJSON.hs view
@@ -0,0 +1,26 @@+{-# LANGUAGE TemplateHaskell #-}+++module Phoityne.VSCode.TH.CompletionsResponseBodyJSON where++import Data.Aeson.TH++import Phoityne.VSCode.Utility+import Phoityne.VSCode.TH.CompletionsItemJSON++-- |+-- Response to 'completions' request.+--+data CompletionsResponseBody =+ CompletionsResponseBody {+ targetsCompletionsResponseBody :: [CompletionsItem] -- The possible completions for .+ } deriving (Show, Read, Eq)+++$(deriveJSON defaultOptions { fieldLabelModifier = rdrop (length "CompletionsResponseBody") } ''CompletionsResponseBody)++-- |+--+defaultCompletionsResponseBody :: CompletionsResponseBody+defaultCompletionsResponseBody = CompletionsResponseBody []+
+ app/Phoityne/VSCode/TH/CompletionsResponseJSON.hs view
@@ -0,0 +1,40 @@+{-# LANGUAGE TemplateHaskell #-}+++module Phoityne.VSCode.TH.CompletionsResponseJSON where++import Data.Aeson.TH++import Phoityne.VSCode.Utility+import Phoityne.VSCode.TH.CompletionsResponseBodyJSON+import Phoityne.VSCode.TH.CompletionsRequestJSON++-- |+-- Response to 'completions' request.+--+data CompletionsResponse =+ CompletionsResponse {+ seqCompletionsResponse :: Int -- Sequence number+ , typeCompletionsResponse :: String -- One of "request", "response", or "event"+ , request_seqCompletionsResponse :: Int -- Sequence number of the corresponding request+ , successCompletionsResponse :: Bool -- Outcome of the request+ , commandCompletionsResponse :: String -- The command requested + , messageCompletionsResponse :: String -- Contains error message if success == false.+ , bodyCompletionsResponse :: CompletionsResponseBody+ } deriving (Show, Read, Eq)++$(deriveJSON defaultOptions { fieldLabelModifier = rdrop (length "CompletionsResponse") } ''CompletionsResponse)++-- |+--+defaultCompletionsResponse :: Int -> CompletionsRequest -> CompletionsResponse+defaultCompletionsResponse seq (CompletionsRequest reqSeq _ _ _) =+ CompletionsResponse seq "response" reqSeq True "completions" "" defaultCompletionsResponseBody++-- |+--+errorCompletionsResponse :: Int -> CompletionsRequest -> String -> CompletionsResponse+errorCompletionsResponse seq (CompletionsRequest reqSeq _ _ _) msg =+ CompletionsResponse seq "response" reqSeq False "completions" msg defaultCompletionsResponseBody++
+ app/Phoityne/VSCode/TH/ConfigurationDoneRequestJSON.hs view
@@ -0,0 +1,21 @@+{-# LANGUAGE TemplateHaskell #-}+++module Phoityne.VSCode.TH.ConfigurationDoneRequestJSON where++import Data.Aeson.TH++import Phoityne.VSCode.Utility++-- |+-- ConfigurationDone request; value of command field is 'configurationDone'.+-- The client of the debug protocol must send this request at the end of the sequence of configuration requests (which was started by the InitializedEvent).+--+data ConfigurationDoneRequest =+ ConfigurationDoneRequest {+ seqConfigurationDoneRequest :: Int -- Sequence number+ , typeConfigurationDoneRequest :: String -- One of "request", "response", or "event"+ , commandConfigurationDoneRequest :: String -- The command to execute+ } deriving (Show, Read, Eq)++$(deriveJSON defaultOptions { fieldLabelModifier = rdrop (length "ConfigurationDoneRequest") } ''ConfigurationDoneRequest)
+ app/Phoityne/VSCode/TH/ConfigurationDoneResponseJSON.hs view
@@ -0,0 +1,43 @@+{-# LANGUAGE TemplateHaskell #-}+++module Phoityne.VSCode.TH.ConfigurationDoneResponseJSON where++import Data.Aeson.TH++import Phoityne.VSCode.Utility+import Phoityne.VSCode.TH.ConfigurationDoneRequestJSON ++-- |+-- Response to 'configurationDone' request. This is just an acknowledgement, so no body field is required.+--+data ConfigurationDoneResponse =+ ConfigurationDoneResponse {+ seqConfigurationDoneResponse :: Int -- Sequence number+ , typeConfigurationDoneResponse :: String -- One of "request", "response", or "event"+ , request_seqConfigurationDoneResponse :: Int -- Sequence number of the corresponding request+ , successConfigurationDoneResponse :: Bool -- Outcome of the request+ , commandConfigurationDoneResponse :: String -- The command requested + , messageConfigurationDoneResponse :: String -- Contains error message if success == false.+ } deriving (Show, Read, Eq)++$(deriveJSON defaultOptions { fieldLabelModifier = rdrop (length "ConfigurationDoneResponse") } ''ConfigurationDoneResponse)++-- |+--+defaultConfigurationDoneResponse :: Int -> ConfigurationDoneRequest -> ConfigurationDoneResponse+defaultConfigurationDoneResponse seq (ConfigurationDoneRequest reqSeq _ _) =+ ConfigurationDoneResponse seq "response" reqSeq True "configurationDone" ""+++-- |+--+parceErrorConfigurationDoneResponse :: Int -> String -> ConfigurationDoneResponse+parceErrorConfigurationDoneResponse seq msg =+ ConfigurationDoneResponse seq "response" (-1) False "configurationDone" msg++-- |+--+errorConfigurationDoneResponse :: Int -> ConfigurationDoneRequest -> String -> ConfigurationDoneResponse+errorConfigurationDoneResponse seq (ConfigurationDoneRequest reqSeq _ _) msg =+ ConfigurationDoneResponse seq "response" reqSeq False "configurationDone" msg
app/Phoityne/VSCode/TH/SetBreakpointsResponseBodyJSON.hs view
@@ -17,7 +17,7 @@ -- data SetBreakpointsResponseBody = SetBreakpointsResponseBody {- breakpoints :: [Breakpoint] -- Information about the breakpoints. The array elements are in the same order as the elements of the 'breakpoints' (or the deprecated 'lines') in the SetBreakpointsArguments.+ breakpointsSetBreakpointsResponseBody :: [Breakpoint] -- Information about the breakpoints. The array elements are in the same order as the elements of the 'breakpoints' (or the deprecated 'lines') in the SetBreakpointsArguments. } deriving (Show, Read, Eq) $(deriveJSON defaultOptions { fieldLabelModifier = rdrop (length "SetBreakpointsResponseBody") } ''SetBreakpointsResponseBody)
app/Phoityne/VSCode/TH/SetFunctionBreakpointsResponseBodyJSON.hs view
@@ -13,7 +13,7 @@ -- data SetFunctionBreakpointsResponseBody = SetFunctionBreakpointsResponseBody {- breakpoints :: [Breakpoint] -- Information about the breakpoints. The array elements are in the same order as the elements of the 'breakpoints' (or the deprecated 'lines') in the SetFunctionBreakpointsArguments.+ breakpointsSetFunctionBreakpointsResponseBody :: [Breakpoint] -- Information about the breakpoints. The array elements are in the same order as the elements of the 'breakpoints' (or the deprecated 'lines') in the SetFunctionBreakpointsArguments. } deriving (Show, Read, Eq) $(deriveJSON defaultOptions { fieldLabelModifier = rdrop (length "SetFunctionBreakpointsResponseBody") } ''SetFunctionBreakpointsResponseBody)
app/Phoityne/VSCode/TH/StoppedEventBodyJSON.hs view
@@ -27,5 +27,5 @@ $(deriveJSON defaultOptions { fieldLabelModifier = rdrop (length "StoppedEventBody") } ''StoppedEventBody) defaultStoppedEventBody :: StoppedEventBody-defaultStoppedEventBody = StoppedEventBody "breakpoint" 0 "" False+defaultStoppedEventBody = StoppedEventBody "step" 0 "" False
phoityne-vscode.cabal view
@@ -1,18 +1,18 @@-name: phoityne-vscode-version: 0.0.8.0-synopsis: ghci debug viewer on Visual Studio Code-description: Please see README.md-license: BSD3-license-file: LICENSE-author: phoityne_hs-maintainer: phoityne.hs@gmail.com-homepage: https://sites.google.com/site/phoityne/vscode-copyright: 2016 phoityne_hs-category: Development-build-type: Simple-cabal-version: >=1.10-extra-source-files: README.md- , Changelog.md+name: phoityne-vscode+version: 0.0.9.0+synopsis: ghci debug viewer on Visual Studio Code+description: Please see README.md+license: BSD3+license-file: LICENSE+author: phoityne_hs+maintainer: phoityne.hs@gmail.com+homepage: https://sites.google.com/site/phoityne/vscode+copyright: 2016 phoityne_hs+category: Development+build-type: Simple+cabal-version: >=1.10+extra-source-files: README.md+ , Changelog.md executable phoityne-vscode ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing@@ -27,6 +27,13 @@ , Phoityne.VSCode.Utility , Phoityne.VSCode.IO.Utility , Phoityne.VSCode.TH.BreakpointJSON+ , Phoityne.VSCode.TH.CompletionsItemJSON+ , Phoityne.VSCode.TH.CompletionsArgumentsJSON+ , Phoityne.VSCode.TH.CompletionsResponseBodyJSON+ , Phoityne.VSCode.TH.CompletionsRequestJSON+ , Phoityne.VSCode.TH.CompletionsResponseJSON+ , Phoityne.VSCode.TH.ConfigurationDoneRequestJSON+ , Phoityne.VSCode.TH.ConfigurationDoneResponseJSON , Phoityne.VSCode.TH.ContinueArgumentsJSON , Phoityne.VSCode.TH.ContinueRequestJSON , Phoityne.VSCode.TH.ContinueResponseJSON