[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/csharp-mode dbbd17a 312/459: Merge pull request #171 fr
From: |
ELPA Syncer |
Subject: |
[elpa] externals/csharp-mode dbbd17a 312/459: Merge pull request #171 from josteink/fontification-lighter |
Date: |
Sun, 22 Aug 2021 13:59:51 -0400 (EDT) |
branch: externals/csharp-mode
commit dbbd17ae11c6a08cbf9237b60a4ab01c73a9bded
Merge: a753601 f774b55
Author: Theodor Thornhill <theo@thornhill.no>
Commit: GitHub <noreply@github.com>
Merge pull request #171 from josteink/fontification-lighter
Make fontification a little less 'constant-heavy'
---
csharp-mode-tests.el | 16 +++++++++---
csharp-mode.el | 72 +++++++++++++++++++++++++++++++++++++++++++++++-----
2 files changed, 78 insertions(+), 10 deletions(-)
diff --git a/csharp-mode-tests.el b/csharp-mode-tests.el
index 13c7238..f18cf02 100644
--- a/csharp-mode-tests.el
+++ b/csharp-mode-tests.el
@@ -90,6 +90,14 @@
"var package = true;"
"package" 'font-lock-variable-name-face))
+(ert-deftest fontification-of-functions ()
+ (require 'assess)
+ (assess-face-in-text= "var foo = bar.Baz()"
+ "Baz" 'font-lock-function-name-face)
+ (assess-face-in-text= "var foo = bar.Baz<Quux>()"
+ "Baz" 'font-lock-function-name-face
+ "Quux" 'font-lock-type-face))
+
(ert-deftest fontification-of-import ()
(require 'assess)
(assess-face-in-text=
@@ -162,9 +170,9 @@
"using" 'font-lock-keyword-face
"Reference" 'font-lock-type-face
"Under_scored" 'font-lock-type-face
- "WithNumbers09" 'font-lock-constant-face
+ "WithNumbers09" 'font-lock-variable-name-face
"Ok" 'font-lock-type-face
- "WithNumbers09" 'font-lock-constant-face
+ "WithNumbers09" 'font-lock-variable-name-face
"OkV2" 'font-lock-type-face
))
@@ -173,9 +181,9 @@
"namespace" 'font-lock-keyword-face
"Reference" 'font-lock-type-face
"Under_scored" 'font-lock-type-face
- "WithNumbers09" 'font-lock-constant-face
+ "WithNumbers09" 'font-lock-variable-name-face
"Ok" 'font-lock-type-face
- "WithNumbers09" 'font-lock-constant-face
+ "WithNumbers09" 'font-lock-variable-name-face
"Ok" 'font-lock-type-face
))
diff --git a/csharp-mode.el b/csharp-mode.el
index a640ee9..3a106f7 100644
--- a/csharp-mode.el
+++ b/csharp-mode.el
@@ -53,12 +53,6 @@
csharp (append '((?@ . "w"))
(c-lang-const c-identifier-syntax-modifications)))
-(c-lang-defconst c-basic-matchers-after
- csharp (append nil
- ;; cc-mode defaults
- (c-lang-const c-basic-matchers-after)))
-
-
(c-lang-defconst c-symbol-start
csharp (concat "[" c-alpha "_@]"))
@@ -241,6 +235,72 @@
(cpp-macro .
c-lineup-dont-change)
(substatement-open . 0)))))
+(c-lang-defconst c-basic-matchers-before
+ "Font lock matchers for basic keywords, labels, references and various
+other easily recognizable things that should be fontified before generic
+casts and declarations are fontified. Used on level 2 and higher."
+ csharp `(
+ ;; Put warning face on unclosed strings
+ ,@(if (version< emacs-version "27.0")
+ ;; Taken from 26.1 branch
+ `(,(c-make-font-lock-search-function
+ (concat ".\\(" c-string-limit-regexp "\\)")
+ '((c-font-lock-invalid-string))))
+ `(("\\s|" 0 font-lock-warning-face t nil)))
+
+ ;; Invalid single quotes
+ c-font-lock-invalid-single-quotes
+
+ ;; Fontify keyword constants
+ ,@(when (c-lang-const c-constant-kwds)
+ (let ((re (c-make-keywords-re nil (c-lang-const
c-constant-kwds))))
+ `((eval . (list ,(concat "\\<\\(" re "\\)\\>")
+ 1 c-constant-face-name)))))
+
+ ;; Fontify all keywords except the primitive types.
+ ,`(,(concat "\\<" (c-lang-const c-regular-keywords-regexp))
+ 1 font-lock-keyword-face)
+
+ ,@(when (c-lang-const c-opt-identifier-concat-key)
+ `(,(c-make-font-lock-search-function
+ ;; Search for identifiers preceded by ".". The anchored
+ ;; matcher takes it from there.
+ (concat (c-lang-const c-opt-identifier-concat-key)
+ (c-lang-const c-simple-ws) "*"
+ (concat "\\("
+ ;; "[" c-upper "]"
+ "[" (c-lang-const c-symbol-chars) "]*"
+ "\\|"
+ "\\)"))
+ `((let (id-end)
+ (goto-char (1+ (match-beginning 0)))
+ (while (and (eq (char-before) ?.)
+ (progn
+ (backward-char)
+ (c-backward-syntactic-ws)
+ (setq id-end (point))
+ (< (skip-chars-backward
+ ,(c-lang-const c-symbol-chars))
+ 0))
+ (not (get-text-property (point) 'face)))
+ (c-put-font-lock-face (point) id-end
+ font-lock-variable-name-face)
+ (c-backward-syntactic-ws)))
+ nil
+ (goto-char (match-end 0))))))
+
+ (eval . (list "\\(!\\)[^=]" 1 c-negation-char-face-name))
+ ))
+
+(c-lang-defconst c-basic-matchers-after
+ csharp (append
+ ;; merge with cc-mode defaults
+ (c-lang-const c-basic-matchers-after)
+
+ ;; function names
+ `(("\\.\\([A-Za-z0-9_]+\\)[<(]" 1 font-lock-function-name-face t))
+ ))
+
(defcustom csharp-font-lock-extra-types
(list (concat "[" c-upper "]\\sw*[" c-lower "]\\sw"))
(c-make-font-lock-extra-types-blurb "C#" "csharp-mode" (concat))
- [elpa] externals/csharp-mode 2ab4d62 293/459: Remove unused import, (continued)
- [elpa] externals/csharp-mode 2ab4d62 293/459: Remove unused import, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode e79d694 299/459: Add standard query operators kwds, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 608805c 300/459: Relicense to GPLv3, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode c6ec8c2 306/459: Remove before/after functions, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 70d3d89 297/459: Fix cl failure for old cc-mode versions, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 919dd65 294/459: Fix c-default-style warnings, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode b85033a 309/459: Make fontification a little less 'constant-heavy', ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 795b9bb 301/459: Merge pull request #168 from josteink/relicense, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 3fc339e 310/459: Add fontification to functions, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 3526396 305/459: Remove before/after functions, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode dbbd17a 312/459: Merge pull request #171 from josteink/fontification-lighter,
ELPA Syncer <=
- [elpa] externals/csharp-mode 7a41dad 318/459: Add attributes to indentation-tests, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode f46d656 321/459: Fix indentation in one defconst, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 49d8392 323/459: Add nullable operator to concatenated identifiers, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 2ee53e4 234/459: Fix some easy checkdoc errors., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 309e2c8 238/459: Create failing test-case., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode cef0d90 243/459: Don't override user's customizations., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode af61254 244/459: Fix off-by-one error for region directive comments, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 4b3d6f8 247/459: More region comment fixes., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode b20e65f 249/459: communicate default style safely (#118), ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 29dab33 255/459: Silence warning in compatibility-shim., ELPA Syncer, 2021/08/22