Skip to content

haskell-tools silently fails #154

@teto

Description

@teto

Neovim version (nvim -v)

master

Operating system/version

nixos unstable

Output of haskell-language-server-wrapper --version

No response

How to reproduce the issue

remove haskell-language-server from PATH

Expected behaviour

a notification error that neovim could not start the LSP server

Actual behaviour

line numbers may differ as I patched the plugin but my config calls start_or_attach in ftplugin/haskell.lua which triggers:

Error executing lua callback: ...neovim-unwrapped-1cc23e1/share/nvim/runtime/filetype.lua:21: Error executing lua: ...neovim-unwrapped-1cc23e1/share/nvim/runtime/filetype.lua:22: BufReadPost Autocommands for "*"..FileType Autocommands for "*"..function <SN
R>1_LoadFTPlugin[19]..script /home/teto/home/config/nvim/ftplugin/haskell.lua: Vim(runtime):E5113: Error while calling lua chunk: ...eto/neovim/haskell-tools.nvim/lua/haskell-tools/init.lua:72: attempt to call field 'start' (a nil value)                   
stack traceback:                                                                                                                                                                                                                                                
        ...eto/neovim/haskell-tools.nvim/lua/haskell-tools/init.lua:72: in function 'start_or_attach'                                                                                                                                                           
        /home/teto/home/config/nvim/ftplugin/haskell.lua:103: in main chunk                                            

Log files

No response

The minimal config used to reproduce this issue.

My interpretation of the bug is that haskell-tools checks if the lsp server is executable in lsp.setup() , which it was not in my case because LSP servers are available on a per-project (i.e., flake) basis and I was out of a project when I started neovim with a haskell file. Then HT gives up on the setup on this line


thus lsp.start() is never defined, which triggers my issue.
There is this in the log:

WARN | 2023-03-08 10:13:19 | ...teto/neovim/haskell-tools.nvim/lua/haskell-tools/lsp.lua:104 | Command haskell-language-server not found in PATH.

I think it would be better for HT to not check the presence of haskell-tools and leave neovim notify that it can't start the server.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions