mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 511274 - Compute correct replacement length for ParameterGuessingProposal
Change-Id: Ia2d6f10086f8d2a9ec922a3ff37eadc8ab94c9ed
This commit is contained in:
parent
0f2acb0221
commit
a44bef00d6
2 changed files with 14 additions and 1 deletions
|
@ -38,6 +38,8 @@ import org.eclipse.cdt.core.CCorePlugin;
|
|||
import org.eclipse.cdt.core.testplugin.TestScannerProvider;
|
||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.text.contentassist.CCompletionProposal;
|
||||
|
||||
/**
|
||||
* A collection of code completion tests.
|
||||
*
|
||||
|
@ -1660,6 +1662,17 @@ public class CompletionTests extends CompletionTestBase {
|
|||
}
|
||||
}
|
||||
|
||||
// void foo(int x, int y);
|
||||
// void caller() {
|
||||
// fo/*cursor*/
|
||||
// }
|
||||
public void testReplacementLength_511274() throws Exception {
|
||||
Object[] results = invokeContentAssist(fCursorOffset, 0, true, false, true).results;
|
||||
assertEquals(1, results.length);
|
||||
assertInstance(results[0], CCompletionProposal.class);
|
||||
assertEquals(2, ((CCompletionProposal) results[0]).getReplacementLength());
|
||||
}
|
||||
|
||||
// struct A {
|
||||
// void foo();
|
||||
// };
|
||||
|
|
|
@ -113,7 +113,7 @@ public class ParameterGuessingProposal extends FunctionCompletionProposal {
|
|||
replacement = fullPrefix + replacement + ")"; //$NON-NLS-1$
|
||||
replacementOffset = proposal.getReplacementOffset();
|
||||
}
|
||||
replacementLength = replacement.length();
|
||||
replacementLength = prefix.length();
|
||||
ParameterGuessingProposal ret = new ParameterGuessingProposal(replacement, replacementOffset,
|
||||
replacementLength, proposal.getImage(), proposal.getDisplayString(), proposal.getIdString(),
|
||||
proposal.getRelevance(), context.getViewer(), function, invocationOffset, parseOffset,
|
||||
|
|
Loading…
Add table
Reference in a new issue