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

Error: [telescope.builtin.lsp_*]: server does not support definitionProvider #589

Closed
mawkler opened this issue Nov 21, 2023 · 3 comments
Closed

Comments

@mawkler
Copy link

mawkler commented Nov 21, 2023

LSP client configuration

-- Fetches Lazy if not present.
local function bootstrap_lazy()
  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)
end
bootstrap_lazy()

require('lazy').setup({
  {
    'williamboman/mason.nvim',
    opts = {},
  },
  {
    'mfussenegger/nvim-jdtls',
    dependencies = {
      'williamboman/mason.nvim',
      'neovim/nvim-lspconfig',
      { 'nvim-telescope/telescope.nvim', dependencies = 'nvim-lua/plenary.nvim' },
    },
    config = function()
      local function setup_jdtls()
        local mason_path = require('mason-core.path')
        local function get_install_path(package)
          return require('mason-registry').get_package(package):get_install_path()
        end

        local config = {
          cmd = { mason_path.concat({ get_install_path('jdtls'), 'jdtls' }) },
        }
        require('jdtls').start_or_attach(config)
      end

      local augroup = vim.api.nvim_create_augroup('jdtls', {})
      vim.api.nvim_create_autocmd('FileType', {
        pattern = 'java',
        group = augroup,
        callback = setup_jdtls,
      })
    end,
  },
})

Eclipse.jdt.ls version

v1.29.0

Steps to Reproduce

  1. :Telescope lsp_definitions
  2. Error: [telescope.builtin.lsp_*]: server does not support definitionProvider

Expected Result

(basically) the same behaviour as with vim.lsp.buf.definition() (which does work)

Actual Result

I get the errorr: [telescope.builtin.lsp_*]: server does not support definitionProvider

@mawkler
Copy link
Author

mawkler commented Nov 21, 2023

I'm not sure if this is an issue with nvim-jdtls or if it's an issue with telescope.nvim, but I've been using Telescope for a while and I've never had this issue before. I just installed nvim-jdtls.

@mfussenegger
Copy link
Owner

That's very likely a telescope issue.

Since neovim/neovim@ddd92a7 neovim supports dynamic registration for definition, and eclipse.jdt.ls uses that, so the definitionProvider is not available in the server_capabilities.

They should adapt it to use client.supports_method('textDocument/definition') to check for the capability. It takes both - the static and dynamic capabilities into consideration.

@fgheng
Copy link

fgheng commented Jan 26, 2024

Whether you found a solution.

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

No branches or pull requests

3 participants