Skip to content

feature: Workspace data dir should be unique #54

@jvalkeal

Description

@jvalkeal

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Status

In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions