Skip to content

Commit

Permalink
feat(builtins): add vfmt as a formatting builtin (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
BarrOff authored Jan 21, 2024
1 parent e64f03f commit dd30788
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
17 changes: 17 additions & 0 deletions doc/BUILTINS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5114,6 +5114,23 @@ local sources = { null_ls.builtins.formatting.usort }
- Command: `usort`
- Args: `{ "format", "-" }`

### [vfmt](https://github.com/vlang/v)

Reformat Vlang source into canonical form.

#### Usage

```lua
local sources = { null_ls.builtins.formatting.vfmt }
```

#### Defaults

- Filetypes: `{ "vlang" }`
- Method: `formatting`
- Command: `v`
- Args: `{ "fmt", "-w", "$FILENAME" }`

### [verible_verilog_format](https://github.com/chipsalliance/verible)

The verible-verilog-format formatter manages whitespace in accordance with a particular style. The main goal is to relieve humans of having to manually manage whitespace, wrapping, and indentation, and to provide a tool that can be integrated into any editor to enable editor-independent consistency.
Expand Down
20 changes: 20 additions & 0 deletions lua/null-ls/builtins/formatting/vfmt.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
local h = require("null-ls.helpers")
local methods = require("null-ls.methods")

local FORMATTING = methods.internal.FORMATTING

return h.make_builtin({
name = "vfmt",
meta = {
url = "https://github.com/vlang/v",
description = "Reformat Vlang source into canonical form.",
},
method = FORMATTING,
filetypes = { "vlang" },
generator_opts = {
command = "v",
args = { "fmt", "-w", "$FILENAME" },
to_temp_file = true,
},
factory = h.formatter_factory,
})

0 comments on commit dd30788

Please sign in to comment.