mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 10:16:03 +02:00
Fix for 180883 and 197990, content assist before saving file.
This commit is contained in:
parent
f530f86969
commit
c6851a2543
2 changed files with 19 additions and 8 deletions
|
@ -1220,12 +1220,13 @@ public class CVisitor {
|
||||||
}
|
}
|
||||||
} else if ( parent instanceof IASTTranslationUnit ){
|
} else if ( parent instanceof IASTTranslationUnit ){
|
||||||
IASTTranslationUnit translation = (IASTTranslationUnit) parent;
|
IASTTranslationUnit translation = (IASTTranslationUnit) parent;
|
||||||
if (!prefix || translation.getIndex() == null) {
|
if (!prefix) {
|
||||||
nodes = translation.getDeclarations();
|
nodes = translation.getDeclarations();
|
||||||
scope = (ICScope) translation.getScope();
|
scope = (ICScope) translation.getScope();
|
||||||
} else {
|
} else {
|
||||||
//The index will be search later
|
// The index will be search later, still we need to look at the declarations found in
|
||||||
nodes = null;
|
// the AST, bug 180883
|
||||||
|
nodes = translation.getDeclarations();
|
||||||
scope = null;
|
scope = null;
|
||||||
}
|
}
|
||||||
} else if( parent instanceof IASTStandardFunctionDeclarator ){
|
} else if( parent instanceof IASTStandardFunctionDeclarator ){
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Anton Leherbauer (Wind River Systems) - initial API and implementation
|
* Anton Leherbauer (Wind River Systems) - initial API and implementation
|
||||||
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.ui.tests.text.contentassist2;
|
package org.eclipse.cdt.ui.tests.text.contentassist2;
|
||||||
|
@ -126,7 +127,7 @@ public class CompletionTests_PlainC extends AbstractContentAssistTest {
|
||||||
|
|
||||||
//// to_be_replaced_
|
//// to_be_replaced_
|
||||||
//void gfunc(){aNew/*cursor*/
|
//void gfunc(){aNew/*cursor*/
|
||||||
public void _testGlobalVariableBeforeSave_Bug180883() throws Exception {
|
public void testGlobalVariableBeforeSave_Bug180883() throws Exception {
|
||||||
String replace= "// to_be_replaced_";
|
String replace= "// to_be_replaced_";
|
||||||
String globalVar= "int aNewGlobalVar;";
|
String globalVar= "int aNewGlobalVar;";
|
||||||
IDocument doc= getDocument();
|
IDocument doc= getDocument();
|
||||||
|
@ -143,4 +144,13 @@ public class CompletionTests_PlainC extends AbstractContentAssistTest {
|
||||||
assertCompletionResults(expected);
|
assertCompletionResults(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static int staticVar197990;
|
||||||
|
// void gFunc() {
|
||||||
|
// stat/*cursor*/
|
||||||
|
public void testStaticVariables_Bug197990() throws Exception {
|
||||||
|
final String[] expected= {
|
||||||
|
"staticVar197990"
|
||||||
|
};
|
||||||
|
assertCompletionResults(expected);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue