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

Known compatible LSP servers #17

Closed
j-hui opened this issue Jan 27, 2022 · 34 comments
Closed

Known compatible LSP servers #17

j-hui opened this issue Jan 27, 2022 · 34 comments
Labels
documentation Improvements or additions to documentation

Comments

@j-hui
Copy link
Owner

j-hui commented Jan 27, 2022

This plugin is known to work with the following LSP servers:

And doesn't (yet) work with the following:

Please comment below if you find this plugin works or doesn't work with an LSP server you use.


Note that fidget's implementation relies on my cursory and incomplete understanding of the progress notification spec. Please file a separate issue if you think there's something I missed.

However, if language servers actually deviate from spec, then this plugin will not know how to handle that. Please also file an issue in this repo for these cases.

Ideally we should never terminate ungracefully, and have some kind of sane behavior for handling these cases. For example, if a server never sends an end progress notification, then the fidget will remain stuck onscreen.

At the same time, if language servers do not appear to be conforming to LSP, we should file an issue with their maintainers, if anything but to clarify what the behavior is.

@rockyzhang24
Copy link
Contributor

For tsserver, I find this plugin works great with TypeScript, but not JavaScript. I tested it by opening a file in a JavaScript repo, but nothing was shown up.

@mrjones2014
Copy link

hm, @yanzhang0219 I don't have that issue. It works the same for me in Javascript files.

@rockyzhang24
Copy link
Contributor

rockyzhang24 commented Jan 27, 2022

@mrjones2014 could you please provide the js repo? I want to test it on my end. I cloned some js repos from github but not any progress information was shown on the bottom after I opened js files. Thanks.

@mrjones2014
Copy link

I just tested it with a proprietary repo I had open at work. But testing a little further, it seems like there is an issue when there is only Javascript. It worked when I opened a Javascript file in a project which also contains Typescript files.

But I tested again with https://github.com/mrjones2014/eslint-plugin-storage and was able to reproduce the issue, actually.

@rockyzhang24
Copy link
Contributor

rockyzhang24 commented Jan 27, 2022

Yes. That's what I was saying. Pure js repo has the issue. Let me test your repo now.

UPDATE: it is confirmed that it doesn't work with pure js repo.

@rockyzhang24
Copy link
Contributor

rockyzhang24 commented Jan 27, 2022

I tested lsp-status.nvim just now and it didn't show any progress for the pure js repo. So I think it completely depends on the server. If the server doesn't return progress information to Neovim core lsp client, this plugin can do nothing. Am I correct? @j-hui

@j-hui
Copy link
Owner Author

j-hui commented Jan 27, 2022

If the server doesn't return progress information to Neovim core lsp client, this plugin can do nothing.

Yeah that's exactly right.

@gegoune
Copy link

gegoune commented Jan 27, 2022

This is what I was thinking from the very beginning. I am not sure if there is need for specifying which servers it works with, it's up to the server to send messages and this plugin cannot do anything extra to ensure compatibility with specific servers. Isn't it correct?

Great plugin, having messages in status line never sat well with me. Your plugins employs such a simple yet beautiful idea, well done!

@j-hui
Copy link
Owner Author

j-hui commented Jan 27, 2022

Thanks @gegoune !

I am not sure if there is need for specifying which servers it works with, it's up to the server to send messages and this plugin cannot do anything extra to ensure compatibility with specific servers. Isn't it correct?

Perhaps not, but a few people had asked about this information, so I figured it's worth accumulating this knowledge somewhere.

Also, while LSP defines the progress endpoint, it doesn't seem to say anything about the format with which servers should report progress. For example, right now I assume that each progress notification comes with a message field and a title field. I just read the document more closely and realized the format is indeed specified by the protocol. But I still want to keep this issue to help me keep track of different schemas different language servers may employ, in case my implementation misses anything in the spec, or in case any server deviates from spec.

@polyzen

This comment has been minimized.

@crisidev
Copy link

I am using this also with kotlin (https://github.com/fwcd/kotlin-language-server) and works properly. FYI the kotlin-language-server takes a lot to startup, so fidget starts around 30 seconds after opening the first file of the session

@Slotos
Copy link

Slotos commented Feb 6, 2022

Solargraph (Ruby LSP) works. Server itself can take a few seconds to start sending messages, especially on larger projects.

@cjnucette
Copy link

Yes. That's what I was saying. Pure js repo has the issue. Let me test your repo now.

UPDATE: it is confirmed that it doesn't work with pure js repo.

You need either a tsconfig.json or a jsconfig.json file on your project for it to work.

@fitrh
Copy link

fitrh commented Feb 15, 2022

dartls with lspconfig works fine, but flutter-tools.nvim does not, is there some modification ? I'm not familiar with LSP specs

@HiPhish
Copy link
Contributor

HiPhish commented Feb 19, 2022

Works out of the box with erlang-ls for me, tested with version 0.23.1.
Screenshot_20220219_142025

@j-hui
Copy link
Owner Author

j-hui commented Feb 19, 2022

@fitrh flutter-tools.nvim appears to install their own progress handler, which will override Fidget's: https://github.com/akinsho/flutter-tools.nvim/blob/3f3b16d69cdd26e2ed1b2baa719abac7f4c1a8b1/lua/flutter-tools/lsp/init.lua#L85

@fitrh
Copy link

fitrh commented Feb 20, 2022

@j-hui does this line mean they still call the default handler so other plugin can use it ? I tried using arkav/lualine-lsp-progress and it seems they can catch the progress from flutter-tools.nvim

@fitrh
Copy link

fitrh commented Feb 20, 2022

@j-hui dartls with flutter-tools.nvim works, seems like a lazy loading issue

@mrnovalles
Copy link

this plugin does not work with elixirls at the moment. I'd be willing give the fix a try, but I am completely new to all of it

@Slotos
Copy link

Slotos commented Mar 23, 2022

this plugin does not work with elixirls at the moment. I'd be willing give the fix a try, but I am completely new to all of it

It doesn't seem like elixir-ls implements workDoneProgress Without it, there's no data for fidget to report.

You can monitor LSP exchange by setting vim.lsp.set_log_level("debug") and tailing ~/.cache/nvim/lsp.log. Sumneko or Solargraph will initiate startup progress report with something akin to:

[DEBUG][2022-03-23 18:46:56] .../vim/lsp/rpc.lua:454	"rpc.receive"	{  id = 9,  jsonrpc = "2.0",  method = "window/workDoneProgress/create",  params = {    token = 2  }}
[DEBUG][2022-03-23 18:46:56] .../vim/lsp/rpc.lua:454	"rpc.receive"	{  jsonrpc = "2.0",  method = "$/progress",  params = {    token = 2,    value = {      cancellable = false,      kind = "begin",      message = "46/511",      percentage = 9,      title = "Loading workspace"    }  }}
[DEBUG][2022-03-23 18:46:56] .../vim/lsp/rpc.lua:454	"rpc.receive"	{  jsonrpc = "2.0",  method = "$/progress",  params = {    token = 2,    value = {      kind = "report",      message = "48/511",      percentage = 9    }  }}
[DEBUG][2022-03-23 18:46:57] .../vim/lsp/rpc.lua:454	"rpc.receive"	{  jsonrpc = "2.0",  method = "$/progress",  params = {    token = 2,    value = {      kind = "report",      message = "53/511",      percentage = 10    }  }}

ElixirLs doesn't initiate this reporting and I can't find any mention of workDone in its or it dependencies code.

@pca006132
Copy link

I've tried adding basic scala metals support:

local function metals_status_handler(_, status, ctx)
  -- https://github.com/scalameta/nvim-metals/blob/main/lua/metals/status.lua#L36-L50
  local val = {}
  if status.hide then
    val = {kind = "end"}
  elseif status.show then
    val = {kind = "begin", message = status.text}
  elseif status.text then
    val = {kind = "report", message = status.text}
  else
    return
  end
  local info = {client_id = ctx.client_id}
  local msg = {token = "metals", value = val}
  -- call fidget progress handler
  vim.lsp.handlers["$/progress"](nil, msg, info)
end

local handlers = {}
handlers['metals/status'] = metals_status_handler
require('lspconfig')['metals'].setup {
  init_options = {
    -- default setting in lspconfig is "show-message"
    statusBarProvider = "on"
  },
  handlers = handlers
}

Currently it will show 'nil' in the fidget output, not sure what is the cause (did not look into much of the code)
Also, there is a spinner icon in the metals status text, perhaps we can trim that out.

image

@benjstephenson
Copy link

Looks like omnisharp doesn't work at the moment, I'd be keen to give it a try though.

@jsholmes
Copy link

This says it works with clangd, but it doesn't seem to for me. Is there something extra I need to add to the clangd config? I'm already doing clangdFileStatus = true in the init_options

@zefr0x
Copy link

zefr0x commented Aug 2, 2022

It doesn't seem to work with jedi-language-server for python.

@Alaz-Oz
Copy link

Alaz-Oz commented Aug 7, 2022

This says it works with clangd, but it doesn't seem to for me. Is there something extra I need to add to the clangd config? I'm already doing clangdFileStatus = true in the init_options

It works in Cmake project. If you have makefile project, then shift to "Cmake project"

@fitrh
Copy link

fitrh commented Aug 7, 2022

It works in Cmake project. If you have makefile project, then shift to "Cmake project"

No, with this config even makefile project works for me, I think all we need is init_options.clangdFileStatus = true

@j-hui
Copy link
Owner Author

j-hui commented Aug 7, 2022

@jsholmes @asteroidalaz @fitrh it definitely works with Clangd, regardless of build system (make vs clangd). I use fidget with clangd daily.

What matters is you need to have your build system generate a compile_commands.json to tell clangd what what flags you're compiling each file with. Iirc cmake happens to know how to generate these out of the box; for Makefiles, you'll need the help of a tool like bear.

If you are still having trouble with clangd (or any other language server), first verify that you are able to get other LSP features working (e.g., see if go to definition works). If it still doesn't work, open an issue. This issue is not for troubleshooting specific LSP setups; it is for discussing whether language servers provide progress notifications given that they already work otherwise.

(Conversation moved to #90)

@jsholmes

This comment was marked as off-topic.

@kataklasm
Copy link

kataklasm commented Jan 4, 2023

Unfortunately I can't get fidget to work with Julia, even though LanguageServer.jl sends workDoneProress according to some issues over there.

Julia works. It takes a while to show up but that is LS.jl's fault, it is notoriously slow at initializing.
Thanks for this rad plugin!

@calebdw
Copy link

calebdw commented Feb 10, 2023

This works with phpactor (PHP).

@davidelias
Copy link

ElixirLs doesn't initiate this reporting and I can't find any mention of workDone in its or it dependencies code.

There's already an issue reported: elixir-lsp/elixir-ls#848

Meanwhile, you can try this hack as a temporary solution:

local on_log_message = function(err, result, ctx, config)
  vim.lsp.handlers['window/logMessage'](err, result, ctx, config)

  -- Only do it for info/log type logs
  if result.type > 2 then
    local opts = { client_id = ctx.client_id }
    local token = tostring({}):sub(10) -- random string hack

    vim.lsp.handlers['$/progress'](nil, {
      token = token,
      value = { kind = 'begin', title = result.message }
    }, opts)

    vim.lsp.handlers['$/progress'](nil, {
      token = token,
      value = { kind = 'end' }
    }, opts)
  end
end

require('lspconfig').elixirls.setup({
  ...
  handlers = {
    ['window/logMessage'] = on_log_message,
  },
  ...
})

@j-hui
Copy link
Owner Author

j-hui commented Nov 11, 2023

I'm closing this issue in favor of this Wiki page. I've also updated it to include some of the newer messages I missed.

And for the sake of navigability, it's probably a good idea to file separate issues (or discussions?) to bring this up. (Man, implementing a Wiki using a pinned issue was such a bad idea...)

@j-hui j-hui closed this as completed Nov 11, 2023
@j-hui
Copy link
Owner Author

j-hui commented Nov 11, 2023

By the way, @davidelias can you please test whether your workaround still works(around)?

If so, I will add it to the Wiki page.

@j-hui j-hui unpinned this issue Nov 11, 2023
@rudiejd
Copy link

rudiejd commented Nov 26, 2023

This doesn't work with csharp-ls. I'll see if I can get it working

j-hui: moved to #173

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

No branches or pull requests