Skip to content

Add identifier range info#1

Open
mgood wants to merge 1 commit into
ramya-rao-a:masterfrom
mgood:ident-range
Open

Add identifier range info#1
mgood wants to merge 1 commit into
ramya-rao-a:masterfrom
mgood:ident-range

Conversation

@mgood

@mgood mgood commented May 4, 2017

Copy link
Copy Markdown

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 is nil, so the identifier range is possibly nil 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.

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` is `nil`, so the identifier range is possibly `nil` too.
@mgood

mgood commented Jun 21, 2017

Copy link
Copy Markdown
Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant