Oliver Watkins
Oliver Watkins

Reputation: 13489

WebStorm/IntelliJ does not associate TypeScript file type

I cannot get IntelliJ/WebStorm to associate a ".ts" file as TypeScript file.

I have created a file named confirmationRequiredRenderer. Initially I created this file by just creating a text file and then adding a .ts at the end of the file name.

enter image description here

Now, no matter what I do, I cannot associated this file as a TypeScript file type. It thinks it is a text file.

These are the actions I have gone through to fix this problem and nothing has worked:

Any advice on why my IDE is so confused with this file?

Upvotes: 2

Views: 1302

Answers (1)

LazyOne
LazyOne

Reputation: 165088

I have created a file named confirmationRequiredRenderer. Initially I created this file by just creating a text file and then adding a .ts at the end of the file name.

That is the source of the problem: the confirmationRequiredRenderer file name is now associated with the Text file type. And it has a "priority" because it's longer/more specific than just default *.ts.

You need to go into the IDE Settings/Preferences and remove such a association for more broad *.ts to be used instead.

  1. Go to Settings/Preferences | Editor | File Types
  2. Locate Text file type there
  3. Locate and remove the offending entry -- should be confirmationRequiredRenderer or very similar to that.
  4. Save the settings, let IDE reindex that file and see how it goes.

If still nothing (pretty unlikely but still possible): it may still have an association in another file type, so may need to check other files types for the same.

enter image description here


P.S. Another alternative is to hard-override the file type for that specific file. Just right click on the file in the Project View panel and choose the right action (Override File Type).

It will work for that specific file but will still be an issue for the file with the same name in another project/another folder. So it's much better to fix the original source of the issue.

Upvotes: 4

Related Questions