Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ Idea: How to temporarily change file type?

How to change file type of open file without binding file extension to new file type?

I'd like to use that to view python scripts that don't have any extension. So there is no extension to associate file type with.

like image 703
czerny Avatar asked Aug 16 '17 15:08

czerny


2 Answers

You should be able to just try opening the file in IntelliJ, and you will automatically be prompted to associate it with a language type.
In the case of files without an extension the association is made on the entire file name, rather than a set of extensions (no 'wildcard' character).

Take a look at how the association window automatically handles two different types of unknown files: adding file type

The 'File pattern' field is editable as well, so if your files have a common pattern to them, you can use a wildcard (*) to quickly associate them all .

There is no way to just open a file without creating this association, otherwise IntelliJ couldn't perform any syntax highlighting or the like, but it is possible to review/remove any file associations you have created under Settings - Editor > File Types (You can quickly add new associations this way too).

reviewing file type

like image 118
phaze0 Avatar answered Oct 22 '22 09:10

phaze0


Good news : IDEA now allow to temporarily set a file type : open "Actions" menu (Ctrl+Shift+A), and look for "override file type" item.

like image 21
Mat Avatar answered Oct 22 '22 09:10

Mat