Qt Creator 4.3.1 code highlighting for custom files not working
-
I am using Qt Creator and opening TypeScript files using it but the code highlighting is not working. I used the "Import existing project" option to open a project that contains some .ts files, opened one of the files and the "a highlight definition was not found" error. Then I added *.ts to the patterns of the application/javascript MIME type but this didn't make the highlighting work. Then I tried renaming the file from filename.ts to filename.js but this also didn't make the highlighting work. How do I get the IDE to highlight my ts files?
Update: it seems that the IDE is highlighting ts files as html files.
-
Hi and welcome to devnet,
Can you check against a more recent version of Qt Creator ? The actual is 4.4.1
-
I was able to isolate the issue. Adding extensions other than *.ts to the application/javascript MIME type enables code highlighting for those extensions, but not for *.ts. I went through all MIME types in Qt Creator and noticed that there are other MIME types (for example mp2t) that include ts. I was able to remove ts from all of them except from one, the application/x-linguist MIME type. For some reason, this MIME type is not possible to be edited. Everytime I edit it, it automatically reverts. I think this is the issue.
-
Thanks for sharing your findings.
Did you check the bug report system to see if there's anything related ?
-
I submitted the bug: https://bugreports.qt.io/browse/QTCREATORBUG-19449