Open mgood opened 7 years ago
Hey, so I wanted to follow up more on this feedback from Microsoft/vscode-go#962
@ramya-rao-a: @mgood Your changes to go-outline changes the output and that may affect other users of the tool.
I tried to keep this change safe by only adding a new field to the JSON without changing the structure of existing fields. In my experience most tools parsing JSON will ignore fields they don't recognize, so this is fairly safe. While I factored the start
and end
fields into a Range
struct to be able to share some code, by embedding the struct in the Declaration
the JSON output for start
and end
will look the same.
Does that help address your concerns?
In order to support Microsoft/vscode-go#962 this exposes the start/end range of the identifiers for each declaration. In some case (particularly imports) the
ast.Ident
isnil
, so the identifier range is possiblynil
too.I've quickly checked the output of this on some Go files, but since it requires some more integration work on the vscode-go side, it's probably best to finish that before merging in case this patch needs any more work.