Open codeinabox opened 9 years ago
If individually comment lines 3, 12 and 17 to 20 I get the following the comments outside the class are fine but inside the class incorrectly use ""
What's the value of
echo synIDattr(synID(line('.'), col('.'), 1), 'name')
at the first non-whitespace character of the line you want to comment
out ("new")? I get phpDefine
.
It would also be interesting to know:
echo map(range(1, col('$') - 1), "synIDattr(synID(line('.'), v:val, 1), 'name')")
Do you use a non-standard php plugin?
Here is the value of echo synIDattr(synID(line('.'), col('.'), 1), 'name')
for each of the lines:
3: phpInclude 12: phpKeyword 17: phpKeyword
For echo map(range(1, col('$') - 1), "synIDattr(synID(line('.'), v:val, 1), 'name')")
Line 3
['phpInclude', 'phpInclude', 'phpInclude', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'p hpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion', 'phpRegion']
Line 12
['rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'phpKeyword', 'phpKeyword', 'phpKeyword', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbowr2', 'rainbow r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rain bow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_p3', 'rainbow_p3', 'rainbow_o2']
I am using shawncplus/phpcomplete.vim but judging by the above could luochen1990/rainbow be interfering?
['rainbow_r2' This could indeed explain the behaviour. tcomment cannot detect the filetype based on the syntax group and uses the fallback filetype, which is "html" for php files.
What's the result of :|echo map(range(1, col('$') - 1), "synIDattr(synID(line('.'), v:val, 0), 'name')")
If it yields something matching php\u\w* then we could do something about it.
Disabling the plugin solves the problem?
For line 12 I get:
['rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'phpKeyword', 'phpKeyword', 'phpKeyword', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbowr2', 'rainbow r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rain bow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_r2', 'rainbow_p3', 'rainbow_p3', 'rainbow_o2']
Disabling the rainbow plugin gives me this for line 12:
['phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpKeyword', 'phpKeyword', 'phpKeyword', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'p hpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpPare nt', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'phpParent', 'Delimiter', 'Delimiter', 'phpParent']
After that it comments fine properly. If I didn't want to remove the rainbow plugin is there a way I can set the fallback filetype? I could submit a PR to do so.
After that it comments fine properly. If I didn't want to remove the rainbow plugin is there a way I can set the fallback filetype?
You can set g:tcommentGuessFileType_php = 1 or 'php' but you'll probably use the ability to comment out html, js etc. If you're certain that rainbow syntax groups are used only in php code, you could also add a rewrite rule to |g:tcomment#syntax_substitute|.
IMHO you should ask the author of the rainbow plugin to change the syntax definition, maybe add 'transparent'.
HTH
This is a follow up to issue #144, which continues after 1a9e65e. Given the following PHP file
If individually comment lines 3, 12 and 17 to 20 I get the following the comments outside the class are fine but inside the class incorrectly use ""