dumb-jump icon indicating copy to clipboard operation
dumb-jump copied to clipboard

Library sources support

Open vlad17 opened this issue 3 years ago • 0 comments

dumb-jump looks really cool, thank you for making it!

Often, I'll want to go to the definition of a library function outside of my current repository.

dumb-jump supports this through .dumbjump by letting me add additional paths:

-tests
+/home/vlad/.local/lib/python3.8/site-packages

where the above would let me go to definition for locally installed pip packages in my system python.

However, often times library sources are in weird places. This differs user-to-user (e.g., b/c $HOME does) and is dependent on python configuration. For instance, for my recent poetry-based project, the python library sources would be found with:

+/home/vlad/.cache/pypoetry/virtualenvs/$project-L7SDcTsr-py3.8/lib/python3.8/site-packages
+/home/vlad/.cache/pypoetry/virtualenvs/$project-L7SDcTsr-py3.8/local/lib/python3.8/dist-packages
+/home/vlad/.cache/pypoetry/virtualenvs/$project-L7SDcTsr-py3.8/lib/python3/dist-packages
+/home/vlad/.cache/pypoetry/virtualenvs/$project-L7SDcTsr-py3.8/lib/python3.8/dist-packages

Obviously, this is all very user and system and language dependent, but if dumb-jump.el were to provide a hook to add include paths dynamically (i.e., after loading a .dumbjump config), then I could add my own elisp logic which could dynamically generate system library paths based on the current buffer. E.g., if the lang is python then my hook could run poetry run python -c 'import site; print(site.getsitepackages())' and add those to the :include config.

vlad17 avatar Oct 03 '21 16:10 vlad17