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: change default annotation convention on the fly #127

Open
WieeRd opened this issue Jan 28, 2023 · 0 comments
Open

feat: change default annotation convention on the fly #127

WieeRd opened this issue Jan 28, 2023 · 0 comments

Comments

@WieeRd
Copy link

WieeRd commented Jan 28, 2023

It is quite bothersome to modify Neogen config every time
when working on multiple projects with different doc annotation.
.generate() API does support convention option, but it's not ideal to call
:lua require("neogen").generate({ annotation_convention = "example" }) every time.

To solve this, I suggest 2 things:

Expose default convention table as part of API

There should be a table accessible through require("neogen").annotation_convention,
which contains the default value for annotation_convention option of .generate().

---@type table<string,string>
neogen.annotation_convention = {
	["{filetype}"] = "{convention}",
	["python"] = "numpydoc",
}

---buffer-local config; looked up before table above
---@type table<number,table<string,string>>
neogen.local_annotation_convention = {
	[bufnr] = {
		["{filetype}"] = "{convention}",
	},
	[3] = {
		["python"] = "numpydoc",
	},
}

Add a command to easily modify those tables

Something like :DocType[!] [filetype] <convention>.
When used with ! it sets buffer-local option.
When no filetype is given, it uses vim.bo.filetype.
(e.g. :DocType numpydoc or :DocType python numpydoc)

Adding features like these will make it easier to set project-local options
and try out different annotation conventions with minimal effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant