PHPStorm: Generate filename on custom file template - phpstorm

PHP Storm: File templates
I would like to add custom file template with generated filename. I do not want to prompt filename by hand, I want it generated with variable values.
E.g. ${YEAR}${MONTH}${DAY}_${MyCustomVar}.sql
It there a way to do that?

Would you like to create files with 'fixed' names generated using temploate variables? It's not currently possible - you can file a request for this feature to youtrack (http://youtrack.jetbrains.com/issues/IDEA)
Related ticket: http://youtrack.jetbrains.com/issue/IDEABKL-6428

Related

generate a variable in index.html variable in flutter web

Is there any way that I can generate the index.html file with a global variable for example a base URL using flutter.so that if I change it in the index.html file later on, it will use the same value through out the app. For example if I have a string variable with a base URL value and it is used in URLs as a base and after creating the build if I change it in index.html file, It starts using the new value of it thoroughly. So, that I won't have to go to the dart code again and again?

HTML select a folder and a non existing file name

After getting a datasream from a server I would like to select an existing folder and set a new file name to which the stream should be stored.
The of HTML expects an existing file name to be entered.
What is the way to do it ? (html and jscript)
I'm not aware of HTML not letting you select un-made files but if you want to deal with files have a look at this MDN reference here
The file does not need to be made for your website to target it!

pycharm does not accept html file

I use the Django authentication system, and for this I created a template, named this file login.html and in the registration directory. I already had a file with this name (login.html), and then I created this file and deleted the previous file, now pycharm does not accept the new file as html, and because of this I can not put Django template in this file and Leave a link.
And you know you can't rename the file, because then the Django template authentication system can't find it. And now I do not know what to do.
What can I do to make pycharm accept this as html?
Make sure login.html has HTML file type and not e.g. Text one in Settings | Editor | File Types.
You Can simply rename this html file from login.html for example to login_users.html

Create hidden file template in PhpStorm

What is the best approach to creating a PhpStorm file template for a hidden file that pre-populates the file name (.htaccess) and does not include an extension?
The workflow currently is as follows:
Create file from template
Type in .editorconfig filename and hit 'ok'. Generated filename is .editorconfig..
Rename .editorconfig. to .editorconfig.
Is it possible to optimize this workflow to:
Create file from template
'editorconfig' filename prepopulated; simply hit 'ok'
AFAIK you cannot create File Template using File & Code Templates functionality for extensionless files (e.g. .editorconfig or .haccess) using standard GUI as it requires file extension part.
Few options:
1. Write custom plugin that would offer such functionality -- that's what .ignore plugin does.
2. Create File Template using .editorconfig extension (IDE will ask what File Type to use to associate *.editorfocnfig files with; I would choose "Ini").
Then create new file File | New | Your New FileTemplate and give it some name (e.g. a) -- in the end you will have a.editorconfig file.
Now just rename it to .editorconfig only.
You seem to be doing already that (slightly different version of it).
3. Do not use any File Templates. Just create brand new empty file (File | New | File) -- here you have to specify full file name including extension .. so .editorconfig can be entered here.
Once done -- just use Live Template functionality and quickly paste needed content.
You just need to create such Live Template in advance and give it some easy to use and remember abbreviation (if you wish to enter such text by typing abbreviation[TAB] (e.g. ec[TAB] where [TAB] is the expand key).
Live Templates official manual/how-to: https://confluence.jetbrains.com/display/PhpStorm/Live+Templates+%28Snippets%29+in+PhpStorm
Official Help pages: https://www.jetbrains.com/help/phpstorm/2016.3/live-templates.html?search=live%20template

Custom filetype per file

Let's say that i have file /home/foo/myfile without extension. Is there option to add syntax setting into this file? In vim it's :set syntax=javascript. I know that in Sublime you can set default syntax color.
There's similar question Changing default syntax based on filename but there you set specific filename. I need to set it in file itself, since i have a lot of different files without extension.
The package ApplySyntax should be able to do what you want.
ApplySyntax is a plugin for Sublime Text 2 and 3 that allows you to
detect and apply the syntax of files that might not otherwise be
detected properly. For example, files with the .rb extension are
usually Ruby files, but when they are found in a Rails project, they
could be RSpec spec files, Cucumber step files, Ruby on Rails files
(controllers, models, etc), or just plain Ruby files. This is actually
the problem I was trying to solve when I started working on this
plugin.
Set your rules/filenames in the ApplySyntax.sublime-settings file:
// "rules" is a list (array) of checks that you want to make against
the file in the current view. A rule is either a regular expression
or a function. If using a regular expression, you can specify
whether you want it tested against the "file_name" or the first
line of the file (think shebangs and xml files). If the rule is a
function, you must provide the path to the file containing the
function and the name of the function to call. When this function is
called, the "file_name" will be passed to it as the only argument.
You are free to do whatever you want in your function, just return
True or False.
you can do this on the fly through the command menu (on OSX cmd+shift+p, windows ctrl+shift+p) then type what you need (e.g. javascript) and it will come up in the list set syntax: JavaScript.
Sublime will remember this until you close the file