Bug 361716

Summary: Duplicate suggestions in include file completion
Product: [Applications] kdevelop Reporter: Alexander Potashev <aspotashev>
Component: Language Support: CPP (Clang-based)Assignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: git master   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: screenshot of projectmanagerview.cpp

Description Alexander Potashev 2016-04-13 12:46:55 UTC
When I write #include "" and press Ctrl+Space inside the double quotes, I see a list of .h files where the .h from the current directory appear twice.

Reproducible: Always




I have several include directories set up manually in the project configuration, including the above mentioned current directory.
Comment 1 Kevin Funk 2016-09-08 19:31:35 UTC
Still a problem? Please post a screenshot in that case; including the project tree view with the folder hierarchy if possible.
Comment 2 Alexander Potashev 2016-09-10 10:18:50 UTC
Created attachment 101009 [details]
screenshot of projectmanagerview.cpp

Still a problem.
Comment 3 Milian Wolff 2016-09-11 20:12:26 UTC
Alexander, any chance we can reproduce this with a project that is accessible to us? Do you also see this in KDE projects by any chance e.g.? Or any other FOSS project we can test ourselves?
Comment 4 Alexander Potashev 2016-09-11 22:05:02 UTC
(In reply to Milian Wolff from comment #3)
> Alexander, any chance we can reproduce this with a project that is
> accessible to us? Do you also see this in KDE projects by any chance e.g.?
> Or any other FOSS project we can test ourselves?

Milian,

As you can see in the screenshot, it was projectmanagerview.cpp from kdevplatform[master].
Comment 5 Milian Wolff 2016-09-13 21:37:42 UTC
Heh, I should pay more attention to the surroundings of the actual bug ;-)

Sadly, I cannot reproduce this locally. Any chance you could add some debug output and debug it locally to see why it adds two files for you?
Comment 6 Alexander Potashev 2016-09-13 23:10:13 UTC
Proposed fix: https://phabricator.kde.org/D2765
Comment 7 Alexander Potashev 2016-09-14 08:56:50 UTC
Git commit 8ed162c5024778f50cb303f333a3062727f695c4 by Alexander Potashev.
Committed on 14/09/2016 at 08:56.
Pushed by aspotashev into branch '5.0'.

clang: Make sure include paths are unique

Summary:
std::unique() is not enough because it only removes consecutive
duplicates.

In my case Path(url).parent() pushed into the list at line
"paths.push_front(Path(url).parent());" was duplicating an existing
include path probably generated by CMake.

Reviewers: mwolff, kfunk

Reviewed By: kfunk

Subscribers: brauch, kfunk, kdevelop-devel

Differential Revision: https://phabricator.kde.org/D2765

M  +1    -0    languages/clang/codecompletion/includepathcompletioncontext.cpp

http://commits.kde.org/kdevelop/8ed162c5024778f50cb303f333a3062727f695c4