Auto TS Generator
Auto TS File Generator is a VS Code extension designed to boost productivity in TypeScript projects. It allows developers to generate TypeScript files with customizable configurations effortlessly.
With a few clicks, you can create:
- Classes: Fully structured with constructors and placeholders for methods.
- Interfaces: Ready-to-use templates for defining object shapes.
- Enums: Easily define enumerations for your projects.
- Types: Generate type aliases to streamline your code.
- Functions: Boilerplate code for reusable logic.
- Variables: Predefined variables for consistent coding.
Table of Contents
Requirements
Key Features
- Custom Configurations: Choose formatting, strict mode, and comment options to match your project's style.
- Integrated Workflow: Seamlessly create files in your workspace folders.
- Extensibility: Easily extend the generator for additional use cases.
- Open Source: Auto TS Generator is open-source software, so you can contribute to its development and help make it even better.
Project Settings
Configure your project by creating or updating a settings.json file at the project's root. If you already have a .vscode/settings.json
file, skip the first two steps.
Open the command palette in VSCode:
CTRL + SHIFT + P
(Windows)
CMD + SHIFT + P
(Mac OS)
Type Preferences: Open Workspace Settings (JSON)
.
In the .vscode/settings.json
file, copy and paste the following settings:
{
"autoTS.enable": true, // Enable or disable Auto TS Generator
"autoTS.files.fileExtension": "ts", // The file extension for generated files
"autoTS.files.skipFolderConfirmation": false, // Skip the folder confirmation dialog
"autoTS.files.autoImport": false, // Automatically import generated files
"autoTS.files.defaultBarrelFileName": "index.ts", // The default name for barrel files
"autoTS.formatting.useSingleQuotes": true, // Use single quotes for strings
"autoTS.formatting.excludeSemiColonAtEndOfLine": false, // Exclude semicolons at the end of lines
"autoTS.formatting.keepExtensionOnExport": false, // Keep file extension on export
"autoTS.formatting.endOfLine": "lf", // The end-of-line character
"autoTS.formatting.useStrict": false, // Use strict mode in generated files
"autoTS.formatting.headerCommentTemplate": [], // A template for header comments
"autoTS.formatting.insertFinalNewline": true, // Insert a newline at the end of files
}
Restart VS Code
Your project is now set up to automatically format code upon saving.
Settings Options
Configure Auto TS Generator settings in your .vscode/settings.json
file to customize the extension's behavior. The following settings are available:
autoTS.enable
: Enable or disable Auto TS Generator. Default is true
.
autoTS.files.fileExtension
: The file extension for generated files. Default is ts
.
autoTS.files.skipFolderConfirmation
: Skip the folder confirmation dialog. Default is false
.
autoTS.files.autoImport
: Automatically import generated files. Default is false
.
autoTS.files.defaultBarrelFileName
: The default name for barrel files. Default is index.ts
.
autoTS.formatting.useSingleQuotes
: Use single quotes for strings. Default is true
.
autoTS.formatting.excludeSemiColonAtEndOfLine
: Exclude semicolons at the end of lines. Default is false
.
autoTS.formatting.keepExtensionOnExport
: Keep file extension on export. Default is false
.
autoTS.formatting.endOfLine
: The end-of-line character. Default is lf
.
autoTS.formatting.useStrict
: Use strict mode in generated files. Default is false
.
autoTS.formatting.headerCommentTemplate
: A template for header comments. Default is []
.
autoTS.formatting.insertFinalNewline
: Insert a newline at the end of files. Default is true
.
For more information on configuring Auto TS Generator settings, refer to the Project Settings section.
Follow Me
If you enjoy using Auto TS Generator, consider following me for updates on this and future projects:
VSXpert Template
This extension was created using VSXpert, a template that helps you create Visual Studio Code extensions with ease. VSXpert provides a simple and easy-to-use structure to get you started quickly.
Other Extensions
Contributing
Auto TS Generator is open-source software, and we welcome contributions from the community. If you'd like to contribute, please fork the GitHub repository and submit a pull request with your changes.
Before contributing, please read our Contribution Guidelines for instructions on coding standards, testing, and more.
Code of Conduct
We are committed to providing a friendly, safe, and welcoming environment for all, regardless of gender, sexual orientation, disability, ethnicity, religion, or similar personal characteristic. Please review our Code of Conduct before participating in our community.
Changelog
For a complete list of changes, see the CHANGELOG.md
Authors
See also the list of contributors who participated in this project.
License
This extension is licensed under the MIT License. See the MIT License for details.