Gain deep insights into your VSCode environment with comprehensive context information. This project currently provides a VSCode extension as the client to extract your context as a JSON output. In the near future, it will soon be able to write the context to your MCP memory server as entities, relations, and observations. Next, it will be the client to a standalone VSCode Context MCP Server.
The VSCode Context extension provides detailed insights into your development environment. The following data is captured:
- Workspace folders and file structure
- Editor configuration (font size, tab size, etc.)
- File and search settings
- Active text editor information
- Visible text editors and their documents
- Terminal information and state
- Window focus and state changes
- Active editor language ID
- Available languages
- Language diagnostics and capabilities
- Active debug session information
- Breakpoints and their types
- Debug configurations
- Repository information
- Source control state (changes, conflicts, branch)
- Available tasks and their configurations
- Task execution information
- Problem matchers and presentation options
- Extension version and state
- Global and workspace extension state
- Activation events and commands
The extension provides these features through:
- Command palette integration
- Dedicated output channel for context data
- Event subscriptions for real-time updates
- Install the VSIX extension the source directory where you installed this project and ran npm run build.
- Open the Command Palette (
Ctrl+Shift+P
orCmd+Shift+P
) - Run the command:
VSCode Context: Extract Context
- View the output in the "VSCode Context" output channel
The extension can be configured through VSCode settings. Use the VS Code settings UI and filter to "vscode-context"
:
You can configure which context categories are included in the extracted context:
- Workspace: Includes information about your workspace folders, file system, and recently opened files
- Window: Includes information about the active window, editors, terminals, selections, and window state
- Language: Includes information about the current language, diagnostics, available languages, and language features
- Debug: Includes information about the active debug session, breakpoints, and debug configurations
- Source Control: Includes information about your git repositories, branches, and commit templates
- Tasks: Includes information about your configured tasks, execution settings, and problem matchers
- Extension: Includes information about the extension itself (version, state, settings)
- Extension Host: Includes information about the VS Code Extension host (platform, process)
- Settings: Includes the current VS Code settings
- Keybindings: Includes the current VS Code Keybindings
- Theme: Includes the current VS Code theme
- Views: Includes information about the current VS Code views
- Custom Editors: Includes information about any custom editors you have open
To capture a more complete context, actively use VS Code features before running the context extraction command. Here's how:
General Setup:
- Open VS Code: Start your Visual Studio Code instance
- Open a Workspace/Folder:
Open a folder or workspace (
File > Open Folder...
orFile > Open Workspace from File...
) - Open Files:
Open one or more files (double-click or
File > Open File...
). Use different languages to test language-specific context - Interact with Files:
- Make a text selection
- Ensure one file has focus
Populating Specific Context Areas:
- Workspace: Open a workspace that contains multiple folders to test
workspaceFolders
- Window:
- Open a file, and make sure it has focus
- Make a selection
- Open an integrated terminal (
Ctrl+
or
Cmd+``)
- Debug:
- Open a file
- Set a breakpoint
- Go to the Run and Debug view (
Ctrl+Shift+D
orCmd+Shift+D
) - Click "Run and Debug" (the session does not need to complete)
- Source Control:
- Open a folder or workspace initialized as a Git repository
- Optionally make changes to a file (do not commit yet)
Executing the Context Extraction:
- Open the Command Palette (
Ctrl+Shift+P
orCmd+Shift+P
) - Run the
VSCode Context: Extract Context
command - View the output in the "VSCode Context" output channel
Important Notes:
- Execute the extraction command after performing the above steps. The context reflects the state at the exact moment the command is run
- Repeat these steps in different scenarios to get a full view of the data accessible to the extension
The extension uses a modern development workflow with:
- TypeScript for type-safe development
- Webpack for optimized production builds
- ESLint for code quality
- Prettier for code formatting
- TypeDoc for documentation generation
- MarkdownLint for documentation quality
The project uses JSON configuration files to customize the build process:
webpack.config.js
: Webpack build configuration.eslintrc.cjs
: ESLint configuration.prettierrc.json
: Prettier formatting rules.markdownlint.json
: Markdown linting rulestypedoc.json
: TypeDoc documentation settings
To modify build settings:
- Edit the appropriate configuration file
- Add custom settings following the JSON format
- Common customizations include:
- Adding new Webpack loaders
- Extending ESLint rules
- Customizing Prettier formatting
- Adding TypeDoc plugins
- Open
webpack.config.js
- Add the loader configuration:
module.exports = {
module: {
rules: [
{
test: /\.custom$/,
use: ['custom-loader'],
},
],
},
};
- Install the required loader:
npm install custom-loader --save-dev
The project uses a comprehensive quality assurance setup:
- Configuration file:
.eslintrc.cjs
(only ESLint configuration file) - Linting scope: Focused on
src/
directory, excluding test files - Ignored patterns:
node_modules/
,dist/
,out/
,coverage/
,*.min.js
,*.d.ts
- Extends:
eslint:recommended
,@typescript-eslint/recommended
,prettier/recommended
- Overrides: Specific rules for source files in
src/
directory
- Configuration file:
.prettierrc.json
- Integrated with ESLint through
eslint-config-prettier
- Automatic formatting on save
- Configuration file:
.markdownlint.json
- Lints all documentation files except
node_modules/
,dist/
,out/
,coverage/
- Enforces consistent markdown formatting
The project uses
npm run format && npm run lint && npm run lint:markdown
- Configuration file:
typedoc.json
- Generates API documentation
- Enforces documentation standards
All code should be documented using TypeDoc comments following these guidelines:
- Use
/** */
for documentation blocks - Include descriptions for all public APIs
- Use
@param
for function parameters - Use
@returns
for return values - Use
@example
for code examples
- Install dependencies and build:
npm install && npm run build
- Package with source maps:
vsce package --yarn --testFlag=false
npm run package:dev
The extension uses CommonJS modules for VSCode compatibility. Key configuration details:
- Webpack configuration uses CommonJS
require()
syntax - Output file is
extension.cjs
- ESLint is configured to allow CommonJS syntax in
webpack.config.js
package.json
'smain
field points toextension.cjs
package.json
must include:main
pointing to the entry fileactivationEvents
defining when the extension activatescontributes
defining commands, menus, etc.engines.vscode
specifying the compatible VSCode version
- Entry file must:
- Be a CommonJS module (
extension.cjs
) - Export an
activate
function - Export a
deactivate
function (optional)
- Be a CommonJS module (
- Must be packaged using
vsce
(Visual Studio Code Extensions) - Output files must be included in
.vscodeignore
Command | Description |
---|---|
npm run build |
Run quality checks and build production bundle |
npm run watch |
Watch and rebuild on changes |
npm run quality |
Run all quality checks (linting, formatting, docs) |
npm run lint |
Run ESLint checks |
npm run format |
Format code with Prettier |
npm run lint:markdown |
Lint markdown files |
npm run docs |
Generate API documentation |
npm run package |
Build production bundle and package extension |
npm run package:dev |
Package development version (skips dependencies) |
The extension uses CommonJS modules for VSCode compatibility. Key configuration details:
- Webpack configuration uses CommonJS
require()
syntax - Output file is
extension.cjs
- ESLint is configured to allow CommonJS syntax in
webpack.config.js
package.json
'smain
field points toextension.cjs
The extension uses Webpack to:
- Bundle all dependencies into a single optimized file
- Tree-shake unused code
- Minify production builds
- Generate source maps for debugging
We welcome contributions! Please see our Contributing Guidelines for details.
Note: For detailed documentation and troubleshooting, visit our documentation site