Skip to content

Commit b580b5a

Browse files
Merge pull request #299 from SwiftFiddle/fix-value
value.text instead of value.description
2 parents 7b02bc7 + 418c2d4 commit b580b5a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1246
-1153
lines changed

Public/css/popover.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
.popover-content dd {
5454
margin-bottom: 2px;
5555
margin-left: 0;
56-
padding: 0 0 0 10px;
5756
font-family: Menlo, Consolas, "DejaVu Sans Mono", "Ubuntu Mono", monospace;
5857
word-break: break-all;
5958
}

Resources/branch_main/Sources/parser/TokenVisitor.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ final class TokenVisitor: SyntaxRewriter {
107107
StructureProperty(
108108
name: name,
109109
value: StructureValue(
110-
text: "\(value)"
110+
text: "\(value.text)"
111111
.replacingOccurrences(of: " ", with: "")
112112
.replacingOccurrences(of: "\n", with: ""),
113113
kind: "\(value.tokenKind)"
@@ -230,7 +230,8 @@ final class TokenVisitor: SyntaxRewriter {
230230
private func replaceSymbols(text: String) -> String {
231231
text
232232
.replacingOccurrences(of: " ", with: "")
233-
.replacingOccurrences(of: "<br>", with: "")
233+
.replacingOccurrences(of: "<br>", with: "↲<br>")
234+
234235
}
235236
}
236237

Resources/branch_main/Tests/Tests/Fixtures/test-1-1.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159
"name": "bindingSpecifier",
160160
"value": {
161161
"kind": "keyword(SwiftSyntax.Keyword.let)",
162-
"text": "let"
162+
"text": "let"
163163
}
164164
},
165165
{
@@ -331,7 +331,7 @@
331331
"name": "identifier",
332332
"value": {
333333
"kind": "identifier(&quot;number&quot;)",
334-
"text": "number"
334+
"text": "number"
335335
}
336336
},
337337
{
@@ -382,7 +382,7 @@
382382
"name": "equal",
383383
"value": {
384384
"kind": "equal",
385-
"text": "="
385+
"text": "="
386386
}
387387
},
388388
{

Resources/branch_main/Tests/Tests/Fixtures/test-1-2.json

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"name": "endOfFileToken",
3232
"value": {
3333
"kind": "endOfFile",
34-
"text": "↲↲//␣Prints␣&quot;It&apos;s␣really␣warm.␣Don&apos;t␣forget␣to␣wear␣sunscreen.&quot;"
34+
"text": ""
3535
}
3636
},
3737
{
@@ -159,7 +159,7 @@
159159
"name": "bindingSpecifier",
160160
"value": {
161161
"kind": "keyword(SwiftSyntax.Keyword.var)",
162-
"text": "var"
162+
"text": "var"
163163
}
164164
},
165165
{
@@ -331,7 +331,7 @@
331331
"name": "identifier",
332332
"value": {
333333
"kind": "identifier(&quot;temperatureInFahrenheit&quot;)",
334-
"text": "temperatureInFahrenheit"
334+
"text": "temperatureInFahrenheit"
335335
}
336336
},
337337
{
@@ -382,7 +382,7 @@
382382
"name": "equal",
383383
"value": {
384384
"kind": "equal",
385-
"text": "="
385+
"text": "="
386386
}
387387
},
388388
{
@@ -575,7 +575,7 @@
575575
"name": "ifKeyword",
576576
"value": {
577577
"kind": "keyword(SwiftSyntax.Keyword.if)",
578-
"text": "↲↲if␣"
578+
"text": "if"
579579
}
580580
},
581581
{
@@ -614,7 +614,7 @@
614614
"name": "elseKeyword",
615615
"value": {
616616
"kind": "keyword(SwiftSyntax.Keyword.else)",
617-
"text": "else"
617+
"text": "else"
618618
}
619619
},
620620
{
@@ -653,7 +653,7 @@
653653
"text": "if",
654654
"token": {
655655
"kind": "keyword(SwiftSyntax.Keyword.if)",
656-
"leadingTrivia": "",
656+
"leadingTrivia": "<br>↲<br>",
657657
"trailingTrivia": ""
658658
},
659659
"type": "other"
@@ -808,7 +808,7 @@
808808
"name": "identifier",
809809
"value": {
810810
"kind": "identifier(&quot;temperatureInFahrenheit&quot;)",
811-
"text": "temperatureInFahrenheit"
811+
"text": "temperatureInFahrenheit"
812812
}
813813
},
814814
{
@@ -871,7 +871,7 @@
871871
"name": "operator",
872872
"value": {
873873
"kind": "binaryOperator(&quot;&lt;=&quot;)",
874-
"text": "&lt;="
874+
"text": "&lt;="
875875
}
876876
},
877877
{
@@ -922,7 +922,7 @@
922922
"name": "literal",
923923
"value": {
924924
"kind": "integerLiteral(&quot;32&quot;)",
925-
"text": "32"
925+
"text": "32"
926926
}
927927
},
928928
{
@@ -999,7 +999,7 @@
999999
"name": "rightBrace",
10001000
"value": {
10011001
"kind": "rightBrace",
1002-
"text": "↲}␣"
1002+
"text": "}"
10031003
}
10041004
},
10051005
{
@@ -1217,7 +1217,7 @@
12171217
"name": "identifier",
12181218
"value": {
12191219
"kind": "identifier(&quot;print&quot;)",
1220-
"text": "↲␣␣print"
1220+
"text": "print"
12211221
}
12221222
},
12231223
{
@@ -1255,7 +1255,7 @@
12551255
"text": "print",
12561256
"token": {
12571257
"kind": "identifier(&quot;print&quot;)",
1258-
"leadingTrivia": "↲␣␣",
1258+
"leadingTrivia": "<br>␣␣",
12591259
"trailingTrivia": ""
12601260
},
12611261
"type": "other"
@@ -1600,7 +1600,7 @@
16001600
"text": "}",
16011601
"token": {
16021602
"kind": "rightBrace",
1603-
"leadingTrivia": "",
1603+
"leadingTrivia": "<br>",
16041604
"trailingTrivia": ""
16051605
},
16061606
"type": "other"
@@ -1643,7 +1643,7 @@
16431643
"name": "ifKeyword",
16441644
"value": {
16451645
"kind": "keyword(SwiftSyntax.Keyword.if)",
1646-
"text": "if"
1646+
"text": "if"
16471647
}
16481648
},
16491649
{
@@ -1682,7 +1682,7 @@
16821682
"name": "elseKeyword",
16831683
"value": {
16841684
"kind": "keyword(SwiftSyntax.Keyword.else)",
1685-
"text": "else"
1685+
"text": "else"
16861686
}
16871687
},
16881688
{
@@ -1876,7 +1876,7 @@
18761876
"name": "identifier",
18771877
"value": {
18781878
"kind": "identifier(&quot;temperatureInFahrenheit&quot;)",
1879-
"text": "temperatureInFahrenheit"
1879+
"text": "temperatureInFahrenheit"
18801880
}
18811881
},
18821882
{
@@ -1939,7 +1939,7 @@
19391939
"name": "operator",
19401940
"value": {
19411941
"kind": "binaryOperator(&quot;&gt;=&quot;)",
1942-
"text": "&gt;="
1942+
"text": "&gt;="
19431943
}
19441944
},
19451945
{
@@ -1990,7 +1990,7 @@
19901990
"name": "literal",
19911991
"value": {
19921992
"kind": "integerLiteral(&quot;86&quot;)",
1993-
"text": "86"
1993+
"text": "86"
19941994
}
19951995
},
19961996
{
@@ -2067,7 +2067,7 @@
20672067
"name": "rightBrace",
20682068
"value": {
20692069
"kind": "rightBrace",
2070-
"text": "↲}␣"
2070+
"text": "}"
20712071
}
20722072
},
20732073
{
@@ -2285,7 +2285,7 @@
22852285
"name": "identifier",
22862286
"value": {
22872287
"kind": "identifier(&quot;print&quot;)",
2288-
"text": "↲␣␣print"
2288+
"text": "print"
22892289
}
22902290
},
22912291
{
@@ -2323,7 +2323,7 @@
23232323
"text": "print",
23242324
"token": {
23252325
"kind": "identifier(&quot;print&quot;)",
2326-
"leadingTrivia": "↲␣␣",
2326+
"leadingTrivia": "<br>␣␣",
23272327
"trailingTrivia": ""
23282328
},
23292329
"type": "other"
@@ -2668,7 +2668,7 @@
26682668
"text": "}",
26692669
"token": {
26702670
"kind": "rightBrace",
2671-
"leadingTrivia": "",
2671+
"leadingTrivia": "<br>",
26722672
"trailingTrivia": ""
26732673
},
26742674
"type": "other"
@@ -2737,7 +2737,7 @@
27372737
"name": "rightBrace",
27382738
"value": {
27392739
"kind": "rightBrace",
2740-
"text": "}"
2740+
"text": "}"
27412741
}
27422742
},
27432743
{
@@ -2955,7 +2955,7 @@
29552955
"name": "identifier",
29562956
"value": {
29572957
"kind": "identifier(&quot;print&quot;)",
2958-
"text": "↲␣␣print"
2958+
"text": "print"
29592959
}
29602960
},
29612961
{
@@ -2993,7 +2993,7 @@
29932993
"text": "print",
29942994
"token": {
29952995
"kind": "identifier(&quot;print&quot;)",
2996-
"leadingTrivia": "↲␣␣",
2996+
"leadingTrivia": "<br>␣␣",
29972997
"trailingTrivia": ""
29982998
},
29992999
"type": "other"
@@ -3338,7 +3338,7 @@
33383338
"text": "}",
33393339
"token": {
33403340
"kind": "rightBrace",
3341-
"leadingTrivia": "",
3341+
"leadingTrivia": "<br>",
33423342
"trailingTrivia": ""
33433343
},
33443344
"type": "other"
@@ -3356,7 +3356,7 @@
33563356
"text": "",
33573357
"token": {
33583358
"kind": "endOfFile",
3359-
"leadingTrivia": "<span class='lineComment' data-title='//␣Prints␣&quot;It&apos;s␣really␣warm.␣Don&apos;t␣forget␣to␣wear␣sunscreen.&quot;' data-content='lineComment' data-type='Trivia'>//␣Prints␣&quot;It&apos;s␣really␣warm.␣Don&apos;t␣forget␣to␣wear␣sunscreen.&quot;</span>",
3359+
"leadingTrivia": "<br>↲<br><span class='lineComment' data-title='//␣Prints␣&quot;It&apos;s␣really␣warm.␣Don&apos;t␣forget␣to␣wear␣sunscreen.&quot;' data-content='lineComment' data-type='Trivia'>//␣Prints␣&quot;It&apos;s␣really␣warm.␣Don&apos;t␣forget␣to␣wear␣sunscreen.&quot;</span>",
33603360
"trailingTrivia": ""
33613361
},
33623362
"type": "other"

0 commit comments

Comments
 (0)