Linker Documentation

Complete guide for intelligent import management

Introduction

What is Linker?

Linker is an intelligent VS Code extension that automatically updates import statements across your entire codebase when you rename or move files and folders. It supports multiple programming languages and provides a visual preview of all changes before applying them.

Why Use Linker?

  • Save Time: No more manually finding and updating imports
  • Prevent Errors: Avoid broken imports during refactoring
  • Multi-Language: Works with JavaScript, TypeScript, Python, Java, Go, and CSS
  • Visual Preview: See all changes before applying them
  • Undo/Redo: Full history tracking with easy reversion

Key Benefits

  • Zero Configuration — Works out-of-the-box with smart defaults
  • Visual Feedback — See exactly what will change before applying
  • Format Preservation — Maintains your code style (quotes, semicolons, indentation)
  • Performance Optimized — Handles large codebases (1000+ files) efficiently
  • Production Ready — Battle-tested with robust error handling

Installation

Method 1: VS Code Marketplace (Recommended)

  1. 1.Open Visual Studio Code
  2. 2.Click the Extensions icon in the sidebar or press Ctrl+Shift+X
  3. 3.Search for "Linker" or "Import Linker"
  4. 4.Click Install
  5. 5.Reload VS Code if prompted

Method 2: Command Line

Open your terminal and run:

code --install-extension linkerdev.import-linker

Method 3: Manual Installation

  1. 1.Download the .vsix file from GitHub Releases
  2. 2.In VS Code, go to Extensions (Ctrl+Shift+X)
  3. 3.Click the menu at the top
  4. 4.Select "Install from VSIX..."
  5. 5.Choose the downloaded file

Verify Installation

After installation:

  • Check that Linker appears in your Extensions list
  • Open the Command Palette (Ctrl+Shift+P)
  • Type "Linker" and you should see Linker commands

Getting Started

Quick Start (3 Steps)

Step 1: Rename a File

  1. Open your project in VS Code
  2. In the Explorer, right-click on any file
  3. Select Rename or press F2
  4. Type the new name and press Enter

Step 2: Review the Preview

Linker will show a preview window with:

  • List of files that will be modified
  • Before and after comparison of each import
  • Total number of imports to update

Step 3: Apply or Cancel

  • Click Apply to update all imports
  • Click Cancel to abort the operation
  • All changes happen instantly

Your First Example

Create two files and try renaming one:

utils.ts

export const greet = (name: string) => {
  return `Hello, ${name}!`;
};

app.ts

import { greet } from './utils';

console.log(greet('World'));

Try renaming utils.ts to helpers.ts

Linker will automatically update the import in app.ts

Supported Languages

JavaScript / TypeScript

Supported Import Patterns:

// ES6 Imports
import Component from './Component';
import { named } from './utils';
import * as utils from './utils';

// CommonJS
const utils = require('./utils');
const { helper } = require('../helpers');

// Dynamic Imports
const module = await import('./dynamic');

// Re-exports
export { something } from './other';
export * from './all';

// Type Imports (TypeScript)
import type { User } from './types';

File Extensions: .js, .ts, .jsx, .tsx, .mjs, .cjs

Python

Supported Import Patterns:

# Absolute imports
import utils
import utils.helpers
from utils import helper
from utils.helpers import format_date, format_time

# Relative imports
from . import helpers
from .helpers import format_date
from .. import utils
from ..utils.helpers import format_date

# Import with alias
import utils as u
from utils import helper as h

File Extensions: .py

Note: Linker preserves relative vs absolute import style and automatically converts dot notation

Java

Supported Import Patterns:

// Package imports
import com.example.utils.Helper;
import com.example.utils.*;

// Static imports
import static com.example.utils.Helper.doSomething;
import static com.example.utils.Constants.*;

File Extensions: .java

Note: Updates both regular and static imports. Package notation is preserved

Go

Supported Import Patterns:

// Single imports
import "fmt"
import "project/utils"

// Block imports
import (
    "fmt"
    "log"
    "project/utils"
    "project/helpers"
)

// Import with alias
import (
    u "project/utils"
    h "project/helpers"
)

File Extensions: .go

Note: Go imports reference packages (folders), not individual files. Renaming a folder updates all imports of that package

CSS / SCSS / LESS

Supported Import Patterns:

/* CSS @import */
@import "styles/variables.css";
@import url("styles/mixins.css");
@import url('styles/reset.css');

/* SCSS/LESS @import */
@import 'base/variables';
@import 'components/buttons';
@import '../shared/mixins';

File Extensions: .css, .scss, .less

Note: Supports both @import and @import url() syntax. File extensions can be included or omitted

Features

Visual Diff Preview

Shows you exactly what will change before applying updates.

How to use:

  1. 1.Rename a file or folder
  2. 2.A preview window appears showing each file that will be modified
  3. 3.Review before/after comparison for each import

Configuration:

{
  "linker.preview.diffView": true,
  "linker.preview.layout": "side-by-side"
}

Undo/Redo System

Tracks all import changes so you can easily revert or reapply them.

Keyboard Shortcuts:

Undo: Ctrl+Alt+Z (Windows/Linux) or Cmd+Alt+Z (Mac)

Redo: Ctrl+Alt+Y (Windows/Linux) or Cmd+Alt+Y (Mac)

Configuration:

{
  "linker.history.enabled": true,
  "linker.history.maxEntries": 50
}

Format Preservation

Maintains your code style when updating imports.

Preserves:

  • Quote Style: Single quotes, double quotes, or backticks
  • Semicolons: Present or absent
  • Indentation: Spaces or tabs
  • Line Breaks: Empty lines and spacing

Configuration:

{
  "linker.formatting.quoteStyle": "auto",
  "linker.formatting.semicolons": "auto"
}

TypeScript Path Aliases

Resolves and updates TypeScript path aliases from tsconfig.json.

Example tsconfig.json:

{
  "compilerOptions": {
    "baseUrl": "./src",
    "paths": {
      "@/*": ["*"],
      "@components/*": ["components/*"],
      "~/*": ["*"]
    }
  }
}

Watch Linker in Action:

Automatically updates:

// Before renaming utils → helpers
import { validateEmail } from '@/utils/validators';

// After renaming (auto-updated)
import { validateEmail } from '@/helpers/validators';

Folder Rename Support

Updates all imports when you rename or move folders.

Example:

// Before: Folder named "services"
import { fetchUsers } from '../services/userService';

// After: Renamed to "api"
import { fetchUsers } from '../api/userService';

Git Integration

Uses git mv for tracked files and optionally auto-stages changes.

Benefits:

  • Preserves Git history
  • Works with Git workflows
  • Automatic staging of modified imports

Configuration:

{
  "linker.git.enabled": true,
  "linker.autoStageChanges": false
}

Configuration

Access via: File → Preferences → Settings → Search "Linker"

Basic Settings

{
  // File types to scan for imports
  "linker.fileExtensions": [
    "js", "ts", "jsx", "tsx", "mjs", "cjs",
    "py",
    "java",
    "go",
    "css", "scss", "less"
  ],
  
  // Folders to exclude from scanning
  "linker.exclude": [
    "**/node_modules/**",
    "**/.git/**",
    "**/dist/**",
    "**/build/**",
    "**/__pycache__/**",
    "**/*.egg-info/**"
  ]
}

Preview Settings

{
  // Enable visual diff preview
  "linker.preview.diffView": true,
  
  // Layout: "side-by-side" or "inline"
  "linker.preview.layout": "side-by-side"
}

Formatting Settings

{
  // Quote style: "single", "double", or "auto"
  "linker.formatting.quoteStyle": "auto",
  
  // Semicolons: "always", "never", or "auto"
  "linker.formatting.semicolons": "auto"
}

History Settings

{
  // Enable undo/redo functionality
  "linker.history.enabled": true,
  
  // Maximum number of history entries
  "linker.history.maxEntries": 50
}

Language Settings

{
  // Enable/disable specific language support
  "linker.multiLanguage.python": true,
  "linker.multiLanguage.java": true,
  "linker.multiLanguage.go": true,
  "linker.multiLanguage.css": true
}

Git Settings

{
  // Use git mv for tracked files
  "linker.git.enabled": true,
  
  // Automatically stage files modified by Linker
  "linker.autoStageChanges": false
}

Performance Settings

{
  // Debounce delay in milliseconds (default: 500)
  "linker.performance.debounceDelay": 500,
  
  // Batch size for processing files (default: 50)
  "linker.performance.batchSize": 50,
  
  // Enable file caching for better performance
  "linker.performance.caching": true
}

Complete Settings Reference

SettingTypeDefaultDescription
linker.fileExtensionsArrayAll supportedFile types to scan
linker.excludeArraynode_modules, .gitPatterns to ignore
linker.preview.diffViewBooleantrueShow visual preview
linker.preview.layoutStringside-by-sideDiff layout style
linker.formatting.quoteStyleStringautoQuote preference
linker.formatting.semicolonsStringautoSemicolon usage
linker.history.enabledBooleantrueEnable undo/redo
linker.history.maxEntriesNumber50History limit
linker.multiLanguage.pythonBooleantruePython support
linker.multiLanguage.javaBooleantrueJava support
linker.multiLanguage.goBooleantrueGo support
linker.multiLanguage.cssBooleantrueCSS support
linker.git.enabledBooleantrueUse git mv
linker.autoStageChangesBooleanfalseAuto-stage in Git
linker.performance.debounceDelayNumber500Debounce delay (ms)
linker.performance.batchSizeNumber50Batch size
linker.performance.cachingBooleantrueEnable caching

Recommended Configurations

For JavaScript/TypeScript Projects

{
  "linker.fileExtensions": ["js", "ts", "jsx", "tsx"],
  "linker.exclude": ["**/node_modules/**", "**/dist/**"],
  "linker.formatting.quoteStyle": "single",
  "linker.formatting.semicolons": "never"
}

For Python Projects

{
  "linker.fileExtensions": ["py"],
  "linker.exclude": ["**/__pycache__/**", "**/venv/**"],
  "linker.multiLanguage.python": true
}

For Multi-Language Projects

{
  "linker.fileExtensions": ["js", "ts", "py", "java", "go"],
  "linker.exclude": [
    "**/node_modules/**",
    "**/__pycache__/**",
    "**/target/**"
  ],
  "linker.multiLanguage.python": true,
  "linker.multiLanguage.java": true,
  "linker.multiLanguage.go": true
}

Examples

Example 1: Simple File Rename

Scenario: Rename utils.ts → helpers.ts

Before:

// src/app.ts
import { formatDate } from './utils';

After (Linker auto-updates):

// src/app.ts
import { formatDate } from './helpers';

Example 2: Folder Rename

Scenario: Rename services/ → api/

Before:

import { fetchUsers } from '../services/userService';

After (Linker auto-updates):

import { fetchUsers } from '../api/userService';

Example 3: Python Imports

Scenario: Rename helpers.py → utilities.py

Before:

from utils.helpers import format_date

After (Linker auto-updates):

from utils.utilities import format_date

Example 4: Java Package Imports

Scenario: Rename Helper.java → Utility.java

Before:

import com.example.utils.Helper;
import static com.example.utils.Helper.doSomething;

After (Linker auto-updates):

import com.example.utils.Utility;
import static com.example.utils.Utility.doSomething;

Example 5: CSS Imports

Scenario: Rename variables.css → vars.css

Before:

@import "partials/variables.css";

After (Linker auto-updates):

@import "partials/vars.css";

Keyboard Shortcuts

ActionWindows/LinuxMac
Undo last import changesCtrl+Alt+ZCmd+Alt+Z
Redo import changesCtrl+Alt+YCmd+Alt+Y
Show import historyCommand Palette → "Linker: Show History"
Clear import historyCommand Palette → "Linker: Clear History"

Tip: Access Command Palette with Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (Mac)

Troubleshooting

Issue: "No import updates needed"

Possible Causes:

  • File not imported anywhere
  • Imports already correct
  • File type not in fileExtensions

Solutions:

  1. 1.Check that file is actually imported
  2. 2.Verify linker.fileExtensions includes the file type
  3. 3.Check linker.exclude is not blocking the directory

Issue: Preview not showing

Possible Causes:

  • Preview disabled in settings
  • VS Code UI issue

Solutions:

  1. 1.Enable preview: "linker.preview.diffView": true
  2. 2.Reload VS Code: Ctrl+Shift+P → "Reload Window"
  3. 3.Check VS Code console for errors

Issue: Wrong quote style used

Possible Causes:

  • Auto-detection could not determine style
  • Multiple styles in same file

Solutions:

  1. 1.Set explicit style: "linker.formatting.quoteStyle": "single"
  2. 2.Ensure consistent style in your codebase
  3. 3.Run Prettier/ESLint before using Linker

Issue: Slow performance

Possible Causes:

  • Large workspace (1000+ files)
  • Not enough exclusions

Solutions:

  1. 1.Add more exclusions (dist, build, node_modules)
  2. 2.Limit file extensions to only what you need
  3. 3.Close unused workspace folders

Getting Help

  • Check Console: Help → Toggle Developer Tools → Console tab
  • GitHub Issues: Report a bug on GitHub
  • Community: GitHub Discussions for questions

Best Practices

1. Review Before Applying

Always review the preview before clicking "Apply":

  • Check all files are correct
  • Verify import paths look right
  • Look for unexpected changes

2. Use Version Control

Protect your codebase:

  • Commit before large refactoring
  • Review Git diff after Linker updates
  • Use branches for major renames

3. Configure Exclusions

Exclude unnecessary directories for better performance:

{
  "linker.exclude": [
    "**/node_modules/**",
    "**/dist/**",
    "**/build/**",
    "**/.next/**",
    "**/coverage/**"
  ]
}

4. Consistent Code Style

Maintain consistent formatting:

  • Use Prettier or ESLint
  • Set explicit quoteStyle if needed
  • Keep semicolon usage consistent

5. Test After Refactoring

After using Linker:

  • Run your tests
  • Check the app runs
  • Verify imports resolve correctly

FAQ

General Questions

Is Linker free?

Yes, Linker is completely free and open-source (MIT License).

Does it work offline?

Yes, Linker works entirely offline with no internet required.

Does it modify my files automatically?

Only after you review and approve the preview.

Can I undo changes?

Yes, use Ctrl+Alt+Z or the undo command.

Technical Questions

What languages are supported?

JavaScript, TypeScript, Python, Java, Go, CSS/SCSS/LESS.

Does it work with TypeScript path aliases?

Yes, Linker reads your tsconfig.json automatically.

Can it rename folders?

Yes, folder renames are fully supported.

Does it work in monorepos?

Yes, configure exclusions for optimal performance.

Performance Questions

How large of a project can it handle?

Tested with projects up to 1000+ files efficiently.

Will it slow down VS Code?

No, Linker uses smart caching and batch processing.

Can I limit which files are scanned?

Yes, use fileExtensions and exclude settings.

Need More Help?

Join Discord