#snippets #visual-studio-code #generator #productivity #extension #development-tools

build vscode-generator

A powerful VSCode snippets generator with support for multiple languages. Create, manage and share your code snippets effortlessly.

4 releases

0.2.0 Nov 11, 2024
0.1.2 Aug 12, 2024
0.1.1 Aug 9, 2024
0.1.0 Aug 5, 2024

#206 in Build Utils

44 downloads per month

MIT license

31KB
296 lines

github crates.io docs.rs

VS Code Extensions Generator

🛠️ A flexible toolkit for crafting VS Code extensions. This library streamlines the development process while maintaining high standards of 🚀 code quality and 🎯 user experience.

Overview

  • ✨ Snippets generation with builder pattern
  • 🎯 Future support for other VS Code extensions (planned)
  • 🛠 Rich customization options
  • ⚡ Efficient and type-safe implementation

Using

Add to your Cargo.toml:

[dependencies]
vscode-generator = "<latest-version>"

Generating Snippets

use vscode_generator::{ Snippet, SnippetsFile };

// create snippets:
let snippet = Snippet::builder()
    .set_prefix("fn")
    .set_body(vec![
        "fn ${1:name}(${2:args}) ${3:-> ReturnType }{",
        "    ${0}",
        "}"
    ])
    .set_description("Create a new function")
    .set_scope("rust")
    .build()?;

// save snippets to file:
let snippets_file = SnippetsFile::new(vec![snippet]);
snippets_file.write_to("./snippets/rust.code-snippets")?;

User Snippets

📝 You can write this snippets to your VS Code custom user snippets folder Locales:

  • 🗂️ Windows: %APPDATA%/Code/User/snippets
  • 🍎 MacOS: ~/Library/Application Support/Code/User/snippets
  • 🐧 Linux: ~/.config/Code/User/snippets //! 💡 Or simply access it via VS Code:
  1. Press Ctrl/Cmd + Shift + P
  2. Type "Snippets: Configure User Snippets"
  3. Select the language or create a new snippet file

For detailed snippets documentation and advanced features, see snippets module.

Future Extensions (Planned)

  • 🎨 Color Themes
  • 🔧 Language Support
  • ⚙️ Custom Commands
  • 🧩 Workspace Configuration

Dependencies

~0.7–1.6MB
~34K SLoC