Skip to content

Instantly share code, notes, and snippets.

@rajrao
Last active November 7, 2022 20:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rajrao/b581cc00b380033f60aad18e1d20056b to your computer and use it in GitHub Desktop.
Save rajrao/b581cc00b380033f60aad18e1d20056b to your computer and use it in GitHub Desktop.

The following JSON goes into the user settings.json file for VSCode.

For more information see: https://blog.aggregatedintelligence.com/2021/11/gitlens-remote-provider-settings-for.html

"gitlens.remotes": [{
        "regex": "https:\\/\\/(git-codecommit\\.us-west-2\\.amazonaws\\.com)\\/v1/repos\\/(.+)",
        "type": "Custom",
        "name": "AWS Code Commit",
        "protocol": "https",
        "urls": {
            "repository": "https://us-west-2.console.aws.amazon.com/codesuite/codecommit/repositories/${repo}/browse?region=us-west-2",
            "branches": "https://us-west-2.console.aws.amazon.com/codesuite/codecommit/repositories/${repo}/branches?region=us-west-2",
            "branch": "https://us-west-2.console.aws.amazon.com/codesuite/codecommit/repositories/${repo}/browse/refs/heads/${branch}?region=us-west-2", //
            "commit": "https://us-west-2.console.aws.amazon.com/codesuite/codecommit/repositories/${repo}/commit/${id}?region=us-west-2",
            "file": "https://us-west-2.console.aws.amazon.com/codesuite/codecommit/repositories/${repo}/browse/refs/heads/${branch}/--/${file}?region=us-west-2&lines=${line}",
            "fileInBranch": "https://us-west-2.console.aws.amazon.com/codesuite/codecommit/repositories/${repo}/browse/refs/heads/${branch}/--/${file}?region=us-west-2&lines=${line}",
            "fileInCommit": "https://us-west-2.console.aws.amazon.com/codesuite/codecommit/repositories/${repo}/browse/${id}/--/${file}?region=us-west-2&lines=${line}",
            "fileLine": "${line}-${line}",
            "fileRange": "${start}-${end}"
            }
        }]
@RealGuillaume
Copy link

Hi there, thank you for this, It is usefull!
You might want to replace "fileLine": "{line}", with "fileLine": "${line}-${line}",
That way, the link work witouth making a selection in vscode

@rajrao
Copy link
Author

rajrao commented Jan 7, 2022

@RealGuillaume updated the gist with your suggestions

@DiegoFleitas
Copy link

DiegoFleitas commented Mar 23, 2022

Thanks

EDIT:
Btw I needed to set up a repo that used a ssh config file today, these threads were mighty useful. (for my specific case I only need to tweak up the regex to match what the output of git remote -vv )
gitkraken/vscode-gitlens#1736
gitkraken/vscode-gitlens#1449

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment