Bug 426642 - 'Adapt signature' for an argument of method (doing this in its definition) removes spaces in declaration
Summary: 'Adapt signature' for an argument of method (doing this in its definition) re...
Status: REPORTED
Alias: None
Product: kdevelop
Classification: Applications
Component: general (show other bugs)
Version: 5.6.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-17 15:28 UTC by Piotr Mierzwinski
Modified: 2020-09-17 15:29 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Mierzwinski 2020-09-17 15:28:39 UTC
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