changeset 321:aa0a095f8759

Set up python formatting and linting through efm
author zegervdv <zegervdv@me.com>
date Mon, 21 Dec 2020 09:39:45 +0100
parents 4daaf43a2b28
children deb606f02fc4
files dot_config/nvim/config.lua
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dot_config/nvim/config.lua	Thu Dec 17 17:51:54 2020 +0100
+++ b/dot_config/nvim/config.lua	Mon Dec 21 09:39:45 2020 +0100
@@ -132,6 +132,24 @@
 if (vim.fn.executable('efm-langserver') == 1) then
   lsp.efm.setup{
     on_attach = on_attach;
+    init_options = {documentFormatting = true};
     root_dir = lsputil.root_pattern('.git', '.hg');
+    settings = {
+      rootMarkers = {".git/", ".hg/"},
+      languages = {
+        python = {
+          {
+            formatCommand = "black -",
+            formatStdin = true
+          },
+          {
+            lintCommand = "flake8 --stdin-display-name ${INPUT} -",
+            lintStdin = true,
+            lintIgnoreExitCode = true,
+            lintFormats = {"%f:%l:%c: %m"}
+          }
+        }
+      }
+    };
   }
 end