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.
|
||||
cdtLog = new CDTLogWriter(CCorePlugin.getDefault().getStateLocation().append(".log").toFile()); //$NON-NLS-1$
|
||||
configurePluginDebugOptions();
|
||||
getPluginPreferences().setDefault(PREF_USE_STRUCTURAL_PARSE_MODE, false);
|
||||
PositionTrackerManager.getInstance().install();
|
||||
|
||||
// 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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* 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(CCorePlugin.PREF_USE_STRUCTURAL_PARSE_MODE, false);
|
||||
|
||||
// indexer defaults
|
||||
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.ITranslationUnit;
|
||||
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.ICEditorContentAssistInvocationContext;
|
||||
|
||||
|
@ -120,26 +121,23 @@ public class CContentAssistInvocationContext extends ContentAssistInvocationCont
|
|||
ICProject proj= getProject();
|
||||
if (proj == null) return null;
|
||||
|
||||
try{
|
||||
try {
|
||||
IIndexManager manager= CCorePlugin.getIndexManager();
|
||||
if (manager.isProjectIndexed(proj)) {
|
||||
fIndex = CCorePlugin.getIndexManager().getIndex(proj,
|
||||
IIndexManager.ADD_DEPENDENCIES | IIndexManager.ADD_DEPENDENT);
|
||||
fIndex = manager.getIndex(proj, IIndexManager.ADD_DEPENDENCIES | IIndexManager.ADD_DEPENDENT);
|
||||
|
||||
try {
|
||||
fIndex.acquireReadLock();
|
||||
} catch (InterruptedException e) {
|
||||
fIndex = null;
|
||||
}
|
||||
try {
|
||||
fIndex.acquireReadLock();
|
||||
} catch (InterruptedException e) {
|
||||
fIndex = null;
|
||||
}
|
||||
|
||||
int flags = ITranslationUnit.AST_SKIP_ALL_HEADERS | ITranslationUnit.AST_CONFIGURE_USING_SOURCE_CONTEXT;
|
||||
if (fIndex == null) {
|
||||
flags = 0;
|
||||
}
|
||||
boolean parseNonIndexed= CUIPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.PREF_USE_STRUCTURAL_PARSE_MODE);
|
||||
int flags = parseNonIndexed ? ITranslationUnit.AST_SKIP_INDEXED_HEADERS : ITranslationUnit.AST_SKIP_ALL_HEADERS;
|
||||
flags |= ITranslationUnit.AST_CONFIGURE_USING_SOURCE_CONTEXT;
|
||||
|
||||
fCN = fTU.getCompletionNode(fIndex, flags, offset);
|
||||
} catch (CoreException e) {
|
||||
CUIPlugin.getDefault().log(e);
|
||||
}
|
||||
|
||||
return fCN;
|
||||
|
|
Loading…
Add table
Reference in a new issue