nixvim icon indicating copy to clipboard operation
nixvim copied to clipboard

[BUG] nvim-jdtls cannot set per project data setting using lua

Open blackdragon2447 opened this issue 1 year ago • 0 comments

Field Description
Plugin nvim-jdtls
Nixpkgs unstable
Home Manager unstable

  • [x] I have read the FAQ and my bug is not listed there.

Description

The data option for nvim-jdtls can only be a string, which means lua cannot be used to set it programmatically, while jdtls expects the directory this points to be specific to the current (java) project. This is bad because this severely limits the usability of nvim-jdtls by limiting it to one project.

This can be worked around by using extraOptions.cmd.__raw to set the command and thus the data argument, but that is quite ugly.

Minimal, Reproducible Example (MRE)

programs.nixvim = {
  plugins.jdtls = {
    enable = true;
    # Limited to one path
    data = "<something>";
    
    # Allows path to be set by lua, but ugly
    extraOptions = {
      cmd.__raw = ''
        {
          "${lib.getExe pkgs.jdt-language-server}",
          "-data", "<base path>" .. vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t"),
          ...
        }
      '';
    };
  };
}

blackdragon2447 avatar Apr 06 '24 16:04 blackdragon2447