StanAngeloff / php.vim

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

Single line comment blocks broken #5

Closed mikehaertl closed 10 years ago

mikehaertl commented 10 years ago

Commit 356f296e5678edbd45d7f52b9bf4e6efabf92ed5 seems to have introduced a bug with comment blocks on a single line. For example with a comment like

        $emailJob = $this->loadEmailJob($message['id']); /* @var EmailJob $emailJob */

all following lines are treaded as comments.

Full example:

<?php
class x
{
    /**
     * Processes a message
     *
     * @param array $message the decoded message to process
     */
    public function process($message)
    {
        $emailJob = $this->loadEmailJob($message['id']); /* @var EmailJob $emailJob */
        if (!is_object($emailJob))
            return;
        $this->sendEmails($emailJob);
    }
}

These lines are incorrectly highlighted as comments now:

        if (!is_object($emailJob))
            return;
        $this->sendEmails($emailJob);
    }
}
StanAngeloff commented 10 years ago

Thanks for reporting this. I'll flag it as a bug. If you can help with a patch that would be awesome :star: I'll try and have a look over the weekend otherwise.

mikehaertl commented 10 years ago

Cool, thanks. I'd love to help, but unfortunately I only have very little knowledge of vims syntax hl syntax. But the given commit only changes a couple of lines. So if the issue is reproducable with my code it should hopefully be easy to track down the problem.

StanAngeloff commented 10 years ago

I've tried it on master as well as 356f296 ^image and I don't get the lines highlighted as comments. What other bundles do you have installed? What specific to PHP do you have in your .vimrc? Can you also check your :echo &synmaxcol setting?

mikehaertl commented 10 years ago

:echo &synmaxcol gives me 3000. Here's my complete vimrc.local that i use on Ubuntu:

https://gist.github.com/mikehaertl/1612035

I was able to reproduce it on other machines, too. I've commented out all other Vundle plugins except for php.vim - still the same issue.

php_comment

mikehaertl commented 10 years ago

Any news on this? Can you reproduce it?

mikehaertl commented 10 years ago

I've tried again on Ubuntu 13.10 with vim 7.4 and a very lean /etc/vim/vimrc.local and was able to still reproduce the issue:

filetype off                        " required by Vundle!
set rtp+=/etc/vim/bundle/vundle
call vundle#rc('/etc/vim/bundle')   " Use a shared folder instead of ~/.vimrc/bundle

" Vundle plugins
Bundle 'gmarik/vundle'
Bundle 'StanAngeloff/php.vim'
" color scheme approximator
Bundle 'CSApprox'
Bundle 'Colour-Sampler-Pack'

set t_Co=256                    " Enable 256 color mode
syntax on                       " syntax highlighting on (set before colorscheme)
colorscheme darkspectrum
StanAngeloff commented 10 years ago

I haven't got a way to try this in my day-to-day machine and short of installing a VM, I can't see it in action. Getting a VM is on my list, appreciate the concise .vimrc, it will come handy.

StanAngeloff commented 10 years ago

I was finally able to reproduce it in a Docker container, thanks for the .vimrc reference. Does the syntax work correctly with the latest version from master?

mikehaertl commented 10 years ago

Yay, looks good :+1:. Thanks!