Fix tsserver formatter not working (#925)

This commit is contained in:
hui.liu 2021-07-14 15:05:25 +08:00 committed by GitHub
parent abab0d5e82
commit 946b251233
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -309,7 +309,7 @@ O = {
},
formatter = {
exe = "prettier",
args = { "--stdin-filepath", vim.api.nvim_buf_get_name(0), "--single-quote" },
args = {},
},
},
vim = {},

View file

@ -9,9 +9,14 @@ end
O.formatters.filetype["javascriptreact"] = {
function()
local args = { "--stdin-filepath", vim.fn.fnameescape(vim.api.nvim_buf_get_name(0)) }
local extend_args = O.lang.tsserver.formatter.args
for i = 1, #extend_args do
table.insert(args, extend_args[i])
end
return {
exe = prettier_instance,
args = O.lang.tsserver.formatter.args,
args = args,
stdin = true,
}
end,