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

[Feature Request]Support search definitions in libraries paths #56

Open
glepnir opened this issue Apr 9, 2020 · 8 comments
Open

[Feature Request]Support search definitions in libraries paths #56

glepnir opened this issue Apr 9, 2020 · 8 comments

Comments

@glepnir
Copy link

glepnir commented Apr 9, 2020

like Println will jump to the source code print.go.

image

@pechorin
Copy link
Owner

pechorin commented Apr 9, 2020

Hello, thanks for issue. I think you looking for "search definitions in libraries paths". This feature is in my release plan, but currently i don't know how to implement libs paths detection for all kinds of languages. I think i will try provide integration with modern's package managers only (go mod, rubygems, etc)

@glepnir
Copy link
Author

glepnir commented Apr 9, 2020

@pechorin Thanks for your reply, I think the easiest way is to integrate with lsp to get the doc returned by the language server,Or refer to dump-jump in emacs, it does not use lsp but provides accurate jump.

@glepnir glepnir changed the title Jump to definition support go source code. [Feature Request]Support search definitions in libraries paths Apr 9, 2020
@pechorin
Copy link
Owner

pechorin commented Apr 9, 2020

@taigacute where you find libraries lookup feature in dumb-jump? i don't see any of this abilities in dump-jump.el sources :/

@glepnir
Copy link
Author

glepnir commented Apr 9, 2020

I did n’t take a look at its implementation, but it is very accurate in the definition of jumps,This emacs package may be useful to you, this is just my suggestion. Thank you.

@pechorin
Copy link
Owner

pechorin commented Apr 9, 2020

dump-jump.el is the main inspiration point for me :) original idea and regexp rules are comes from dumb-jump.el :) https://github.com/pechorin/any-jump.vim/blob/master/autoload/lang_map.vim#L2

@glepnir
Copy link
Author

glepnir commented Apr 9, 2020

@pechorin Ok, i saw it.

@edzhelyov
Copy link

Hey, I assume you already have an idea of how to approach it. But I got it working by adding bundle list --paths to

fu! s:RunAgDefinitionSearch(language, patterns) abort
  let ag_ft = s:GetAgFiletype(a:language)

  let cmd = s:ag_base_cmd . ' --' . ag_ft
  let cmd = cmd . s:GetAgIgnoreSpecifier()
  let cmd = cmd . ' ' . a:patterns . ' `bundle list --paths`'

If you expose the search path as variable and allow that to be configurable per language it will solve the issue of how to find definitions. I think reference should stay only in the current project.

The problem I hit is that the file paths are really long and you can't see the actual definition, so that might require a refactoring. I couldn't find a way to render the paths without the .../.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/bundler/gems/, but this path is basically the GEM_PATH, so it's possible to supply a function per language to format the displayed path.

@pechorin
Copy link
Owner

pechorin commented Dec 7, 2020

@edzhelyov yeah, it's a very naive implementation without long paths names displaying.

But the problem is long gems/node-packages/any-other-package-manager directories lists - the searching execution time will be slow (async search is another big not-implemented story) so we should add:

  • searching in all packages directories with some kind of AnyJumpPackages
  • searching in 1/N packages directories AnyJumpPackage <package-name> <package-name-2>

i should check is it possible to implement N vim arguments (maybe with select list with data from bundle list --paths or ls ./node-modules)

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

No branches or pull requests

3 participants