Fix align of doxygen comments in templates
ClosedPublic

Authored by buschinski on Oct 7 2018, 3:47 PM.

Details

Summary

After
https://bugs.kde.org/show_bug.cgi?id=360456
https://cgit.kde.org/ktexteditor.git/commit/?id=58baf7c318d4641a243ea18f04ef15ee017509e3

the align of doxygen comments in templates stopped working.

Without the patch:

/**
* foo
*/
void foo();

with the patch:

/**
 * foo
 */
void foo();
NOTE: this does not break 360456, a unittest for this is already present
Test Plan

Original test:

  • start kdevelop
  • open any c/cpp file with functions
  • select the function / click in the name
  • Code -> Document Declaration

-> not properly align

Newly added testcase:

  • ./bin/templatehandler_test testAlignC

Old test:

  • ./bin/kateindenttest testCstyle:360456

Diff Detail

Repository
R39 KTextEditor
Lint
Lint Skipped
Unit
Unit Tests Skipped
buschinski created this revision.Oct 7 2018, 3:47 PM
Restricted Application added projects: Kate, Frameworks. · View Herald TranscriptOct 7 2018, 3:47 PM
Restricted Application added subscribers: kde-frameworks-devel, kwrite-devel. · View Herald Transcript
buschinski requested review of this revision.Oct 7 2018, 3:47 PM

Hi, thanks for the patch to improve the indentation handling.
A case to reproduce would help.
For me, the identation is messed up in Kate if I do indent/unindent of such comments and the "keep extra spaces" option is off.
But I think that has nothing to do with this bug.

For the code:
Hmm, why do you use rtrim? That removes trailing spaces, that won't help the startsWith checks. Or do I misread that?

...
For the code:
Hmm, why do you use rtrim? That removes trailing spaces, that won't help the startsWith checks. Or do I misread that?

You are absolutely right, this makes no sense. I further investigate & fix.

buschinski updated this revision to Diff 43088.Oct 7 2018, 10:03 PM
buschinski edited the summary of this revision. (Show Details)
buschinski edited the test plan for this revision. (Show Details)
Restricted Application added a project: KDevelop. · View Herald TranscriptOct 7 2018, 10:03 PM
Restricted Application added a subscriber: kdevelop-devel. · View Herald Transcript

This did not work for templates as "isComment" uses line attributes and at the time the template is inserted it is always "C/C++ Code/Data"-attribute never a comment. It only becomes a "doxygen comment"-attribute after the template "editing" is finished.

buschinski changed the repository for this revision from R32 KDevelop to R39 KTextEditor.Oct 7 2018, 10:06 PM
buschinski updated this revision to Diff 43201.Oct 9 2018, 8:53 AM

Changed to (correct) ktexteditor repository. Someday... I will learn how to use phabricator :)

Dominik is more well versed in cstyle.js ;=)

dhaumann accepted this revision.Oct 20 2018, 8:07 PM

Well, make test works for me, and if this fixes the issue for you, I'm fine with that.

Locally, I had to resolve one hunk that did not apply. Maybe you have to update the patch again.

Can you commit yourself, or shall I push?

This revision is now accepted and ready to land.Oct 20 2018, 8:07 PM
buschinski added a comment.EditedOct 21 2018, 9:40 AM

Thx for the review :)
I will update the patch (and post it here again).

I can commit it myself, to master? or any special branch?

EDIT: as ktexteditor git only has a master, I will go ahead and push it to master.

buschinski updated this revision to Diff 44010.Oct 21 2018, 9:45 AM
buschinski retitled this revision from Fix align of doxygen comments to Fix align of doxygen comments in templates.
buschinski removed a project: KDevelop.
buschinski removed a subscriber: kdevelop-devel.
  • updated again master
  • mentioned templates in commit title
buschinski closed this revision.Oct 21 2018, 1:05 PM

Yes, in KDE Frameworks, there is only a master branch.