StanAngeloff / php.vim

An up-to-date Vim syntax for PHP (7.x supported)
477 stars 69 forks source link

A bunch of new matches #27

Closed rszabo closed 8 years ago

rszabo commented 10 years ago

Hello.

I'm not accustomed to the way pull requests are made here so I'm sharing some changes I made locally.

These changes add proper handling of class constants and static methods and -variables, makes null/array/boolean separate types and more.

Remember to add the keywords to "syn cluster" or else they aren't exported properly.

syn match phpStaticSelector "::" contained display

syn match phpClassConstant "::\h\w[^(]\w" contained contains=phpMethods,phpStaticSelector display syn match phpStaticMethods "::\h\w(" contained contains=phpMethods,phpStaticSelector display syn match phpStaticClasses "\v\h\w+(::)@=" contained display syn keyword phpException DomainException BadFunctionCallException BadMethodCallException InvalidArgumentException OutOfBoundsException OutOfRangeException OverflowException UnderflowException UnexpectedValueException UserException RuntimeException LogicException ErrorException DOMException ReflectionException Exception contained

syn keyword phpArray array contained syn keyword phpBoolean true false TRUE FALSE contained syn keyword phpNull null NULL contained

" Default links hi def link phpBoolean Boolean hi def link phpNull Null hi def link phpArray Array

Furthermore, I strongly suggest adding file|class|brief|details|author|created|date|todo|bug|warning| to the list of phpDocTags.

StanAngeloff commented 10 years ago

Hey @rszabo! Thanks for sharing your changes. The best way to review those set against the full source file is to upload your version of syntax/php.vim to gist.github.com. I can then download it and diff against the Git version to see the places where you've made those modifications.

StanAngeloff commented 10 years ago

As for the phpDocTags enhancements, I've opened a new issue in #28 to track that update separately.

rszabo commented 10 years ago

Sure! https://gist.github.com/rszabo/ae010537711ba0a25027

I left a comment on row 475 which really shouldn't be disabled but it's self-explanatory why I did it.

rszabo commented 10 years ago

You don't happen to know the correct syntax for phpClassConstant and phpStaticMethods? It bugs me that phpParentError believes that one parenthesis is off.

StanAngeloff commented 10 years ago

I've reviewed your code and have commented below on the proposed changes:

rszabo commented 10 years ago

Sorry for the serious delay in replying. Glad I could help, and thanks for pointing out me=e-n, really good stuff.

StanAngeloff commented 8 years ago

Hey, I am archiving this discussion as it has gotten quite old now and hasn't seen any updated in over an year. If you have anything new to report, please feel free to reopen with more information. Thanks!

rszabo commented 8 years ago

Hi there!

Have you tried this with nvim, any recent version? I.e. NVIM 0.1.0 (compiled Nov 5 2015 00:37:23) / Commit: v0.1.0

Several of these matches that existed while we were working on this are no longer usable, i.e. phpStaticClasses, phpStaticClassVariable, phpStaticMethods.

syn match phpClassConstant  "::\h\w*[^(]\w" contained contains=phpMethods,phpStaticSelector display
syn match phpStaticMethods  "::\(\h\w\+\)("me=e-1 contained contains=phpStaticSelector display
syn match phpStaticClassVariable  "::\$\(\h\w\+\)" contained contains=phpStaticSelector display

Thank you

StanAngeloff commented 8 years ago

Hey @rszabo, the functionality in question wasn't merged in this repository. I had left you some feedback in my earlier post.

rszabo commented 8 years ago

@StanAngeloff Yes, sorry about being away. I implemented many of those as I wrote, but failed to go upstream. Either way, they were working fine but somewhere along the neovim updates they broke, and figured maybe you saw any immediate errors.

StanAngeloff commented 8 years ago

Mm, interesting, other than a line for the missing syn match phpStaticSelector I can't see anything wrong with those matches. The syntax should be compatible with Neovim (albeit I don't use it very often and not an expert).

rszabo commented 8 years ago
syn match phpStaticSelector "::" contained display

I'd love to provide a pull request of some changes in the near future.

You should check out neovim, it's much faster and instead of using Bundle you can use Plug which supports threads and more.