packages feed

phoityne-vscode 0.0.13.0 → 0.0.14.0

raw patch · 14 files changed

+82/−147 lines, 14 files

Files

Changelog.md view
@@ -1,10 +1,16 @@ +20170507 phoityne-vscode-0.0.14.0+  * [ADD] [15](https://github.com/phoityne/phoityne-vscode/issues/15) : adding main args setting to launch.json+  * [FIX] [16](https://github.com/phoityne/phoityne-vscode/issues/16) : Exit on stdin eof++ 20170402 phoityne-vscode-0.0.13.0   * [FIX] [10](https://github.com/phoityne/phoityne-vscode/issues/10) : Unable to set breakpoints   * [FIX] [11](https://github.com/phoityne/phoityne-vscode/issues/11) : Debugger not progressing past IO   * [ADD] [12](https://github.com/phoityne/phoityne-vscode/issues/12) : support Column break points   * [MODIFY] [6](https://github.com/phoityne/phoityne-vscode/issues/6) : adding stopOnEntry setting on launch.json    * [MODIFY] : add ghci-options -fprint-evld-with-show to stack run command in launch.json file.+  20170205 phoityne-vscode-0.0.12.0   * [FIX] [8](https://github.com/phoityne/phoityne-vscode/issues/8) : Unterminated process after leaving GHCi 
README.md view
@@ -7,16 +7,12 @@  ## Information -* [2017/04/02] phoityne-vscode released.  -  * Marketplace [phoityne-vscode-0.0.11](https://marketplace.visualstudio.com/items?itemName=phoityne.phoityne-vscode)-  * hackage [phoityne-vscode-0.0.13.0](https://hackage.haskell.org/package/phoityne-vscode)  +* [2017/05/07] phoityne-vscode released.  +  * Marketplace [phoityne-vscode-0.0.12](https://marketplace.visualstudio.com/items?itemName=phoityne.phoityne-vscode)+  * hackage [phoityne-vscode-0.0.14.0](https://hackage.haskell.org/package/phoityne-vscode)   * Release Summary-  * FIX [10](https://github.com/phoityne/phoityne-vscode/issues/10) : Unable to set breakpoints-  * FIX [11](https://github.com/phoityne/phoityne-vscode/issues/11) : Debugger not progressing past IO-  * ADD [12](https://github.com/phoityne/phoityne-vscode/issues/12) : support Column breakpoints-  * MODIFY [6](https://github.com/phoityne/phoityne-vscode/issues/6) : add "stopOnEntry" setting to launch.json -  * MODIFY : add "--ghci-options -fprint-evld-with-show" to ghci command option in launch.json, instead of hard-coded.-+  * ADD [15](https://github.com/phoityne/phoityne-vscode/issues/15) : adding main args setting to launch.json+  * FIX [16](https://github.com/phoityne/phoityne-vscode/issues/16) : Exit on stdin eof   ![01_debug.gif](https://raw.githubusercontent.com/phoityne/phoityne-vscode/master/docs/01_debug.gif)@@ -58,7 +54,7 @@     C:\Users\[user name]\AppData\Roaming\local\bin\phoityne-vscode.exe          % phoityne-vscode --version-    phoityne-vscode-0.0.13.0+    phoityne-vscode-0.0.14.0     %     % code @@ -146,6 +142,7 @@ |stopOnEntry|required|true|stop or not after debugger launched. |logFile|required|${workspaceRoot}/.vscode/phoityne.log|internal log file.| |logLevel|required|WARNING|internal log level.|+|mainArgs|optional|-|main arguments.|  ### __.vscode/tasks.json__ @@ -156,33 +153,3 @@ |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--* [2017/02/05] phoityne-vscode released.  -  * Marketplace [phoityne-vscode-0.0.10](https://marketplace.visualstudio.com/items?itemName=phoityne.phoityne-vscode)-  * hackage [phoityne-vscode-0.0.12.0](https://hackage.haskell.org/package/phoityne-vscode)  --* [2016/12/18] phoityne-vscode released.  -  * Marketplace [phoityne-vscode-0.0.9](https://marketplace.visualstudio.com/items?itemName=phoityne.phoityne-vscode)-  * hackage [phoityne-vscode-0.0.11.0](https://hackage.haskell.org/package/phoityne-vscode)  --* [2016/10/09] phoityne-vscode released.  -  * Marketplace [phoityne-vscode-0.0.8](https://marketplace.visualstudio.com/items?itemName=phoityne.phoityne-vscode)-  * hackage [phoityne-vscode-0.0.10.0](https://hackage.haskell.org/package/phoityne-vscode)  --* [2016/09/19] 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)  --* [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/Main.hs view
@@ -3,14 +3,10 @@  module Main where --- モジュール import qualified Phoityne.VSCode.IO.Main as M---- システム import System.Exit  -- |---  メイン -- main :: IO () main = do
app/Phoityne/GHCi.hs view
@@ -1,11 +1,3 @@-{-# LANGUAGE GADTs               #-}-{-# LANGUAGE LambdaCase          #-}-{-# LANGUAGE MultiWayIf          #-}-{-# LANGUAGE BinaryLiterals      #-}-{-# LANGUAGE OverloadedStrings   #-}-{-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE DeriveDataTypeable  #-}- module Phoityne.GHCi (   module Phoityne.GHCi.IO.Process , module Phoityne.GHCi.IO.Command
app/Phoityne/GHCi/IO/Command.hs view
@@ -8,7 +8,6 @@ {-# LANGUAGE FlexibleContexts    #-}   - module Phoityne.GHCi.IO.Command (     SourcePosition(..)   , StackFrame(..)@@ -338,7 +337,6 @@     Right msg -> return $ extractStackFrame msg  -- |---   引数の移動量はghc8から対応 -- back :: GHCiProcess -> OutputHandler -> Int -> IO (Either ErrorData SourcePosition) back ghci outHdl _ = do@@ -348,7 +346,6 @@     Right msg -> return $ extractTracePosition msg  -- |---   引数の移動量はghc8から対応 -- forward :: GHCiProcess -> OutputHandler -> Int -> IO (Either ErrorData SourcePosition) forward ghci outHdl _ = do@@ -371,7 +368,6 @@   -- |---  intaractve error is returned as Left Error -- force :: GHCiProcess -> OutputHandler -> String -> IO (Either ErrorData String) force ghci outHdl target = do@@ -381,7 +377,6 @@     Right msg -> return $ extractErrorResult (normalizeConsoleOut msg)   -- |---  intaractve error is returned as Left Error -- info :: GHCiProcess -> OutputHandler -> String -> IO (Either ErrorData String) info ghci outHdl target = do@@ -391,7 +386,6 @@     Right msg -> return $ extractErrorResult (normalizeConsoleOut msg)   -- |---  intaractve error is returned as Left Error -- showType :: GHCiProcess -> OutputHandler -> String -> IO (Either ErrorData String) showType ghci outHdl target = do@@ -401,7 +395,6 @@     Right msg -> return $ extractErrorResult (normalizeConsoleOut msg)   -- |---  intaractve error is returned as Left Error -- showKind :: GHCiProcess -> OutputHandler -> String -> IO (Either ErrorData String) showKind ghci outHdl target = do@@ -482,7 +475,7 @@       parsePosition  -- |---  parser of+--  parser for --   A) src\Phoityne\IO\Main.hs:31:11-14 --   B) src\Main.hs:(17,3)-(19,35) --   C) src\Phoityne\IO\Main.hs:31:11@@ -521,7 +514,6 @@     drive2lower xs = xs  -- |---  トレース情報のパーサ -- --  parser of --    Phoityne>>= :history@@ -556,7 +548,6 @@       return funcName  -- |---  トレース位置のパーサ -- --  parser of --    Phoityne>>= :back 10@@ -580,7 +571,6 @@       parsePosition  -- |---  バインディング変数のパーサ -- --  parser of --    Phoityne>>= :show bindings@@ -621,7 +611,6 @@   -- |---  interactive errorのパーサ --    Phoityne>>= :info IO xx -- --      <interactive>:1:1: error: Not in scope: ‘xx’
app/Phoityne/VSCode/Argument.hs view
@@ -9,15 +9,12 @@ , config ) where --- システム+import Paths_phoityne_vscode (version) import System.Console.CmdArgs import qualified Control.Exception as E--import Paths_phoityne_vscode (version) import Data.Version (showVersion)  -- |---  ヘルプ表示時の例外 -- data HelpExitException = HelpExitException                        deriving (Show, Typeable)@@ -25,13 +22,10 @@ instance E.Exception HelpExitException  -- |---  コマンドライン引数データ設定---    モードを使用する場合のサンプル -- data ArgData = ModeA deriving (Data, Typeable, Show, Read, Eq)  -- |---  アノテーション設定 -- config :: ArgData config = modes [confA]@@ -54,12 +48,5 @@            , "Phoityne is a ghci debug viewer for Visual Studio Code. "            , ""            ]----- |---  enum値引数----data Method = Get | Post | Put | Delete-              deriving (Data, Typeable, Show, Read, Eq)  
app/Phoityne/VSCode/Constant.hs view
@@ -72,3 +72,10 @@ _NO_BREAK_POINT_LOCATION :: String _NO_BREAK_POINT_LOCATION = "No breakpoints found at that location." ++-- |+--+--+_TWO_CRLF :: String+_TWO_CRLF = "\r\n\r\n"+
app/Phoityne/VSCode/IO/Control.hs view
@@ -9,24 +9,23 @@  module Phoityne.VSCode.IO.Control where --- モジュール+import Phoityne.VSCode.Constant import Phoityne.VSCode.Utility import qualified Phoityne.VSCode.Argument as A import qualified Phoityne.VSCode.IO.Core as GUI import qualified Data.ByteString.Lazy as BSL --- システム import System.IO import Control.Concurrent-import qualified Data.ConfigFile as C import Text.Parsec+import qualified Data.ConfigFile as C+import qualified System.Log.Logger as L  -- |---  ロジックメイン -- -run :: A.ArgData      -- コマンドライン引数-    -> C.ConfigParser -- INI設定-    -> IO Int         -- exit code+run :: A.ArgData+    -> C.ConfigParser+    -> IO Int run _ _ = do    hSetBuffering stdin NoBuffering@@ -47,26 +46,33 @@ wait :: MVar GUI.DebugContextData -> IO () wait mvarDat = go BSL.empty   where-    go :: BSL.ByteString -> IO ()-    go buf = do-      c <- BSL.hGet stdin 1-      let newBuf = BSL.append buf c-      case readContentLength (lbs2str newBuf) of-        Left _ -> go newBuf-        Right len -> do-          cnt <- BSL.hGet stdin len-          GUI.handleRequest mvarDat newBuf cnt-          wait mvarDat+    go buf = BSL.hGet stdin 1 >>= withC buf     -      where-        readContentLength :: String -> Either ParseError Int-        readContentLength = parse parser "readContentLength"+    withC buf c+      | c == BSL.empty = unexpectedEOF+      | otherwise      = withBuf $ BSL.append buf c     -        parser = do-          string "Content-Length: "-          len <- manyTill digit (string _TWO_CRLF)-          return . read $ len+    withBuf buf = case parse parser "readContentLength" (lbs2str buf) of+        Left _    -> go buf+        Right len -> BSL.hGet stdin len >>= withCnt buf +    withCnt buf cnt+      | cnt == BSL.empty = unexpectedEOF+      | otherwise        = do+        GUI.handleRequest mvarDat buf cnt+        wait mvarDat++    parser = do+      string "Content-Length: "+      len <- manyTill digit (string _TWO_CRLF)+      return . read $ len++    unexpectedEOF = do+      L.criticalM _LOG_NAME "unexpected EOF on stdin."+      return ()+++ -- | -- sendResponse :: BSL.ByteString -> IO ()@@ -75,10 +81,4 @@   BSL.hPut stdout $ str2lbs _TWO_CRLF   BSL.hPut stdout str   hFlush stdout---- |-------_TWO_CRLF :: String-_TWO_CRLF = "\r\n\r\n" 
app/Phoityne/VSCode/IO/Core.hs view
@@ -175,12 +175,6 @@ -- | -- ---_TWO_CRLF :: String-_TWO_CRLF = "\r\n\r\n"---- |------ _SEP_WIN :: Char _SEP_WIN = '\\' @@ -537,7 +531,6 @@ launchRequestHandler :: MVar DebugContextData -> J.LaunchRequest -> IO () launchRequestHandler mvarCtx req@(J.LaunchRequest _ _ _ args) = flip E.catches handlers $ do -  -- コンテキストデータの保持   ctx <- takeMVar mvarCtx   putMVar mvarCtx ctx {       workspaceDebugContextData   = J.workspaceLaunchRequestArguments args@@ -545,7 +538,6 @@     , stopOnEntryDebugContextData = J.stopOnEntryLaunchRequestArguments args     } -  -- ロギング設定   let logLevelStr = J.logLevelLaunchRequestArguments args   logLevel <- case readMay logLevelStr of     Just lv -> return lv@@ -557,12 +549,14 @@    logRequest $ show req -  -- tasks.jsonファイルの準備   prepareTasksJsonFile  -  -- ghciのランチ-  runGHCi mvarCtx (J.ghciCmdLaunchRequestArguments args) (J.ghciPromptLaunchRequestArguments args) >>= ghciLaunched +  runGHCi mvarCtx+          (J.ghciCmdLaunchRequestArguments args)+          (J.ghciPromptLaunchRequestArguments args)+          -- (J.ghciEnvLaunchRequestArguments args)+           >>= ghciLaunched          where@@ -606,15 +600,26 @@         let msg = L.intercalate " " ["startup load error.", J.startupLaunchRequestArguments args]         sendErrorEvent mvarCtx $ msg ++ "\n" +      setMainArgs ghciProc (J.mainArgsLaunchRequestArguments args) >>= \case+        Right _  -> return ()+        Left err -> do+          let msg = L.intercalate " " ["set args error.", err, show (J.mainArgsLaunchRequestArguments args)]+          sendErrorEvent mvarCtx $ msg ++ "\n"+       resSeq <- getIncreasedResponseSequence mvarCtx       sendResponse mvarCtx $ J.encode $ J.defaultLaunchResponse resSeq req            resSeq <- getIncreasedResponseSequence mvarCtx       sendEvent mvarCtx $ J.encode $ J.defaultInitializedEvent resSeq -      -- ファイル変更ウォッチの開始       watch mvarCtx     +    setMainArgs _ Nothing = return . Right $ ()+    setMainArgs ghciProc (Just argsStr)+      | null (U.strip argsStr) = return . Right $ ()+      | otherwise = G.set ghciProc (sendStdoutEvent mvarCtx) ("args " ++ argsStr)++ -- | -- configurationDoneRequestHandler :: MVar DebugContextData -> J.ConfigurationDoneRequest -> IO ()@@ -1215,7 +1220,7 @@       sendResponse mvarCtx resStr        -- |-    --  force結果のパーサ+    --  force result parser     --     --  parser of     --    Phoityne>>= :force x@@ -1232,7 +1237,7 @@           manyTill anyChar eof      -- |-    --  type結果のパーサ+    --  type result parser     --     --  parser of     --    Phoityne>>= :type x@@ -1328,7 +1333,10 @@ -- | -- ---runGHCi :: MVar DebugContextData -> String -> String -> IO (Either G.ErrorData G.GHCiProcess)+runGHCi :: MVar DebugContextData+        -> String+        -> String+        -> IO (Either G.ErrorData G.GHCiProcess) runGHCi mvarCtx cmdStr pmt = do   ctx <- readMVar mvarCtx   let cmdList = filter (not.null) $ U.split " " cmdStr
app/Phoityne/VSCode/IO/Main.hs view
@@ -3,11 +3,9 @@  module Phoityne.VSCode.IO.Main (run) where --- モジュール import qualified Phoityne.VSCode.Argument as A import qualified Phoityne.VSCode.IO.Control as CTRL --- システム import Data.Either.Utils import System.Exit import qualified Control.Exception as E@@ -17,18 +15,14 @@   -- |---  アプリケーションメイン --  run :: IO Int run = flip E.catches handlers $ do -  -- コマンドライン引数設定   args <- getArgs -  -- INI設定ファイルのRead   iniSet <- loadIniFile args -  -- ロジック実行   flip E.finally finalProc $ do     CTRL.run args iniSet @@ -47,7 +41,6 @@   -- |---  引数データの取得 --  getArgs :: IO A.ArgData getArgs = E.catches (CMD.cmdArgs A.config) handlers@@ -59,17 +52,15 @@   -- |---  INI設定ファイルデータの取得 -- -loadIniFile :: A.ArgData          -- コマンドライン引数-            -> IO C.ConfigParser  -- INI設定+loadIniFile :: A.ArgData+            -> IO C.ConfigParser loadIniFile _ = do   let cp = forceEither $ C.readstring C.emptyCP defaultIniSetting   return cp{ C.accessfunc = C.interpolatingAccess 5 }   -- |--- デフォルトINI設定 --  defaultIniSetting :: String defaultIniSetting = unlines [
app/Phoityne/VSCode/IO/Utility.hs view
@@ -2,7 +2,6 @@  module Phoityne.VSCode.IO.Utility where --- システム import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as LBS import GHC.IO.Encoding
app/Phoityne/VSCode/TH/LaunchRequestArgumentsJSON.hs view
@@ -4,7 +4,7 @@ module Phoityne.VSCode.TH.LaunchRequestArgumentsJSON where  import Data.Aeson.TH-+-- import qualified Data.Map as M import Phoityne.VSCode.Utility  -- |@@ -23,6 +23,8 @@   , ghciPromptLaunchRequestArguments   :: String     -- Phoityne specific argument. required.   , ghciCmdLaunchRequestArguments      :: String     -- Phoityne specific argument. required.   , stopOnEntryLaunchRequestArguments  :: Bool       -- Phoityne specific argument. required.+  , mainArgsLaunchRequestArguments     :: Maybe String         -- Phoityne specific argument. required.+  -- , ghciEnvLaunchRequestArguments      :: M.Map String String  -- Phoityne specific argument. required.   } deriving (Show, Read, Eq)  
app/Phoityne/VSCode/Utility.hs view
@@ -1,7 +1,6 @@  module Phoityne.VSCode.Utility where --- システム import Data.Either.Utils import qualified Data.ByteString as BS import qualified Data.ByteString.Lazy as LBS@@ -15,32 +14,26 @@   -- |---  UTF8文字列をByteStringへの変換 -- str2bs :: String -> BS.ByteString str2bs = TE.encodeUtf8 . T.pack  -- |---  ByteStringをUTF8文字列への変換 -- bs2str :: BS.ByteString -> String bs2str = T.unpack. TE.decodeUtf8  -- |---  UTF8文字列をLazyByteStringへの変換 -- str2lbs :: String -> LBS.ByteString str2lbs = TLE.encodeUtf8 . TL.pack  -- |---  LazyByteStringをUTF8文字列への変換 -- lbs2str :: LBS.ByteString -> String lbs2str = TL.unpack. TLE.decodeUtf8  -- |---  INI設定の指定したセクションに含まれる---  すべて設定項目を返す。 -- getIniItems :: CFG.ConfigParser             -> CFG.SectionSpec@@ -53,7 +46,6 @@   -- |---   --  addChildTree :: TR.Tree a -> TR.Tree a -> TR.Tree a addChildTree parent child = parent { TR.subForest = child : curForest}@@ -61,7 +53,6 @@   -- |---   --  pushWithLimit :: [a] -> a -> Int -> [a] pushWithLimit [] item _ = [item]
phoityne-vscode.cabal view
@@ -1,5 +1,5 @@ name:                  phoityne-vscode-version:               0.0.13.0+version:               0.0.14.0 synopsis:              ghci debug viewer on Visual Studio Code description:           Please see README.md license:               BSD3@@ -8,7 +8,7 @@ maintainer:            phoityne.hs@gmail.com homepage:              https://github.com/phoityne/phoityne-vscode bug-reports:           https://github.com/phoityne/phoityne-vscode/issues-copyright:             2016 phoityne_hs+copyright:             2016-2017 phoityne_hs category:              Development build-type:            Simple cabal-version:         >=1.10