Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-13912

Broken approach for matching highlighting files

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • Qt Creator 3.4.0-beta1
    • Qt Creator 3.3.0
    • Editors
    • None
    • a22dc36aaf612735d09a51d4fb5865fc64297d02

    Description

      Currently only mime-types are used to match highlighting files. This introduces at least two problems:

      Highlighting files without mime-specification

      Assume that there already is a mime type "text/foo" as a sub class of "text/plain", with glob pattern "*.foo".
      Now a highlighting file specifies extension "*.foo" and no mime type.
      The result is, that a mime type "text/x-artificial-foo" as a sub class of "text/plain", with glob pattern "*.foo" needs to be registered.
      Now we have two mime types with same-weight matching glob pattern on the same level (direct child of "text/plain"), and there is no way to tell which one will be returned as the "best match" for a .foo file. Which could either lead to a custom editor type for "text/foo" never be used, or to the highlighting file never be used even when force-opening the file in PlainTextEditor.

      Highlighting files with mime-specification

      There is no guarantee that the glob pattern that is specified in the highlighting file has anything to do with the mime type(s) that it specifies. So, if Qt Creator has a specification for the given mime type(s), it might have completely different glob patterns than specified for the highlighting file.
      Additionally, when a highlighting file specifies a mime type that is not known to Qt Creator's mime database, it currently creates a new mime type with the given glob pattern(s) as a child of "text/plain". This then leads to the same problem as in "Highlighting files without mime-specification"

      I think the two attributes should be read: Use me if the file has one of the following mime types, or one of the following file extensions. So, matching highlighting files should be done by checking if the file has a matching mime type, and then if the file has a matching file extension.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            con Eike Ziller
            con Eike Ziller
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes