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.
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:
- rebuild project
- restart IDE
- Invalidate caches
- creating a TS file through the wizard, and then renaming it
- npm build
Any advice on why my IDE is so confused with this file?
CodePudding user response:
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.
- Go to
Settings/Preferences | Editor | File Types
- Locate
Text
file type there - Locate and remove the offending entry -- should be
confirmationRequiredRenderer
or very similar to that. - 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.
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.