Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>PR File RelationshipsNew to Visual Studio Code? Get it now.
PR File Relationships

PR File Relationships

jainsamwork

|
1 install
| (0) | Free
Shows top 10 related files based on GitHub PR analysis
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

PR File Relationships

A VS Code extension that analyzes GitHub Pull Request history to show you the top related files based on how often they're modified together in PRs.

Features

  • Automatic PR Analysis: Fetches and analyzes merged PRs from your GitHub repository
  • Related Files Tree View: Shows the top 10 files most frequently changed together with your current file
  • Quick Pick Menu: Quickly jump to related files with Cmd+Shift+P → "PR Relations: Show Related Files"
  • Status Bar Integration: See how many related files exist for your current file at a glance
  • Configurable Weight Threshold: Filter relationships by minimum edge weight (how many times files changed together)
  • Local Caching: Cache PR data locally to avoid repeated GitHub API calls

Prerequisites

This extension requires the github-pr-graph Go binary to be built in your workspace:

go build -o github-pr-graph main.go

Make sure you have:

  • Go installed
  • GitHub token set (either GITHUB_TOKEN env var or gh CLI logged in)

Usage

1. Analyze PRs

First, analyze PRs from your repository:

  • Open Command Palette (Cmd+Shift+P / Ctrl+Shift+P)
  • Run "PR Relations: Analyze PRs"
  • Enter your GitHub owner and repo when prompted (or configure in settings)

The extension will:

  1. Run the github-pr-graph tool
  2. Parse the generated graph data
  3. Build an adjacency map of file relationships

2. View Related Files

Once analysis is complete, you have two ways to see related files:

Tree View (Sidebar)

  • Click the PR Relationships icon in the activity bar
  • Open any file in your workspace
  • The tree view automatically shows the top 10 related files

Quick Pick Menu

  • Open a file
  • Run "PR Relations: Show Related Files" command
  • Select a file from the list to open it

3. Status Bar

The status bar shows:

  • Number of related files for the current file
  • Number of PRs the file appeared in
  • Click it to show the quick pick menu

Configuration

Configure the extension in your workspace settings (.vscode/settings.json):

{
  "prFileRelationships.owner": "Zomato",
  "prFileRelationships.repo": "search-service",
  "prFileRelationships.numPRs": 100,
  "prFileRelationships.baseBranch": "dev",
  "prFileRelationships.minWeight": 2,
  "prFileRelationships.topN": 10
}

Settings

Setting Default Description
owner "" GitHub repository owner
repo "" GitHub repository name
numPRs 100 Number of PRs to analyze
baseBranch "dev" Base branch to filter merged PRs
minWeight 2 Minimum edge weight (files must have changed together at least this many times)
topN 10 Number of top related files to show

Commands

Command Description
PR Relations: Analyze PRs Fetch and analyze PRs (uses cache if available)
PR Relations: Show Related Files Show quick pick menu of related files for current file
PR Relations: Refresh Cache Re-fetch PRs from GitHub and update cache

How It Works

  1. Data Collection: The Go tool fetches merged PRs and files changed in each PR
  2. Graph Building: Creates a graph where:
    • Nodes = files
    • Edges = files changed in the same PR
    • Edge weight = number of PRs both files appeared in together
  3. Relationship Detection: For any file, finds connected files with weight above threshold
  4. Ranking: Sorts by weight (descending) and shows top N results

Example

If main.go and config.yaml were both modified in 5 different PRs:

  • Edge weight = 5
  • When viewing main.go, config.yaml appears in related files with weight 5
  • If minWeight = 2, this relationship will be shown

Tips

  • Start with cached analysis: Use --cache flag for faster subsequent runs
  • Adjust minWeight: Higher values show only strongly related files
  • Increase numPRs: More PRs = better relationship detection, but slower analysis
  • Use for code reviews: Quickly find files that often change together to understand dependencies

Development

Running the Extension

  1. Open this folder in VS Code
  2. Press F5 to open a new window with the extension loaded
  3. In the Extension Development Host window, open a workspace with the Go binary
  4. Run "PR Relations: Analyze PRs" to test

Building

npm run compile

Packaging

npm run package
vsce package

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft