Skip to content
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

feature: Workspace data dir should be unique #54

Closed
1 task done
jvalkeal opened this issue Dec 20, 2023 · 2 comments · Fixed by #63
Closed
1 task done

feature: Workspace data dir should be unique #54

jvalkeal opened this issue Dec 20, 2023 · 2 comments · Fixed by #63
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@jvalkeal
Copy link

Did you check the docs?

  • I have read all the docs

Is your feature request related to a problem? Please describe.

Currently jdtls is launched with something like -data /home/jvalkealahti/.cache/nvim/jdtls/workspaces/common-workspace. All the examples around jdtls seems to propose to just use a common directory which imho is just wrong. When you re-launch jdtls or used a completely different project, jdtls will actually partially wipe stuff from its data directory.

That's why i.e. vscode will calculate a hash(based on your project root) and uses that to launch jdtls with unique data directory.

Describe the solution you'd like

In my nvim-jdtls setup i've just been using this relatively naive hack which with this plugin would look something like:

local project_name = string.gsub(vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h"), "/", "_")
local path = join(cache_dir, 'nvim', 'jdtls', 'workspaces', 'common-workspace', project_name)

That would give you something like /home/jvalkealahti/.cache/nvim/jdtls/workspaces/common-workspace/_home_jvalkealahti_path_to_projectroot.

Lua don't have any buildin hash functions so we'd just need to come up with something else which creates a unique directory name.

Describe alternatives you've considered

Don't there's any.

Additional context

No response

@jvalkeal jvalkeal added the enhancement New feature or request label Dec 20, 2023
@s1n7ax
Copy link
Member

s1n7ax commented Dec 20, 2023

@jvalkeal Good point. I will add this to next release.

@s1n7ax s1n7ax self-assigned this Dec 20, 2023
@s1n7ax s1n7ax moved this to Todo in Java for Neovim Dec 20, 2023
@s1n7ax s1n7ax added this to the v2.0.0 milestone Dec 20, 2023
@jvalkeal
Copy link
Author

I could work on these issues I'm creating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

2 participants