mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-04-01 10:41:52 +00:00
language/r: migrate to conform/nvim-lint
This commit is contained in:
parent
a5deffb890
commit
7cf9e5c0a6
1 changed files with 22 additions and 18 deletions
|
@ -24,28 +24,29 @@
|
|||
package = pkgs.rWrapper.override {
|
||||
packages = [pkgs.rPackages.styler];
|
||||
};
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.styler.with({
|
||||
command = "${cfg.format.package}/bin/R",
|
||||
})
|
||||
)
|
||||
'';
|
||||
config = {
|
||||
command = "${cfg.format.package}/bin/R";
|
||||
};
|
||||
};
|
||||
|
||||
format_r = {
|
||||
package = pkgs.rWrapper.override {
|
||||
packages = [pkgs.rPackages.formatR];
|
||||
};
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.format_r.with({
|
||||
command = "${cfg.format.package}/bin/R",
|
||||
})
|
||||
)
|
||||
'';
|
||||
config = {
|
||||
command = "${cfg.format.package}/bin/R";
|
||||
stdin = true;
|
||||
args = [
|
||||
"--slave"
|
||||
"--no-restore"
|
||||
"--no-save"
|
||||
"-s"
|
||||
"-e"
|
||||
''formatR::tidy_source(source="stdin")''
|
||||
];
|
||||
# TODO: range_args seem to be possible
|
||||
# https://github.com/nvimtools/none-ls.nvim/blob/main/lua/null-ls/builtins/formatting/format_r.lua
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -118,8 +119,11 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.r-format = formats.${cfg.format.type}.nullConfig;
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.r = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = formats.${cfg.format.type}.config;
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.lsp.enable {
|
||||
|
|
Loading…
Add table
Reference in a new issue