astrocommunity icon indicating copy to clipboard operation
astrocommunity copied to clipboard

nvim-java uses tabulator for code inserted via code action

Open Jaffex opened this issue 11 months ago • 1 comments

Checklist

  • [x] I have searched through the AstroNvim documentation
  • [x] I have searched through the existing issues of this project
  • [x] I have searched the existing issues of plugins related to this issue
  • [x] I can replicate the bug with the minimal repro.lua provided below

Neovim version (nvim -v)

0.10.3

Operating system/version

Fedora 41

Terminal/GUI

alacritty

Describe the bug

When using nvim-java's code actions, for example to create a non existing method, the added method will use tabulators as indentation instead of the configured default or recognized indentation character (4 spaces in my case).

Steps to Reproduce

Install nvim-java via the community plugins, then open a java file and create a new method via code action.

Expected behavior

I would expect nvim-java to use the same indentation settings as neovim uses for example when I write the code by hand.

Screenshots

No response

Additional Context

No response

Minimal configuration

-- save as repro.lua
-- run with nvim -u repro.lua
-- DO NOT change the paths
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "runtime", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  -- stylua: ignore
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)

-- install plugins
local plugins = {
  { "AstroNvim/AstroNvim", import = "astronvim.plugins" },
  { "AstroNvim/astrocommunity", import = "astrocommunity.lsp.nvim-java" },

  -- add any other plugins/customizations here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

-- add anything else here (autocommands, vim.filetype, etc.)

Jaffex avatar Jan 30 '25 13:01 Jaffex