Skip to content

Commit de747e0

Browse files
authored
feat(pint): Improve pint cmd (#49)
* feat: check if pint is available in PATH before using project specific version * doc(pint): update builtins doc for pint * review(pint): make suggested changes
1 parent bbd8c0c commit de747e0

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

doc/BUILTINS.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -4093,9 +4093,13 @@ local sources = { null_ls.builtins.formatting.pint }
40934093

40944094
- Filetypes: `{ "php" }`
40954095
- Method: `formatting`
4096-
- Command: `./vendor/bin/pint`
4096+
- Command: `pint`
40974097
- Args: `{ "--no-interaction", "--quiet", "$FILENAME" }`
40984098

4099+
#### Notes
4100+
4101+
- Command is `./vendor/bin/pint` if pint is installed per project else `pint` if globally installed
4102+
40994103
### [prettier](https://github.com/prettier/prettier)
41004104

41014105
Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ return h.make_builtin({
1313
method = FORMATTING,
1414
filetypes = { "php" },
1515
generator_opts = {
16-
command = "./vendor/bin/pint",
16+
command = vim.fn.executable("./vendor/bin/pint") == 1 and "./vendor/bin/pint" or "pint",
1717
args = {
1818
"--no-interaction",
1919
"--quiet",

0 commit comments

Comments
 (0)