branch: externals/csharp-mode commit 4da4c399f8a993d658ffc2817ecad4a5d4cc2247 Author: Jostein Kjønigsen <jost...@kjonigsen.net> Commit: Jostein Kjønigsen <jost...@kjonigsen.net>
Fix fontification of namespaces to match using-statement rules. --- csharp-mode-tests.el | 6 ++++++ csharp-mode.el | 2 +- test-files/namespace-fontification.cs | 7 +++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/csharp-mode-tests.el b/csharp-mode-tests.el index 1e5a954..584da2d 100644 --- a/csharp-mode-tests.el +++ b/csharp-mode-tests.el @@ -123,6 +123,12 @@ "WithNumbers09.Ok" 'font-lock-constant-face )) +(ert-deftest fontification-of-namespace-statements () + (assess-face-in-file= "./test-files/namespace-fontification.cs" + "namespace" 'font-lock-keyword-face + "Reference" 'font-lock-constant-face + "Under_scored" 'font-lock-constant-face + "WithNumbers09.Ok" 'font-lock-constant-face )) (defun list-repeat-once (mylist) diff --git a/csharp-mode.el b/csharp-mode.el index 08504db..8efdf32 100644 --- a/csharp-mode.el +++ b/csharp-mode.el @@ -1110,7 +1110,7 @@ to work properly with code that includes attributes." ;; this needs to be done in the matchers-after because ;; otherwise the namespace names get the font-lock-type-face, ;; due to the energetic efforts of c-forward-type. - ,`("\\<\\(namespace\\)[ \t\n\r\f\v]+\\(\\(?:[A-Za-z_][[:alnum:]]*\\.\\)*[A-Za-z_][[:alnum:]]*\\)" + ,`("\\<\\(namespace\\)[ \t\n\r\f\v]+\\(\\(?:[A-Za-z0-9_]+\\.\\)*[A-Za-z0-9_]+\\)" 2 font-lock-constant-face t) diff --git a/test-files/namespace-fontification.cs b/test-files/namespace-fontification.cs new file mode 100644 index 0000000..9c7e8dd --- /dev/null +++ b/test-files/namespace-fontification.cs @@ -0,0 +1,7 @@ +namespace Reference { + +} + +namespace Under_Scored { + +}