feat: create new MR diff comments
This MR introduces a feature that allows users to comment on MR diff. It removes feature flag so the commenting ranges are visible by default.
Error handling
In a case that the extension fails to create a comment (e.g. network failure), we show the user a message and store the comment text in the log. The comment is not lost, but it's not trivial to try to resend the comment.
{
"userMessage": "Extension failed to create the comment.\n Open extension logs to see your comment text and find more details about the error",
"errorMessage": "MR(77670491), {\"baseSha\":\"1f0fa02de1f6b913d674a8be10899fb8540237a9\",\"headSha\":\"ee2c4f1b9e07894d896c247c24858bc513e3a53b\",\"startSha\":\"1f0fa02de1f6b913d674a8be10899fb8540237a9\",\"paths\":{\"oldPath\":\"test.js\",\"newPath\":\"test.js\"},\"oldLine\":8,\"newLine\":8}, FetchError: request to https://gitlab.com/api/graphql failed, reason: getaddrinfo ENOTFOUND gitlab.com",
"stack": [
"Error: MR(77670491), {\"baseSha\":\"1f0fa02de1f6b913d674a8be10899fb8540237a9\",\"headSha\":\"ee2c4f1b9e07894d896c247c24858bc513e3a53b\",\"startSha\":\"1f0fa02de1f6b913d674a8be10899fb8540237a9\",\"paths\":{\"oldPath\":\"test.js\",\"newPath\":\"test.js\"},\"oldLine\":8,\"newLine\":8}, FetchError: request to https://gitlab.com/api/graphql failed, reason: getaddrinfo ENOTFOUND gitlab.com",
"\tat GitLabNewService.<anonymous> (/Users/tomas/workspace/gitlab-vscode-extension/out/src/gitlab/gitlab_new_service.js:349:95)",
"\tat Generator.throw (<anonymous>)",
"\tat rejected (/Users/tomas/workspace/gitlab-vscode-extension/out/src/gitlab/gitlab_new_service.js:6:65)",
"\tat processTicksAndRejections (internal/process/task_queues.js:93:5)"
]
}
How to review
This MR is a bit larger. The key to understanding this MR is to understand the createNewComment
method: !266 (comment 589983226). The rest of the MR are tests and some helper functions.
Related to #342 (closed)
Edited by Tomas Vik