Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>Copy Info with ContextNew to Visual Studio Code? Get it now.
Copy Info with Context

Copy Info with Context

Donald Chan

|
238 installs
| (0) | Free
Copy code snippets with intelligent contextual information - filename, line numbers, smart path detection, and automatic PII masking. Perfect for documentation, code reviews, debugging, and sharing code with proper attribution and privacy protection.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Copy Info with Context - VS Code Extension

Born from the frustration of constantly copying and pasting code snippets, data, and configuration fragments without any context about where they came from or what they represented.

A VS Code extension that copies code snippets with intelligent contextual information - filename, line numbers, and smart path detection for structured data. Perfect for documentation, code reviews, debugging, and sharing code with proper attribution.

The Problem This Solves

Have you ever:

  • Copied a JSON snippet and forgot which property path it came from?
  • Shared XML data without knowing which nested element you were looking at?
  • Pasted code in Slack without line numbers, making it impossible to reference?
  • Lost track of which file a configuration came from?
  • Struggled to explain CSV data without column context?

This extension was created to solve exactly these problems - providing rich context for any code or data you copy.

Features

  • Context Detection: JSON/JSONC property paths, XML/HTML hierarchy, CSV/TSV/PSV columns, function/class context, CSS selectors.
  • Multiple Output Formats: Plain text, HTML, Markdown, ANSI colored, custom formats.
  • Syntax Highlighting: 10+ languages, smart color coding, auto-detects delimited files.
  • Smart Data Masking: Detects and masks 40+ types of PII (email, phone, address, credit cards, SSN, IBAN, BSB, TFN, ABN, passports, IDs, etc.)
    • Industry Presets: Basic, Financial, Healthcare, Enterprise, Custom — each preset now enables the right PII types, and you can switch presets straight from the right-click menu (fixed and added in v1.8.0).
    • Masking Strategies: Partial, Full, Structural, Hash, Redact
    • Manage masked/excluded fields by right-click: Add a field to the always-mask (deny) or never-mask (allow) list, or manage both lists, straight from the editor context menu — no settings JSON editing required (shown only when masking is enabled).
    • Disabled by default – Enable in settings
  • CSV Intelligence: Delimiter detection, quote-aware parsing, column type detection, ASCII table rendering.
  • Performance Optimizations: Fast parsing, memory-efficient, O(1) lookups, lazy RegExp compilation.
  • VS Code Integration: Keyboard shortcuts, right-click menu, command palette, status bar indicator.

Quick Start

  1. Install from VS Code Marketplace
  2. Copy code/data with context using:
    • Ctrl+Alt+C / Cmd+Alt+C – Copy with context
    • Ctrl+Alt+H / Cmd+Alt+H – Copy with HTML highlighting
  3. Configure features in VS Code settings (Ctrl+, → search "copy info with context")

Configuration

See Configuration Guide for all settings.

Example: Enable Data Masking

{
  "copyInfoWithContext.enableDataMasking": true,
  "copyInfoWithContext.maskingPreset": "financial"
}

Usage Examples

  • JSON: Shows property path and array indices
  • XML: Shows element hierarchy and sibling indices
  • CSV: Shows column context and supports 4 output modes
  • Functions/Classes: Shows containing function/class name
  • HTML/Markdown/ANSI: Rich formatted output for documentation, Slack, email

See Usage Examples for details.

Key Features in Latest Version

✨🐛 v1.9.0: Column-Aware Masking for Delimited .txt Files

  • Column-aware masking now applies to delimited .txt and other non-CSV files when they look tabular with a header row — column-type detection plus your deny/allow lists, the same as .csv/.tsv. Plain prose and headerless data fall back to normal masking. Also fixes multi-delimiter masking so the file's actual delimiter (tab, pipe, semicolon, comma) is detected and preserved.
  • See full details in CHANGELOG.md

🐛 v1.8.1: Masking Bug Fixes

  • Deny/allow lists now apply across CSV, XML, and JSON; repeated sensitive values are masked in every occurrence; CSV/TSV copy with masking enabled no longer errors; and impossible calendar dates are no longer accepted as dates of birth.
  • See full details in CHANGELOG.md

🐛🎯 v1.8.0: Presets Fixed + Apply Preset from the Right-Click Menu

  • Fixed: Masking presets now actually apply. Previously, selecting basic, financial, healthcare, or enterprise via maskingPreset had no effect due to a key mismatch — every preset silently fell back to the defaults. Each preset now enables the correct PII detection types:
    • Basic — email and phone only.
    • Financial Services — banking, credit cards, and account numbers (Australian BSB/TFN/ABN, IBAN, SWIFT, routing numbers).
    • Healthcare — SSN, date of birth, address, national ID, Australian Medicare, passport, and driver's licence, plus email and phone.
    • Enterprise — all detection types enabled.
    • None / Custom are unchanged (no preset filtering / use your own type toggles and custom patterns).
    • If you had already selected a preset, you now get that preset's behaviour automatically — a behaviour change in your favour.
  • Added: A new editor context menu command Masking: Apply Preset… opens a QuickPick of all six presets (with descriptions and your current one marked) and applies your choice immediately — no reload, no settings JSON editing. It appears only when data masking is enabled, does not destructively overwrite your per-type toggles, and your deny/allow lists continue to apply on top.
  • See full details in CHANGELOG.md

🎯 v1.7.0: Manage Masking Lists from the Right-Click Menu

  • Three new editor context menu commands manage which fields are masked or excluded — no settings JSON editing required.
    • Masking: Add Field to Deny List (Always Mask)
    • Masking: Add Field to Allow List (Never Mask)
    • Masking: Manage Deny/Allow Lists… (view and multi-select remove entries)
  • Field names pre-fill from your selection or the word under the cursor; dedup is case-insensitive while preserving your original casing.
  • Adding a field already on the opposite list prompts you to move it (Allow > Deny > Auto-Detection).
  • The commands appear only when data masking is enabled, write to User (Global) settings, and take effect immediately — no reload needed.
  • See full details in CHANGELOG.md

🐛 v1.6.2: CDATA Masking Bug Fixes

  • Fixed CDATA line merging caused by \s-based patterns (BSB, TFN, phone, etc.) matching across newlines inside CDATA sections.
  • Fixed outer XML tag corruption that occurred when length-changing masks were applied alongside CDATA replacements.
  • See full details in CHANGELOG.md

🏗️ v1.6.0: Modular Architecture & Performance Optimization

  • Monolithic masking engine split into 8 focused modules for maintainability, speed, and testability.
  • 66% code reduction (1,739 → ~590 lines).
  • 97% faster module load time, 50-70% fewer false positives, O(1) lookups.
  • Enhanced maintainability and testability.
  • See full details in CHANGELOG.md

Documentation & Guides

  • 🔒 Data Masking Guide
  • 📊 CSV Intelligence Guide
  • 🎯 Confidence Scoring Example
  • 🧠 Context-Aware Masking
  • 📜 Full Changelog

Supported File Types

Category Formats/Languages
Programming JS, TS, Python, C#, Java, Go, Rust
Data JSON, XML, HTML, YAML, CSV, TSV, PSV, SSV
Styling CSS, SCSS, SASS, LESS
Markup HTML, XML, Markdown
Configuration YAML, JSON, TOML, INI

Development

git clone https://github.com/dwmchan/copy-info-with-context.git
cd copy-info-with-context
npm install
npm run compile
npm test

Note on the test runner: The project's tests are written in TypeScript and compiled to JavaScript under out/test. The test entrypoint is src/test/runTest.ts, which imports the individual test suites; the test script runs npm run compile and then executes node ./out/test/runTest.js. Keep src/test/runTest.ts as the canonical place to add new test suites.

Contributing

Contributions welcome! See CONTRIBUTING.md.

License

MIT License – see LICENSE.

Support

  • Issues
  • CHANGELOG
  • Feature Guides

Credits

Created by Donald Chan (donald@iendeavour.com.au)

Special thanks to the VS Code community for feedback and suggestions.

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