mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix for 215884: Inactive code highlighting isn't in accordance with content-assist.
This commit is contained in:
parent
9bbcd90dd9
commit
93e5a9c520
3 changed files with 13 additions and 15 deletions
|
@ -325,7 +325,6 @@ public class CCorePlugin extends Plugin {
|
||||||
// do harmless stuff first.
|
// do harmless stuff first.
|
||||||
cdtLog = new CDTLogWriter(CCorePlugin.getDefault().getStateLocation().append(".log").toFile()); //$NON-NLS-1$
|
cdtLog = new CDTLogWriter(CCorePlugin.getDefault().getStateLocation().append(".log").toFile()); //$NON-NLS-1$
|
||||||
configurePluginDebugOptions();
|
configurePluginDebugOptions();
|
||||||
getPluginPreferences().setDefault(PREF_USE_STRUCTURAL_PARSE_MODE, false);
|
|
||||||
PositionTrackerManager.getInstance().install();
|
PositionTrackerManager.getInstance().install();
|
||||||
|
|
||||||
// new project model needs to register the resource listener first.
|
// new project model needs to register the resource listener first.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2007 QNX Software Systems and others.
|
* Copyright (c) 2000, 2008 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -59,6 +59,7 @@ public class CCorePreferenceInitializer extends AbstractPreferenceInitializer {
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultPreferences.putBoolean(CCorePreferenceConstants.SHOW_SOURCE_FILES_IN_BINARIES, true);
|
defaultPreferences.putBoolean(CCorePreferenceConstants.SHOW_SOURCE_FILES_IN_BINARIES, true);
|
||||||
|
defaultPreferences.putBoolean(CCorePlugin.PREF_USE_STRUCTURAL_PARSE_MODE, false);
|
||||||
|
|
||||||
// indexer defaults
|
// indexer defaults
|
||||||
IndexerPreferences.initializeDefaultPreferences(defaultPreferences);
|
IndexerPreferences.initializeDefaultPreferences(defaultPreferences);
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.eclipse.cdt.core.index.IIndexManager;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
import org.eclipse.cdt.ui.PreferenceConstants;
|
||||||
import org.eclipse.cdt.ui.text.contentassist.ContentAssistInvocationContext;
|
import org.eclipse.cdt.ui.text.contentassist.ContentAssistInvocationContext;
|
||||||
import org.eclipse.cdt.ui.text.contentassist.ICEditorContentAssistInvocationContext;
|
import org.eclipse.cdt.ui.text.contentassist.ICEditorContentAssistInvocationContext;
|
||||||
|
|
||||||
|
@ -120,26 +121,23 @@ public class CContentAssistInvocationContext extends ContentAssistInvocationCont
|
||||||
ICProject proj= getProject();
|
ICProject proj= getProject();
|
||||||
if (proj == null) return null;
|
if (proj == null) return null;
|
||||||
|
|
||||||
try{
|
try {
|
||||||
IIndexManager manager= CCorePlugin.getIndexManager();
|
IIndexManager manager= CCorePlugin.getIndexManager();
|
||||||
if (manager.isProjectIndexed(proj)) {
|
fIndex = manager.getIndex(proj, IIndexManager.ADD_DEPENDENCIES | IIndexManager.ADD_DEPENDENT);
|
||||||
fIndex = CCorePlugin.getIndexManager().getIndex(proj,
|
|
||||||
IIndexManager.ADD_DEPENDENCIES | IIndexManager.ADD_DEPENDENT);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
fIndex.acquireReadLock();
|
fIndex.acquireReadLock();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
fIndex = null;
|
fIndex = null;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int flags = ITranslationUnit.AST_SKIP_ALL_HEADERS | ITranslationUnit.AST_CONFIGURE_USING_SOURCE_CONTEXT;
|
boolean parseNonIndexed= CUIPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.PREF_USE_STRUCTURAL_PARSE_MODE);
|
||||||
if (fIndex == null) {
|
int flags = parseNonIndexed ? ITranslationUnit.AST_SKIP_INDEXED_HEADERS : ITranslationUnit.AST_SKIP_ALL_HEADERS;
|
||||||
flags = 0;
|
flags |= ITranslationUnit.AST_CONFIGURE_USING_SOURCE_CONTEXT;
|
||||||
}
|
|
||||||
|
|
||||||
fCN = fTU.getCompletionNode(fIndex, flags, offset);
|
fCN = fTU.getCompletionNode(fIndex, flags, offset);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
|
CUIPlugin.getDefault().log(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return fCN;
|
return fCN;
|
||||||
|
|
Loading…
Add table
Reference in a new issue