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

:GoAddTags json,omitempty doesn't work #1777

Closed
arp242 opened this issue Apr 8, 2018 · 3 comments · Fixed by #2227
Closed

:GoAddTags json,omitempty doesn't work #1777

arp242 opened this issue Apr 8, 2018 · 3 comments · Fixed by #2227
Assignees

Comments

@arp242
Copy link
Contributor

arp242 commented Apr 8, 2018

:GoAddTags is documented as:

If [option] is passed it'll either add a new tag with an option or will
modify existing tags. An example of adding omitempty to all json
fields would be:

  :GoAddTags json,omitempty

But that doesn't work; :GoAddTags json works fine, but :GoAddTags json,omitempty doesn't seem to do anything.

Not a recent breakage – I noticed this over a month ago (...just forgot to create issue).

@fatih
Copy link
Owner

fatih commented Apr 8, 2018

This is by purpose like this (another discussion from last year: #985 (comment)) . To add an option, the tag needs to exist. If not it won't do anything. So to add the option you have the call these two:

:GoAddTags json
:GoAddTags json,omitempty

There is a reason I did this, but I still don't remember it unfortunately. I'm ok changing it back the behavior and seeing how it feels. The reason I've added it might come up in this case.

@arp242
Copy link
Contributor Author

arp242 commented Apr 11, 2018

Hm, interesting. I made a quick patch (see above link) to pass both -add-tags and -add-options, and it seems to work in my testing(?)

If it doesn't work, then should at least clarify docs.

@fatih
Copy link
Owner

fatih commented Apr 11, 2018

The tool works, the implementation in vim-go, as I know, won't work due the way I've implemented it initially. As I said, I don't remember the details.

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

Successfully merging a pull request may close this issue.

2 participants