From 5085668d62214992298b56ad9c73905a94526fe2 Mon Sep 17 00:00:00 2001 From: Hugo Barrera Date: Thu, 6 May 2021 07:08:08 +0000 Subject: efm: Include current file dir in root detection The current settings for EFM make it so that it will only work within a git repository. This change adds a fallback, so that if the current file is _not_ inside a git repository then the current directory is used instead. This is useful, for example, when opening a random python file, so as to get feedback from the system flake8. --- lua/lspconfig/efm.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lua') diff --git a/lua/lspconfig/efm.lua b/lua/lspconfig/efm.lua index d4fc88ac..97ce744f 100644 --- a/lua/lspconfig/efm.lua +++ b/lua/lspconfig/efm.lua @@ -8,7 +8,9 @@ local bin_name = "efm-langserver" configs[server_name] = { default_config = { cmd = {bin_name}; - root_dir = util.root_pattern(".git"); + root_dir = function(fname) + return util.root_pattern(".git")(fname) or util.path.dirname(fname) + end; }; docs = { @@ -18,7 +20,7 @@ https://github.com/mattn/efm-langserver General purpose Language Server that can use specified error message format generated from specified command. ]]; default_config = { - root_dir = [[root_pattern(".git")]]; + root_dir = [[util.root_pattern(".git")(fname) or util.path.dirname(fname)]]; }; }; } -- cgit v1.2.3-70-g09d2