Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(builtins): add vfmt as a formatting builtin #64

Merged
merged 1 commit into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
})
Loading