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.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Can you check against a more recent version of Qt Creator ? The actual is 4.4.1



  • I tried using v4.5.0 but saw the same problem. I'm using Ubuntu 64bit



  • by the way, I actually noticed that if I rename a *.ts file to a *.js then the highlighting doesn't work, but then if I close that file and open it again, the highlighting then works



  • 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.


  • Lifetime Qt Champion

    Thanks for sharing your findings.

    Did you check the bug report system to see if there's anything related ?




Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.