From 659838ff4244ef6af095395ce68aaaf99fa8e696 Mon Sep 17 00:00:00 2001 From: Steven Arcangeli <506791+stevearc@users.noreply.github.com> Date: Wed, 6 Dec 2023 22:20:29 -0800 Subject: refactor!: formatter config functions take self as first argument (#233) This is a breaking API change, but there is a shim in place that will keep existing functions working, just with a warning notification. Most people should not encounter this at all. For anyone overriding a formatter config value with a function that takes `(ctx)` as the parameter, it will need to be updated to take `(self, ctx)`. --- tests/runner_spec.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tests/runner_spec.lua') diff --git a/tests/runner_spec.lua b/tests/runner_spec.lua index 020afac..c9cf75a 100644 --- a/tests/runner_spec.lua +++ b/tests/runner_spec.lua @@ -70,7 +70,7 @@ describe("runner", function() } local config = assert(conform.get_formatter_config("test")) local ctx = runner.build_context(0, config) - local cmd = runner.build_cmd(ctx, config) + local cmd = runner.build_cmd("", ctx, config) assert.are.same({ "echo", vim.api.nvim_buf_get_name(bufnr) }, cmd) end) @@ -84,7 +84,7 @@ describe("runner", function() } local config = assert(conform.get_formatter_config("test")) local ctx = runner.build_context(0, config) - local cmd = runner.build_cmd(ctx, config) + local cmd = runner.build_cmd("", ctx, config) assert.are.same({ "echo", vim.fs.dirname(vim.api.nvim_buf_get_name(bufnr)) }, cmd) end) @@ -99,7 +99,7 @@ describe("runner", function() } local config = assert(conform.get_formatter_config("test")) local ctx = runner.build_context(0, config) - local cmd = runner.build_cmd(ctx, config) + local cmd = runner.build_cmd("", ctx, config) assert.are.same({ "echo", "--stdin" }, cmd) end) @@ -113,7 +113,7 @@ describe("runner", function() } local config = assert(conform.get_formatter_config("test")) local ctx = runner.build_context(0, config) - local cmd = runner.build_cmd(ctx, config) + local cmd = runner.build_cmd("", ctx, config) assert.equal("echo " .. vim.api.nvim_buf_get_name(bufnr) .. " | patch", cmd) end) @@ -127,7 +127,7 @@ describe("runner", function() } local config = assert(conform.get_formatter_config("test")) local ctx = runner.build_context(0, config) - local cmd = runner.build_cmd(ctx, config) + local cmd = runner.build_cmd("", ctx, config) assert.equal("echo " .. vim.fs.dirname(vim.api.nvim_buf_get_name(bufnr)) .. " | patch", cmd) end) @@ -142,7 +142,7 @@ describe("runner", function() } local config = assert(conform.get_formatter_config("test")) local ctx = runner.build_context(0, config) - local cmd = runner.build_cmd(ctx, config) + local cmd = runner.build_cmd("", ctx, config) assert.equal("echo | patch", cmd) end) end) -- cgit v1.2.3-70-g09d2