Change file association manually

Answered

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 f...ing 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  f...ing thing?!

74 comments
Comment actions Permalink

@Serge Baranov, as description of that plugin states: Useful for "unknown" files or files without extensions.

So for *.conf I can't change to nginx, *.html to twig, .....

Check issue of that in github: https://github.com/mfedko/idea-file-language/issues/2

0
Comment actions Permalink

Tomas,

There is separate request for on-the-fly association switching: https://youtrack.jetbrains.com/issue/IDEA-103297

1
Comment actions Permalink

I have found that I have .js files getting seen as plain text (among other files). I have been able to get it back to proper JS visual encoding by doing the following:

Every time this has happened to me, it's because the file I want to change somehow gets added to the 'Plain Text' list under Settings > Editor > File Types > Plain Text (NOTE: I am in . Going here and removing the file (you will probably see other files you recognize too) will then put that file back in it's original rendering category.

I hope that helps.

0
Comment actions Permalink

In Emacs: Oh, this config.conf file looks like YAML, I will just set it to YAML mode. It isn't YAML ? well, just type M-x json-mode or xml-mode, or whatever you want it to be

 

In Idea: Welp, screw you, change file name or forever assign .conf files to be YAMLs till you go and manually change it to something else

0
Comment actions Permalink

Not sure if this helps the OP (or others), but I had a similar issue to today where i have a swagger.json file that wasn't actually being parsed as swagger due to the "generic" extension. I clicked that select box at the bottom of the file and re-associated it and now as you can see, it is parsed by the Swagger Plug-in properly and gives me the intellisense as expected. Although what I don't see is the icon change to the "swagger" green {} one that I'd expect (and a co-workers shows the same file properly too even) -- so there must be some other setting i'm missing? But cosmetics aside, at least it works code-wise.

0
Comment actions Permalink

 

 

niiiice

0
Comment actions Permalink

I was having the same issue... and getting frustrated... I found the menu on Webstorm 2018 but it was greyed out.

Using Webstrom EAP (2019.02) Fixed the issue. you just need to install jetbrains toolbox and download EAP builds.

 

I hope it helps.

0
Comment actions Permalink

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.

1
Comment actions Permalink

Must say that on this one I share the same frustration of Ar Vicco in 2012, now in 2019.
I have a toml file that was saved in the codebase with conf extension. Was not able to quickly figure how to make Pycharm understand that that specific file is a toml file.

This should not take over half hour to figure out by googling and getting to read here.

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.

0
Comment actions Permalink

"Associate with file type..." dialog can be accessed through actions menu (shift-shift-shift or cmd+shift+A).

But its' name have to be entered fully "Associate with file type".

Partial search isn't working for this dialog for unknown reason 🤷‍♂️

0
Comment actions Permalink

PyCharm > Preferences > Editor > File Type > Recognised file types > Select one (e.g., Javascript) > Registered Patterns (+ add wildcard * > apply > - remove wildcard).

This worked for me to get my files associated with the right type.  

 

0
Comment actions Permalink

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

1

Please sign in to leave a comment.