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 support for unite.vim about :GoDecls / :GoDeclsDir #1391

Merged
merged 4 commits into from
Sep 11, 2017

Conversation

delphinus
Copy link
Contributor

unite.vim is a powerful "listing & selecting" plugin that looks like ctrlp.vim. I want to use :GoDeclsDir feature with unite.vim and have implemented it.

It has almost like :GoDeclsDir / :GoDecls, but differs at some points below.

  • :Unite decls has features for both :GoDeclsDir and :GoDecls, but the main target is :GoDeclsDir because unite.vim has already :Unite outline that is similar to :GoDecls.
  • :Unite decls does not conflict with the existent :GoDecls / :GoDeclsDir, so both of them can be used if both unite.vim and ctrp.vim are installed.

The document about this on vim-go.txt is the one I am worrying about. I placed it at the next of :GoDeclsDir, but does anyone have an idea to place somewhere better?

:Unite decls
2017-07-27 20 38 20
:Unite decls:appengine.go
2017-07-27 20 38 40
FYI: existing function from unite.vim :Unite outline
2017-07-27 20 43 34

@delphinus
Copy link
Contributor Author

Fixed docs & pass the tests

@fatih
Copy link
Owner

fatih commented Aug 8, 2017

Thanks @delphinus I need to install unite.vim and see how it behaves and works. One question though, while quick skimming the code, I wonder what happens if motion returns an error. For example introduce a syntax error and call Unite. What happens? I think Unite takes care of it?

@delphinus
Copy link
Contributor Author

Ah, good point. I see many unite addon have error handling from source command output. I will add it.

@delphinus
Copy link
Contributor Author

2017-08-08 20 53 27

done. If motion returned errors, unite handles them.

endif

let l:include = get(g:, 'go_decls_includes', 'func,type')
let l:command = printf('%s -format vim -mode decls -include %s -%s %s', l:bin_path, l:include, l:mode, l:path)
Copy link
Contributor

@arp242 arp242 Sep 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should shellescape() most or all the variables you're printf-ing in the command string; otherwise stuff will break if the path contains spaces or special shell characters (this is uncommon in Go, but not illegal either, and especially an issue on systems like Windows with stuff Application Data in the path).

For example, if I use :Unite decls on ~/go/src/a/space path/space name.go I get [unite.vim] [decls] command returned invalid response..

Other than this it seems to work well 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx for reviewing 👍 I fixed it.

@arp242 arp242 merged commit 37e5082 into fatih:master Sep 11, 2017
@delphinus delphinus deleted the feature/unite-godecls branch September 11, 2017 22:50
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.

3 participants