packages feed

phoityne-vscode 0.0.5.0 → 0.0.6.0

raw patch · 5 files changed

+69/−46 lines, 5 files

Files

Changelog.md view
@@ -1,4 +1,9 @@ +20160626 phoityne-vscode-0.0.6.0++  * [Modify] launchリクエストのghciCmdパラメータで指定したghci起動コマンドを使用するように変更した。+  * [Modify] ghciの起動に失敗した場合、デバッグを終了するように修正した。+ 20160605 phoityne-vscode-0.0.5.0    * [Modify] launchリクエストのnoDebugパラメータをMaybeに変更した。
app/Phoityne/IO/Control.hs view
@@ -50,7 +50,6 @@    return 1 -   where     createCmdData mvarENV mvarCUI =       GUI.DebugCommandData {@@ -119,9 +118,9 @@ -- | -- -- -debugStart :: MVar GHCI.ExternalCommandData -> FilePath -> IO ()-debugStart mvarCUI cwd = do-  exeData <- GHCI.run "stack" ["ghci", "--test", "--no-build", "--no-load"] $ Just cwd+debugStart :: MVar GHCI.ExternalCommandData -> String -> [String] -> FilePath -> IO ()+debugStart mvarCUI cmd opts cwd = do+  exeData <- GHCI.run cmd opts $ Just cwd   takeMVar mvarCUI >> putMVar mvarCUI exeData  
app/Phoityne/IO/GUI/Control.hs view
@@ -114,7 +114,7 @@ -- data DebugCommandData =   DebugCommandData {-    startDebugCommandData        :: FilePath ->  IO ()+    startDebugCommandData        :: String -> [String] -> FilePath ->  IO ()   , stopDebugCommandData         :: IO ExitCode   , readDebugCommandData         :: IO String   , readLinesDebugCommandData    :: ([String] -> IO Bool) -> IO [String]@@ -588,6 +588,7 @@       logFile     = J.logFileLaunchRequestArguments args       logLevelStr = J.logLevelLaunchRequestArguments args       prmptStr    = J.ghciPromptLaunchRequestArguments args+      cmdStr      = J.ghciCmdLaunchRequestArguments args    -- コンテキストデータの保持   ctx <- takeMVar mvarCtx@@ -598,7 +599,7 @@    envSetPromptDebugCommandData cmdData $ prmptStr -  -- ログイング設定+  -- ロギング設定   logLevel <- case readMay logLevelStr of     Just lv -> return lv     Nothing -> do@@ -614,31 +615,9 @@     -- ghciのランチ-  runGHCi cmdData mvarCtx ws--  loadHsFile cmdData mvarCtx su--  -- レスポンスとinitializedイベント送信-  resSeq <- incResSeq mvarCtx-  sendResponseL $ J.encode $ J.defaultLaunchResponse resSeq req--  resSeq <- incResSeq mvarCtx-  sendEventL $ J.encode $ J.defaultInitializedEvent resSeq--  -- ファイル変更ウォッチの開始-  watch cmdData mvarCtx--  -- ランチ完了後のメッセージ出力-  let infoMsg = [-                ""-              , "  Now, ghci initialized."-              , "  Press F5 to start debugging."-              , "  Or modify source code. it will be loaded to ghci automatically."-              , ""-              ]-  putStrLnConsole mvarCtx $ L.intercalate "\n" infoMsg-  putStrStdout mvarCtx prmptStr+  runGHCi cmdData mvarCtx cmdStr ws >>= ghciLaunched  +       where     handlers = [ E.Handler someExcept ]     someExcept (e :: E.SomeException) = do@@ -660,7 +639,43 @@           putStrLnConsole mvarCtx $ "create tasks.json file. " ++ jsonFile           saveFileLBS jsonFile _TASKS_JSON_FILE_CONTENTS +    -- |+    -- +    ghciLaunched False = do+      let msg = L.intercalate " " ["ghci launch error."]+      resSeq <- incResSeq mvarCtx+      sendResponse $ J.encode $ J.errorLaunchResponse resSeq req msg +      putStrLnStderr mvarCtx msg +    ghciLaunched True = do+      startupRes <- loadHsFile cmdData mvarCtx (J.startupLaunchRequestArguments args)++      when (False == startupRes) $ do+        let msg = L.intercalate " " ["startup load error.", J.startupLaunchRequestArguments args]+        putStrLnStderr mvarCtx msg++      -- レスポンスとinitializedイベント送信+      resSeq <- incResSeq mvarCtx+      sendResponseL $ J.encode $ J.defaultLaunchResponse resSeq req+    +      resSeq <- incResSeq mvarCtx+      sendEventL $ J.encode $ J.defaultInitializedEvent resSeq+    +      -- ファイル変更ウォッチの開始+      watch cmdData mvarCtx+    +      putStrLnConsole mvarCtx $ L.intercalate "\n" infoMsg+      putStrStdout mvarCtx $ J.ghciPromptLaunchRequestArguments args+    +    -- ランチ完了後のメッセージ出力+    infoMsg = [+              ""+            , "  Now, ghci initialized."+            , "  Press F5 to start debugging."+            , "  Or modify source code. it will be loaded to ghci automatically."+            , ""+            ]+ -- | -- disconnectHandler :: DebugCommandData -> MVar DebugContext -> J.DisconnectRequest -> IO ()@@ -1266,15 +1281,18 @@ -- | -- ---runGHCi :: DebugCommandData -> MVar DebugContext -> FilePath -> IO Bool-runGHCi cmdData mvarCtx cwd = do+runGHCi :: DebugCommandData -> MVar DebugContext -> String -> FilePath -> IO Bool+runGHCi cmdData mvarCtx cmdStr cwd = do   let startCmd  = startDebugCommandData cmdData       readWhile = readWhileDebugCommandData cmdData--  infoM _LOG_NAME "% stack ghci --test --no-load --no-build \n"-  putStrLnStdout mvarCtx "% stack ghci --test --no-load --no-build \n"+      cmdList = filter (not.null) $ Data.String.Utils.split " " cmdStr+      cmd  = head cmdList+      opts = tail cmdList+      cmdLogStr = L.intercalate " " $ cmd : opts+  infoM _LOG_NAME $ cmdLogStr ++ "\n"+  putStrLnStdout mvarCtx $ cmdLogStr ++ "\n" -  startCmd cwd+  startCmd cmd opts cwd    str <- readWhile $ not . endswith _GHCI_PROMPT @@ -1398,7 +1416,7 @@ --  GHCi上でブレークポイントを追加する -- addBreakPointOnCUI :: DebugCommandData -> MVar DebugContext -> BreakPointData -> IO (Either String Int)-addBreakPointOnCUI cmdData mvarCtx (BreakPointData modName _ lineNo _ _) = do+addBreakPointOnCUI cmdData _ (BreakPointData modName _ lineNo _ _) = do    let setBreak    = breakDebugCommandData cmdData       getResult   = readDebugCommandData cmdData
app/Phoityne/IO/GUI/VSCode/TH/LaunchRequestArgumentsJSON.hs view
@@ -13,14 +13,15 @@ data LaunchRequestArguments =   LaunchRequestArguments {     noDebugLaunchRequestArguments    :: Maybe Bool --  If noDebug is true the launch request should launch the program without enabling debugging.-  , nameLaunchRequestArguments       :: String     -- Phoityne specific argument.-  , typeLaunchRequestArguments       :: String     -- Phoityne specific argument.-  , requestLaunchRequestArguments    :: String     -- Phoityne specific argument. must be "request"-  , startupLaunchRequestArguments    :: String     -- Phoityne specific argument.-  , workspaceLaunchRequestArguments  :: String     -- Phoityne specific argument.-  , logFileLaunchRequestArguments    :: String     -- Phoityne specific argument.-  , logLevelLaunchRequestArguments   :: String     -- Phoityne specific argument.-  , ghciPromptLaunchRequestArguments :: String     -- Phoityne specific argument.+  , nameLaunchRequestArguments       :: String     -- Phoityne specific argument. required.+  , typeLaunchRequestArguments       :: String     -- Phoityne specific argument. required.+  , requestLaunchRequestArguments    :: String     -- Phoityne specific argument. required. must be "request"+  , startupLaunchRequestArguments    :: String     -- Phoityne specific argument. required.+  , workspaceLaunchRequestArguments  :: String     -- Phoityne specific argument. required.+  , logFileLaunchRequestArguments    :: String     -- Phoityne specific argument. required.+  , logLevelLaunchRequestArguments   :: String     -- Phoityne specific argument. required.+  , ghciPromptLaunchRequestArguments :: String     -- Phoityne specific argument. required.+  , ghciCmdLaunchRequestArguments    :: String     -- Phoityne specific argument. required.   } deriving (Show, Read, Eq)  
phoityne-vscode.cabal view
@@ -1,5 +1,5 @@ name:                phoityne-vscode-version:             0.0.5.0+version:             0.0.6.0 synopsis:            ghci debug viewer on Visual Studio Code description:         Please see README.md license:             BSD3