mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-22 03:35:21 +02:00
plugins/conform: init + test (#667)
This commit is contained in:
parent
b5414a3841
commit
76291156fa
3 changed files with 182 additions and 0 deletions
62
tests/test-sources/plugins/lsp/conform-nvim.nix
Normal file
62
tests/test-sources/plugins/lsp/conform-nvim.nix
Normal file
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
empty = {
|
||||
plugins.conform-nvim.enable = true;
|
||||
};
|
||||
|
||||
default = {
|
||||
plugins.conform-nvim = {
|
||||
enable = true;
|
||||
|
||||
formattersByFt = {
|
||||
lua = ["stylua"];
|
||||
python = ["isort" "black"];
|
||||
javascript = [["prettierd" "prettier"]];
|
||||
"*" = ["codespell"];
|
||||
"_" = ["trimWhitespace"];
|
||||
};
|
||||
formatOnSave = {
|
||||
lspFallback = true;
|
||||
timeoutMs = 500;
|
||||
};
|
||||
formatAfterSave = {
|
||||
lspFallback = true;
|
||||
};
|
||||
logLevel = "ERROR";
|
||||
notifyOnError = true;
|
||||
formatters = {
|
||||
myFormatter = {
|
||||
command = "myCmd";
|
||||
args = ["--stdin-from-filename" "$FILENAME"];
|
||||
rangeArgs = ''
|
||||
function(ctx)
|
||||
return { "--line-start", ctx.range.start[1], "--line-end", ctx.range["end"][1] }
|
||||
end;
|
||||
'';
|
||||
stdin = true;
|
||||
cwd = ''
|
||||
require("conform.util").rootFile({ ".editorconfig", "package.json" });
|
||||
'';
|
||||
requireCwd = true;
|
||||
condition = ''
|
||||
function(ctx)
|
||||
return vim.fs.basename(ctx.filename) ~= "README.md"
|
||||
end;
|
||||
'';
|
||||
exitCodes = [0 1];
|
||||
env = {
|
||||
VAR = "value";
|
||||
};
|
||||
"inherit" = true;
|
||||
prependArgs = ["--use-tabs"];
|
||||
};
|
||||
otherFormatter = ''
|
||||
function(bufnr)
|
||||
return {
|
||||
command = "myCmd";
|
||||
}
|
||||
end;
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue