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

Multiline comments #146510

Closed
alexr00 opened this issue Apr 1, 2022 · 19 comments
Closed

Multiline comments #146510

alexr00 opened this issue Apr 1, 2022 · 19 comments
Assignees
Labels
comments Comments Provider/Widget/Panel issues feature-request Request for new features or functionality on-testplan
Milestone

Comments

@alexr00
Copy link
Member

alexr00 commented Apr 1, 2022

The comments widget currently only allows commenting on a single line. For some use-cases of comments, such as code review comments, commenting on a range is not only beneficial, it's already supported by the underlying tooling (see GitHub pull requests for example). We should support a way to comment on a range. This support will require:

  • API that allows comments to be made on a range
  • UX that indicates commenting on a range is possible
  • UX that shows that an existing comment is on a range
    • In the editor for the comments widget
    • In the Comments view
@alexr00 alexr00 added feature-request Request for new features or functionality comments Comments Provider/Widget/Panel issues labels Apr 1, 2022
@alexr00 alexr00 added this to the April 2022 milestone Apr 1, 2022
@alexr00 alexr00 self-assigned this Apr 1, 2022
@alexr00
Copy link
Member Author

alexr00 commented Apr 1, 2022

@rebornix FYI since I think you also want this in notebooks and @laurentlb since I know you were interested in this.

@rebornix
Copy link
Member

rebornix commented Apr 1, 2022

@alexr00 if I understand correctly, the api already supports this since the comment is based on range other than line. The UX in the editor and panel doesn't take the range into account though, only the start line of the range.

@alexr00
Copy link
Member Author

alexr00 commented Apr 1, 2022

@rebornix yes, the API does currently support this! I was just outlining all the parts.

alexr00 added a commit to microsoft/vscode-pull-request-github that referenced this issue Apr 6, 2022
alexr00 added a commit to microsoft/vscode-pull-request-github that referenced this issue Apr 6, 2022
* Support multiline comments
Part of microsoft/vscode#146510

* Fix test
@alexr00
Copy link
Member Author

alexr00 commented Apr 12, 2022

First pass at UX for leaving a comment on a range and indicating that an existing comment is on a range:

Recording 2022-04-12 at 14 49 14

The comment thread range styling is a background + border that is based off of the peek view border color.

@IllusionMH
Copy link
Contributor

Looks great!

Is it possible to add explicit lines range to the header of comment as it is in GH with "Commenting on lines 63 to 66" as well?
For example: "Start discussion on lines 15 to 20" or "Start discussion (lines 15-20)" in your example

@alexr00
Copy link
Member Author

alexr00 commented Apr 13, 2022

Is it possible to add explicit lines range to the header of comment...

I do want to add this information somewhere, but the content of the header/title of the comment thread is owned by the extension that provides the comment. I will try adding the range info somewhere else in the comments widget.

alexr00 added a commit that referenced this issue Apr 13, 2022
alexr00 added a commit that referenced this issue Apr 19, 2022
@alexr00
Copy link
Member Author

alexr00 commented Apr 21, 2022

I've tried out adding line numbers in the comment thread title area, but I haven't found a place that I like it.
Example right aligned:
image
Example left aligned:
image

Since the extension controls the contents of the title, all we can do is append it in there, and it just ends up looking out of place. Individual extensions can of course put the line numbers in their in an integrated way themselves. The rest of the widget is comment node focused, not comment thread focused, so it doesn't belong there either.

Happy to have suggestions for where else to put it, but for now I will leave it out since the editor decoration already provides this info.

@alexr00 alexr00 closed this as completed Apr 21, 2022
@brianjmurrell
Copy link

brianjmurrell commented Apr 21, 2022

This should open the door to supporting ```suggestion blocks, yes? Surely there is a ticket for that, but given the genericness of the terms, I'm having a difficult time finding it. Anyone know off-hand?

I'm probably subscribed to an issue for that feature, however https://github.com/notifications/subscriptions is not showing that I am subscribed to any issues in this repo, which is clearly incorrect. I am subscribed to this issue for example.

I wonder if somebody from the @microsoft org can poke GitHub about this.

@IllusionMH
Copy link
Contributor

IllusionMH commented Apr 21, 2022

@alexr00 is it possible to extend comment block at the top for multiline comments as GH does? So it will be displayed above thread label (controlled by extension).
image

@alexr00
Copy link
Member Author

alexr00 commented Apr 21, 2022

@brianjmurrell this does indeed open the door for the suggestion feature in GitHub: microsoft/vscode-pull-request-github#603

@brianjmurrell
Copy link

@alexr00 Ha! That's the one, and yes, I am subscribed to it already. Too bad GitHub's tool to find all of your subscriptions is not listing anything from this repo.

Thanks for the pointer!

@brianjmurrell
Copy link

Hrm. This does not seem to be working for me. I try to click and drag but I just get a plus-sign that moves with my mouse cursor, no multi-line selecting for comment.

@alexr00
Copy link
Member Author

alexr00 commented May 11, 2022

Clicking and dragging on the + is not currently supported. Instead you make a text selection then click the +: #148214

@brianjmurrell
Copy link

Ahhh. I see. Thanks @alexr00!

@noalbalint
Copy link

hey @alexr00 thanks for implementing this, works really well!

just noticed one UX issue: when the comment is collapsed, it still shows the background and border on the code... fairly unpleasant to look at 😬

Screen Shot 2022-05-24 at 10 15 13 AM

ideally, that styling should only display if the comment is expanded, right? :)

@alexr00
Copy link
Member Author

alexr00 commented May 30, 2022

I intentionally left the background and border when the comment is collapsed so that there was a strong indication that the comment is there and it's how other code review tools I've used in the past have worked.

However, this is your code editor too and not just a code review tool. If there's lots of feedback that this is undesirable then we can change it. I could also have a separate theme color for when the comment is collapsed so that you could essentially hide the background and border in this case.

@laurentlb
Copy link
Contributor

I suspect it can be annoying to have the region always highlighted, in particular when the comment is resolved.

I don't have data or user feedback yet, I can share it in the future.
cc @albertelo

@hermannloose
Copy link
Contributor

I find the highlight distracting even with the comment card open. I would prefer a setting for the highlight to only show up when the comment card is moused over or focused.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 5, 2022
@alexr00
Copy link
Member Author

alexr00 commented Jun 15, 2022

Just FYI, #152067 will hide the range highlight when the thread is collapsed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
comments Comments Provider/Widget/Panel issues feature-request Request for new features or functionality on-testplan
Projects
None yet
Development

No branches or pull requests

7 participants