You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for the great plugin!
Just wanted to mention a part of the config that was tricky for me and If you are ok with it I can create a PR to update the README:
In the README's data directory configuration section it says to do something like the following to get the project name:
In my case, I was using the airblade/vim-rooter plugin, which automatically changes the cwd upon navigation to a file, and vim.fn.getcwd() was returning the "wrong" value before the cwd had been changed.
The solution I came up with was to use the same construct that's used for the root_dir prop:
local project_root = require("jdtls.setup").find_root({"gradlew"})
local project_name = vim.fn.fnamemodify(project_root, ":p:h:t")
This feels more bulletproof than using vim.fn.getcwd().
Also, another side thing was that the build.gradle for the project I was working on relied on the cwd being correct as it was reading some relative files, and it took me a while to realize I had to set cmd_cwd = project_root.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi there,
Thank you for the great plugin!
Just wanted to mention a part of the config that was tricky for me and If you are ok with it I can create a PR to update the
README
:In the
README
's data directory configuration section it says to do something like the following to get the project name:In my case, I was using the
airblade/vim-rooter
plugin, which automatically changes the cwd upon navigation to a file, andvim.fn.getcwd()
was returning the "wrong" value before the cwd had been changed.The solution I came up with was to use the same construct that's used for the
root_dir
prop:This feels more bulletproof than using
vim.fn.getcwd()
.Also, another side thing was that the
build.gradle
for the project I was working on relied on the cwd being correct as it was reading some relative files, and it took me a while to realize I had to setcmd_cwd = project_root
.Cheers,
Stephan
Beta Was this translation helpful? Give feedback.
All reactions