-1

View.score_selector gives zero in PHP, expected score > 0

colinta 6 years ago • updated 6 years ago 1
In PHP, when I view the selector (crtl+shift+p), I see this:
text.html.basic source.php.embedded.block.html

But when I run view.score_selector(pos, 'source'), it returns 0L


I have a command (bracketeer, insert single quote) that tries to determine whether the cursor is in a string, a text scope, or in a comment.  In this case, I expect view.score_selector(pos, 'source') to be greater than view.score_selector(pos, 'text').

I have more details... If I enter some PHP, just about anything will do, the score_selector works.  So that's good, this is actually useable in most scripts.


Still, strange that an empty file (just <?php, no code) behaves differently


Works:


<?php
class Test{}

Doesn't work:

<?php