IntelliJ does not recognize the specific file correctly, instead it is stuck as a text file

My IntelliJ project has a freemarker (ftl) file that is not correctly recognized as a text file. There are many of the same type that are correct. I know the option "Mark as text". This may be the original reason this file was marked as text, but Iโ€™m not given the option โ€œmark as ftl fileโ€ to return it if this is really a problem. If I mark other ftl files as txt, I can return them back to ftl files as expected.

+82
java intellij-idea file-type freemarker
Apr 10 '13 at 1:01
source share
7 answers

Make sure that this file (or the template that represents it) is not listed in

Settings โ†’ Editor โ†’ File Types โ†’ Text files

For OS X

Preferences โ†’ Editor โ†’ File Types โ†’ Text files

+241
Apr 10 '13 at 6:23
source share

Step 1: Click โ€œFileโ€ ==> โ€œSettingsโ€

Step 2: Expand "Editor" and click "File Types"

Step 3: You will see all file types on the right. Go to "Text Files" and click on it.

Step 4: You should see the name of your file at the bottom of the registered templates (bottom field)

Step 5: Remove your file from registered templates. The problem should be resolved and allow you to rename with fileName.java

Step 6: If not, delete the file from the project and recreate it with the name fileName

Source

+22
Nov 25 '14 at 18:07
source share

OSX:

 Preferences > Editor > File Types > Text Files 

Window:

 Settings > Editor > File Types > Text Files 
+14
Mar 25 '15 at 13:49
source share

I had the same problem and none of the above solutions resolved this. The fact is that in the end it was decided by choosing a module and going to the module settings (press F4 on the module name)

Then, on the Sources tab, select the java folder and click on the Sources button. This tells IntelliJ that the specified folder is a source folder.

Then select a test folder and click "Tests".

What is it. Then it will correctly recognize files and show errors as necessary.

See screenshot.

enter image description here

+5
May 12 '15 at 11:43
source share

You may have accidentally changed the template in the file and code template. Press Ctrl+Alt+S

In <

  Settings -> Editor -> File and Code Templates 

For me, I changed the FileHeader.java file in the include tab.

Remember what type of template you may have changed earlier, and return it to default.

Hope it works :)

-one
Jul 19 '16 at 5:07
source share

I had the same problem with creating a new java class, the problem was in Header.java, which can be accessed with the crt + alt + s command and go to the / FileAndCodeTemplates / Includes editor, and it can be in this format:

/ ** * Created by Alex Leporoni on $ {DATE}. * /

This is the solution to my problem, now I can create classes again :) I hope this article can help others who have the same problems with creativity classes in IntelliJIdea ... hugs everyone.

-one
Jul 07 '17 at 18:20
source share

Renaming a file with a file type worked for me.

FileName .java

-one
Jun 20 '18 at 9:37
source share



All Articles