Closed rszabo closed 8 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.
As for the phpDocTags
enhancements, I've opened a new issue in #28 to track that update separately.
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.
You don't happen to know the correct syntax for phpClassConstant and phpStaticMethods? It bugs me that phpParentError believes that one parenthesis is off.
I've reviewed your code and have commented below on the proposed changes:
SQL is disabled using Vimscript comments. You can use configuration options instead:
let php_sql_query=0
let php_sql_heredoc=0
['array']
which defeats the purpose of having array
highlighted differently. If we also make an exception for array
, we can soon decide to have all other keywords highlighted differently. I'm not ready to do that. ::
static selector is a nice addition and I can see the benefits. There is already a case for ->
methods. The reason parenthesis are not balanced is likely due to the fact you've consumed the (
as part of the match. You can backtrack using :help syn-pattern-offset
. See phpCommentStar
and phpCommentTitle
where me=e-X
is used to exclude several characters at the end from matching. If you come up with a working solution, please send it over so it can be merged :+1:TRUE
, FALSE
and NULL
were considered constants. Thank you for pointing this out, a commit is coming to address this.Sorry for the serious delay in replying. Glad I could help, and thanks for pointing out me=e-n, really good stuff.
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!
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
Hey @rszabo, the functionality in question wasn't merged in this repository. I had left you some feedback in my earlier post.
@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.
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).
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.
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.