https://bugs.kde.org/show_bug.cgi?id=426642

            Bug ID: 426642
           Summary: 'Adapt signature' for an argument of method (doing
                    this in its definition) removes space in declaration
           Product: kdevelop
           Version: 5.6.0
          Platform: Archlinux Packages
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: kdevelop-bugs-n...@kde.org
          Reporter: piotr.mierzwin...@gmail.com
  Target Milestone: ---

SUMMARY
When I rename argument in method doing this in its definition then in its
declaration the spaces (after opening and before closing bracket) are removed.
I have set "Qt Artistic Style" as formatting code.
I suppose the problem is similar to handle of "Rename assistant" (Bug 317299),
where (the most likely) is calling formatting of code. Example of code please
find below.

Second issue or let's say inconvenience here is that, after I use "Adapt
signature" (in definition), I'm not able to rename massively all occurrences of
renamed argument present in body this method. I need to use "Rename assistant"
for each of one, so click several times, which of course is not so comfortable
(it something like "monkey job"). Of course I can use simply rename of string,
after selecting of block affected code, but this is only work around. Rather I
would expect to get additional tool tip like is showing just after rename
argument. Notice that, in first moment I have two solutions. I can do "Adapt
signature" or "Rename", unfortunately the result of neither of them is complete
(compilation fails). Usually when we have some argument in method we use it in
body this method, so rename is necessary and adapt signature, as well.

// Header file
class MyClass {
private:
        void showSomething( bool bShow );
        void myMethod1( bool bShow ) {}
        void myMethod2( bool bShow ) {}
};

// Cpp file:
void MyClass::showSomething( bool bShow )
{
   if (bShow)
      qDebug() << "show something";

    myMethod1(bShow);
    myMethod2(bShow);
}

Rename "bShow" in definition of method with "bShowResult".

OBSERVED RESULT
// Header file
class MyClass {
private:
        void showSomething(bool bShowResult);
        void myMethod1( bool bShow ) {}
        void myMethod2( bool bShow ) {}
};

// Cpp file:
void MyClass::showSomething( bool bShowResult )
{
   if (bShow)
      qDebug() << "show something";

    myMethod1(bShow);
    myMethod2(bShow);
}


EXPECTED RESULT
// Header file
class MyClass {
private:
        void showSomething( bool bShowResult );
        void myMethod1( bool bShow ) {}
        void myMethod2( bool bShow ) {}
};

// Cpp file:
void MyClass::showSomething( bool bShowResult )
{
   if (bShowResult)
      qDebug() << "show something";

    myMethod1(bShowResult);
    myMethod2(bShowResult);
}


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: YES
(available in About System)
KDE Plasma Version: 5.19.5
KDE Frameworks Version: 5.74.0
Qt Version: 5.15.1

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to