Reputation: 669
I am trying to get vim´s omnicomplete feature to suggest class properties in addition to methods.
The tags file generated by ctags does contain the variable info, so it should be able to show this, but I only get the methods.
class.php:
<?php
class Thing {
public string $name;
public function run(){}
}
code.php
<?php
require_once "class.php";
$thing = new Thing();
$thing->#cursor here, pressing <C-X><C-O> reveals only run( f ) - not name
tags:
Thing class.php /^class Thing$/;" c language:PHP
name class.php /^ public string $name;$/;" v language:PHP class:Thing typeref:unknown:string access:public
run class.php /^ public function run(){}$/;" f language:PHP class:Thing access:public signature:()
generated with: ctags --fields=+aimlS --languages=php --PHP-kinds=+cdfintv class.php
.vimrc:
set nocompatible
filetype plugin on
set omnifunc=syntaxcomplete#Complete
open vim with: vim -u .vimrc code.php
Edit:
The docs say that it should complete both methods and variables for a class after ->
- so what I am looking for should work.
after "->" complete only function and variable names specific for given class.
update:
it seems the problem is caused by vim (or it's built-in plugins) not being updated with the latest syntax for php. only untyped properties are shown:
Upvotes: 0
Views: 86