Bug 358521 - Completion only offers to implement a method when under a '}'
Summary: Completion only offers to implement a method when under a '}'
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: general (other bugs)
Version First Reported In: 4.90.91
Platform: Compiled Sources Linux
: VHI normal
Target Milestone: 5.0.0
Assignee: kdevelop-bugs-null
URL:
Keywords: release_blocker
Depends on:
Blocks:
 
Reported: 2016-01-25 07:42 UTC by David Faure
Modified: 2016-07-16 11:40 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Faure 2016-01-25 07:42:16 UTC
In kio/autotests/clipboardupdatertest.h add a method void foo() after all other test methods.
In the .cpp file, go to the first line after the closing '}' of testPasteAfterRenameFiles() and request completion, it will offer (after a bit of time which I find too long)
* implement void ClipboardUpdaterTest::foo() [as expected]

Cancel this popup, insert one blank line, call completion again
-> it doesn't offer this anymore!

Reproducible: Always



Expected Results:  
It shouldn't matter if I'm right under a '}' or not.
Comment 1 Milian Wolff 2016-01-25 17:43:54 UTC
I've seen this behavior as well. I guess it's related to us not triggering a reparse after  whitespace-only changes. The clang TU is then probably stale and thinks we are completing in a different context.

We should also look at the performance and figure out why it takes so long.
Comment 2 Milian Wolff 2016-02-08 08:07:43 UTC
Git commit 83fb88ec7b14b0f128db6c86b7078f3f51646aa1 by Milian Wolff.
Committed on 07/02/2016 at 21:37.
Pushed by mwolff into branch '5.0'.

Also offer to implement function when in line of next function.

This fixes a bug where putting the cursor at the start of a line
where another function is defined, no implementations are offered.

This also workarounds the common case for bug 358521, where the
real cause is that the TU is not properly updated. Thus the
cursor will point to the old position where a function was and
then no offers where given.

M  +2    -0    languages/clang/codecompletion/completionhelper.cpp
M  +4    -0    languages/clang/tests/test_codecompletion.cpp

http://commits.kde.org/kdevelop/83fb88ec7b14b0f128db6c86b7078f3f51646aa1
Comment 3 Milian Wolff 2016-02-08 08:07:44 UTC
Git commit a034f76041aea5f1ade48759a17e42959833b62e by Milian Wolff.
Committed on 08/02/2016 at 08:05.
Pushed by mwolff into branch '5.0'.

Add test case for broken implementation helper after edit operation.

M  +32   -1    languages/clang/tests/test_codecompletion.cpp
M  +1    -0    languages/clang/tests/test_codecompletion.h

http://commits.kde.org/kdevelop/a034f76041aea5f1ade48759a17e42959833b62e
Comment 4 Sven Brauch 2016-07-16 11:40:30 UTC
The issue is fixed (more or less a side-effect of 0931fe88180d1); the test still fails though since it does not wait for the update.