How to force Intellij to treat some random file other than registered type - intellij-idea

Intellij Ide is choosing the wrong syntax highlighting. So I need to override preselected file type. File name can be anything, which means I need to change the file type on the fly.
Edit: There are no extention in the file name.
Thanks,

Related

PlantUML file in IntelliJ autocomplete and color formatting not working [duplicate]

I have several django projects and several different files with name utils.py, however pycharm treats them as simple .txt files with no syntax highlighting or any other kind of parsing, how can I fix this?
Please see File | Settings (Preferences on Mac) | Editor | File Types.
Look for your file name mapped to the Text type or to the Auto-detect file type by content type.
Remove the incorrect mapping and it will fix the issue.
If you still can't find the wrong mapping in the IDE settings, locate the options/filetypes.xml file in the Configuration directory. Close the IDE and either edit this file to remove the incorrect mapping or delete this file to reset all the file types to the defaults.
You can also use Revert File Type Override / Override File Type file context menu actions.
As CrazyCoder answered, my file also landed in an unintended association. In my case it was "Auto-detect file type by content". You can just try to add your file to the desired file type (e.g. Python) and PyCharm will automatically try to move the association.
FYI, a quick action to reassociate a file's type will be available in the context menu of the Project tool window in IntelliJ IDEA 2021.2 (EAPs should be available publicly around May 2021).
In my case I had to right click the file in question (a django migration) and select Mark as Python.
I probably clicked Mark as Plain Text before by mistake.
I actually solved this by going to the Project section , and then clicking Override File Type by right clicking on the specific file. Then I selected the type of the file from the list of available file types.
That worked
For me, the file somehow forgot its type. This can be overridden by
Right click the file name --> Override File Type --> Select file type.

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")

Choose editor depending not only on file extension

Is it possible to use a different editor in IntelliJ depending on file contents (or at least file name) instead of just file extension? IntelliJ Idea highlighting depending on file structure; NOT file extension says it isn't, but perhaps it has changed in last 6.5 years?

Intellij IDEA 2016.3 default properties file encoding doesn't work

I've set the Default encoding for properties files to "ISO-8859-1" in my Intellij IDEA 2016.3, then I create properties files, but the file encoding is still UTF-8:
Any idea? Or should this be an issue?
Updates:
After changed the project and system default encoding to ISO-8859-1 and then create new properties file, it is still applied with UTF-8 encoding, and I can't manually change the properties file encoding while I do be able to change encoding for other files.
Updates:
I've created an issue on youtrack:
https://youtrack.jetbrains.com/issue/IDEA-165440
Today I faced exactly the same problem. I found a workaround to fix the affected properties files:
rename the file to txt; make sure the checkbox 'Rename bound resource bundle' is unchecked (e.g. locale-en.properties -> locale_en.txt)
go to -> File -> Settings -> File Encodings -> chose the renamed file in the file tree to the right
You are now able to chose the new encoding from the drop-down list (e.g. ISO-8859-1)
Choose 'OK' and then 'Convert' (confirm also the warning about characters that can't be converted, if a dialog shows up)
Rename the file back to it's original name (e.g. locale-en.properties)
If the dialog in step 4 showed up, make sure that you fix the characters which were not converted properly (in my case some of the German umlaut showed up as ? and had to be fixed manually)

IDEA, how to disassociate editor with file type?

I have a new resource file in my directory named protected.keys. When creating it, i asked IntelliJ to treat it as properties.
Instead i'd like to change this to text how can i do this please?
You can change it in File | Settings | File Types, remove the file name or extension from the Properties files and assign it to the Text files.