Open glepnir opened 4 years ago
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)
@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.
@taigacute where you find libraries lookup feature in dumb-jump? i don't see any of this abilities in dump-jump.el sources :/
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.
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
@pechorin Ok, i saw it.
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.
@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:
AnyJumpPackages
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
)
like
Println
will jump to the source codeprint.go
.