This extension adds the command Copy Code as Snippet to your Command Palette. When run, it converts the selected code, or the entire file if nothing is selected, into a ready-to-use VS Code snippet and copies it to your clipboard.
Features
Command Integration: Adds Copy Code as Snippet to the Command Palette.
Intelligent Snippet Generation: Converts code into a snippet while preserving spacing and indentation.
Smart Tab Stops: Replaces key symbols like function names, interfaces, and types with tab stops for quick editing.
Usage
Select your code: Highlight the code you want to convert. (If no selection is made, the entire file is used.)
Run the command: Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P) and search for Copy Code as Snippet.
Paste your snippet: A success message appears. Click Open to jump to your snippets file and paste it in.
Customize: Edit the snippet’s name, prefix, or body if needed.
Done! Your snippet is ready to use.
Requirements & Supported Languages
Currently supports:
typescriptreact
javascriptreact
javascript
typescript
Requirements
No additional setup required. Works out of the box with VS Code’s built-in snippet system.
Release Notes
v1.0.0
Initial release
Adds the Copy Code as Snippet command
Generates intelligent snippets with automatic tab stops
Supports TS, JS, JSX, and TSX files
Usage Examples
Contributing
Contributions are welcome! Feel free to open an issue or pull request on GitHub.