Nemory
A Visual Studio Code extension that automatically discovers, manages, and exports SQL snippets from your projects.
Features
- 🔍 Automatic SQL Discovery: Scans your workspace for SQL queries in
.sql files and embedded SQL in application code (TypeScript, JavaScript, Python, Go, Java, PHP, Ruby, C#, C++, Rust, Kotlin, Swift)
- 📦 Snippet Management: View all discovered SQL snippets in a hierarchical tree view organized by directory and file
- ✅ Selective Export: Choose which snippets to export with checkbox selection
- 📁 Flexible Export: Export selected snippets to individual
.sql files with metadata comments
- 🔄 Smart Scanning: Respects
.gitignore patterns and provides progress feedback during workspace scans
- 🎯 Go to Source: Click any snippet to jump directly to its location in your code with precise line and column tracking
- 🌍 Localization: Built-in internationalization support
- 💾 Local Storage: All snippets stored locally in SQLite - no external data transmission
Getting Started
Installation
Install the extension from the VS Code Marketplace by searching for "Nemory".
Once installed, open a workspace containing SQL files or code with SQL queries.
Basic Usage
- Scan Project: Open the Nemory view and click the refresh icon to scan your workspace for SQL snippets
- Set Export Path: Click the settings icon and choose where to save exported SQL files
- Browse Snippets: View discovered SQL snippets in the tree view, organized by directory and file
- Select Snippets: Check the boxes next to snippets you want to export (or use "Toggle Select All")
- Export: Click the export button to save selected snippets as individual files
SQL Detection Examples
Standalone SQL files:
-- queries.sql
SELECT * FROM users WHERE active = true;
SELECT COUNT(*) FROM orders;
TypeScript/JavaScript:
// String literals
const query = "SELECT * FROM users WHERE id = ?";
// Template literals
const query = `SELECT * FROM users WHERE id = ${id}`;
// Tagged template literals
const result = await sql`SELECT * FROM orders WHERE status = ${status}`;
Python:
# Triple-quoted strings
query = """
SELECT * FROM users
WHERE created_at > ?
"""
# Regular strings
query = "SELECT * FROM products WHERE active = 1"
Go:
query := `
SELECT * FROM users
WHERE active = true
`
Commands
| Command |
Title |
nemory.openSettings |
Nemory: %command.openSettings.title% |
nemory.refreshSnippets |
Nemory: %command.refreshSnippets.title% |
nemory.exportSelected |
Nemory: %command.exportSelected.title% |
nemory.goToSource |
Nemory: %command.goToSource.title% |
nemory.toggleSelectAll |
Nemory: %command.toggleSelectAll.title% |
nemory.setExportPath |
Nemory: %command.setExportPath.title% |
nemory.showLogs |
Nemory: %command.showLogs.title% |
Each exported SQL snippet is saved as an individual file with metadata comments:
Filename format: {title}_{timestamp}_{id}.sql
File content:
-- Title: SELECT users query
-- Source: src/database/queries.ts:15-17
-- Captured: 2025-01-12T10:30:00.000Z
SELECT * FROM users WHERE active = true;
Metadata includes:
- Title: Snippet title (derived from SQL statement)
- Source: Original file path and line range
- Captured: Timestamp when the snippet was first discovered
Keyboard Shortcuts
Currently, all commands are accessible via the Command Palette. You can configure custom keybindings in your keyboard shortcuts settings.
Known Limitations
- SQL detection in string literals requires minimum 10 characters
- Template literals with interpolations are converted to placeholder syntax (
?) for validation
- Files matching
.gitignore patterns are excluded from scanning
node_modules and common build directories are automatically excluded
Requirements
- Visual Studio Code version 1.105.0 or higher
- A workspace with SQL files or code containing SQL queries
Privacy & Data
All SQL snippets are stored locally in a SQLite database within your workspace. No data is sent to external servers.
Troubleshooting
Snippets not appearing?
- Click the refresh icon to manually scan your workspace
- Check that your files aren't in
.gitignore or node_modules
- Verify SQL queries are at least 10 characters long
- Check the logs with
Nemory: Show Logs command for scanning details
Export not working?
- Set an export path via the settings icon first
- Verify the export path is valid and writable
- Ensure you've selected at least one snippet (checkboxes should be checked)
- Check the logs with
Nemory: Show Logs command for error details