Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>CiteCodeNew to Visual Studio Code? Get it now.
CiteCode

CiteCode

QingFeng

|
3 installs
| (0) | Free
Copy code citations (file path with line ranges) to quickly point to code locations
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

CiteCode

English | 简体中文

A VSCode extension for quickly copying code citations (file path + line range).

Select code, copy its citation in one click:

src/index.js:21-30

Paste it into an issue, a PR comment, your docs, or send it directly to AI tools like Codex / OpenCode to pinpoint a code location.

Features

  • Copy the citation for the current selection: src/index.js:21-30
  • Single-line selections copy only src/index.js:21
  • With no selection, the line under the cursor is cited
  • Multiple selections are output one per line (configurable to join with commas)
  • CodeLens buttons appear above the selection: Copy Reference / Copy Reference and Snippet; clicking copies all selections
  • Context menu: Copy Code Path (path + line range) and Copy File Path (path only), also available from the command palette
  • Keyboard shortcuts: Ctrl+Alt+C copies the code path / Ctrl+Alt+F copies the file path (macOS: Cmd+Alt+C / Cmd+Alt+F)
  • Configurable: path format (relative/absolute), include columns, join multiple selections, CodeLens toggle

Installation

Search for CiteCode in the VSCode extension panel (Ctrl+Shift+X) and click Install; or click Install on the Visual Studio Marketplace page.

For local development: run npm run build && npx vsce package in the project directory, then use "Install from VSIX..." to install the generated cite-code-x.y.z.vsix (see Development below).

Requirements

  • Visual Studio Code 1.85 or later

Usage

Method 1: CodeLens buttons (recommended)

  1. Select code; two buttons appear above the first line of the selection
  2. Click Copy Reference to copy src/index.js:21-30
  3. Click Copy Reference and Snippet to copy the citation plus the code snippet

Method 2: Context menu / command palette

  1. Place the cursor on the target code (with a selection, the selection is cited; without one, the line under the cursor is cited)

  2. Right-click → Copy Code Path (relative path + line range); choose Copy File Path to copy only the file path without line numbers. Or use the shortcuts Ctrl+Alt+C / Ctrl+Alt+F (macOS: Cmd+Alt+C / Cmd+Alt+F, customizable in keybindings.json), or run the commands from the command palette

  3. Paste the citation into an issue, a PR comment, or your docs, for example:

    The problem is in src/index.js:21-30
    

    The same format also works with AI tools: paste it into Codex / OpenCode and they can pinpoint the exact code location.

Configuration

Setting Default Description
citeCode.pathFormat relative Path format for all copy entry points (context menu, shortcuts, CodeLens, command palette): relative (e.g. src/index.js) or absolute (e.g. /home/user/project/src/index.js); applies to both code paths and file paths
citeCode.includeColumns false When true, citations include start and end columns (e.g. src/index.js:21:10-30:17)
citeCode.joinMultipleSelections false When true, multiple selections are joined with commas on one line (e.g. src/index.js:58-64, 80-85); default is one line per selection
citeCode.showCodeLens true When false, hides the CodeLens buttons (the context menu still works)

Development

  • npm run typecheck – TypeScript type checking
  • npm run build / npm run watch – esbuild bundling
  • npm run unit-test – unit tests for pure logic (no editor needed)
  • npm run integration-test – integration tests in a real VSCode instance
  • Press F5 in VSCode – launch the Extension Development Host for debugging
  • Package for the Marketplace: npx vsce package

License

MIT

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