lspconfig: Autostart for emmet_ls failed: matching root directory not detected
See original GitHub issueAfter a recent update, “emmet_ls” just stopped working completely and prompted the following error message whenever an html or css file is opened:

The following is my config file:
-- Setup lspconfig.
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
-- Emmet
require'lspconfig/configs'.emmet_ls = {
default_config = {
cmd = { 'emmet-ls', '--stdio' };
filetypes = { 'html', 'css', 'scss', 'xml', 'pug', 'sass'};
root_dir = function(fname)
return vim.loop.cwd()
end;
settings = {};
};
}
-- Language Servers:
local langservers = {
'cssls',
'html',
'emmet_ls',
'pylsp',
'tsserver',
}
for _, server in ipairs(langservers) do
require'lspconfig'[server].setup {
capabilities = capabilities
}
end
To troubleshoot this, I did clear out my config file and pasted in only the suggested configuration code below from GitHub but the same error message still pop-up indicating “root directory not detected”
local lspconfig = require'lspconfig'
local configs = require'lspconfig/configs'
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
if not lspconfig.emmet_ls then
configs.emmet_ls = {
default_config = {
cmd = {'emmet-ls', '--stdio'};
filetypes = {'html', 'css', 'blade'};
root_dir = function(fname)
return vim.loop.cwd()
end;
settings = {};
};
}
end
lspconfig.emmet_ls.setup{ capabilities = capabilities; }
All the other language servers are working properly except “emmet_ls.” Any reply would be great appreciated, million thanks in advance.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
Getting error matching root directory not detected ... - GitHub
Description If I open a file through netrw, I get the error Autostart for failed: matching root directory not detected while trying to...
Read more >LSP not working with inline_edit.vim or NrrwRgn (Autostart for ...
Once I git init , i.e. .git in project_root, the error Autostart for omnisharp failed: matching root directory not detected went away and...
Read more >Lsp disable autostart message - Neovim Discourse
Autostart for angularls failed: matching root directory not detected. ... (from lspconfig) saying we couldn't autostart angularls because we can't detect ...
Read more >null-ls autostart - You.com | The search engine you control.
First, the :LspInfo command comes from nvim-lspconfig, and autostart is only valid ... `Autostart for null-ls failed: matching root directory not detected.
Read more >Updates based on Chris's lunarvim - dotfiles
If it is not found revert to global Prettier where needed. -local M = {} - -M.setup = function() - local tsserver_args =...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@mondenoir not sure if will work but you can try, next will use your current working directory as your root_dir.
@carlitux You did it again my friend 😃
Due to your reply, I was able to tweaked my config file and now everything works just like before the update 👍👍👍 As a newcomer to the Vim community, you have no clue how much these replies means to me. Thanks a million carlitux 🙏🙏🙏
PS: I will leave a copy of the configuration below to illustrate what I did wrong and what carlitux did to help me correct the mistakes: