Skip to content

Commit 231ed89

Browse files
authored
fix(forge_fmt): cwd to the first parent with the foundry.toml file (#298)
1 parent df77810 commit 231ed89

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lua/null-ls/builtins/formatting/forge_fmt.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
local h = require("null-ls.helpers")
2+
local u = require("null-ls.utils")
23
local methods = require("null-ls.methods")
34

45
local FORMATTING = methods.internal.FORMATTING
@@ -17,6 +18,9 @@ return h.make_builtin({
1718
"fmt",
1819
"$FILENAME",
1920
},
21+
cwd = h.cache.by_bufnr(function(params)
22+
return u.root_pattern("foundry.toml")(params.bufname)
23+
end),
2024
to_stdin = false,
2125
to_temp_file = true,
2226
},

0 commit comments

Comments
 (0)