Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[pdt-dev] about code in GlobalTypesStrategy.getReplacementRange

the code is

    public SourceRange getReplacementRange(ICompletionContext context)
            throws BadLocationException {
        SourceRange replacementRange = super.getReplacementRange(context);
        if (replacementRange.getLength() > 0) {
            return new SourceRange(replacementRange.getOffset(),
                    replacementRange.getLength() - 1);
        }
        return replacementRange;
    }


My question is why override getReplacementRange?

Because I have fixed bug 302073,I want to know if the code here has some relation with bug 302073.

when "Completion Overwrites" is
selected!!!!
(Preferences -> PHP -> Editor -> Content Assist)

you have the following php file

<?php
/**
 *
 * @author douya
 * @var __PHP_Incomplete_Class
 */
class Test
{
    public function Test()
    {
    }
}


$a  = new T|es  //cursor is after "T"

Then you use code assist and then choose Test class,the result is

$a  = new Test()s

and i think it should be

$a  = new Test() //without the last "s"
--

Thanks!

Best Regards!

Zhao

Back to the top