emacs-php / php-mode

A powerful and flexible Emacs major mode for editing PHP scripts
GNU General Public License v3.0
580 stars 118 forks source link

Function faces #725

Open stanholzendorf opened 1 year ago

stanholzendorf commented 1 year ago

Hello, Not sure if this is the right place to ask. Certain functions do not seem to have any highlighting. "isset" for example has but "count" for example has not. There are others as well. Is this something that is just missing or a problem on my end?

zonuexe commented 1 year ago

isset, empty, echo and print are special keywords for syntax called language constructs, and count(), printf(), etc. are just functions. The different coloring is intentional design, as they have different syntactic semantics.

If you want to use coloring to spot misspellings in standard functions, you can add keywords like this:

(require 'php-defs)
(font-lock-add-keywords 'php-mode
 `((,(regexp-opt (cdr (assq 'core php-defs-functions-alist)) 'symbols) . 'php-function-name)))

However, these supports are not accurate, so it is preferable to get support from static analysis tools like PHPStan.