Skip to content

Commit 5902f41

Browse files
authored
feat(builtins): add Fortran findent code formatter (#96)
1 parent e25d2fc commit 5902f41

File tree

5 files changed

+46
-1
lines changed

5 files changed

+46
-1
lines changed

doc/BUILTINS.md

+17
Original file line numberDiff line numberDiff line change
@@ -2400,6 +2400,23 @@ local sources = { null_ls.builtins.formatting.fantomas }
24002400
- Command: `fantomas`
24012401
- Args: `{ "$FILENAME" }`
24022402

2403+
### [findent](https://github.com/gnikit/findent-pypi)
2404+
2405+
findent indents/beautifies/converts and can optionally generate the dependencies of Fortran sources.
2406+
2407+
#### Usage
2408+
2409+
```lua
2410+
local sources = { null_ls.builtins.formatting.findent }
2411+
```
2412+
2413+
#### Defaults
2414+
2415+
- Filetypes: `{ "fortran" }`
2416+
- Method: `formatting`
2417+
- Command: `findent`
2418+
- Args: `{}`
2419+
24032420
### [fish_indent](https://fishshell.com/docs/current/cmds/fish_indent.html)
24042421

24052422
Indent or otherwise prettify a piece of fish code.

doc/builtins.json

+5
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,11 @@
690690
"fsharp"
691691
]
692692
},
693+
"findent": {
694+
"filetypes": [
695+
"fortran"
696+
]
697+
},
693698
"fish_indent": {
694699
"filetypes": [
695700
"fish"

lua/null-ls/builtins/_meta/filetype_map.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ return {
118118
formatting = { "fnlfmt" }
119119
},
120120
fortran = {
121-
formatting = { "fprettify" }
121+
formatting = { "findent", "fprettify" }
122122
},
123123
fsharp = {
124124
formatting = { "fantomas" }

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

+3
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ return {
100100
fantomas = {
101101
filetypes = { "fsharp" }
102102
},
103+
findent = {
104+
filetypes = { "fortran" }
105+
},
103106
fish_indent = {
104107
filetypes = { "fish" }
105108
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
local h = require("null-ls.helpers")
2+
local methods = require("null-ls.methods")
3+
4+
local FORMATTING = methods.internal.FORMATTING
5+
6+
return h.make_builtin({
7+
name = "findent",
8+
meta = {
9+
url = "https://pypi.org/project/findent/",
10+
description = "findent indents/beautifies/converts and can optionally generate the dependencies of Fortran sources.",
11+
},
12+
method = FORMATTING,
13+
filetypes = { "fortran" },
14+
generator_opts = {
15+
command = "findent",
16+
args = {},
17+
to_stdin = true,
18+
},
19+
factory = h.formatter_factory,
20+
})

0 commit comments

Comments
 (0)