Change file association manually


I need to change manually a file type for my file "script" (no file extension), from plaintext to other type (Ruby, if you ask).

In previous versions of Idea, it was just a one-click no-brainer... In Idea 11, I've spent like 2 hours trying to find a action button and reading TFM to no avail... There is NO such action anywhere in the IDE. OK, this is just ridiculous. HOW can such a SIMPLE action become so ridiculously complicated?! Where the f... is this thing?!


Atom / VScode / VIM could do this much easier

  • In Atom:

CTRL+SHIFT+L , Type the language u want, select it

  • In VScode

CTRL+K, Then press M




  • In VIM

Just Type:

set syntax=`the language you want`


  • In intellij:

Sorry,we are in the 90s. ............just a joke...........


Since no one here really wants to answer the question, I figured it out. If you have created a file without an extension (like an executable) and for one reason or another Intellij has decided not to give you the "Associate File Type" option on right click, you can do the following to fix it.

Right click > Refactor > Copy > Give the new file the extension you need ( > Delete the original (foo) > Right Click > Refactor > Rename > Remove the extension > Hit Ok > You will then be given the file type association dialogue.

My opinion is that the "Associate File Type" option on right click should just always be present, even on known types. 

Hope that helps someone!


Nope, does not help - I do NOT want to register a whole new wildcard pattern. All I want is to change file association of THIS ONE single file. And guess what, Idea 11 simpy made it impossible, but WHY?!


First of all, the reason this was changed is because previous versions of IDEA treated all files as binary, which means, for example, that the search for text didn't look into those files at all. Which is much more confusing than the current behavior.
Second, nothing has been made impossible. If you manually define the association in Settings | File Types, it will be recognized as the file type you've specified.
Third, the "Associate with file type" action should be available in the context menu for such files, but currently is not. I've filed an issue for that:
Fourth, does your file have a hashbang line? There is support for auto-detecting a more specific file type by hashbang line, although it's not yet implemented for all languages.


Lance, I'm extremely grateful that you were kind enough to share with us your valuable opinion on writing mannierism. Even though others may feel that unlike other posts, yours hardly contributed anything of substance to this discussion other than an illustration of an old English idiom "".

Personally, I find that honestly sharing your frustration with developers can promptly attract their attention in a way that no amount of -ing is able to do. Long-term, it is also better for the developers since it is just so easy to slide into self-congratulatory complacency if you do not feel the pain inflicted upon your users by your very own design decisions. Which may well lead to loss of revenue and  ultimately to downsizing that no amount of flattery will compensate for.

You, Sir, may most definitely disagree with my approach, as reasonable people do. Such disagreement does not necessarily call for imposing your specific sensibilities and stylistic preferences onto others though.


This is crazy that this is still an issue after 6 YEARS. I've tried deleting the file and re-creating, still a text file. Renamed the extension, can change to another one without a problem, .js for exmaple. Flip it back to a .php extension, and it treats it as a text file again. Delete the .idea folder, re-import the project, same deal. What stores the association of each individual file with it's file type??


5 years later and still the same ergonomic issues.

Once a file has been associated with a file type, the "Associate with File Type" context menu is no longer available (why?), and the only way to change the association is to dig through all the registered patterns under  "Preferences... | Editor > File Types".  The shebang detection does not work (at all), and bash files are regularly registered as "Text Files". 


Sorry what is the problem, to change files on the file?

Put in the corner a simple-menu with the types like, php, html, twig, js..... This would be the best feature ....
I think many people have some files who looks .html but seems like .php .... and many many more.


I am on  IDEA version 2018.2.4.

I have quite a few files without extensions, many of them are executable bash and lua scripts.

Bash scripts with hashbang are recognized even without an extension but lua scripts, even with #!/usr/bin/env lua, fail to be recognized.

I understand the option "associate with file type..." but it registers a pattern using filename. This poses a problem because, in my case, I have bash and lua scripts with the same filename and associating the filename with one type makes all the files, in any project, open with that type's syntax highlighting.

I been a long time user of IDEA, I love it but lack of this feature frustrates me. I don't want to jump through mouse-clicks, menu-items and patterns. I just want to open the "action menu", type "set syntax lua", enter.

At this point I don't even care if IDEA remembers the file type syntax. I will set syntax manually every time I open the file.

Hope you add this feature.


Open preferences (ctrl + alt + s)
search File Types

enter the extension that you need to change.

Click '-' (remove symbol). as simple as that!

Thanks to this guy: 

Hope this helps!!


I have found in phpstorm that I can use the Refactor > Rename... function to associate a file of unspecified file type (e.g. a name with no extension) with a file type.

For example if I have a bash script named do_the_things I can Refactor > Rename it to which causes it to pick up the bash highlighting, then when I Refactor > Rename it back to do_the_things it keeps the bash highlighting.


Please make it easier to dynamically override associations-by-extention, that's so 90s.  We need to work with all kinds of little conf files and whatnot.  Don't make us clutch on to emacs and vim!  :-)  Thanks for a great set of IDEs btw, loving CLion.


I love this thread. Six whole years of people trying to be helpful but entirely missing the point that file associations should not be this hard.


The action "Associate with file type" is found under the File menu (at the bottom of the list of menu items) after selecting the file in question. It is not present in the right-click contextual menu, which is the most obvious spot.

Good news for you folks: the action will be available in the context menu of the Project view in IntelliJ IDEA 2021.2 (EAPs should be available publicly around May 2021). 


I've tried this with Idea Ultimate Edition 11.01 and a pop-up was displayed allowing me to open the extension-less file with whatever editor I like.
1. I've create a file  named FileWithoutExtention
2. Open that file. A popup allow me to choose an editor. I did choose Groovy.
3. Open Settings and go to FileTypes, and select Groovy Files. I've noticed that a new entry (FileWithoutExtention) was added to default register patterns.

Maybe it's a bug, and in that case it is better to file it at


Refactoring doesn't work if filetype is registered in that filetype dialog. In my case I accidentally associated one Vue.js file as React.js file. Figured out that this specific file was actually listed in filetype dialog and there under javascript. It had entry for one other file for mine as well so deleted both and then file was recognized correctly.

So just to clarify two files of mine were listed below that highlighted *.js


Yep, dumbest thing ever. If you associate a file with a file type you can't change it. I tried renaming the file, I tried deleting and creating it again, I even tried editing the workspace xml to remove any mention of my file. This thing is as stubborn as a mule.


You're in default settings. Go to Settings instead.


Sometimes it's just easier to `rm -rf .idea` and re import project instead of browsing through file associations.



That's really good news! Thanks for posting.

I am using IntelliJ IDEA 2018.2.5 (Ultimate Edition)
Build #IU-182.4892.20, built on October 16, 2018

And I don't any language setting on the bottom toolbar. I have a lock icon and then settings icon. No language drop down menu.

Any advice?



@Kohlia @category6 Same version as @category6, same result -- I don't see anything at the bottom to change the format. I do appreciate that I can now handle this stuff with the Registered Patterns of file types, but it's definitely much clunkier than in any other editor that I'm used to.


The problem is when you try to use for example Jekyll, where everything is *.html, but all is Liquid. There's not even a but of Liquid support, but I still want to open them as Twig, because essentially they are the same. But I can' do that!!! ANY text editor can do that. I don't get it why we're talking about associations, when often I just want to change highlighting/autocompletion on the fly. That should've been implemented many years ago.

Edit: I also have nothing like the screenshots above. I'm using latest stable IntelliJ, RubyMine, Android Studio, AppCode.


Wow, 7 years and jetBRAINS still doesn't get what we need. Will try to provide few more use cases where file type/syntax select is needed:

  • config files for apache, nginx, supervisord and many more use *.conf extension
  • yml files have different structure, possible value and restrictions for symfony, docker, ....
  • files without extension can contain ANY content


In these cases EASY and FAST function to change file type/syntax temporary (without creating file match pattern) is CRUCIAL!!!



There is separate request for on-the-fly association switching:


File name endings to determine file type are an anti-pattern on unix systems.  The end user doesn't care what a script is implemented in. The system uses the shebang line to determine this association between interpreter and file.

It would be immensely helpful on a daily basis to have this functionality when IntelliJ opens (or creates) a file. As it stands, this is a daily pain point for me.

I love IntelliJ, but when I encounter this problem then I consider trying out VSCode.


Hello Ar.

I've switched to IDEA a few months ago (from Eclipse). An I can say I love it.
Back to topic, unfortunately I don't know  how you can do that in IDEA 11.
But I am just currious how did you managed to do that in previous versions? and what versions are those?

Thank you in advance.


In previous versions, when you double-click a file with no known association (like file with no extension), Idea asked you how you want to open this file, and remembered this preference. In 11 version, for unknown reason, developers just decided that all files with no known association will be just treated as plaintext without asking the user. Which is just plain dumb stupid and makes no sense, compared to a pre-11 behavior.


This still works form me (Idea11): I get a popup and can choose how to edit/treat that file.
After that I can choose to deal with it as a text or switch back to whatever edit mode.
So, check your File Type settings...


Well, all my files with no extension are shown as plaintext everywhere in Idea 11. Even if I clean all wildcards for 'text' in Settings>File Types, it does not help a bit, unfortunately. I have to manually enter every script file wildcard into Settings>File Types, which is so annoying.


Please sign in to leave a comment.