jacktasia / dumb-jump

an Emacs "jump to definition" package for 50+ languages
GNU General Public License v3.0
1.57k stars 150 forks source link

Library sources support #404

Open vlad17 opened 3 years ago

vlad17 commented 3 years ago

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.