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

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.

Related

WebStorm not showing .vue syntax highlighting on on file but is on another

Does anyone know what is causing this problem? I can't seem to figure it out.
When I create a new .vue file, I can't get any autocomplete/syntax highlight at all.
But the one I created at the start of the project seems to work fine.
Looks as if the file GameDetails.vue is treated as plain text file. Does the issue persist if you rename the file? Please check the registered patterns in Settings | Editor | File types, Text and Auto-detect file type by content file types - can you see GameDetails.vue or any pattern with .vue suffix there? Removing it from the list should solve the problem.

File named "auth_actions.dart" won't be highlighted in Intellij-idea

I created a file named "auth_actions.dart" in a dart project(either angular or not). The file content would have text colour being plain white, without any highlighted.
If I rename it to "auth_action.dart" or "auth_actionss.dart", the highlight will come back.
I did some experiments even from some random projects downloaded from github, all of them had this issue.
Anyone know how to fix it? Does anyone see the same issue using the name "auth_actions.dart"?
I assume you accidentally added the file to
Preferences > Editor > File Types > Recognized File Types > Text
Remove it from Registered Patterns to get hightlighting again.
You could accidentally mark it as plain text (the option is in the right-click menu). In this case, the option to mark it back as a Dart file is also in the context menu.

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

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,

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

Intellij Idea how can I specify colors for a specific file type?

I am using a color theme that I am perfectly happy with, but I am dealing with a lot of ".impex" files that are unique to the Hybris platform. The IDE essentially sees them as text files. How can I add syntax coloring to these ".impex" files so the text is not just all one color?
Maybe this plugin can help you.
Syntax highlight for impex files
Besides, you can register a file pattern to a recognised file type: Preferences -> IDE Settings -> File Types.