0

I noticed that when I use :Telescope lsp_workspace_symbol query=xxx I only get results of type class, in other words it only find classes with that xxx in the name, but not methods, fields, constructors, packages, etc.

When I use :Telescope lsp_document_symbol it will find classes, methods, fields, etc. but not when using :Telescope lsp_workspace_symbol or :Telescope lsp_dynamic_workspace_symbol.

Why is that? Is it a limitation of the language server eclipse.jdt.ls/jdtls or it's a limitation of the lsp client nvim-jdtls? Or did I misconfigure something?

1 Answer 1

0

From this answer

jdtls does support method in the workspace via the includeSourceMethodsDeclarations configuration settings that is false by default. So the workspace search for symbols will be limited to types (class) and method.

To enable the method search you need to configure nvim-jdtls like this:

local config = { ... settings = { java = { symbols = { includeSourceMethodDeclarations = true, } }, } ... } require("jdtls").start_or_attach(config) 

The other configuration settings for jdtls/eclipse.jdt.ls can be inferred from https://github.com/eclipse-jdtls/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request (currently the only "symbol" options is includeSourceMethodDeclarations).

1
  • Friendly reminder to accept your self-answer. Commented Apr 29 at 8:22

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.