scalameta / nvim-metals

A Metals plugin for Neovim
https://scalameta.org/metals/
Apache License 2.0
454 stars 73 forks source link

not found: "metals/findTextInDependencyJars" request handler for client "GitHub Copilot". #664

Open alycklama opened 2 months ago

alycklama commented 2 months ago

Describe the bug

When executing :MetalsFindInDependencyJars on the command-line with the GitHub Copilot plugin installed with the following input:

Filemask: .conf
Query: String

I then run into the following error:

Error executing Lua callback: ...l/Cellar/neovim/0.9.5/share/nvim/runtime/lua/vim/lsp.lua:1382: not found: "metals/findTextInDependencyJars" request handler for client "GitHub Copilot".
stack traceback:
        [C]: in function 'assert'
        ...l/Cellar/neovim/0.9.5/share/nvim/runtime/lua/vim/lsp.lua:1382: in function 'request'
        ...l/Cellar/neovim/0.9.5/share/nvim/runtime/lua/vim/lsp.lua:1969: in function 'fn'
        ...l/Cellar/neovim/0.9.5/share/nvim/runtime/lua/vim/lsp.lua:184: in function 'for_each_buffer_client'
        ...l/Cellar/neovim/0.9.5/share/nvim/runtime/lua/vim/lsp.lua:1968: in function 'buf_request'
        ...lt.ext/.local/share/nvim/lazy/nvim-metals/lua/metals.lua:281: in function 'send_request'
        ...lt.ext/.local/share/nvim/lazy/nvim-metals/lua/metals.lua:292: in function 'on_confirm'
        ...al/Cellar/neovim/0.9.5/share/nvim/runtime/lua/vim/ui.lua:103: in function 'input'
        ...lt.ext/.local/share/nvim/lazy/nvim-metals/lua/metals.lua:288: in function 'get_query_and_send'
        ...lt.ext/.local/share/nvim/lazy/nvim-metals/lua/metals.lua:302: in function 'on_confirm'
        ...al/Cellar/neovim/0.9.5/share/nvim/runtime/lua/vim/ui.lua:103: in function 'input'
        ...lt.ext/.local/share/nvim/lazy/nvim-metals/lua/metals.lua:297: in function <...lt.ext/.local/share/nvim/lazy/nvim-metals/lua/metals.lua:276>
        .../.local/share/nvim/lazy/nvim-metals/lua/metals/setup.lua:46: in function <.../.local/share/nvim/lazy/nvim-metals/lua/metals/setup.lua:45>

Why is GitHub Copilot affected by a command for Metals? Any idea what could be going on here?

Expected behavior

I would expect to see the results when searching for text in dependency jars.

Operating system

macOS

Version of Metals

v1.2.2

Commit of nvim-metals

4f9bf0c821092f20dd34c1a4ea5b07b0500ff089

ckipp01 commented 2 months ago

Just to confirm, if you don't have copilot enabled or installed you don't have this problem? Just testing the command locally for me works fine, so you'll have to try and minimally reproduce. I have no idea why having copilot would impact this at all.

alycklama commented 2 months ago

Correct, if I disable Copilot I don't run into any issue and I see the results in the Quickfix window.

ckipp01 commented 2 months ago

I will need to try and reproduce this. I think what is happening is that we're just grabbing the current client and sending the request to it. Normally in Scala here this would always just be Metals, but it seems that the client this is being sent to is copilot... and of course the custom metals endpoint doesn't exist there.

alycklama commented 2 months ago

That would be great, thanks!

This is my Lazy config for Copilot :

  {
    "github/copilot.vim"
  },

Using the latest version:

  "copilot.vim": { "branch": "release", "commit": "1e135c5303bc60598f6314a2276f31dc91aa34dd" },