aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorHugo Barrera <hugo@barrera.io>2021-05-06 07:08:08 +0000
committerHugo Osvaldo Barrera <hugo@barrera.io>2021-05-06 09:24:32 +0200
commit5085668d62214992298b56ad9c73905a94526fe2 (patch)
tree0748b12141588da940ecc74a7611c850ef5c931a /lua
parentMerge pull request #875 from zupatisc/master (diff)
downloadnvim-lspconfig-5085668d62214992298b56ad9c73905a94526fe2.tar
nvim-lspconfig-5085668d62214992298b56ad9c73905a94526fe2.tar.gz
nvim-lspconfig-5085668d62214992298b56ad9c73905a94526fe2.tar.bz2
nvim-lspconfig-5085668d62214992298b56ad9c73905a94526fe2.tar.lz
nvim-lspconfig-5085668d62214992298b56ad9c73905a94526fe2.tar.xz
nvim-lspconfig-5085668d62214992298b56ad9c73905a94526fe2.tar.zst
nvim-lspconfig-5085668d62214992298b56ad9c73905a94526fe2.zip
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.
Diffstat (limited to 'lua')
-rw-r--r--lua/lspconfig/efm.lua6
1 files changed, 4 insertions, 2 deletions
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)]];
};
};
}