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

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

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

@DanRevel's answer helped. This is exactly what I did (in Intellij 1.4):

 

1) Right-click on the file that you want to change the file association of.

2) Click Refactor -> Rename

3) Change the file extension of the name and click Refactor

4) Select a file association so that Intellij automatically opens the file in the format you want.

5) Repeat these steps for the same file and rename the file extension to the original name.

-1
Comment actions Permalink

@Pjandot: This is fixed! See Amsharma's answer (2 posts up).

-1
Comment actions Permalink

yole wrote:

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: http://youtrack.jetbrains.net/issue/IDEA-79574
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.

Fifth, the original poster could have asked his question without all the alluded to profanity ("F...ing").
Sixth, the original poster's subsequent replies could have been made without the pejoratives ("dumb stupid") directed at the JetBrains developers.
Seventh, the original poster should learn that while Dmitry was kind enough to overlook the rudeness of items 5 and 6, typically one attracts more flies with honey then with vinegar and that common courtesy & manners are important.

-4
Comment actions Permalink

Go to Settings - Editor - FileTypes: Now find your file type in "recognized file type" section and then in "registered patterns" section, add a new pattern by hitting "+" button. Now enter the whole file name as a pattern. IDEA will then ask you this pattern is already assigned to text file, do you want to reassign. Say yes. Then you are done!

-5
Comment actions Permalink

Under Settings -> Editor -> File Types you can define file type patterns.

-8
Comment actions Permalink

Settings > File Types

-19

Please sign in to leave a comment.