diff options
author | Abouzar Parvan <[email protected]> | 2021-07-14 04:19:36 +0430 |
---|---|---|
committer | GitHub <[email protected]> | 2021-07-13 19:49:36 -0400 |
commit | de7ec62f5fde20ca1d7e53ed83a0077f8945f67c (patch) | |
tree | 1d54b2232489e53a98025825ed550c28e7adea95 /ftplugin/rust.lua | |
parent | 6bbc082f5758cdb57ecb25f270e5558ab63d3754 (diff) |
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
Diffstat (limited to 'ftplugin/rust.lua')
-rw-r--r-- | ftplugin/rust.lua | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/ftplugin/rust.lua b/ftplugin/rust.lua index 04fc4249..dd34483e 100644 --- a/ftplugin/rust.lua +++ b/ftplugin/rust.lua @@ -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 |