branch: externals/csharp-mode commit 0cd0b2c5579525c0d48c4b9dbe6c55b34e19327b Author: Jostein Kjønigsen <jost...@kjonigsen.net> Commit: Jostein Kjønigsen <jost...@kjonigsen.net>
Fix fontification of using-statements. This closes https://github.com/josteink/csharp-mode/issues/100. --- csharp-mode-tests.el | 7 +++++++ csharp-mode.el | 4 ++-- test-files/using-fontification.cs | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/csharp-mode-tests.el b/csharp-mode-tests.el index 1549b3f..da6a0e4 100644 --- a/csharp-mode-tests.el +++ b/csharp-mode-tests.el @@ -115,6 +115,13 @@ ;; "GenericMethod2" 'font-lock-function-name-face )) +(ert-deftest fontification-of-using-statements () + (assess-face-in-file= "./test-files/using-fontification.cs" + "using" 'font-lock-keyword-face + "Reference" 'font-lock-constant-face + "Under_scored" 'font-lock-constant-face + )) + (defun list-repeat-once (mylist) (append mylist mylist)) diff --git a/csharp-mode.el b/csharp-mode.el index 1d97d16..8c5d0ab 100644 --- a/csharp-mode.el +++ b/csharp-mode.el @@ -762,11 +762,11 @@ to work properly with code that includes attributes. ,`(,(concat "\\<\\(using\\)[ \t\n\f\v\r]+" "\\(?:" - "\\([A-Za-z_][[:alnum:]]*\\)" + "\\([A-Za-z_]+\\)" "[ \t\n\f\v\r]*=" "[ \t\n\f\v\r]*" "\\)?" - "\\(\\(?:[A-Za-z_][[:alnum:]]*\\.\\)*[A-Za-z_][[:alnum:]]*\\)" + "\\(\\(?:[A-Za-z_]+\\.\\)*[A-Za-z_]+\\)" "[ \t\n\f\v\r]*;") (2 font-lock-constant-face t t) (3 font-lock-constant-face)) diff --git a/test-files/using-fontification.cs b/test-files/using-fontification.cs new file mode 100644 index 0000000..3c3b121 --- /dev/null +++ b/test-files/using-fontification.cs @@ -0,0 +1,2 @@ +using Reference; +using Under_scored;