Discussion sign and diagnostics (#78)

This MR adds support for in-line comments in the review pane. This allows you to view comments (as diagnostics) directly in the Neovim buffers that you are reviewing. You can then jump to them directly in the discussion tree if you want to reply, edit, and so forth.
This commit is contained in:
johnybx
2023-11-13 15:06:04 +01:00
committed by GitHub
parent 59557e464b
commit 58c3dcc9ec
8 changed files with 737 additions and 59 deletions

View File

@@ -33,8 +33,20 @@ func ExtractGitInfo(getProjectRemoteUrl func() (string, error), getCurrentBranch
return GitProjectInfo{}, fmt.Errorf("Could not get project Url: %v", err)
}
// play with regex at: https://regex101.com/r/P2jSGh/1
re := regexp.MustCompile(`(?:^git@.+:|^https?:\/\/.+?[^\/:]\/)(.+)\/([^\/]+)\.git$`)
// play with regex at: https://regex101.com/r/P2jSGh/1
/*
This should match following formats:
namespace: namespace, projectName: dummy-test-repo:
https://gitlab.com/namespace/dummy-test-repo.git
git@gitlab.com:namespace/dummy-test-repo.git
ssh://git@gitlab.com/namespace/dummy-test-repo.git
namespace: namespace/subnamespace, projectName: dummy-test-repo:
ssh://git@gitlab.com/namespace/subnamespace/dummy-test-repo
https://git@gitlab.com/namespace/subnamespace/dummy-test-repo.git
git@git@gitlab.com:namespace/subnamespace/dummy-test-repo.git
*/
re := regexp.MustCompile(`(?:^https?:\/\/|^ssh:\/\/|^git@)(?:[^\/:]+)[\/:](.*)\/([^\/]+?)(?:\.git)?$`)
matches := re.FindStringSubmatch(url)
if len(matches) != 3 {
return GitProjectInfo{}, fmt.Errorf("Invalid Git URL format: %s", url)