File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import (
15
15
"encoding/json"
16
16
"fmt"
17
17
"go/ast"
18
+ "go/format"
18
19
"go/token"
19
20
"go/types"
20
21
"io"
@@ -167,6 +168,10 @@ func handleSelectJSON(w http.ResponseWriter, req *http.Request) {
167
168
168
169
// Syntax debug output.
169
170
ast .Fprint (out , fset , path [0 ], nil ) // ignore errors
171
+ fmt .Fprintf (out , "\n " )
172
+
173
+ // Pretty-print of selected syntax.
174
+ format .Node (out , fset , path [0 ])
170
175
171
176
// Clean up the messy temp file name.
172
177
outStr := strings .ReplaceAll (out .String (), f .Name (), "play.go" )
@@ -263,4 +268,5 @@ function onLoad() {
263
268
const mainCSS = `
264
269
textarea { width: 6in; }
265
270
body { color: gray; }
271
+ div#out { font-family: monospace; font-size: 80%; }
266
272
`
You can’t perform that action at this time.
0 commit comments