1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 02:06:01 +02:00

Fix for 180883 and 197990, content assist before saving file.

This commit is contained in:
Markus Schorn 2007-07-27 13:05:26 +00:00
parent f530f86969
commit c6851a2543
2 changed files with 19 additions and 8 deletions

View file

@ -6,10 +6,10 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Bryan Wilkinson (QNX)
* Andrew Ferguson (Symbian)
* IBM Rational Software - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Bryan Wilkinson (QNX)
* Andrew Ferguson (Symbian)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
@ -1220,12 +1220,13 @@ public class CVisitor {
}
} else if ( parent instanceof IASTTranslationUnit ){
IASTTranslationUnit translation = (IASTTranslationUnit) parent;
if (!prefix || translation.getIndex() == null) {
if (!prefix) {
nodes = translation.getDeclarations();
scope = (ICScope) translation.getScope();
} else {
//The index will be search later
nodes = null;
// The index will be search later, still we need to look at the declarations found in
// the AST, bug 180883
nodes = translation.getDeclarations();
scope = null;
}
} else if( parent instanceof IASTStandardFunctionDeclarator ){

View file

@ -7,6 +7,7 @@
*
* Contributors:
* Anton Leherbauer (Wind River Systems) - initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.ui.tests.text.contentassist2;
@ -126,7 +127,7 @@ public class CompletionTests_PlainC extends AbstractContentAssistTest {
//// to_be_replaced_
//void gfunc(){aNew/*cursor*/
public void _testGlobalVariableBeforeSave_Bug180883() throws Exception {
public void testGlobalVariableBeforeSave_Bug180883() throws Exception {
String replace= "// to_be_replaced_";
String globalVar= "int aNewGlobalVar;";
IDocument doc= getDocument();
@ -143,4 +144,13 @@ public class CompletionTests_PlainC extends AbstractContentAssistTest {
assertCompletionResults(expected);
}
// static int staticVar197990;
// void gFunc() {
// stat/*cursor*/
public void testStaticVariables_Bug197990() throws Exception {
final String[] expected= {
"staticVar197990"
};
assertCompletionResults(expected);
}
}