_Continuing discussion from here._
First piece of code that generates issues:
class acf_field_gallery {
function render_attachment() {
if(1) ) {}
else {}
?>
<div class="acf-gallery-side-info acf-cf"></div>
<?php
}
}
If you delete the else{} line, you will get this wrongly highlight (in fact, is enough to remove curly brackets)
The second issue is that all functions are highlighted the same:
function foo(){}
$bar = foo();
$baz = strftime()
Until now, the highlight was still a bit broken, but at least was a bit less confusing.
The third issue, which is not _that_important, is that with this custom Monokai, things goes green:
class acf_field_gallery {
function foo() {
$options = acf_parse_args( $_POST, array());
}
}
It appears that the problem is generated by the keyword class.
I'm looking into the issue of embedded HTML inside of curly braces now. It makes sense that the issue could have arisen with all of the recent changes to PHP.
The second item is up to the color scheme being used. The first function call is scoped variable.function and the second is support.function. As it happens, with Monokai, these are colored the same. I believe previously foo() did not scope foo as variable.function (only a meta. scope), however that scope is being added to the various syntaxes for better ability for color schemes to target things.
The third item is really kind of a bug in the modified color scheme. You should basically never add color to meta. scopes, as the original TextMate documentation explained that they are for marking up large sections of code. In this case, recently we've been making all syntaxes (where possible) have meta.function for the whole function definition and meta.class for the whole class definition. The meta. scopes are mostly for targeting things contained inside of other structures. For instance, users may want to indent methods in the symbol list, or use a different color for a function defined in a class body (aka a method) as opposed to one in the global scope. Thus you can use meta. for making scope selectors more specific, but you shouldn't color them directly.
I'm not sure what the intent of trying to color all of meta.class was, however most likely you just want to color entity.name.class and entity.other.inherited-class.php (traits, class inheritance and interfaces).
As all of this work has been going on for syntaxes, my intent is to bring all of the syntaxes up to support for the current versions of languages, and bring the scopes into a consistent set so we can have official documentation for syntax authors and color scheme writer to make things as compatible and consistent as possible. I realize this will change things for some users, but I'm hoping the forward progress with outweigh small changes that seem wrong at first.
The second item is up to the color scheme being used
Indeed, with Cobalt things looks better, but then.. you know, it's Cobalt, not Monokai :smile_cat:
I'm not sure what the intent of trying to color all
To be honest, i'm not sure either. I have kept adding stuff to the theme in the past few years and here I am :dancer:
I realize this will change things for some users
As long is not a deal breaker (i.e. make all text green on a red background), that's OK :)
The issue with changing back to HTML output inside of a function or block has been fixed by 6ce9636d3f058c30ee4a956363398bee41f0907d.
Note that I did not allow outputting HTML in a class body outside of a function, or other custom {} blocks like trait conflict resolution or namespace use statements. I believe the current implementation should cover all real use cases.
@wbond i think there is still an issue with snippet autocompletion, although i'm not sure if it's related to this or is a separate issue: php snippet does not work anymore in certain cases (e.g. when i try to open up a tag inside a function)

Most helpful comment
I'm looking into the issue of embedded HTML inside of curly braces now. It makes sense that the issue could have arisen with all of the recent changes to PHP.
The second item is up to the color scheme being used. The first function call is scoped
variable.functionand the second issupport.function. As it happens, with Monokai, these are colored the same. I believe previouslyfoo()did not scopefooasvariable.function(only ameta.scope), however that scope is being added to the various syntaxes for better ability for color schemes to target things.The third item is really kind of a bug in the modified color scheme. You should basically never add color to
meta.scopes, as the original TextMate documentation explained that they are for marking up large sections of code. In this case, recently we've been making all syntaxes (where possible) havemeta.functionfor the whole function definition andmeta.classfor the whole class definition. Themeta.scopes are mostly for targeting things contained inside of other structures. For instance, users may want to indent methods in the symbol list, or use a different color for a function defined in a class body (aka a method) as opposed to one in the global scope. Thus you can usemeta.for making scope selectors more specific, but you shouldn't color them directly.I'm not sure what the intent of trying to color all of
meta.classwas, however most likely you just want to colorentity.name.classandentity.other.inherited-class.php(traits, class inheritance and interfaces).As all of this work has been going on for syntaxes, my intent is to bring all of the syntaxes up to support for the current versions of languages, and bring the scopes into a consistent set so we can have official documentation for syntax authors and color scheme writer to make things as compatible and consistent as possible. I realize this will change things for some users, but I'm hoping the forward progress with outweigh small changes that seem wrong at first.