Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Link PatternsNew to Visual Studio Code? Get it now.
Link Patterns

Link Patterns

Dan Levett

|
10,783 installs
| (3) | Free
Automatically turn text into links based upon regex patterns.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Link Patterns

Link Patterns is a VS Code extension that automatically turns text into links based upon regex patterns.

Animated gif showing a code comment that has a link that can be clicked

Configuration

Multiple patterns can be defined in your VS Code settings. The following examples highlight common use cases.

{
  "patternlinks.rules": [
    {
      "linkPattern": "ISSUE-\\d+",
      "linkTarget": "https://myorg.atlassian.net/browse/$0"
      // Example URL: https://myorg.atlassian.net/browse/ISSUE-299
    },
    {
      "linkPattern": "(FOO|BAR)-(\\d+)",
      "linkTarget": "https://example.com/$1/$2",
      // Example URL: https://example.com/FOO/123

      // Limit to specific languages
      "languages": ["plaintext", "markdown"]
    },
    {
      "linkPattern": "SKU([A-Z_]+)",
      "linkTarget": "https://shop.com?search=$1&min-price=\\$1"
      // Example URL: https://shop.com?search=PRODUCT_CODE&min-price=$1
      // Here, `\` is being used as an escape character to prevent substitution
      // of the second `$1`.
    }
  ]
}

Rule precedence

When two rules apply to the same text, the one defined last wins.

{
  "patternlinks.rules": [
    // Match links like repo-name#22 to the relevant pull request
    {
      "linkPattern": "([a-z_-]+)#(\\d+)",
      "linkPatternFlags": "i", // Case insensitive
      "linkTarget": "https://github.com/myorg/$1/pull/$2"
    },
    // Match links like special-case#22 to the relevant pull request,
    // which is in a different github organisation, and has a long,
    // inconvenient name.
    {
      "linkPattern": "special-case#(\\d+)",
      "linkTarget": "https://github.com/someorg/really-long-inconvenient-name/pull/$1"
    }
  ]
}

The text special-case#22 technically matches both of these rules, but the second one is the one that takes effect.

Contributing

  1. Clone this repository
  2. npm install to install dependencies
  3. npm run watch to start the compiler in watch mode
  4. Open this folder in VS Code and start the debugger (F5).
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft