File tree 1 file changed +11
-0
lines changed
1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -30,8 +30,10 @@ import (
30
30
"strings"
31
31
32
32
"golang.org/x/tools/go/ast/astutil"
33
+ "golang.org/x/tools/go/ast/inspector"
33
34
"golang.org/x/tools/go/packages"
34
35
"golang.org/x/tools/go/types/typeutil"
36
+ "golang.org/x/tools/internal/astutil/cursor"
35
37
"golang.org/x/tools/internal/typeparams"
36
38
)
37
39
@@ -161,6 +163,15 @@ func handleSelectJSON(w http.ResponseWriter, req *http.Request) {
161
163
innermostExpr = e
162
164
}
163
165
}
166
+ // Show the cursor stack too.
167
+ // It's usually the same, but may differ in edge
168
+ // cases (e.g. around FuncType.Func).
169
+ inspect := inspector .New ([]* ast.File {file })
170
+ if cur , ok := cursor .Root (inspect ).FindPos (startPos , endPos ); ok {
171
+ fmt .Fprintf (out , "Cursor.FindPos().Stack() = %v\n " , cur .Stack (nil ))
172
+ } else {
173
+ fmt .Fprintf (out , "Cursor.FindPos() failed\n " )
174
+ }
164
175
fmt .Fprintf (out , "\n " )
165
176
166
177
// Expression type information
You can’t perform that action at this time.
0 commit comments