PHPStorm plugin for custom autocomplete (Updated)
Hi.
I'm trying to develop PHPStrom plugin for Scalar Objects PHP extension (https://github.com/nikic/scalar_objects) so i'd be able to do something like
<?php
class StringHandler {
public function length() {return strlen($this);}
public function replace($search, $replace) {return str_replace($search, $replace, $this);}
}
register_primitive_type_handler('string', 'StringHandler');
$string = "test string";
and get autocompletion for
echo $string->replace("test ", "")->length(); //6
I guess i need to check variable type and load all public methods from registered for this type handler (handler could be set manually in plugin settings e.g.) to autcompletion list, but i have no idea about even what to begin with due to lack of information about developing Intellij plugins and very few examples.
Any help would be appreciated.
--UPD--
Ok, i found something interestring.
If you name a class just as one of PHP scalar types, autocomplete works great for variables of this type:
Unforunately, it's impossible to create class named "array", so it's the main problem i have to solve - how to make PHPStorm look up variants for autocomplete in custom class at least for array type variables.
Message was edited by: Dmitry Avdonkin

Please sign in to leave a comment.