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

C++17 if/switch initializer highlighting and refactoring support

    XMLWordPrintable

Details

    • Linux/X11

    Description

      Creator (the Clang code model plugin is enabled) can not highlight "par" in the following code:

      if (auto* par = obj.parent(); par != nullptr) {
          par->setText(message);
      }
      

      Putting the text caret on "par" in the "auto* par" initializer will not highlight anything. Putting it on one of the other occurrences will highlight it and the occurrence within the if block, but not the occurrence in the initializer.

      Refactoring has the same issue. You can't rename "par", unless you do it on the occurrence in the condition or in the body. And that will only rename those two but leave the occurrence in the initializer with the old name.

      Switching to the experimental "ClangRefactoring" plugin helps a tiny bit with refactoring, as it will also rename the initializer occurrence when renaming that occurrence directly, but that will bring up the full "replace" UI instead of allowing you to rename it inline. When trying to rename one of the other occurrences will get you inline renaming, but this will leave the initializer occurrence untouched, just like without the ClangRefactoring plugin.

      Highlighting still doesn't work even with the ClangRefactoring plugin.

      All of the above also applies to C++17 switch statements with initializers.

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            realnc Nikos Chantziaras
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes