haskell-dap 0.0.5.0 → 0.0.6.0
raw patch · 6 files changed
+48/−13 lines, 6 files
Files
- Changelog.md +6/−0
- README.md +4/−3
- app/Haskell/DAP/GHCi/Command.hs +30/−7
- app/Haskell/DAP/GHCi/Constant.hs +6/−1
- haskell-dap.cabal +1/−1
- src/GHCi/DAP/IFData.hs +1/−1
Changelog.md view
@@ -1,4 +1,10 @@ +20180601 haskell-dap-0.0.6.0++ * [MODIFY] support VisualStudio2017.(see [hdx4vs](https://github.com/phoityne/hdx4vsc))+ * [ADD] [2][ support Logpoints](https://github.com/phoityne/haskell-dap/issues/3)++ 20180601 haskell-dap-0.0.5.0 * [ADD] setExceptionBreakpoint commands.
README.md view
@@ -7,9 +7,10 @@ ## Information -* [2018/06/01] Release haskel-dap-0.0.5.0. - * [ADD] setExceptionBreakpoint commands.- * [ADD] breakHitCounter, breakCondition, logPoint function.+* [2018/07/01] Release haskel-dap-0.0.6.0. + * [MODIFY] support VisualStudio2017.(see [hdx4vs](https://github.com/phoityne/hdx4vsc))+ * [ADD] [2][ support Logpoints](https://github.com/phoityne/haskell-dap/issues/3)+ ## Limitation Currently this project is an experimental design and implementation.
app/Haskell/DAP/GHCi/Command.hs view
@@ -267,7 +267,7 @@ addBP :: String -> D.SourceBreakpoint -> G.GHCi (ModuleName, D.SourceBreakpoint, D.Breakpoint) addBP mod srcBP = do let lineNo = show $ D.lineSourceBreakpoint srcBP - colNo = maybe "" show $ D.columnSourceBreakpoint srcBP + colNo = getColNo $ D.columnSourceBreakpoint srcBP argStr = mod ++ " " ++ lineNo ++ " " ++ colNo bp <- addBreakpoint argStr @@ -276,6 +276,13 @@ -- | -- + getColNo :: Maybe Int -> String + getColNo Nothing = "" + getColNo (Just 1) = "" + getColNo (Just a) = show a + + -- | + -- updateBpCtx :: [(ModuleName, D.SourceBreakpoint, D.Breakpoint)] -> IO () updateBpCtx bps = do ctx <- takeMVar ctxMVar @@ -954,9 +961,12 @@ -- | -- TyThings https://hackage.haskell.org/package/ghc-8.2.1/docs/HscTypes.html#t:TyThing -- + tyThing2Val :: GHC.TyThing -> G.GHCi D.Variable tyThing2Val (AnId i) = do - let isForce = False - GHC.obtainTermFromId maxBound isForce i >>= withTerm i + let isForce = True + depth <- getInspectDepth ctxMVar + GHC.obtainTermFromId depth isForce i >>= withTerm i + tyThing2Val x = do dflags <- getDynFlags return D.defaultVariable { @@ -979,13 +989,16 @@ typeStr = showSDoc dflags (pprTypeForUser ty) valStr = showSDoc dflags termSDoc + nextIdx <- getNextIdx ctxMVar t nameStr + return D.defaultVariable { D.nameVariable = nameStr , D.typeVariable = typeStr , D.valueVariable = valStr , D.evaluateNameVariable = Just nameStr - , D.variablesReferenceVariable = 0 + , D.variablesReferenceVariable = nextIdx } + withTerm i _ = do dflags <- getDynFlags idSDoc <- pprTypeAndContents i @@ -1129,8 +1142,9 @@ withArgs :: Either String D.EvaluateArguments -> G.GHCi (Either String D.EvaluateBody) withArgs (Left err) = return $ Left $ "[DAP][ERROR] " ++ err ++ " : " ++ argsStr withArgs (Right args) = case D.contextEvaluateArguments args of - "repl" -> runRepl args - _ -> runOther args + Nothing -> runRepl args + Just "repl" -> runRepl args + _ -> runOther args -- | -- @@ -1188,7 +1202,8 @@ withTyThing (AnId i) = do let isForce = True - body <- GHC.obtainTermFromId maxBound isForce i >>= withTerm i + depth <- getInspectDepth ctxMVar + body <- GHC.obtainTermFromId depth isForce i >>= withTerm i return $ Right body withTyThing x = do @@ -1280,3 +1295,11 @@ && length val > 2 && head val == '"' && last val == '"' = tail $ init val | otherwise = val + + +-- | +-- +getInspectDepth :: MVar DAPContext -> G.GHCi Int +getInspectDepth _ = return _INSPECT_DEPTH + +
app/Haskell/DAP/GHCi/Constant.hs view
@@ -22,4 +22,9 @@ _GHCi_SCOPE :: String _GHCi_SCOPE = "GHCi Scope" - + +-- | +-- +_INSPECT_DEPTH :: Int +_INSPECT_DEPTH = 10 +
haskell-dap.cabal view
@@ -1,5 +1,5 @@ name: haskell-dap-version: 0.0.5.0+version: 0.0.6.0 synopsis: haskell-dap is a GHCi having DAP interface. description: Please see README.md homepage: https://github.com/phoityne/haskell-dap
src/GHCi/DAP/IFData.hs view
@@ -184,7 +184,7 @@ etc. -}- , contextEvaluateArguments :: String+ , contextEvaluateArguments :: Maybe String } deriving (Show, Read, Eq)