Browse Source

[Bugfix] fix formatter/linter nil issue (#1353)

* fix formatter/linter issue for undefined lang/filetypes

* revrese the order
Abouzar Parvan 3 năm trước cách đây
mục cha
commit
1f45d1531d
3 tập tin đã thay đổi với 3 bổ sung3 xóa
  1. 1 1
      lua/default-config.lua
  2. 1 1
      lua/lsp/null-ls/formatters.lua
  3. 1 1
      lua/lsp/null-ls/linters.lua

+ 1 - 1
lua/default-config.lua

@@ -1189,7 +1189,7 @@ lvim.lang = {
   },
   vim = {
     formatters = {},
-    linters = { "" },
+    linters = {},
     lsp = {
       provider = "vimls",
       setup = {

+ 1 - 1
lua/lsp/null-ls/formatters.lua

@@ -63,7 +63,7 @@ function M.list_configured(formatter_configs)
 end
 
 function M.setup(filetype, options)
-  if formatters_by_ft[filetype] and not options.force_reload then
+  if not lvim.lang[filetype] or (formatters_by_ft[filetype] and not options.force_reload) then
     return
   end
 

+ 1 - 1
lua/lsp/null-ls/linters.lua

@@ -63,7 +63,7 @@ function M.list_configured(linter_configs)
 end
 
 function M.setup(filetype, options)
-  if linters_by_ft[filetype] and not options.force_reload then
+  if not lvim.lang[filetype] or (linters_by_ft[filetype] and not options.force_reload) then
     return
   end