feat(rust) Add support for rust (func, file) #34

This commit is contained in:
danymat
2022-01-09 16:29:50 +01:00
parent ded4838eaf
commit 4227f608b2
3 changed files with 39 additions and 2 deletions

View File

@@ -194,6 +194,8 @@ There is a list of supported languages and fields, with their annotation style
| | [Godoc](https://go.dev/blog/godoc) (`"godoc"`) | |
| java | | | `func`, `class` |
| | [Javadoc](https://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/javadoc.html#documentationcomments) (`"javadoc"`) | |
| rust | | | `func`, `file` |
| | [Rustdoc](https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html) (`"rustdoc"`) | |
## Adding Languages

View File

@@ -122,8 +122,6 @@ function neogen.jumpable(reverse)
return neogen.utilities.cursor.jumpable(reverse)
end
function neogen.generate_command()
vim.api.nvim_command('command! -range -bar Neogen lua require("neogen").generate()')
end
@@ -142,6 +140,7 @@ neogen.setup = function(opts)
cpp = require("neogen.configurations.c"),
go = require("neogen.configurations.go"),
java = require("neogen.configurations.java"),
rust = require("neogen.configurations.rust"),
},
})

View File

@@ -0,0 +1,36 @@
return {
parent = {
func = { "function_item" },
file = { "source_file" },
},
data = {
func = {
["function_item"] = {
["0"] = {
extract = function()
return {}
end,
},
},
},
file = {
["source_file"] = {
["0"] = {
extract = function()
return {}
end,
},
},
},
},
template = {
annotation_convention = "rustdoc",
rustdoc = {
{ nil, "! $1", { no_results = true, type = { "file" } } },
{ nil, "", { no_results = true, type = { "file" } } },
{ nil, "/ $1", { no_results = true, type = { "func" } } },
},
},
}