GithubHelp home page GithubHelp logo

template-generator-vscode's Introduction

Template Generator

This extension helps in creating files and folders easily from defined templates.

Features

  • File template support
  • Folder template support

Usages

Commands

  • Files: New File from Template
  • Template: Open Templates Folder

Default templates path

  • Windows : %HOMEPATH%/.vscode/templates
  • Linux : ~/.vscode/templates
  • Mac : ~/.vscode/templates

Custom fields

  • {__name__} : file name
  • {__author__} : author
  • {__email__} : email
  • {__link__} : link
  • {__date__} : create time
  • {__camelCaseName__} : camelCaseFileName
  • {__pascalCaseName__} : PascalCaseFileName
  • {__snakeCaseName__} : snake_case_file_name
  • {__kebabCaseName__} : kebab-case-file-name
  • {__lowerDotCaseName__} : lower.dot.case.file.name
  • {__delete__} : empty string

You can define the name displayed on the template selector, like:

  • {__name__.python}.py

Example

File name :

{__name__.python}.py

File content :

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# {__name__}.py
# @Author : {__author__} ({__email__})
# @Link   : {__link__}
# @Date   : {__date__}

More Example

Default templates

  • html.html
  • javascript.js
  • lua.lua
  • python.py
  • typescript.ts
  • python Folder

Extension Settings

This extension contributes the following settings:

Settings

  • templateGenerator.templatesPath : Where do you want to save the template Settings
  • templateGenerator.openFileByFileTemplate : Open the file when the file is created by file template
  • templateGenerator.openFilesByFolderTemplate : Open all files when the files is created by folder template

Fileds

  • templateGenerator.fields.author : Custom fields of Template Generator: author
  • templateGenerator.fields.email : Custom fields of Template Generator: email
  • templateGenerator.fields.link : Custom fields of Template Generator: link

Known Issues

Release Notes

For more information

Enjoy!

template-generator-vscode's People

Contributors

dengsir avatar diogoosorio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

template-generator-vscode's Issues

Can't create file from template in a folder

I am currently unable to create a folder in a subdirectory.
When I use the "create file from template" action, and specify a name like "danny_labnotes/2018-01-10", this value is considered an error and is not accepted.

Providing just the name "2018-01-10" is ok though.

Unable to use templateGenerator.templatesPath successfully

Whenever I try to use templateGenerator.templatesPath I get a permission denied error or file does not exist. I've tried the following, plus many more.

"templateGenerator.templatesPath": "${workspaceFolder}/templates"
"templateGenerator.templatesPath": "./templates"
"templateGenerator.templatesPath": "/templates"
"templateGenerator.templatesPath": "~/.vscode/templates"
"templateGenerator.templatesPath": ".vscode/templates"
"templateGenerator.templatesPath": "~/.vscode/templatess"
"templateGenerator.templatesPath": "~/templates"

I've created a templates dir in the proper location where these should work, but I continue to get errors. If I leave this options empty everything works as expected. Is there something I'm doing wrong, or is this a issue?

VS Code Version 1.23.1 (1.23.1)

On a side note, this is a great extension and thanks for creating it.

Generate templates with case

Hello,

It is not possible to generate template with different cases sensitivity.
It is actually really useful for example with NextJs where pages have to be lowcase and components should be camelCase by convention.

Why not use some {__name__}, {__NAME__} and {__Name__} to be replaced in the correct case ?

Thanks a lot.

How to use it

I have installed the extension but have no idea how to make it work.

I do ctrl P the type Files: and I get no command found.

Thank you

How to convert to uppercase?

Thank you for this great extension! It is really useful!

In the issue #1 is is stated that uppercase {NAME} conversion is implemented. In my template this is not working. How can I convert the {name} value to uppercase?

Thanks in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.