How do you create file template without extension in IntelliJ editors - intellij-idea

In IntelliJ editors you can add your own file templates in File>Settings>Editor>File and Code Templates>Create new template. After I made my own template, I wanted to add child template, which should be a folder with .gitkeep file. The problem is that even when I leave the extension field empty the dot is added to the end of that file resulting in: .gitkeep..
How do I make it so that this end dot is not appended?

Related

Can't remove reference to template

I have a macro-enabled Word document with a reference to a template in the Project > References section of the VBA/macro editor. I can't delete this reference directly. When I delete it through the Developer panel's Document Template dialog box, the template name in that dialog box reverts to Normal, but the macros' Project > References section still shows the old template.
Behavior: the macros fail with the message
"Compile error: can't find project or library."
The missing template appears to be the source of the complaint, since I can create a dummy file with the same name and location as the missing template and the macros load fine. VBA is not relying on any code in that missing template, either, from what I can see. It's just a missing file that's specifically referenced so the compiler chokes. But I need to circulate this macro-enabled document on its own without requiring users to make a new path and copy a dummy file into it.
I've tried editing the XML within the .docm file to remove the reference, but the template is also referenced in the vbaProject.bin binary file. Hex editing that binary file to remove the reference (replacing it with nulls or a valid path/name of the same length) and re-zipping the structure produced a document that Word recognized as corrupted (also tested re-zipping it without making any changes, to make sure the unzipping/zipping process wasn't causing new problems, and that version opened fine but failed at the same place it always fails: the missing template file). Word produced a recovered version, which shows all the macros listed, but it also shows the reference to the template I'm trying to remove.
Windows 10, Word 365 latest
Help?

Are resource bundle properties file supposed to be created manually

I created a resource bundle file in the Intellij idea called login.properties with some key value pairs. Now I want to create a french version for it so I guess it should be named login_fr.properties
But what about the text in french. The login.properties file has English text. Is there an automated way to create this login_fr.properties file? the file and the content bother tr

How to set a filename for file templates in IntelliJ

I am trying to create a new file template in IntelliJ for a specific type of file needed by the framework I am using. The name of this file is always going to be base.kt, and I have added the file template as per this:
This works fine for me other than the fact that everytime I right-click on a module and say 'New base.kt', it still asks me to enter a filename. For the package-info file template that comes pre-shipped with IntelliJ, it just creates the file without prompting this dialog:
Is there a way for me to make IntelliJ always use a particular name and skip this dialog?
You just need to write #set($NAME="base")

How to get HTML-formatted code from clipboard? [duplicate]

Is there a simple way to copy syntax-coloured code block as rtf in intellij IDEA?
UPDATE: there is now a new plug-in for this: 'Copy' on steroids that is maintained by JetBrains.
There is no way to copy colored code block from IDEA directly.
A workaround is to use File | Export to HTML, then open HTML in a browser, then copy from the browser window and paste into Wordpad or MS Word.
Another and more faster way is to install the Copy as HTML plug-in in Settings | Plugins:
Copies a snippet of code as html
Adds menu items "Copy as HTML" to main menu and editor popup. Will copy the current selection or the complete editor buffer. Currently only works if focus is in editor (for example won't work in project tree).
Preserves more formatting than the built-in HTML export.
HTML is only a snippet (without html and body tags) meant to be inserted into a complete HTML document.
Currently HTML format is fixed and uses CSS a lot.
Options: unindent, add border, padding, line numbers, tabs to spaces conversion, include editor's warning and error highlighting (see IDE Settings -> Copy as HTML).
Reuses the editor "Show Line Numbers" setting (see Idea's "View" menu).
IntelliJ IDEA 15
By default, you can copy rich text from IntelliJ to Microsoft Word (for example).
This feature can be found in File > Settings... > Editor > General > Rich-text copy > Copy as rich text by default
You can also change the color scheme only for the copy-paste operation (your current scheme won't be affected).
Go to https://gist.github.com/
Copy code from IntelliJ to the new private gist;
Save it, copy colorful code from the browser to wherever you want;
Delete the gist.
Use external tool notepad++
1) copy code snippet to notepad++
2) apply syntax highlighting
3) copy with nppexport plugin to clipboard as rtf
If you're on a mac and like TextMate, here's a great way to copy styled code from TextMate: https://github.com/bblimke/copy-with-style-tmbundle
It's not as convenient as doing it directly from IntelliJ, but it's a bit more convenient than using gist or pastebin. Also, unlike the Copy as HTML Plugin for IntelliJ, this solution actually works at the time of this writing.

Webstorm not recognising JavaScript file

Webstorm doesn't recognize one of my .js files as a JavaScript file so I'm losing syntax highlighting and being able to add break points. I've looked in the workspace.xml file and the file in question seems to have similar settings to other .js files that work correctly.
If I change the name of the file it works ok. So somehow Webstorm is stuck on misinterpreting the type of a file that has this name. Where else can I edit the project?
So I see three possible reasons for the problem:
The file was marked as 'Plain text'
There is a pattern for 'Text files' file type that matches this file (or back: file type 'JavaScript' exclude this file name). See image below
There is a custom plugin that overrides default behavior for files with this name (unlikely)
Updated: after several years I've found one more reason for the behavior and most likely it the main source of the issues. When you create a file without any extensions the "Register New File Type Association" is appeared. And you can accidentally specify a new file type, for some file name. It is can be fixed with (2) but it is the reason why the pattern was added there.
Note: the solution works for all IDEA-based IDEs: IntelliJ IDEA, WebStorm, RubyMine, PyCharm, PhpStorm.
File -> Settings -> Editor -> FileTypes -> Text files -> check for "ContentRepository.js" pattern there and remove it.
If the file was marked as "Plain Text", then this can be fixed as follows:
Right click on the file.
One of the menu options is "Mark as Javascript" . Just below "Delete".
Click that. Your file is now recognized as javascript by WebStorm.
Since WebStorm was not allowing screenshots after right click so couldn't add it here.
My problem was with Auto-detect file type by context
For me this did the trick
1) Preferences
2) Editor
3) FileTypes
4) Search for javascript
5) Add *.js to registered patterns
You can also try "Template data languages" (in file > settings) which will force a specific language synatax high-lighting on a specific file or folder. See screenshot below
For a block of code you can also use "language injection". Simply high-light the block of code, wait for the little lamp to appear then select the bottom choice and then the language you need (screenshot also attached)
In case it is helpful elsewhere (OMG this was scary).
For some reason IntelliJ was not recognizing any .js file in my project (even after .idea removal (rm -rf .idea)).
I went to Webstorm (in my case RubyMine): Webstorm > Preferences ... > Editor > File Types then went to Recognized Filed Types, picked Javascript (but whatever file type you are missing will do), then added back a Registered Patterns entry of *.js
Of course, press Apply and then Ok.
Wow, scary stuff. but solved my problem, hope it does for someone else.
I was always trying to add .js as a recognised file types, but somehow .js was added to Ignored Files and Folders.
I just removed .js from Ignored Files and Folders and it worked for me.
Preferences
Editor
FileTypes
Ignored Files and Folders
Remove *.js
2022 update!
Right click on file and choose JavaScript