Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inlayhints for jdtls #2970

Closed
snaggen opened this issue Jan 15, 2024 · 2 comments
Closed

Inlayhints for jdtls #2970

snaggen opened this issue Jan 15, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@snaggen
Copy link

snaggen commented Jan 15, 2024

Language server

jdtls

Requested feature

By default jdtls doesn't send inlay hints, this can be enabled by the server config (signatureHelp is not really inlay related, but still nice to have)

                        settings = {
                            java = {
                                inlayHints = { parameterNames = { enabled = "all" } },
                                signatureHelp = { enabled = true },
                            }
                        }

However, jdtls have a slow start and run in to the inlay hint not drawn on startup as discussed in
neovim/neovim#26511 (comment)
so to work around that I have registered handler

                        handlers = {
                            ['language/status'] = function(_, result, ctx, _)
                                if result.type == "ServiceReady" then
                                    for _, bufnr in ipairs(vim.lsp.get_buffers_by_client_id(ctx.client_id)) do
                                        vim.lsp.inlay_hint.enable(bufnr, false);
                                        vim.lsp.inlay_hint.enable(bufnr, true);
                                    end
                                end
                            end
                        },

This of course needs ot be genralized to check if the user have inlay hints enabled before toggling them, but you get the idea.

Other clients which have this feature

No response

@snaggen snaggen added the enhancement New feature or request label Jan 15, 2024
@justinmk
Copy link
Member

Thanks for your report. The configs in this repo are unsupported and provided only as a starting point. We depend on users (like you) to troubleshoot issues with their specific LSP setups and send improvements.

If you found a bug in the core Nvim vim.lsp module (not part of this repo), the best way to get it fixed is to report to Nvim (not nvim-lspconfig) with:

  • steps to reproduce it without the particular LSP server and other factors particular to your environment
  • (optional, but very helpful): by adding a failing test case to lsp_spec.lua, which has code to setup a fake LSP server to simulate various scenarios

@justinmk justinmk closed this as not planned Won't fix, can't repro, duplicate, stale Jan 29, 2024
@snaggen
Copy link
Author

snaggen commented Jan 29, 2024

If you read the discussion, you see that the consensus was that this is not a bug in Neovim but should be fixed with setup. That is why I filed it here with the method I provide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants