Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 353281 - [C] No content assist for names of designated initializers
Summary: [C] No content assist for names of designated initializers
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: 8.0.2   Edit
Hardware: PC Linux
: P3 major with 1 vote (vote)
Target Milestone: 8.3.0   Edit
Assignee: Markus Schorn CLA
QA Contact: Markus Schorn CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-28 02:49 EDT by Jan Pohanka CLA
Modified: 2013-12-20 20:36 EST (History)
5 users (show)

See Also:


Attachments
screenshot of situation (727.34 KB, image/png)
2011-07-28 02:49 EDT, Jan Pohanka CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Pohanka CLA 2011-07-28 02:49:07 EDT
Build Identifier: 20110615-0604

Using following test c file, struct members are not offered by content assist in struct declaration. In a large project like linux kernel content assist fails. (Proposals are enabled in settings)

#include <stdio.h>
#include <stdlib.h>

struct foo {
	int a;
	float b;
	double c;
};

struct foo bar = {
    . CONTENT ASSIST DOES NOT OFFER STRUCT MEMBERS HERE
};

int main(void) {
        bar.a = 1; /* a member was correctly offered here */
	puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
	return EXIT_SUCCESS;
}


Reproducible: Always

Steps to Reproduce:
1. Create a sample test c file with struct declaration like in details.
2. Press ctrl+space after . in struct bar definition.
Comment 1 Jan Pohanka CLA 2011-07-28 02:49:58 EDT
Created attachment 200493 [details]
screenshot of situation
Comment 2 Markus Schorn CLA 2011-08-11 10:26:39 EDT
Added testcase and fix.
Comment 3 CDT Genie CLA 2011-08-11 11:38:05 EDT
*** cdt git genie on behalf of Markus Schorn ***

    Bug 353281: Content assist for designated initializers

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=fea0a6163a194903940d0a90424449c60ed1b006
Comment 4 CDT Genie CLA 2011-08-17 08:23:02 EDT
*** cdt git genie on behalf of Markus Schorn ***

    Bug 353281: Follow up.

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=ea5c5cf0d90a3529d98c4f533de5ea9230cf9c96
Comment 5 Jan Pohanka CLA 2012-01-18 04:30:40 EST
Content assist works for global designated initializers, but not for initializers within a function. See example

struct foo {
	int x;
	int y;
	int z;
};

struct foo bar = {
		.x = 0,
		.y = 1, /* content assist works here */
};

int main()
{
	struct foo bar2 = {
			. /* no default proposal */
	};


	return 0;
}
Comment 6 Markus Schorn CLA 2012-03-21 10:14:11 EDT
This is a different issue, I currently don't have the time to look into it.
Comment 7 Jan Pohanka CLA 2012-08-15 02:36:10 EDT
I made a clean install of Eclipse Indigo on Windows with CDT 8.0.2 and it seems that content assist for designated initializers does not work again. Tried also in Juno and situation is the same.
Comment 8 Marc-André Laperle CLA 2013-12-20 00:00:01 EST
Patch to fix the case in Comment 5
https://git.eclipse.org/r/20094/
Comment 9 Marc-André Laperle CLA 2013-12-20 20:36:31 EST
The patch was applied to master (8.3).