Bug 72824 - [Content Assist] Content Assist erases code
Summary: [Content Assist] Content Assist erases code
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 4.0 M6   Edit
Assignee: Bryan Wilkinson CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2004-08-27 16:11 EDT by Andrew Niefer CLA
Modified: 2009-01-09 15:09 EST (History)
4 users (show)

See Also:


Attachments
proposed patch (8.61 KB, patch)
2007-02-09 16:10 EST, Bryan Wilkinson CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Niefer CLA 2004-08-27 16:11:21 EDT
class Strategy{
public:
	enum _Ability {
		IDIOT,
		NORMAL,
		CHEAT
	};

	Strategy( _Ability a );
};

int 
main(int argc, char **argv) {
	Strategy * Strategies[3] = { new Strategy( Str[CTRL+SPACE]
}

With the above code, doing a content assist where indicated, will actually 
erase the existing Str and leave nothing in its place.

(Expect content assist to complete "Strategy")
Comment 1 John Camelon CLA 2004-09-08 14:05:19 EDT
When I run this under the debugger, it works fine. 
There is a race condition in the UI code here.  
Comment 2 Andrew Niefer CLA 2004-09-08 14:22:46 EDT
I'm going to look at a bunch of content assist bugs
Comment 3 John Camelon CLA 2004-09-08 14:23:08 EDT
If you change the code to have 2 constructors, it works fine.  
There are 2 runnables here, and one hides() the other's work.  
Comment 4 Andrew Niefer CLA 2004-09-08 16:31:55 EDT
I believe this is a result of the code that gives us the slightly different
functionality for function proposals when you have no prefix and partial
parameter information (bug 50807).

The problem is that completionOnConstructorReference is not looking for the
right things and is using the result.getIndexOfNextParameter() inappropriately
(leading to the behaviour desired for 50807 which is not want we want here)
Comment 5 Andrew Niefer CLA 2004-09-09 17:06:21 EDT
fixed in HEAD
Comment 6 John Camelon CLA 2004-09-09 21:51:28 EDT
Reopening. 
Please address in AST2 branch as well. 
Comment 7 Andrew Niefer CLA 2004-09-10 15:13:04 EDT
fix has been applied to the cdt_ast2 branch
Comment 8 Markus Schorn CLA 2006-09-11 09:51:21 EDT
Regression test ContentAssistTests._testBug72824() is failing.
Comment 9 Doug Schaefer CLA 2006-09-11 10:55:27 EDT
Content assist doesn't seem to be working in the array initializer.
Comment 10 Bryan Wilkinson CLA 2007-02-09 16:10:10 EST
Created attachment 58699 [details]
proposed patch

Patch includes a quick change to the GNUCPPSourceParser to allow for completions in the array initializer.

Also, since the J-Unit test for this bug requires it, the patch includes changes to include enumerators in class scoped reference.

Example:

Strategy::CH//completion here results in CHEAT
Comment 11 Bryan Wilkinson CLA 2007-02-14 15:16:10 EST
CCing an active committer :)
Comment 12 Doug Schaefer CLA 2007-02-14 15:56:25 EST
This one got hidden in the sands of time. Putting back on cdt-core. If Toni doesn't have time for it, I'll take a look tomorrow.
Comment 13 Andrew Niefer CLA 2007-02-14 16:41:21 EST
I didn't realize there were still cdt bugs assigned to me.  I saw Bryan's patch go by, but have been busy lately and I guess the bug wasn't glamorous enough to look at right away :)
Comment 14 Anton Leherbauer CLA 2007-02-15 03:04:28 EST
Sure, I'll take a look.
Comment 15 Anton Leherbauer CLA 2007-02-15 09:55:46 EST
I'll commit after M5.
Comment 16 Anton Leherbauer CLA 2007-02-19 03:48:48 EST
Committed. Thanks, Bryan.