Add sections support for generating partial docstrings#201
Open
ColinKennedy wants to merge 1 commit intodanymat:mainfrom
Open
Add sections support for generating partial docstrings#201ColinKennedy wants to merge 1 commit intodanymat:mainfrom
sections support for generating partial docstrings#201ColinKennedy wants to merge 1 commit intodanymat:mainfrom
Conversation
a2bfe75 to
cdeb71d
Compare
cdeb71d to
24f6d27
Compare
This was referenced Sep 2, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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,
locatorsare 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
sectionsis not given, don't generate under the cursor (the current, default behavior)sectionsis given andatis not set, assume it is at the user's cursoratis given, use that cursor locationWhat do you think?