phoityne-vscode 0.0.9.0 → 0.0.10.0
raw patch · 5 files changed
+160/−55 lines, 5 files
Files
- Changelog.md +12/−0
- README.md +46/−27
- app/Phoityne/GHCi/IO/Command.hs +42/−18
- app/Phoityne/VSCode/IO/Core.hs +57/−8
- phoityne-vscode.cabal +3/−2
Changelog.md view
@@ -1,4 +1,11 @@ +20161009 phoityne-vscode-0.0.10.0+ * [MODIFY] REPL結果をイベントで返すように変更した。EvaluateResponseで返した場合は、複数行表示ができないため。 + * [MODIFY] REPLにおいて、複数行の入力に対応した。 + * [MODIFY] REPLにおいて、デバッグ関連のコマンドを実行しないように変更した。 + * [FIX] バインディング変数情報の取得において、複数行にまたがる情報のパースが失敗していた箇所を修正した。 ++ 20160919 phoityne-vscode-0.0.9.0 * [ADD] ConfigurationDoneRequestに対応した。 * [ADD] CompletionsRequestに対応した。@@ -6,23 +13,28 @@ * [MODIFY] Hover時のforce実行を止めた。 * [FIX] setBreakpointsResponse, setFunctionBreakpointsResponseのBodyデータにおいて、キー名を修正した。 + 20160804 phoityne-vscode-0.0.8.0 * [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の追加) + 20160626 phoityne-vscode-0.0.6.0 * [MODIFY] launchリクエストのghciCmdパラメータで指定したghci起動コマンドを使用するように変更した。 * [MODIFY] ghciの起動に失敗した場合、デバッグを終了するように修正した。 + 20160605 phoityne-vscode-0.0.5.0 * [MODIFY] launchリクエストのnoDebugパラメータをMaybeに変更した。+ 20160601 phoityne-vscode-0.0.4.0
README.md view
@@ -7,34 +7,14 @@ ## 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) +* [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) * 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-2. Open stack project folder-3. Open debug view-4. Open launch.json-5. Set startup source file. Default file is test/Spec.hs-6. Run debug(F5)--[](https://raw.githubusercontent.com/phoityne/docs/master/demo01.gif)+ * Improvements of repl function. And some bug fixes. -## Key Bindings--* F5 : start debug-* F6 : show command menu (for stack watch)-* Shift + F6 : stop stack watch-* F7 : stack clean & build-* F8 : stack test+ ## Important@@ -42,6 +22,11 @@ * Breakpoint can be set in a .hs file which defineds "module ... where". * Source file extension must be ".hs" * When you start debugging for the first time, .vscode/tasks.json will be created automatically. Then you can use F6, F7, F8 shortcut key.+ * F5 : start debug+ * F6 : show command menu (for stack watch)+ * Shift + F6 : stop stack watch+ * F7 : stack clean & build+ * F8 : stack test ## Install@@ -63,10 +48,40 @@ ### Install vscode extensions -1. ctrlr + p on Visual Studio Code-2. ext install haskell ... +1. open Extensions from side menu of VSCode.+2. search "haskell" 3. select "[Haskell GHCi debug viewer Phoityne](https://marketplace.visualstudio.com/items?itemName=phoityne.phoityne-vscode)" + + +## Features++### Run to Cursor+++++### Bindings & Watch++The variable added to watch will be forced.+++++### Stack trace+++++### Break condition+++++### Repl & Completions+++ ## Capabilites * supportsConfigurationDoneRequest : yes@@ -105,6 +120,10 @@ ## Version history++* [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)
app/Phoityne/GHCi/IO/Command.hs view
@@ -5,7 +5,10 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE FlexibleContexts #-}+ + module Phoityne.GHCi.IO.Command ( SourcePosition(..) , StackFrame(..)@@ -123,14 +126,22 @@ withProcess (Right ghci) = readCharWhile ghci (not.endOfStartMsg) >>= setupGHCi ghci setupGHCi _ (Left err) = return $ Left err- setupGHCi ghci@(GHCiProcess _ _ _ _ pmt) (Right msg) = do+ setupGHCi ghci (Right msg) = do outHdl msg- set ghci outHdl ("prompt \"" ++ pmt ++ "\"") >>= \case- Left err -> return $ Left err- Right _ -> set ghci outHdl "-fprint-evld-with-show" >>= \case- Left err -> return $ Left err- Right _ -> return $ Right ghci+ setPrompt ghci + setPrompt ghci@(GHCiProcess _ _ _ _ pmt) = set ghci outHdl ("prompt \"" ++ pmt ++ "\"") >>= \case+ Left err -> return $ Left err+ Right _ -> setPrompt2 ghci++ setPrompt2 ghci@(GHCiProcess _ _ _ _ pmt) = set ghci outHdl ("prompt2 \"" ++ pmt ++ "\"") >>= \case+ Left err -> return $ Left err+ Right _ -> setPrintEval ghci++ setPrintEval ghci = set ghci outHdl "-fprint-evld-with-show" >>= \case+ Left err -> return $ Left err+ Right _ -> return $ Right ghci+ endOfStartMsg msg | U.endswith _GHCI_PROMPT msg = True | endOfModLoadPrompt (last (lines msg)) = True@@ -351,7 +362,10 @@ let cmd = ":show bindings" exec ghci outHdl cmd >>= \case Left err -> return $ Left err- Right msg -> return $ extractBindingBindingDatas msg+ Right msg -> do+ let msgs = lines msg+ if 1 == length msgs then return $ Right []+ else return $ extractBindingBindingDatas $ unlines $ init $ msgs -- |@@ -573,21 +587,31 @@ -- it :: [String] = [] -- Phoityne>>= ---extractBindingBindingDatas :: String -> (Either ErrorData [BindingData]) -extractBindingBindingDatas src = case parse bindingBindingDatasParser "extractBindingBindingDatas" (normalizeConsoleOut src) of- Right vals -> Right vals+extractBindingBindingDatas :: String -> Either ErrorData [BindingData] +extractBindingBindingDatas src = case parse bindingBindingDatasParser "extractBindingBindingDatas" src of+ Right vals -> Right . reverse $ vals Left err -> Left $ show err ++ " [INPUT]" ++ src where- bindingBindingDatasParser = manyTill bindingBindingDataParser eof+ bindingBindingDatasParser = do+ varName <- manyTill anyChar (try (string " :: "))+ bindingBindingDatasParser' (U.strip varName) [] - bindingBindingDataParser = do- varName <- manyTill anyChar (string " :: ")+ bindingBindingDatasParser' varName acc = do typeName <- manyTill anyChar (try (string " = "))- valStr <- try (manyTill anyChar space) <|> try (manyTill anyChar eof)- return $ BindingData (U.strip varName) (U.strip typeName) (U.strip valStr)+ try (hasMore varName (U.strip typeName) acc) <|> lastItem varName (U.strip typeName) acc + hasMore varName typeName acc = do+ str <- manyTill anyChar (try (string " :: "))+ let strs = lines str+ if 1 == length strs then return $ BindingData varName typeName (U.strip str) : acc+ else bindingBindingDatasParser' (U.strip (last strs))+ $ BindingData varName typeName (U.strip (U.join " " (init strs))) : acc + lastItem varName typeName acc = do+ valStr <- manyTill anyChar eof+ return $ BindingData varName typeName (U.strip valStr) : acc+ -- | -- normalizeConsoleOut :: String -> String@@ -601,12 +625,12 @@ -- <interactive>:1:1: error: Not in scope: ‘xx’ -- Phoityne>>= ---extractErrorResult :: String -> (Either ErrorData String) +extractErrorResult :: String -> Either ErrorData String extractErrorResult str = case parse errorResultParser "extractErrorResult" str of Right errMsg -> Left errMsg- Left _ -> Right $ str+ Left _ -> Right str where errorResultParser = do- _ <- manyTill anyChar (string "<interactive>")+ _ <- manyTill anyChar (try (string "<interactive>")) _ <- manyTill anyChar (char ' ') manyTill anyChar eof
app/Phoityne/VSCode/IO/Core.hs view
@@ -1214,16 +1214,65 @@ evaluateResponse err "" Right typeStr -> evaluateResponse typeStr (getOnlyType typeStr) - withProcess _ exp (Just ghciProc) = G.exec ghciProc outHdl exp >>= \case- Left err -> do+ withProcess _ exp (Just ghciProc) + | null (U.strip exp) = do+ evaluateResponse "" ""+ sendStdoutEvent mvarCtx (G.promptGHCiProcess ghciProc)+ | otherwise = replHandler ghciProc $ map U.rstrip (lines exp)+ + replHandler _ [] = do+ errorM _LOG_NAME "[replHandler] invalid inputs."+ evaluateResponse "" ""+ + replHandler ghciProc (exp:[]) + | isPermitCmd (U.strip exp) = G.exec ghciProc outHdl exp >>= \case+ Left err -> do+ errorM _LOG_NAME $ show err+ evaluateResponse "" ""+ sendErrorEvent mvarCtx $ (G.promptGHCiProcess ghciProc) ++ exp ++ "\n" ++ show err+ sendStdoutEvent mvarCtx $ G.promptGHCiProcess ghciProc+ Right cmdStr -> do+ evaluateResponse "" ""+ sendStdoutEvent mvarCtx $ (G.promptGHCiProcess ghciProc) ++ exp ++ "\n" ++ cmdStr+ infoM _LOG_NAME $ (G.promptGHCiProcess ghciProc) ++ exp ++ "\n" ++ cmdStr+ | otherwise = do+ evaluateResponse "" ""+ sendErrorEvent mvarCtx $ (G.promptGHCiProcess ghciProc) ++ exp ++ "\n can not use these commands.\n" ++ show notPermit ++ "\n"+ sendStdoutEvent mvarCtx $ G.promptGHCiProcess ghciProc+ infoM _LOG_NAME $ (G.promptGHCiProcess ghciProc) ++ exp ++ "\n can not use these commands.\n" ++ show notPermit ++ "\n" ++ replHandler ghciProc exps = G.exec ghciProc outHdl ":{" >>= \case+ Left err -> do errorM _LOG_NAME $ show err- sendErrorEvent mvarCtx $ show err+ evaluateResponse "" ""+ sendErrorEvent mvarCtx $ (G.promptGHCiProcess ghciProc) ++ ":{\n" ++ show err+ Right cmdStr -> replsHandler ghciProc (exps ++ [":}"]) $ (G.promptGHCiProcess ghciProc) ++ ":{\n" ++ cmdStr+ + replsHandler _ [] acc = do+ evaluateResponse "" ""+ sendStdoutEvent mvarCtx acc+ infoM _LOG_NAME acc - Right cmdStr -> do- -- promptを消す- let result = U.join " " . map U.strip . init . lines $ cmdStr- evaluateResponse result ""- sendStdoutEvent mvarCtx $ "\n" ++ G.promptGHCiProcess ghciProc+ replsHandler ghciProc (x:xs) acc + | isPermitCmd (U.strip x) = G.exec ghciProc outHdl x >>= \case+ Left err -> do+ evaluateResponse "" ""+ sendErrorEvent mvarCtx $ acc ++ x ++ "\n" ++ show err+ sendStdoutEvent mvarCtx $ G.promptGHCiProcess ghciProc+ errorM _LOG_NAME $ acc ++ x ++ "\n" ++ show err++ Right cmdStr -> replsHandler ghciProc xs $ acc ++ x ++ "\n" ++ cmdStr+ | otherwise = do+ evaluateResponse "" ""+ sendErrorEvent mvarCtx $ acc ++ x ++ "\n can not use these commands.\n" ++ show notPermit ++ "\n"+ sendStdoutEvent mvarCtx $ G.promptGHCiProcess ghciProc+ infoM _LOG_NAME $ acc ++ x ++ "\n can not use these commands.\n" ++ show notPermit ++ "\n"++ isPermitCmd c = 0 == (length ( filter (flip U.startswith c) notPermit))++ notPermit = [":{", ":abandon", ":back", ":break", ":continue", ":delete", ":force", ":forward"+ , ":history", ":list", ":print", ":sprint", ":step", ":steplocal", ":stepmodule", ":trace"+ ] outHdl msg = do --sendStdoutEvent mvarCtx msg
phoityne-vscode.cabal view
@@ -1,12 +1,13 @@ name: phoityne-vscode-version: 0.0.9.0+version: 0.0.10.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+homepage: https://github.com/phoityne/phoityne-vscode+bug-reports: https://github.com/phoityne/phoityne-vscode/issues copyright: 2016 phoityne_hs category: Development build-type: Simple