elm-language-server icon indicating copy to clipboard operation
elm-language-server copied to clipboard

elm-format spawning vim.ui.select in neovim

Open smoothprogrammer opened this issue 1 year ago • 6 comments

The elm-format when returning error will spawn vim.ui.select in neovim.

Expected Behavior

I'm expecting the LSP to not spawn vim.ui.select when elm-format returning error. Just ignore it.

Current Behavior

As you can see, when elm-format is returning error, it will spawn vim.ui.select with message Running elm-format failed. Check the file for syntax errors. which annoys me as I need to close them every time it shown which is often when you want save to get a useful feedback from elm compiler. image

Possible Solution

Steps to Reproduce (for bugs)

  1. Using native LSP in neovim https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md#elmls
  2. Just default configuration, nothing fancy
  3. Write a invalid elm code
  4. Save and LSP will spawn vim.ui.select due to elm-format returning error

Context

Your Environment

  • Version used:
  • Editor used: Neovim
  • Environment name and version (e.g. node.js 5.4):
  • Operating System and version: NixOS 24.11

smoothprogrammer avatar Nov 19 '24 12:11 smoothprogrammer

Found the code that print the error message. https://github.com/elm-tooling/elm-language-server/blob/dcdcdd067c495ab418720955f7476efe9714d656/src/common/providers/documentFormatingProvider.ts#L68-L70

smoothprogrammer avatar Nov 19 '24 13:11 smoothprogrammer

would be really nice to configure this

aaaaargZombies avatar Jun 23 '25 13:06 aaaaargZombies

Maybe showErrorMessage isn't what's wanted here? Either RemoteConsole.error or showMessage?

nyarly avatar Jun 30 '25 22:06 nyarly

showMessage

Not sure what you mean by that, there are also this.connection.window.showInformationMessage and this.connection.window.showWarningMessage - but I can't find showMessage

razzeee avatar Jul 01 '25 08:07 razzeee

https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#window_showMessage

It was pointed out that the TS library for LSP doesn't seem to surface this feature, so maybe showMessage isn't an option?

nyarly avatar Jul 01 '25 18:07 nyarly

For the future: I was shown this workaround:

https://github.com/joakin/nvim/blob/bddf8f52ec92a5e23425b1a26f13d1c22a70106b/lua/plugins/lspconfig.lua#L183 which I can confirm works.

nyarly avatar Jul 01 '25 18:07 nyarly