-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Rename clang_format to clang-format (#352)
This makes the formatter name consistent with the executable and also with other tools like e.g. Mason, for better interoperability.
- Loading branch information
Showing
4 changed files
with
28 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
local util = require("conform.util") | ||
---@type conform.FileFormatterConfig | ||
return { | ||
meta = { | ||
url = "https://www.kernel.org/doc/html/latest/process/clang-format.html", | ||
description = "Tool to format C/C++/… code according to a set of rules and heuristics.", | ||
}, | ||
command = "clang-format", | ||
args = { "-assume-filename", "$FILENAME" }, | ||
range_args = function(self, ctx) | ||
local start_offset, end_offset = util.get_offsets_from_range(ctx.buf, ctx.range) | ||
local length = end_offset - start_offset | ||
return { | ||
"-assume-filename", | ||
"$FILENAME", | ||
"--offset", | ||
tostring(start_offset), | ||
"--length", | ||
tostring(length), | ||
} | ||
end, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,4 @@ | ||
local util = require("conform.util") | ||
---@type conform.FileFormatterConfig | ||
return { | ||
meta = { | ||
url = "https://www.kernel.org/doc/html/latest/process/clang-format.html", | ||
description = "Tool to format C/C++/… code according to a set of rules and heuristics.", | ||
}, | ||
command = "clang-format", | ||
args = { "-assume-filename", "$FILENAME" }, | ||
range_args = function(self, ctx) | ||
local start_offset, end_offset = util.get_offsets_from_range(ctx.buf, ctx.range) | ||
local length = end_offset - start_offset | ||
return { | ||
"-assume-filename", | ||
"$FILENAME", | ||
"--offset", | ||
tostring(start_offset), | ||
"--length", | ||
tostring(length), | ||
} | ||
end, | ||
} | ||
-- This was renamed to clang-format | ||
local conf = vim.deepcopy(require("conform.formatters.clang-format")) | ||
conf.meta.deprecated = true | ||
return conf |