Skip to content

bug: document_symbol only respecting spring-boot client #447

Closed

Description

@soenkekrusche

Did you check docs and existing issues?

  • I have read all the plugin docs
  • I have searched the existing issues
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

0.11.5

Operating system/version

Win11/WSL Ubuntu 24.04

Describe the bug

Using current version of this plugin, it looks like document_symbol (via telescope, fzflua or just :lua vim.lsp.buf.document_symbol()) just returns values for the spring-boot client. For a minimal setup I've used the devcontainer init.lua available in this repo.

All symbols returned are just spring-boot annotations

Lazy (should be nvim-java 4.0.1?)

● nvim-java 21.46ms  start
dir /home/soenke/.local/share/nvim/lazy/nvim-java
url https://github.com/nvim-java/nvim-java
branch main
commit 389ef7c
readme README.md
help |nvim-java.txt|

  • jdk 21
  • jdtls 1.54.0

When setting lsp loglevel to debug, this is the whole output i'm getting:

[DEBUG][2025-12-08 23:25:36] ...m/lsp/client.lua:674    "LSP[spring-boot]"      "client.request"        1       "textDocument/documentSymbol"   { textDocument = { uri = "<>.java" } } <function 1>    1
[DEBUG][2025-12-08 23:25:36] .../vim/lsp/rpc.lua:277    "rpc.send"      { id = 15, jsonrpc = "2.0", method = "textDocument/documentSymbol", params = { textDocument = { uri = "<>.java" } } }
[DEBUG][2025-12-08 23:25:36] .../vim/lsp/rpc.lua:391    "rpc.receive"   { id = 15, jsonrpc = "2.0", result = { { kind = 11, location = { range = { ["end"] = { character = 15, line = 21 }, start = { character = 0, line = 21 } }, uri = "<>.java" }, name = "@+ '<>' (@RestController <: @Controller, @Component) <>Controller" }, { kind = 11, location = { range = { ["end"] = { character = 98, line = 37 }, start = { character = 1, line = 36 } }, uri = "<>.java" }, name = "@/** -- POST - Accept: application/<> - Content-Type: application/<>" }, { kind = 11, location = { range = { ["end"] = { character = 42, line = 38 }, start = { character = 30, line = 38 } }, uri = "<>.java" }, name = "@RequestBody" }, { kind = 11, location = { range = { ["end"] = { character = 87, line = 59 }, start = { character = 1, line = 59 } }, uri = "<>.java" }, name = "@/**/{request:.+} -- GET - Content-Type: application/<>" }, { kind = 11, location = { range = { ["end"] = { character = 53, line = 60 }, start = { character = 29, line = 60 } }, uri = "<>r.java" }, name = '@PathVariable("request")' } } }

Steps To Reproduce

  1. use devcontainer config, or add nvim-java as plugin to kickstart nvim
  2. open spring boot object (e.g. petclinic)
  3. open a controller
  4. run :lua vim.lsp.buf.document_symbol() (or telescope/fzflua equivalent)

Expected Behavior

I'd expect seeing symbols returned by jdtls as well, instead of only spring boot annotations.
I looked for similar issues, and one of them suggested adding more documentSymbol types to jdtls. however, when using jdtls on it's own it returned the expected symbols just fine

I am not that familiar with nvim plugins, but if anyone has an idea where the problem lies or what needs to be done, I'd gladly try to work on a PR myself

Activity

  1. logrusx commented on Dec 9, 2025

    @logrusx
    Collaborator

    This is something we had in the older version too. I'm not sure if it ever worked but I think it did at some point and somewhere along the way it changed. Is this something we're not instructing jdtls to do?

  2. s1n7ax commented on Dec 10, 2025

    @s1n7ax
    Member

    This did not work. I assume it's not supported by jdtls. But you can use these APIs.
    https://github.com/nvim-java/nvim-java/wiki/Tips-&-Tricks#-workspace-symbols-search

  3. soenkekrusche commented on Dec 10, 2025

    @soenkekrusche
    Author

    It is supported by jdtls, just the .devcontainer config to contain nvim-jdtls, having jdtls 1.54.0 on path an running :lua vim.lsp.buf.document_symbol() returns the following:

    Image

    init.lua excerpt:

    local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
    
    if not vim.loop.fs_stat(lazypath) then
    	vim.fn.system({
    		'git',
    		'clone',
    		'--filter=blob:none',
    		'https://github.com/folke/lazy.nvim.git',
    		'--branch=stable',
    		lazypath,
    	})
    end
    
    vim.opt.rtp:prepend(lazypath)
    
    -- Setup lazy.nvim
    require('lazy').setup({
    	-- {
    	-- 	'nvim-java/nvim-java',
    	-- 	dir = '/workspaces/nvim-java',
    	-- 	config = function()
    	-- 		require('java').setup({
    	-- 			jdk = {
    	-- 				auto_install = false,
    	-- 			},
    	-- 			log = {
    	-- 				use_console = false,
    	-- 				level = 'debug',
    	-- 			},
    	-- 		})
    	-- 		vim.lsp.config('jdtls', {
    	-- 			handlers = {
    	-- 				['language/status'] = function(_, data)
    	-- 					vim.notify(data.message, vim.log.levels.INFO)
    	-- 				end,
    
    	-- 				['$/progress'] = function(_, data)
    	-- 					vim.notify(data.value.message, vim.log.levels.INFO)
    	-- 				end,
    	-- 			},
    	-- 		})
    	-- 		vim.lsp.enable('jdtls')
    	-- 	end,
    	-- },
        {
            'mfussenegger/nvim-jdtls',
    
        }
    })
    
    vim.lsp.config("jdtls", {
      settings = {
        java = {
            -- Custom eclipse.jdt.ls options go here
        },
      },
    })
    vim.lsp.enable("jdtls")
    

    I'd like to keep using nvim-java, the integration with everything I need is awesome - thats the single thing I use often thats missing

  4. reopened this on Dec 10, 2025
  5. s1n7ax commented on Dec 10, 2025

    @s1n7ax
    Member

    I'll have a look

  6. logrusx commented on Dec 10, 2025

    @logrusx
    Collaborator

    I can confirm it works on nvim-jdtls. Also adding the documentSymbol didn't fix it.

  7. s1n7ax commented on Dec 10, 2025

    @s1n7ax
    Member

    Can you create a new spring project spring init -d web --extract proj/demo and then send me the document symbols you find with nvim-jdtls

  8. s1n7ax commented on Dec 10, 2025

    @s1n7ax
    Member

    When I set this flag to false, document symbols are working but seems like spring-boot symbols are stops working. I don't see such flag in nvim-jdtls either.

    https://github.com/nvim-java/nvim-java/blob/389ef7c938f89730f112054132d6a08c180733af/lua/java-core/ls/servers/jdtls/conf.lua?plain=1#L11C4-L11C32

  9. soenkekrusche commented on Dec 10, 2025

    @soenkekrusche
    Author

    Can you create a new spring project spring init -d web --extract proj/demo and then send me the document symbols you find with nvim-jdtls

    Document symbols:
    src/main/java/com/example/proj/demo/DemoApplication.java|6 col 1-23| [Interface] @+ 'demoApplication' (@SpringBootApplication <: @SpringBootConfiguration, @Configuration, @Component) DemoApplication

    Workspace symbols with query demo:
    src/test/java/com/example/proj/demo/DemoApplicationTests.java|7 col 7-27| [Class] DemoApplicationTests src/main/java/com/example/proj/demo/DemoApplication.java|7 col 14-29| [Class] DemoApplication

    Edit: i'll try it out with your fix
    Edit2: tyvm!

    Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions