Code Monkey home page Code Monkey logo

code-template-tool's People

Contributors

dulm-today avatar eastwoodstudio avatar roggenbrot avatar yuanhjty 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

Watchers

 avatar  avatar  avatar

code-template-tool's Issues

use the Command Palette to define variables

Is it possible to add a setting that determines if to use the current interface or the command pallete?
I think the process would feel more fluid and intuitive if you can continue to answer questions in command pallete.

Just an idea!

How can I set author and email generally?

How can I set author and email generally? There var fo it in the sample templates, but it don't work. It makes also no sense to defined theses for each template.

Allow saving templates along with snippets

First of all, amazing piece of work and an amazing extension. Thank you for your contribution. I just have one small issue which I would very much appreciate if you can fix it.

Snippets are saved in the following places:

  • Windows: %APPDATA%\Code\User\snippets
  • Mac: $HOME/Library/Application Support/Code/User/snippets
  • Linux: $HOME/.config/Code/User/snippets

So, please provide us with a value {appdir} for Templates Path setting which resolves to:

  • Windows: %APPDATA%\Code\User
  • Mac: $HOME/Library/Application Support/Code/User
  • Linux: $HOME/.config/Code/User

I would like to store my templates along with snippets.

Add support to get selected file as parameter for template

If i open the context menu on a file in the sidebar, it would be very useful if that file/filename can be used as a parameter for the template. For example if i have a file "temp.cs", i could make a template which uses filename to create a file "temp.md".

Set case formatting within code

Our folder and css class naming is kebabCase and we would like our naming in JS to be camelCase.
Also we're using .c_[component-name] as our css naming convention. Only way to get this to work is to add a prefix to an extra variable. Because when I use .c____var___ {} inside the template all underscores are replaced. even the additional first .c**_**

We can add multiple (3) vars to accomplish this but I was wondering if you could support case formatting inside templates and only replace three underscores before the var. So depending of the template we could convert the variable to a preferred case and can use an underscore before a var name. This way we can use a single var to accomplish all above.

Typo

In the list of Features it says:

"Folders that do not exist can be cerated recursively."

cerated should be created

Screen Shot 2021-08-29 at 8 51 07 AM

No Templates were found!

  • I created directory at my project root /playground/templates
  • I set extension settings 'Template Path' to {workspace}/playground/templates
  • I created template.config.json file with the following
    { "name": "New Object Template", "variables": [ "objectName" ] }
  • I created a template file called ___objectName___Route.js
  • I right click on a folder and select 'New File / Folder from Template
  • I get the following error message: code-template-tool: No Templates were found!

[Feature] Add support for upper and lover case variables (like myPet -> mypet and MYPET)

It would be very helpful to have the possibility to use the upper and lover case variables in the templates.

In my case I want to define a camel case variable myModueName and use in the templates also MYMODULENAME (e.g. as prefix for C defines) as also mymoduleame (e.g. as prefix for the static function/variable names etc.). As the extension has already a great number of complex cases supported this request might be a really a easy one from the implementation point of view but very helpful for a lot of uses cases.

Feature requests - user flow

Thanks for the great work. Currently I'm setting up your plugin inside our project workflow and i've got some feature requests to make it even better.

  • If only one template available, directly select it and go to edit page
  • On edit page, focus directly to first (var) input field
  • Submit on enter

This way we can limit the use of a mouse and quickly add templates with vars inside our projects.

Broken in vscode version 1.56

The plugin is not working since the upgrade to vscode 1.56. All I see when trying to create file/folder from template is an empty white input:

image

Verified by downgrading to 1.55, where everything's working fine.

If you need more information to replicate, please let me know.

Thanks a lot in advance for taking a look 🙏

Error with service workers

At the following version of visual studio code:

Versión: 1.65.2 (system setup)
Commit: c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1
Fecha: 2022-03-10T14:33:55.248Z
Electrón: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.19042

The following error is obteined at the extension page and when making use of the extension, before rendering the forms.

Error loading the web view: Error: Could not register service workers: InvalidStateError: Failed to register a ServiceWorker: The document is in an invalid state..

image

Could you support snakeCase with uppercase letters

Hallo yuanhjty, great extension with a lot of potential.

I miss the snake-case-style with uppercase letters.

For example:

//template.config.json

{
    "name": "Magento 1 Extension",
    "variables": ["extension_name"]
}

Value of extension_name = namespace_extension

Use in a template:
___Extension_Name___

Exspected result is "Namespace_Extension", but the result is "NamespaceExtension".
For building for Magento you need snake-case-style with uppercase letters. It would be great, if you can implement this.

NobyNa

Base folder doesn't get created

I configured the extension as mentioned in the documentation. The only setting I have overwritten is the Template Path to use {workspace}/templates.
This is how one of my template looks -

+ ___component-name___
    - ___component-name___.component.tsx
    - ___component-name___.module.scss
    - ___component-name___.interfaces.ts
    - index.ts

The problems I encountered are -

  1. It doesn't generate the base folder as per + ___component-name___. It just generates all the files directly inside the directory I invoked this command on. I right click on a directory and select "New File/Folder from template". I would expect it to 1st generate the base directory and then create all files inside that directory. As you can check in the attached screenshot, the template didn't create the base directory, but generated all the files directly inside "components" folder.

Screen Shot 2020-03-27 at 7 39 10 PM

2. It generates an extra "template" file along with other files. Is this intentional? Can I add a setting to not generate this file?

I am using VSCode Version: 1.43.1 & latest version of this extension.
Thanks for the help.

Options for Context Menus

Very convenient and configurable tool. Thanks!
I would like to request the ability to select which menu options are included in the context menu. "Edit Templates" and "Reload Templates" should rarely be used and I would prefer they only be accessible from the command palette or keyboard shortcut.

[Feature] support boolean variable to customize template

Consider one case that developer want to use a boolean variable to control whether to show some codes in template.

for example:

{{if show}}
  <h2>show something</h2>
{{/if}}

Now, the work around is creating a new template. But it's difficult to use this method when the boolean variables are more than three or more.

Some replacements is special cases are not replaced as expected

I have two instances where the replacement values do not work as expected.

The first is in implementing a common pattern for NextJS pages where the eventual file or folder name requires to be an all lowercase term followed by id and wrapped with square brackets - so a file or folder may be named [cityaliasid].

I have a variable templateName: cityAlias.

if I use [___templatename___id] as the value for the filename or the folder the value is not replaced when creating the file or folder. However if I use [___templateName___] the value IS replaced but of course the result includes a capital which needs to be dealt with after the template has run.

The other case is in the replacement of a value within a file where I have a pathname that must be preceded by "/" In this case the template contains path={"/___templatename___"} - again the value is not replaced.

All other instances of variables in the templates and filenames are working exactly as expected and correctly case.

I guess the issues result from RegEx syntax being confused by the character appearing immediately before the template.

Handle extra underscores around variables

Hi there! First, that you so much for this extension it's a time saver! I'm running into the following issue:

Expected behavior

Sass relies on the_file-name.scss naming pattern for identifying files that should output a css file. I was trying to auto generate file names and imports with this naming convention in mind:

// template.config.json
{
  "name": "React Component",
  "variables": ["componentName"]
}

Then I attempted to create a scss file with an extra _ in the name to be included in the file name: ____component-name___.scss to create _react-component.scss.

I also imported this file into a JS file:

// index.js
import './____component-name___.scss'; // -> import './_react-component.scss';

I expected that any additional underscores (_) would be respected and remain unchanged.

Actual behavior

All extra underscores (_) are replaced with the variable string:

____component-name___.scss creates react-component.scss

And

// index.js
import './____component-name___.scss'; // -> import './react-component.scss';

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.