I know Sublime Text isn't an IDE, but that's what I like about it. Still, it's nice to have certain IDE-esque functionality from time to time.
Mostly for use with Laravel, I'd like the ability for Sublime to find definitions of symbols that aren't defined in a standard PHP way, eg.
public function truncate()
I have a Str macro defined called truncate
, but Sublime (and various packages I've tried) don't recognize this as a symbol obviously.
It would be amazing to write a doc block above the macro definition that Sublime Text would recognize as a symbol when its goto_definition
is called. Maybe something like:
/**
* @method Str::truncate()
* ...or...
* @function truncate()
*/
Str::macro('truncate', fn() => '...');
The same concept could be applied to magic methods that use __call()
. I've seen other developers list magic or inherited properties in doc blocks on classes possibly for their editor/IDE of choice, but it could just be considerate coders conscious of human readability.
I assume that PHP Storm and similar are smart enough or tailored toward these Laravel concepts to achieve this, but I'm not sure how I can configure or extend Sublime for this use case. I have seen some reference to custom symbol recognition in Sublime but I recall it being pretty complicated without much documentation or examples.
I'm sure there are various ways to accomplish this, but I've yet to see anything promising. Any ideas?