mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 10:16:03 +02:00
Fix for Bug 175283 - [Content Assist] Invalid keyword completion (Patch by Bryan Wilkinson)
This commit is contained in:
parent
b2b1287072
commit
0a05580aef
5 changed files with 220 additions and 176 deletions
|
@ -1582,21 +1582,6 @@
|
||||||
name="%CDTIndexer.domsourceindexer"/>
|
name="%CDTIndexer.domsourceindexer"/>
|
||||||
|
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
|
||||||
point="org.eclipse.cdt.ui.completionContributors">
|
|
||||||
<contributor
|
|
||||||
class="org.eclipse.cdt.internal.ui.text.contentassist.KeywordCompletionContributor"
|
|
||||||
id="Keywords"
|
|
||||||
priority="10"/>
|
|
||||||
<contributor
|
|
||||||
class="org.eclipse.cdt.internal.ui.text.contentassist.HelpCompletionContributor"
|
|
||||||
id="Help"
|
|
||||||
priority="99"/>
|
|
||||||
<!--contributor
|
|
||||||
class="org.eclipse.cdt.internal.ui.text.contentassist.PDOMCompletionContributor"
|
|
||||||
id="PDOM"
|
|
||||||
priority="3"/-->
|
|
||||||
</extension>
|
|
||||||
|
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.cdt.ui.completionProposalComputer"
|
point="org.eclipse.cdt.ui.completionProposalComputer"
|
||||||
|
@ -1651,6 +1636,31 @@
|
||||||
<partition type="__c_preprocessor"/>
|
<partition type="__c_preprocessor"/>
|
||||||
</completionProposalComputer>
|
</completionProposalComputer>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
id="KeywordCompletionProposalComputer"
|
||||||
|
point="org.eclipse.cdt.ui.completionProposalComputer">
|
||||||
|
<completionProposalComputer
|
||||||
|
categoryId="org.eclipse.cdt.ui.parserProposalCategory"
|
||||||
|
class="org.eclipse.cdt.internal.ui.text.contentassist.KeywordCompletionProposalComputer">
|
||||||
|
<partition
|
||||||
|
type="__dftl_partition_content_type">
|
||||||
|
</partition>
|
||||||
|
<partition
|
||||||
|
type="__c_preprocessor">
|
||||||
|
</partition>
|
||||||
|
</completionProposalComputer>
|
||||||
|
</extension>
|
||||||
|
<extension
|
||||||
|
id="HelpCompletionProposalComputer"
|
||||||
|
point="org.eclipse.cdt.ui.completionProposalComputer">
|
||||||
|
<completionProposalComputer
|
||||||
|
categoryId="org.eclipse.cdt.ui.parserProposalCategory"
|
||||||
|
class="org.eclipse.cdt.internal.ui.text.contentassist.HelpCompletionProposalComputer">
|
||||||
|
<partition
|
||||||
|
type="__dftl_partition_content_type">
|
||||||
|
</partition>
|
||||||
|
</completionProposalComputer>
|
||||||
|
</extension>
|
||||||
<!-- template proposals -->
|
<!-- template proposals -->
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.cdt.ui.completionProposalComputer"
|
point="org.eclipse.cdt.ui.completionProposalComputer"
|
||||||
|
|
|
@ -1,104 +0,0 @@
|
||||||
/**********************************************************************
|
|
||||||
* Copyright (c) 2004, 2005 IBM Corporation 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
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* IBM Corporation - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.eclipse.cdt.internal.ui.text.contentassist;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFieldReference;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
|
||||||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
|
||||||
import org.eclipse.cdt.internal.ui.CHelpProviderManager;
|
|
||||||
import org.eclipse.cdt.internal.ui.viewsupport.CElementImageProvider;
|
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
|
||||||
import org.eclipse.cdt.ui.IFunctionSummary;
|
|
||||||
import org.eclipse.cdt.ui.text.ICHelpInvocationContext;
|
|
||||||
import org.eclipse.cdt.ui.text.contentassist.ICompletionContributor;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
|
||||||
import org.eclipse.jface.text.ITextViewer;
|
|
||||||
import org.eclipse.jface.text.contentassist.ContextInformation;
|
|
||||||
import org.eclipse.swt.graphics.Image;
|
|
||||||
|
|
||||||
public class HelpCompletionContributor implements ICompletionContributor {
|
|
||||||
|
|
||||||
public void contributeCompletionProposals(ITextViewer viewer, int offset,
|
|
||||||
IWorkingCopy workingCopy, ASTCompletionNode completionNode, String prefix,
|
|
||||||
List proposals)
|
|
||||||
{
|
|
||||||
final IWorkingCopy fWorkingCopy = workingCopy;
|
|
||||||
if (completionNode != null) {
|
|
||||||
// Find matching functions
|
|
||||||
ICHelpInvocationContext context = new ICHelpInvocationContext() {
|
|
||||||
|
|
||||||
public IProject getProject() {
|
|
||||||
return fWorkingCopy.getCProject().getProject();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ITranslationUnit getTranslationUnit() {
|
|
||||||
return fWorkingCopy.getTranslationUnit();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
IASTName[] names = completionNode.getNames();
|
|
||||||
for (int i = 0; i < names.length; ++i) {
|
|
||||||
IASTName name = names[i];
|
|
||||||
|
|
||||||
if (name.getTranslationUnit() == null)
|
|
||||||
// Not connected
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// ignore if this is a member access
|
|
||||||
if (name.getParent() instanceof IASTFieldReference)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
IFunctionSummary[] summaries = CHelpProviderManager.getDefault().getMatchingFunctions(context, prefix);
|
|
||||||
if (summaries == null )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
int repOffset = offset - prefix.length();
|
|
||||||
int repLength = prefix.length();
|
|
||||||
Image image = CUIPlugin.getImageDescriptorRegistry().get(CElementImageProvider.getFunctionImageDescriptor());
|
|
||||||
|
|
||||||
for (int j = 0; j < summaries.length; j++) {
|
|
||||||
IFunctionSummary summary = summaries[j];
|
|
||||||
String fname = summary.getName() + "()"; //$NON-NLS-1$
|
|
||||||
String fdesc = summary.getDescription();
|
|
||||||
IFunctionSummary.IFunctionPrototypeSummary fproto = summary.getPrototype();
|
|
||||||
String fargs = fproto.getArguments();
|
|
||||||
|
|
||||||
CCompletionProposal proposal;
|
|
||||||
proposal = new CCompletionProposal(fname,
|
|
||||||
repOffset,
|
|
||||||
repLength,
|
|
||||||
image,
|
|
||||||
fproto.getPrototypeString(true),
|
|
||||||
2,
|
|
||||||
viewer);
|
|
||||||
|
|
||||||
if (fdesc != null) {
|
|
||||||
proposal.setAdditionalProposalInfo(fdesc);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fargs != null && fargs.length() > 0) {
|
|
||||||
proposal.setContextInformation(new ContextInformation(fname, fargs));
|
|
||||||
// set the cursor before the closing bracket
|
|
||||||
proposal.setCursorPosition(fname.length() - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
proposals.add(proposal);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,126 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2007 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
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Bryan Wilkinson (QNX) - Initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.internal.ui.text.contentassist;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTFieldReference;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
import org.eclipse.cdt.ui.IFunctionSummary;
|
||||||
|
import org.eclipse.cdt.ui.text.ICHelpInvocationContext;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.ui.CHelpProviderManager;
|
||||||
|
import org.eclipse.cdt.internal.ui.viewsupport.CElementImageProvider;
|
||||||
|
|
||||||
|
public class HelpCompletionProposalComputer extends ParsingBasedProposalComputer {
|
||||||
|
|
||||||
|
protected List computeCompletionProposals(
|
||||||
|
CContentAssistInvocationContext cContext,
|
||||||
|
ASTCompletionNode completionNode, String prefix)
|
||||||
|
throws CoreException {
|
||||||
|
|
||||||
|
boolean handleHelp = false;
|
||||||
|
if (completionNode != null) {
|
||||||
|
IASTName[] names = completionNode.getNames();
|
||||||
|
for (int i = 0; i < names.length; ++i) {
|
||||||
|
IASTName name = names[i];
|
||||||
|
|
||||||
|
// ignore if not connected
|
||||||
|
if (name.getTranslationUnit() == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// ignore if this is a member access
|
||||||
|
if (name.getParent() instanceof IASTFieldReference)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
handleHelp = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!handleHelp) {
|
||||||
|
return Collections.EMPTY_LIST;
|
||||||
|
}
|
||||||
|
|
||||||
|
final ITranslationUnit tu = cContext.getTranslationUnit();
|
||||||
|
// Find matching functions
|
||||||
|
ICHelpInvocationContext helpContext = new ICHelpInvocationContext() {
|
||||||
|
|
||||||
|
public IProject getProject() {
|
||||||
|
return tu.getCProject().getProject();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ITranslationUnit getTranslationUnit() {
|
||||||
|
return tu;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
IFunctionSummary[] summaries = CHelpProviderManager.getDefault()
|
||||||
|
.getMatchingFunctions(helpContext, prefix);
|
||||||
|
if (summaries == null)
|
||||||
|
return Collections.EMPTY_LIST;
|
||||||
|
|
||||||
|
int repOffset = cContext.getInvocationOffset() - prefix.length();
|
||||||
|
int repLength = prefix.length();
|
||||||
|
Image image = CUIPlugin.getImageDescriptorRegistry().get(
|
||||||
|
CElementImageProvider.getFunctionImageDescriptor());
|
||||||
|
|
||||||
|
List proposals = new ArrayList();
|
||||||
|
|
||||||
|
for (int j = 0; j < summaries.length; j++) {
|
||||||
|
IFunctionSummary summary = summaries[j];
|
||||||
|
String fname = summary.getName() + "()"; //$NON-NLS-1$
|
||||||
|
String fdesc = summary.getDescription();
|
||||||
|
IFunctionSummary.IFunctionPrototypeSummary fproto = summary
|
||||||
|
.getPrototype();
|
||||||
|
String fargs = fproto.getArguments();
|
||||||
|
|
||||||
|
CCompletionProposal proposal;
|
||||||
|
proposal = new CCompletionProposal(
|
||||||
|
fname,
|
||||||
|
repOffset,
|
||||||
|
repLength,
|
||||||
|
image,
|
||||||
|
fproto.getPrototypeString(true),
|
||||||
|
2,
|
||||||
|
cContext.getViewer());
|
||||||
|
|
||||||
|
if (fdesc != null) {
|
||||||
|
proposal.setAdditionalProposalInfo(fdesc);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cContext.isContextInformationStyle()) {
|
||||||
|
// set the cursor before the closing bracket
|
||||||
|
proposal.setCursorPosition(fname.length() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fargs != null && fargs.length() > 0) {
|
||||||
|
CProposalContextInformation info = new CProposalContextInformation(image, fname, fargs);
|
||||||
|
info.setContextInformationPosition(cContext.getContextInformationOffset());
|
||||||
|
proposal.setContextInformation(info);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
proposals.add(proposal);
|
||||||
|
}
|
||||||
|
|
||||||
|
return proposals;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,99 +1,106 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2005, 2007 IBM Corporation and others.
|
* Copyright (c) 2007 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
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* Bryan Wilkinson (QNX) - Initial API and implementation
|
||||||
* Anton Leherbauer (Wind River Systems)
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.text.contentassist;
|
package org.eclipse.cdt.internal.ui.text.contentassist;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
|
import org.eclipse.jface.text.BadLocationException;
|
||||||
|
import org.eclipse.jface.text.IDocument;
|
||||||
|
import org.eclipse.jface.text.TextUtilities;
|
||||||
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFieldReference;
|
import org.eclipse.cdt.core.dom.ast.IASTFieldReference;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
import org.eclipse.cdt.core.parser.Directives;
|
import org.eclipse.cdt.core.parser.Directives;
|
||||||
import org.eclipse.cdt.core.parser.Keywords;
|
import org.eclipse.cdt.core.parser.Keywords;
|
||||||
import org.eclipse.cdt.internal.ui.viewsupport.CElementImageProvider;
|
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
import org.eclipse.cdt.ui.text.ICPartitions;
|
import org.eclipse.cdt.ui.text.ICPartitions;
|
||||||
import org.eclipse.cdt.ui.text.contentassist.ICompletionContributor;
|
import org.eclipse.cdt.ui.text.contentassist.ICompletionProposalComputer;
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
|
||||||
import org.eclipse.jface.text.BadLocationException;
|
|
||||||
import org.eclipse.jface.text.IDocument;
|
|
||||||
import org.eclipse.jface.text.ITextViewer;
|
|
||||||
import org.eclipse.jface.text.TextUtilities;
|
|
||||||
import org.eclipse.swt.graphics.Image;
|
|
||||||
|
|
||||||
public class KeywordCompletionContributor implements ICompletionContributor {
|
import org.eclipse.cdt.internal.ui.viewsupport.CElementImageProvider;
|
||||||
|
|
||||||
public void contributeCompletionProposals(ITextViewer viewer, int offset,
|
public class KeywordCompletionProposalComputer extends ParsingBasedProposalComputer implements ICompletionProposalComputer {
|
||||||
IWorkingCopy workingCopy, ASTCompletionNode completionNode,
|
|
||||||
String prefix, List proposals) {
|
|
||||||
|
|
||||||
// No prefix, no completions
|
protected List computeCompletionProposals(
|
||||||
if (prefix.length() == 0)
|
CContentAssistInvocationContext context,
|
||||||
return;
|
ASTCompletionNode completionNode, String prefix)
|
||||||
|
throws CoreException {
|
||||||
|
|
||||||
|
// No prefix, no completions
|
||||||
|
if (prefix.length() == 0 || context.isContextInformationStyle())
|
||||||
|
return Collections.EMPTY_LIST;
|
||||||
|
|
||||||
String[] keywords;
|
String[] keywords;
|
||||||
if(inPreprocessorDirective(viewer.getDocument(), offset)) {
|
if(inPreprocessorDirective(context.getDocument(), context.getInvocationOffset())) {
|
||||||
keywords= preprocessorKeywords;
|
keywords= preprocessorKeywords;
|
||||||
} else {
|
} else {
|
||||||
if (!validContext(completionNode))
|
if (!isValidContext(completionNode))
|
||||||
return;
|
return Collections.EMPTY_LIST;
|
||||||
|
|
||||||
|
ITranslationUnit tu = context.getTranslationUnit();
|
||||||
|
|
||||||
keywords = cppkeywords; // default to C++
|
keywords = cppkeywords; // default to C++
|
||||||
if (workingCopy != null && workingCopy.isCLanguage())
|
if (tu != null && tu.isCLanguage())
|
||||||
keywords = ckeywords;
|
keywords = ckeywords;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List proposals = new ArrayList();
|
||||||
|
|
||||||
// add matching keyword proposals
|
// add matching keyword proposals
|
||||||
ImageDescriptor imagedesc = CElementImageProvider.getKeywordImageDescriptor();
|
ImageDescriptor imagedesc = CElementImageProvider.getKeywordImageDescriptor();
|
||||||
Image image = imagedesc != null ? CUIPlugin.getImageDescriptorRegistry().get(imagedesc) : null;
|
Image image = imagedesc != null ? CUIPlugin.getImageDescriptorRegistry().get(imagedesc) : null;
|
||||||
for (int i = 0; i < keywords.length; ++i) {
|
for (int i = 0; i < keywords.length; ++i) {
|
||||||
if (keywords[i].startsWith(prefix)) {
|
if (keywords[i].startsWith(prefix)) {
|
||||||
int repLength = prefix.length();
|
int repLength = prefix.length();
|
||||||
int repOffset = offset - repLength;
|
int repOffset = context.getInvocationOffset() - repLength;
|
||||||
proposals.add(new CCompletionProposal(keywords[i], repOffset, repLength, image, keywords[i], 1, viewer));
|
proposals.add(new CCompletionProposal(keywords[i], repOffset,
|
||||||
|
repLength, image, keywords[i], 1, context.getViewer()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
return proposals;
|
||||||
// TODO This is copied from the search completion contributor
|
}
|
||||||
// We should make this common
|
|
||||||
private boolean validContext(ASTCompletionNode completionNode) {
|
|
||||||
if (completionNode == null)
|
|
||||||
// No completion node, assume true
|
|
||||||
return true;
|
|
||||||
|
|
||||||
boolean valid = true;
|
|
||||||
IASTName[] names = completionNode.getNames();
|
|
||||||
for (int i = 0; i < names.length; i++) {
|
|
||||||
IASTName name = names[i];
|
|
||||||
|
|
||||||
// not hooked up, not a valid name, ignore
|
|
||||||
if (name.getTranslationUnit() == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// member access currently isn't valid
|
|
||||||
if (name.getParent() instanceof IASTFieldReference) {
|
|
||||||
valid = false;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// found one that was valid
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Couldn't find a valid context
|
|
||||||
return valid;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the given invocation context looks valid for template completion.
|
||||||
|
*
|
||||||
|
* @param context the content assist invocation context
|
||||||
|
* @return <code>false</code> if the given invocation context looks like a field reference
|
||||||
|
*/
|
||||||
|
private boolean isValidContext(ASTCompletionNode completionNode) {
|
||||||
|
IASTName[] names = completionNode.getNames();
|
||||||
|
for (int i = 0; i < names.length; ++i) {
|
||||||
|
IASTName name = names[i];
|
||||||
|
|
||||||
|
// ignore if not connected
|
||||||
|
if (name.getTranslationUnit() == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// ignore if this is a member access
|
||||||
|
if (name.getParent() instanceof IASTFieldReference)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if given offset is inside a preprocessor directive.
|
* Check if given offset is inside a preprocessor directive.
|
||||||
*
|
*
|
||||||
|
@ -112,7 +119,7 @@ public class KeywordCompletionContributor implements ICompletionContributor {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// These are the keywords we complete
|
// These are the keywords we complete
|
||||||
// We only do the ones that are >= 5 characters long
|
// We only do the ones that are >= 5 characters long
|
||||||
private static String [] ckeywords = {
|
private static String [] ckeywords = {
|
|
@ -13,6 +13,7 @@
|
||||||
package org.eclipse.cdt.internal.ui.text.contentassist;
|
package org.eclipse.cdt.internal.ui.text.contentassist;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -45,6 +46,10 @@ public class LegacyCompletionProposalComputer extends ParsingBasedProposalComput
|
||||||
CContentAssistInvocationContext context,
|
CContentAssistInvocationContext context,
|
||||||
ASTCompletionNode completionNode, String prefix) throws CoreException {
|
ASTCompletionNode completionNode, String prefix) throws CoreException {
|
||||||
|
|
||||||
|
if (context.isContextInformationStyle()) {
|
||||||
|
// context information cannot be supported by completionContributors
|
||||||
|
return Collections.EMPTY_LIST;
|
||||||
|
}
|
||||||
ITextViewer viewer = context.getViewer();
|
ITextViewer viewer = context.getViewer();
|
||||||
int offset = context.getInvocationOffset();
|
int offset = context.getInvocationOffset();
|
||||||
IWorkingCopy workingCopy = context.getTranslationUnit().getWorkingCopy();
|
IWorkingCopy workingCopy = context.getTranslationUnit().getWorkingCopy();
|
||||||
|
|
Loading…
Add table
Reference in a new issue