Closed dewyze closed 2 years ago
A lot has changed in the intervening decade. While .type_name()
remains pretty strict, the majority of the conditional syntax highlighting is now keyed off of simple file name matches, ignoring the root entirely. I would be willing to extend this further, replacing most of the remaining type_name()
conditionals with equivalent filename checks. A caveat would be that I would like to do both specs and tests in one go. I don't want to be left with a mess.
There is an old issue that brings this up: https://github.com/tpope/vim-rails/issues/156
But some new styles have emerged that make this more common. If you were using a component based rails app, or a package based rails app using something like packwerk, you lose accurate highlighting because your top level file path is not
^spec.
I realize, per that comment, you do not want to do much work on syntax highlighting. That being said, if you just removed the leading
^
on the below line, for example, I think the problem would be solved?https://github.com/tpope/vim-rails/blob/d38f1bf8575b920042153689492721b80252ae41/autoload/rails.vim#L850
Do you see any reason that removing the leading
^
in many of these checks would be a problem? Then anything that starts withcomponent/<name>/
orpackage/<name>/
would work. It seems that the end of the path name is really the important thing to match on anyway, not sure why the beginning really matters in comparison. I'd be happy to open the PR.If you're not interested I understand.
And either way, thanks for many plugins!