Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function faces #725

Open
stanholzendorf opened this issue Jan 10, 2023 · 2 comments
Open

Function faces #725

stanholzendorf opened this issue Jan 10, 2023 · 2 comments

Comments

@stanholzendorf
Copy link

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
Copy link
Member

zonuexe commented Mar 5, 2023

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.

@pivaldi
Copy link
Contributor

pivaldi commented Sep 13, 2024

You may be interested by the package php-fh that I created.
This is reworked code from this old work that I have used for over 15 years without problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants