Method completion within a class doesn't work
Closed this issue · 4 comments
Example code to reproduce a problem:
class foo {
/**
* @return DateTime
*/
public function makeDateTime() {
}
public function __construct() {
$dt = $this->makeDateTime();
// $dt-> no completion
}
}Completion does work however outside class scope, e.g.:
$foo = new foo;
// $foo->makeDateTime()-> completion does work hereThank you for the report, I can reproduce this.
It seems to be some issue around s:getNextCharWithPos() usage (real file lines vs the function lines).
Same problem for functions as well:
/**
* @return DateTime
*/
function makeDateTime() {
}
function bar() {
$dt = makeDateTime();
$dt->
}It seems to me that only current function's body is examined that's why completion fails.
(I have no experience with vimscript whatsoever so bear with me)
If that helps, changing search_end_line to 1 in https://github.com/shawncplus/phpcomplete.vim/blob/master/autoload/phpcomplete.vim#L1863
fixes the problem.
@SergSerbin, Yeah the problem was somewhere there, the crux of a problem was that when running inside a function the plugin only considers the lines from the function body but neglected to offset the line-numbers when checking against things in in real-buffer-line-number terms.
I think I've fixed this (your examples seem to work) and made a testcase out of the first one. Please check it out and thanks again for the report.
Works flawlessly, thank you.