Fix context help for template data types
ClosedPublic

Authored by antonanikin on Oct 30 2016, 12:57 PM.

Details

Summary

This patch fixes broken code-context help for template data types. Old version has buggy behavior:

  1. Place following code to some source file:
#include <cmath>
#include <math.h>
#include <vector>
#include <QList>

void test()
{
    QList<int> l;
    l.append(1);

    double x = std::sin(1);
    double y = sin(1);
    std::vector<int> v;
}
  1. Place cursor to any function or templated type and call "Show Documentation" from context menu. Help page is NOT shown.

This behavior caused by wrong usage of documentation Url - we pass full qualified type (with template information like QList<...>), but documentation has topics only for plain data type like QList.

Test Plan

Tested on master branch with patched KDevelop plugings for Qt- and man- pages help.

Diff Detail

Repository
R33 KDevPlatform
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
antonanikin retitled this revision from to help_templates_fix.
antonanikin updated this object.
antonanikin edited the test plan for this revision. (Show Details)
Restricted Application added a subscriber: kdevelop-devel. · View Herald TranscriptOct 30 2016, 12:57 PM
antonanikin retitled this revision from help_templates_fix to Fix context help for template data types.Oct 30 2016, 1:04 PM
antonanikin updated this object.
antonanikin edited the test plan for this revision. (Show Details)
antonanikin added a reviewer: KDevelop.
kfunk requested changes to this revision.Oct 31 2016, 12:54 PM
kfunk added a reviewer: kfunk.
kfunk added a subscriber: kfunk.
kfunk added inline comments.
language/duchain/identifier.h
211

Better add an enum for the string formatting options, e.g.:

enum StringFormattingOption {
    AddTemplateIdentifiers = 0,
    IgnoreExplicitelyGlobal = 1 << 0
};
Q_DECLARE_FLAGS(StringFormattingOptions StringFormattingOption)

// ...

QString toString(StringFormattingOptions options)

Note: We have to push this patch to master, since it's an ABI incompatible change. OR (if we want to have it in 5.0, which makes sense) create extra methods which have the additional parameter, keep the original method signatures untouched.

This revision now requires changes to proceed.Oct 31 2016, 12:54 PM
antonanikin updated this revision to Diff 7792.Nov 1 2016, 3:30 AM
antonanikin edited edge metadata.

Add an enum for the string formatting options

kfunk accepted this revision.Nov 16 2016, 11:17 PM
kfunk edited edge metadata.

Rest LGTM, great work

language/duchain/identifier.h
129

Please document enum + enum values

This revision is now accepted and ready to land.Nov 16 2016, 11:17 PM
kfunk added inline comments.Nov 16 2016, 11:22 PM
language/duchain/identifier.h
129

Thinking about it. This needs a NoOptions = 0x0 enumerator (i.e. for saying IgnoreExplicitlyGlobal = false & AddTemplateIdentifiers = false). The other enumerator values need to be bumped.

antonanikin updated this revision to Diff 8242.Nov 17 2016, 2:58 AM
antonanikin edited edge metadata.

enum update

antonanikin marked 2 inline comments as done.Nov 17 2016, 3:07 AM
antonanikin marked an inline comment as done.
kfunk requested changes to this revision.Nov 17 2016, 8:32 AM
kfunk edited edge metadata.

Nice, the enumerator ids are more descriptive now, too. Great work again, Anton!

To master branch.

This revision now requires changes to proceed.Nov 17 2016, 8:32 AM
kfunk accepted this revision.Nov 17 2016, 8:33 AM
kfunk edited edge metadata.
This revision is now accepted and ready to land.Nov 17 2016, 8:33 AM
This revision was automatically updated to reflect the committed changes.