Add sections
support for generating partial docstrings
#201
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes #165
This PR adds (Lua API only) support for generating certain sections of a user's docstring. The basic functionality for generator.lua is like this
(default behavior) if no sections are given, the user wants to generate the whole docstring
if sections are given...
Extra Notes
Locators Are More Important Now
This PR did expose a slight flaw in the currently supported languages though. Normally Neogen assumes that the user's cursor is directly on the node that they want to generate from. But since this new PR generates docstrings from the cursor position,
locators
are now more important than they used to be. A couple languages have one already, this PR adds one for Python. Any other language will likely need a locator too.Until all languages have a locator + unittests, I'm thinking we should fail early if the user provides sections and the given language doesn't provide an explicit locator (it's not in the PR currently but I can add it). What do you think?
Maybe We Should Add
at=
The current PR logic assumes that the docstring must generate under the cursor. I think we could expose this behavior as a Lua parameter. The new logic could be
sections
is not given, don't generate under the cursor (the current, default behavior)sections
is given andat
is not set, assume it is at the user's cursorat
is given, use that cursor locationWhat do you think?