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

Improve class faces #611

Merged
merged 4 commits into from
Mar 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions php-face.el
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@
:group 'php-faces
:tag "PHPDoc Class Name")

(defface php-class-declaration '((t (:inherit php-keyword)))
"Face used to class declarations."
:group 'php-faces
:tag "PHP Class Declaration")

(define-obsolete-face-alias 'php-annotations-annotation-face 'php-doc-annotation-tag "1.19.0")

(provide 'php-face)
Expand Down
2 changes: 2 additions & 0 deletions php-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -1533,6 +1533,8 @@ a completion list."
1 'php-class)
;; Support the ::class constant in PHP5.6
("\\sw+\\(::\\)\\(class\\)\\b" (1 'php-paamayim-nekudotayim) (2 'php-magical-constant))
;; Class declaration keywords (class, trait, interface)
("\\_<\\(class\\|trait\\|interface\\)\\_>" . 'php-class-declaration)

;; Highlight static method calls as such. This is necessary for method
;; names which are identical to keywords to be highlighted correctly.
Expand Down
2 changes: 1 addition & 1 deletion tests/7.4/typed-property.php.faces
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
;; -*- mode: emacs-lisp -*-
(("<?php" . php-php-tag)
("\n\n")
("class" . php-keyword)
("class" . php-class-declaration)
(" ")
("Typed" . font-lock-type-face)
("\n{\n ")
Expand Down
2 changes: 1 addition & 1 deletion tests/issue-136.php.faces
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
("\n")
("final" . php-keyword)
(" ")
("class" . php-keyword)
("class" . php-class-declaration)
(" ")
("SampleClass" . font-lock-type-face)
("\n{\n ")
Expand Down
6 changes: 3 additions & 3 deletions tests/lang/class/anonymous-class.php.faces
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
(" ")
("new" . php-keyword)
(" ")
("class" . php-keyword)
("class" . php-class-declaration)
(" () ")
("extends" . php-keyword)
(" ")
Expand All @@ -21,12 +21,12 @@
("(1, ")
("new" . php-keyword)
(" ")
("class" . php-keyword)
("class" . php-class-declaration)
(" () ")
("extends" . php-keyword)
(" ")
("IteratorAggregate" . font-lock-type-face)
(" {\n ")
("// " . font-lock-comment-delimiter-face)
("###php-mode-test### ((indent 4))\n" . font-lock-comment-face)
("});\n"))
("});\n"))
4 changes: 2 additions & 2 deletions tests/lang/doc-comment/annotation.php.faces
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
("@MyProject\\Annotations\\Foobarable" php-doc-annotation-tag font-lock-doc-face)
("\n */" . font-lock-doc-face)
("\n")
("class" . php-keyword)
("class" . php-class-declaration)
(" ")
("User" . font-lock-type-face)
("\n{\n}\n\n")
Expand All @@ -20,7 +20,7 @@
("myProperty" php-variable-name font-lock-doc-face)
("\n */" . font-lock-doc-face)
("\n")
("class" . php-keyword)
("class" . php-class-declaration)
(" ")
("Child" . font-lock-type-face)
(" ")
Expand Down
2 changes: 1 addition & 1 deletion tests/lang/doc-comment/comments.php.24.faces
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
("\n")
("final" . php-keyword)
(" ")
("class" . php-keyword)
("class" . php-class-declaration)
(" ")
("SampleClass" . font-lock-type-face)
("\n{\n ")
Expand Down
2 changes: 1 addition & 1 deletion tests/lang/doc-comment/comments.php.27.faces
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
("\n")
("final" . php-keyword)
(" ")
("class" . php-keyword)
("class" . php-class-declaration)
(" ")
("SampleClass" . font-lock-type-face)
("\n{\n ")
Expand Down
2 changes: 1 addition & 1 deletion tests/lang/doc-comment/comments.php.faces
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
("\n")
("final" . php-keyword)
(" ")
("class" . php-keyword)
("class" . php-class-declaration)
(" ")
("SampleClass" . font-lock-type-face)
("\n{\n ")
Expand Down
2 changes: 1 addition & 1 deletion tests/lang/doc-comment/issue-8.php.faces
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
("@ORM\\Table" php-doc-annotation-tag font-lock-doc-face)
("(name=\"product\")\n */" . font-lock-doc-face)
("\n")
("class" . php-keyword)
("class" . php-class-declaration)
(" ")
("Product" . font-lock-type-face)
("\n{\n ")
Expand Down
3 changes: 0 additions & 3 deletions tests/language-constructs.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
break;
case;
catch;
class ClassName;
clone;
const;
continue;
Expand Down Expand Up @@ -53,7 +52,6 @@ function;
include_once;
instanceof ClassName;
insteadof ClassName;
interface ClassName;
isset();
list();
namespace ClassName;
Expand All @@ -68,7 +66,6 @@ interface ClassName;
static;
switch;
throw;
trait ClassName;
try;
unset();
use ClassName;
Expand Down
2 changes: 1 addition & 1 deletion tests/type-hints.php.faces
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
;; -*- mode: emacs-lisp -*-
(("<?php" . php-php-tag)
("\n\n")
("class" . php-keyword)
("class" . php-class-declaration)
(" ")
("SomeClass" . font-lock-type-face)
("\n{\n ")
Expand Down