php-vim-syntax
php-vim-syntax copied to clipboard
Merge features from StanAngeloff/php.vim
I wonder if it makes sense to merge some of the features from
https://github.com/StanAngeloff/php.vim
into this project. For example they also define phpDocParam and phpDocIdentifier in addition to phpDocTags. There may be more.
Let me know what you think and I can provide some PR (starting with the above two groups).
I hadn't had the time to look at this earlier, but the functionality seems interesting.
phpDocParam and phpDocIdentifier seem to be for different highlighting of union types and parameters in phpdoc.
- I'm assuming it's missing some features such as
int[][], non-standard functionality such as intersection types in phpdoc (Countable&ArrayAccess), etc - it may be easier to give up and highlight everything before$\h\w*
The highlighting of use aliases also seems moderately useful (as, phpInclude, phpUseFunction)
https://github.com/StanAngeloff/php.vim/blob/master/syntax/php.vim#L651
Here's an example for the two extra groups:
/**
* @param string $text the text to truncate.
*/
stringisphpDocParam. (A better name would bephpDocType)$textisphpDocIdentifier
I've added a fix for array types like int[] to my fork here, but you're right, there's probably more missing.
I'm still unsure how to proceed. The main problem to me is that there are two sophisticated PHP syntax plugins out there. Both seem to have a common ancestor (created by Peter Hodge). But have diverged over the past 10 years a lot.
- @TysonAndre Your version here is maintained but lacks some useful syntax groups (e.g. for user defined classes, methods, class constants, static classes, ...).
- The version by @StanAngeloff has all this but is no longer maintained and currently archived. Still it's not perfect either and would need some fixes. It could probably also be cleaned up and simplified a bit.
Unifying both is quite some work and requires some courageous decisions. Something I don't feel capable of.
Then there's also treesitter which would probably make syntax files obsolete. But it's missing even more stuff and is still in active development. Still it's "the future" - so not sure if it's worth putting much more work into syntax files.