Added default formatters (#908)

* added default formatters for a couple of langs

* fix: sugesstions from tastyep

* allow users to change default formatters

* suggestion: mellow pointed out the telescope issue

* we don't need to use formatter.setup
This commit is contained in:
Abouzar Parvan 2021-07-14 04:19:36 +04:30 committed by GitHub
parent 6bbc082f57
commit de7ec62f5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 164 additions and 38 deletions

View file

@ -1,3 +1,17 @@
O.formatters.filetype["rust"] = {
function()
return {
exe = O.lang.rust.formatter.exe,
args = O.lang.rust.formatter.args,
stdin = not (O.lang.rust.formatter.stdin ~= nil),
}
end,
}
require("formatter.config").set_defaults {
logging = false,
filetype = O.formatters.filetype,
}
if require("lv-utils").check_lsp_client_active "rust_analyzer" then
return
end
@ -81,7 +95,7 @@ else
cmd = { DATA_PATH .. "/lspinstall/rust/rust-analyzer" },
on_attach = require("lsp").common_on_attach,
filetypes = { "rust" },
root_dir = require("lspconfig.util").root_pattern("Cargo.toml", "rust-project.json"),
root_dir = require("lspconfig.util").root_pattern("Carrust.toml", "rust-project.json"),
}
end