Lsp disable autostart message

I have a LSP for AngualrLS configured for my project. Recently I updated things I now I see a message printed when angualrls can’t start

Autostart for angularls failed: matching root directory not detected.
Autostart for angularls failed: matching root directory not detected.
Press ENTER or type command to continue

Is there a way to silence this?

1 Like

That’s just the warning message (from lspconfig) saying we couldn’t autostart angularls because we can’t detect the requisite project structure. How would you prefer we display the message? Is it just the enter prompt that is bothersome?

The “enter” prompt is for sure a pain, but would rather not see the message at all. If it can’t detect the workspace root, my thought would be that it just quietly skip the lsp all together, vs notifying me.

IMO it should only print something if there is an actual error.

Yeah, but on the flip side historically we have had users complain that lspconfig silently failed to start their language servers

Maybe a good middle ground would be to have an option to toggle the logging?

local lspconfig = require "lspconfig"
lspconfig.util.default_config = vim.tbl_extend( "force", lspconfig.util.default_config, { logging = false })
1 Like

What’s the situation in which you would have angular configured in your config but would not want a warning that it can’t start on the current project?

I have angular configured for the typescript, but also tsserver configured. So I typically want tsserver always, and angular-ls only if I’m in an angular project. If i’m not in an angular project, just skip the server

1 Like

+1 for an option like this. @mjlbach my use case is that I have a LSP server that gets attached to Markdown files only when Neovim finds a .zk/ folder in the same directory (and I only have one folder on my system like this, ~/wiki). However, anytime that I open any markdown file that is not in that ~/wiki directory I mentioned, I get this message which gets quite annoying. I use Markdown files all the time and very much would love an option to disable the autostart logging for this specific server. I totally understand why the Neovim team chose to enable this logging, as I can imagine it has helped catch a lot of user configuration errors. Thanks for all your hard work on nvim-lspconfig and Neovim, it’s much appreciated!

There are a lot of framework-specific language servers in the JavaScript ecosystem, so an option to suppress the warning would definitely be appreciated. This is the dumb hack I’m using for now:

local notify = vim.notify
vim.notify = function(msg, ...)
    -- or whatever condition you want to check
    if msg:match("[lspconfig]") then 
        return
    end

    notify(msg, ...)
end
1 Like

+1 for this option.
I have both node and deno projects. The node would use tsserver. The deno one would use deno lsp. Either one of the lsp would fail to start and that’s alright.