Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add identifier range info #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

mgood
Copy link

@mgood mgood commented May 4, 2017

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
Copy link
Author

mgood commented Jun 21, 2017

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