snippet-0.2.0.1: test-cases/nested/readme.yaml
expected:
ansi: |2-
{b}┌─{x} test-cases/nested/readme.yaml:32:8
{b}│{x}
{b}32 │{x} main = {g}do{x}
{b} │{x} {g}╭──────────^{x}
{b}33 │{x} {g}│ {x}{g} let{x}
{b}34 │{x} {g}│ {x}{r}╭──── region = Region{x} {b}•────────────────┤{x}{B}Denotes a region in the snippet{x}
{b}35 │{x} {g}│ {x}{r}│ {x}{r} { startLine = 32{x}
{b}36 │{x} {g}│ {x}{r}│ {x}{r} , startColumn = Just 8{x}
{b}37 │{x} {g}│ {x}{r}│ {x}{r} , endLine = Just 64{x}
{b}38 │{x} {g}│ {x}{r}│ {x}{r} , endColumn = Nothing{x}
{b}39 │{x} {g}│ {x}{r}│ {x}{r} , message = Nothing{x}
{b}40 │{x} {g}│ {x}{r}│ {x}{r} , subRegion ={x}
{b}41 │{x} {g}│ {x}{r}│ {x}{r} Just{x}
{b}42 │{x} {g}│ {x}{r}│ {x}{r} Region{x}
{b}43 │{x} {g}│ {x}{r}│ {x}{r} { startLine = 34{x}
{b}44 │{x} {g}│ {x}{r}│ {x}{r} , startColumn = Just 5{x}
{b}45 │{x} {g}│ {x}{r}│ {x}{r} , endLine = {x}{c}Just{x}{r} 59{x}
{b} │{x} {g}│ {x}{r}│ {x} {c}^^^^{x} {b}•──────────┤{x}{B}Would default to startLine{x}
{b}46 │{x} {g}│ {x}{r}│ {x}{r} , endColumn = Nothing{x}
{b}47 │{x} {g}│ {x}{r}│ {x}{r} , message = Just "Denotes a region in the snippet"{x}
{b}48 │{x} {g}│ {x}{r}│ {x}{r} , subRegion ={x}
{b}49 │{x} {g}│ {x}{r}│ {x}{r} Just{x}
{b}50 │{x} {g}│ {x}{r}│ {x}{r} Region{x}
{b}51 │{x} {g}│ {x}{r}│ {x}{r} { startLine = 45{x}
{b}52 │{x} {g}│ {x}{r}│ {x}{r} , startColumn = Just 27{x}
{b}53 │{x} {g}│ {x}{r}│ {x}{r} , endLine = Nothing{x}
{b}54 │{x} {g}│ {x}{r}│ {x}{r} , endColumn = Just 31{x}
{b}55 │{x} {g}│ {x}{r}│ {x}{r} , message = Just "Would default to startLine"{x}
{b}56 │{x} {g}│ {x}{r}│ {x}{r} , subRegion = Nothing{x}
{b}57 │{x} {g}│ {x}{r}│ {x}{r} }{x}
{b}58 │{x} {g}│ {x}{r}│ {x}{r} }{x}
{b}59 │{x} {g}│ {x}{r}│ {x}{r} }{x}
{b} │{x} {g}│ {x}{r}╰───────^{x}
{b}60 │{x} {g}│{x}
{b}61 │{x} {g}│ {x}{g} -- Returns Nothing if file is missing/empty or region is invalid{x}
{b}62 │{x} {g}│ {x}{g} mSnippet <- snippetFromFile region "README.md"{x}
{b}63 │{x} {g}│{x}
{b}64 │{x} {g}│ {x}{g} traverse_ (putDoc . reAnnotate annToAnsi . prettySnippet) mSnippet{x}
{b} │{x} {g}╰──────────────────────────────────────────────────────────────────────^{x}
text: |2-
┌─ test-cases/nested/readme.yaml:32:8
│
32 │ main = do
│ ╭──────────^
33 │ │ let
34 │ │ ╭──── region = Region •────────────────┤Denotes a region in the snippet
35 │ │ │ { startLine = 32
36 │ │ │ , startColumn = Just 8
37 │ │ │ , endLine = Just 64
38 │ │ │ , endColumn = Nothing
39 │ │ │ , message = Nothing
40 │ │ │ , subRegion =
41 │ │ │ Just
42 │ │ │ Region
43 │ │ │ { startLine = 34
44 │ │ │ , startColumn = Just 5
45 │ │ │ , endLine = Just 59
│ │ │ ^^^^ •──────────┤Would default to startLine
46 │ │ │ , endColumn = Nothing
47 │ │ │ , message = Just "Denotes a region in the snippet"
48 │ │ │ , subRegion =
49 │ │ │ Just
50 │ │ │ Region
51 │ │ │ { startLine = 45
52 │ │ │ , startColumn = Just 27
53 │ │ │ , endLine = Nothing
54 │ │ │ , endColumn = Just 31
55 │ │ │ , message = Just "Would default to startLine"
56 │ │ │ , subRegion = Nothing
57 │ │ │ }
58 │ │ │ }
59 │ │ │ }
│ │ ╰───────^
60 │ │
61 │ │ -- Returns Nothing if file is missing/empty or region is invalid
62 │ │ mSnippet <- snippetFromFile region "README.md"
63 │ │
64 │ │ traverse_ (putDoc . reAnnotate annToAnsi . prettySnippet) mSnippet
│ ╰──────────────────────────────────────────────────────────────────────^
input:
region:
endColumn: null
endLine: 64
message: null
startColumn: 8
startLine: 32
subRegion:
endColumn: null
endLine: 59
message: Denotes a region in the snippet
startColumn: 5
startLine: 34
subRegion:
endColumn: 31
endLine: null
message: Would default to startLine
startColumn: 27
startLine: 45
subRegion: null
source: |
main = do
let
region = Region
{ startLine = 32
, startColumn = Just 8
, endLine = Just 64
, endColumn = Nothing
, message = Nothing
, subRegion =
Just
Region
{ startLine = 34
, startColumn = Just 5
, endLine = Just 59
, endColumn = Nothing
, message = Just "Denotes a region in the snippet"
, subRegion =
Just
Region
{ startLine = 45
, startColumn = Just 27
, endLine = Nothing
, endColumn = Just 31
, message = Just "Would default to startLine"
, subRegion = Nothing
}
}
}
-- Returns Nothing if file is missing/empty or region is invalid
mSnippet <- snippetFromFile region "README.md"
traverse_ (putDoc . reAnnotate annToAnsi . prettySnippet) mSnippet
sourceStartLine: null