Is that possible to hide from File Watcher file just created by File Template?

File Watcher interfere Live Template functionality and immediately start formatting the code (Prettier in my case).

 

P.S. I'll ask for luck: how to use Live Templates things like camelCase inside File Templates?

0
7 comments

File watcher is always triggered on file creation, there is no way to avoid this...

>how to use Live Templates things like camelCase inside File Templates?

You can't use Live templates (snippets/functions) in File Templates. Only Live Templates variables are available             (https://www.jetbrains.com/help/webstorm/2019.2/settings-file-and-code-templates.html, Enable Live Templates).

See https://youtrack.jetbrains.com/issue/IDEA-161937 and linked requests.

File Templates use Apache Velocity template language (http://velocity.apache.org/). You can try using Apache Velocity StringUtils methods in your file templates. For example:

/**
 * File_name to FileName: ${StringUtils.removeAndHump($NAME)}. 
 */

Standard Java String functions can also be used - see http://stackoverflow.com/questions/6998412/velocity-string-function, for example.

0
Avatar
Permanently deleted user

Thank you!

Is that possible to add that functionality in the future? (File Watcher + File creation with Live Templates variables).

0

>Is that possible to add that functionality in the future?

For file watcher, please feel free to file a feature request to youtrack, https://youtrack.jetbrains.com/issues/WEB

as for file creation with Live Templates variables, doesn't it work? See above. Live template functions are not supported, see https://youtrack.jetbrains.com/issue/IDEA-173721

0
Avatar
Permanently deleted user

Yes, it does. But it doesn't work if File Watcher is on (I'm using watcher for all *.vue files to start Prettier).

Template:

 

Result:

0

that's because the watcher is auto-triggered on file creation, changing the new file. It's not about live templates or file templates

0
Avatar
Permanently deleted user

Yeah, I get it. Thanks for help. Should I create feature request or bug report (because IDE throwing me an error)?

0

Can be submitted as a usability issue

0

Please sign in to leave a comment.