gitstream icon indicating copy to clipboard operation
gitstream copied to clipboard

Add ability to access line numbers and add line comments

Open tresat opened this issue 1 year ago • 5 comments

Is your feature request related to a problem? Please describe. It would be good to be able to get the line numbers of each changed line, be able to process the changes, and have an action available to add comments associated with a specific line to a PR.

For instance, if a PR includes a line like TODO:, I'd like to have gitStream automatically add a comment on that line in the PR saying "TODO found, did you mean to address this now?"

Describe the solution you'd like Add line number information to the FileDiff context variable. Provide a add-comment@v2 that allows for supplying a line number argument. Associate the comment with those line numbers.

Describe alternatives you've considered Adding comments without line numbers. Adding the content of the diff to the comment. These are not as helpful.

tresat avatar Apr 13 '23 12:04 tresat

Thanks for the feature request @tresat, it's super awesome to see the Gradle community giving gitStream a shot! I can't promise anything right now, but we'll keep you updated on any improvements we make that might affect this. In the meantime, feel free to make additional feature requests or bug report for things y'all are doing.

BenLloydPearson avatar Apr 17 '23 18:04 BenLloydPearson

Sounds good, thank you! We're excited to be trying out the tool and will almost certainly be sending more suggestions your way as more people on our side get to see it.

tresat avatar Apr 17 '23 20:04 tresat

@tresat This should now be possible with a filter function plugin. You can pass the source.diff.files to this function and use JavaScript to both detect the presence of TODO comments and identify the line number in the response, like so:

{{ source.diff.files | myPlugin }}

Let me know if you have more questions.

BenLloydPearson avatar Jan 10 '24 14:01 BenLloydPearson

I also created a new discussion post for this idea in our new forum dedicated to gitStream plugins: https://github.com/linear-b/gitstream/discussions/417

BenLloydPearson avatar Jan 10 '24 14:01 BenLloydPearson

I'm reopening this because I realize we only solved half of this problem and still need the ability to comment on lines of code.

BenLloydPearson avatar Feb 09 '24 18:02 BenLloydPearson