Переглянути джерело

be explicit about stdin for formatters (#987)

Abouzar Parvan 4 роки тому
батько
коміт
3f4cf5f01d

+ 2 - 1
lua/lang/clang.lua

@@ -13,6 +13,7 @@ M.config = function()
     formatter = {
       exe = "clang-format",
       args = {},
+      stdin = true,
     },
     linters = {
       "cppcheck",
@@ -33,7 +34,7 @@ M.format = function()
       return {
         exe = O.lang.clang.formatter.exe,
         args = O.lang.clang.formatter.args,
-        stdin = not (O.lang.clang.formatter.stdin ~= nil),
+        stdin = O.lang.clang.formatter.stdin,
         cwd = vim.fn.expand "%:h:p",
       }
     end,

+ 2 - 1
lua/lang/dart.lua

@@ -6,6 +6,7 @@ M.config = function()
     formatter = {
       exe = "dart",
       args = { "format" },
+      stdin = true,
     },
   }
 end
@@ -16,7 +17,7 @@ M.format = function()
       return {
         exe = O.lang.dart.formatter.exe,
         args = O.lang.dart.formatter.args,
-        stdin = not (O.lang.dart.formatter.stdin ~= nil),
+        stdin = O.lang.dart.formatter.stdin,
       }
     end,
   }

+ 1 - 1
lua/lang/elixir.lua

@@ -16,7 +16,7 @@ M.format = function()
       return {
         exe = O.lang.elixir.formatter.exe,
         args = O.lang.elixir.formatter.args,
-        stdin = not (O.lang.elixir.formatter.stdin ~= nil),
+        stdin = O.lang.elixir.formatter.stdin,
       }
     end,
   }

+ 2 - 1
lua/lang/go.lua

@@ -5,6 +5,7 @@ M.config = function()
     formatter = {
       exe = "gofmt",
       args = {},
+      stdin = true,
     },
     linters = {
       "golangcilint",
@@ -19,7 +20,7 @@ M.format = function()
       return {
         exe = O.lang.go.formatter.exe,
         args = O.lang.go.formatter.args,
-        stdin = not (O.lang.go.formatter.stdin ~= nil),
+        stdin = O.lang.go.formatter.stdin,
       }
     end,
   }

+ 2 - 1
lua/lang/json.lua

@@ -10,6 +10,7 @@ M.config = function()
     formatter = {
       exe = "python",
       args = { "-m", "json.tool" },
+      stdin = true,
     },
   }
 end
@@ -20,7 +21,7 @@ M.format = function()
       return {
         exe = O.lang.json.formatter.exe,
         args = O.lang.json.formatter.args,
-        stdin = not (O.lang.json.formatter.stdin ~= nil),
+        stdin = O.lang.json.formatter.stdin,
       }
     end,
   }

+ 1 - 1
lua/lang/lua.lua

@@ -22,7 +22,7 @@ M.format = function()
       return {
         exe = O.lang.lua.formatter.exe,
         args = O.lang.lua.formatter.args,
-        stdin = not (O.lang.lua.formatter.stdin ~= nil),
+        stdin = O.lang.lua.formatter.stdin,
         tempfile_prefix = ".formatter",
       }
     end,

+ 1 - 1
lua/lang/php.lua

@@ -30,7 +30,7 @@ M.format = function()
       return {
         exe = O.lang.php.formatter.exe,
         args = O.lang.php.formatter.args,
-        stdin = not (O.lang.php.formatter.stdin ~= nil),
+        stdin = O.lang.php.formatter.stdin,
         tempfile_prefix = ".formatter",
       }
     end,

+ 2 - 1
lua/lang/python.lua

@@ -18,6 +18,7 @@ M.config = function()
     formatter = {
       exe = "yapf",
       args = {},
+      stdin = true,
     },
     linters = {
       "flake8",
@@ -33,7 +34,7 @@ M.format = function()
       return {
         exe = O.lang.python.formatter.exe,
         args = O.lang.python.formatter.args,
-        stdin = not (O.lang.python.formatter.stdin ~= nil),
+        stdin = O.lang.python.formatter.stdin,
       }
     end,
   }

+ 2 - 1
lua/lang/ruby.lua

@@ -11,6 +11,7 @@ M.config = function()
     formatter = {
       exe = "rufo",
       args = { "-x" },
+      stdin = true,
     },
     linters = { "ruby" },
   }
@@ -22,7 +23,7 @@ M.format = function()
       return {
         exe = O.lang.ruby.formatter.exe,
         args = O.lang.ruby.formatter.args,
-        stdin = not (O.lang.ruby.formatter.stdin ~= nil),
+        stdin = O.lang.ruby.formatter.stdin,
       }
     end,
   }

+ 2 - 1
lua/lang/rust.lua

@@ -11,6 +11,7 @@ M.config = function()
     formatter = {
       exe = "rustfmt",
       args = { "--emit=stdout", "--edition=2018" },
+      stdin = true,
     },
     linter = "",
     diagnostics = {
@@ -27,7 +28,7 @@ M.format = function()
       return {
         exe = O.lang.rust.formatter.exe,
         args = O.lang.rust.formatter.args,
-        stdin = not (O.lang.rust.formatter.stdin ~= nil),
+        stdin = O.lang.rust.formatter.stdin,
       }
     end,
   }

+ 1 - 1
lua/lang/sh.lua

@@ -25,7 +25,7 @@ M.format = function()
       return {
         exe = O.lang.sh.formatter.exe,
         args = O.lang.sh.formatter.args,
-        stdin = not (O.lang.sh.formatter.stdin ~= nil),
+        stdin = O.lang.sh.formatter.stdin,
         tempfile_prefix = ".formatter",
       }
     end,

+ 1 - 1
lua/lang/terraform.lua

@@ -16,7 +16,7 @@ M.format = function()
       return {
         exe = O.lang.terraform.formatter.exe,
         args = O.lang.terraform.formatter.args,
-        stdin = not (O.lang.terraform.formatter.stdin ~= nil),
+        stdin = O.lang.terraform.formatter.stdin,
         tempfile_prefix = ".formatter",
       }
     end,

+ 2 - 1
lua/lang/yaml.lua

@@ -5,6 +5,7 @@ M.config = function()
     formatter = {
       exe = "prettier",
       args = { "--stdin-filepath", vim.api.nvim_buf_get_name(0), "--single-quote" },
+      stdin = true,
     },
   }
 end
@@ -15,7 +16,7 @@ M.format = function()
       return {
         exe = O.lang.yaml.formatter.exe,
         args = O.lang.yaml.formatter.args,
-        stdin = not (O.lang.yaml.formatter.stdin ~= nil),
+        stdin = O.lang.yaml.formatter.stdin,
       }
     end,
   }