-
Notifications
You must be signed in to change notification settings - Fork 2
automatically set source_path to fallback educated guess #5
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
base: master
Are you sure you want to change the base?
Conversation
this makes gf jump to JDK imports as well as local imports
instead of clobbering search registers and manual search and open
I now wonder why I couldn't find the documentation of this setting; just grepping yielded
|
The A dedicated plugin to be written I alluded to should attempt
Implementing it is a challenging task. |
Fully agreed, but Vim is full of compromises for making the user's life simpler. In this case, why not use the JDK src.zip as a starting point instead of requiring manual set up and knowing about the overriden search registers? Users will appreciate not to have their heads wrap around these options buried in the docs. |
Let us compare how capable both implementations are by using git clone https://github.com/zzzyxwvut/module-info.git
cd module-info/module_info
git switch java/24
git archive --verbose --format=zip -9 -o /tmp/module_info_sources.zip java/24 src/
./build.sh test
export JDK_24_SRC_ARCH=/path/to/src.zip
vim src/org.module.info.demo/tests/org/demo/tests/Tester.java Now try to load the source file for any type from let g:ftplugin_java_source_path = $JDK_24_SRC_ARCH
doautocmd FileType Relevant types in
|
Surely not, only most likely. You'd prefer reading it from Mind you that all these assumptions are only made as best guesses if source path is unset, so sureness could never be assumed. |
On any developer's host system, there can be a handful of |
Not all developers define their JDK path in their tool chain config when editing Java code in Vim. |
Taking smaller leaps, would you agree on keeping let fname = tr(v:fname, '.', '/') .. '.java'
let ffname = findfile(fname)
if filereadable(ffname)
return ffname
... |
A search in java-vim/runtime/doc/filetype.txt Lines 688 to 695 in b98331c
And for the above example, this setup should suffice to load let g:ftplugin_java_source_path = [
\ 'org.module.info.demo/classes',
\ 'org.module.info.demo/tests',
\ 'org.module.info.tester/classes',
\ ]
\ ->map('"/tmp/module-info/module_info/src/" . v:val')
\ ->join(',')
doautocmd FileType On the other hand, assigning an archive path implies that If you want to set Tags can be a better alternative for local forks.
Without looking at a manifest file and its parent files, you |
It didn't mean it for me. Starting from a default setup, one would expect the standard libraries and all inside the project to be reachable. That's what this PR would achieve.
This is beyond practical a solution for most Vim users editing Java code. Few likely care where the standard libraries reside.
What does |
NB: I myself worked around it by LS, tags and overriding |
this makes gf jump to JDK imports as well as local imports