I am using Sublime Text 3 version 3.2.2, Build 3211.
The issue is that Sublime syntax highlighting does not work for wrongly typed PHP built-in functions. I want it to behave like Notepad++ and some other code editors where If you mistakenly type wrong PHP built-in functions then editor considers it as a normal plain text. So you are aware of typo and just in case if you don't exactly remember the function name. You can rectify mistake as soon as you see that code color didn't change to what they are set for reserved keywords.
I am taking an example of PHP built-in string function strlen()
.
In Notepad++
Here I deliberately typed strlen
to strle
to show you what I meant. Function name color turns to black:
When I type correct function name, the function name color becomes blue:
In Sublime Text 3
Wrong function name is still blue. You can't say it is typed right or wrong:
You can see that wrong PHP function does not change the color. So I can't figure out when I unintentionally type wrong function in large code. How can we fix this issue?
This behavior is color scheme-dependent. I use the Neon Color Scheme (nb: I am its author), and your code looks like this:
As you can see in the upper snippet with strle
, the function name is in green, which all generic (i.e., non built-in) functions are. The relevant scope is meta.function-call.php variable.function.php
, which indicates as much.
In the lower snippet where strlen
is spelled correctly, the syntax highlighting is completely different. The relevant scope there is meta.function-call.php support.function.string.php
, indicating that the function is not only built-in, but it is a string function as well. If you wanted to, you could adjust your color scheme to highlight all string functions differently than other builtins.
I don't know what color scheme you are using, but it apparently doesn't differentiate between different types of functions. Unfortunately, unless you are gifted in both reading JSON and interpreting Sublime scopes in your head, there really isn't a way to see if a given color scheme supports this differentiation or not. I designed Neon with the goal of making as many language constructs as possible look as good as possible, but not all (in fact, not many) color scheme authors share this goal, so if you don't prefer Neon you'll have to look around some. There are currently in the neighborhood of 300 different color schemes on Package Control. If you'd rather alter your current color scheme and the docs don't answer all your questions, just post a new question and I'd be glad to help.