Skip to content

Commit 1f2f82d

Browse files
committed
Add option to display checker name
1 parent 5248264 commit 1f2f82d

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,21 @@
1111
## 🔨 Quickstart
1212

1313
```elisp
14-
(leaf sideline
15-
:hook (flycheck-mode-hook . sideline-mode)
14+
(use-package sideline
15+
:hook (flycheck-mode . sideline-mode)
1616
:init
1717
(setq sideline-backends-right '(sideline-flycheck)))
1818
19-
(leaf sideline-flycheck :hook (flycheck-mode-hook . sideline-flycheck-setup))
19+
(use-package sideline-flycheck :hook (flycheck-mode . sideline-flycheck-setup))
2020
```
2121

22+
## 🔧 Customization
23+
24+
#### 🧪 Variables
25+
26+
- `sideline-flycheck-inhibit-functions` - Functions to inhibit display of sideline flycheck.
27+
- `sideline-flycheck-show-checker-name` - If non-nil, show checker name at the back.
28+
2229
## Contribute
2330

2431
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](http://makeapullrequest.com)

sideline-flycheck.el

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,19 @@
5656
:type 'hook
5757
:group 'sideline-flycheck)
5858

59+
(defcustom sideline-flycheck-show-checker-name nil
60+
"If non-nil, show checker name at the back."
61+
:type 'boolean
62+
:group 'sideline-flycheck)
63+
5964
(defvar-local sideline-flycheck--old-display-function nil
6065
"The former value of `flycheck-display-errors-function'.")
6166

6267
(defvar-local sideline-flycheck--callback nil
6368
"Callback to display errors with sideline.")
6469

6570
(defvar-local sideline-flycheck--errors (ht-create)
66-
"Set to t when ready to do next rendering in sideline.")
71+
"Store error messages as key.")
6772

6873
;;;###autoload
6974
(defun sideline-flycheck (command)
@@ -84,10 +89,13 @@ Argument COMMAND is required in sideline backend."
8489
(dolist (err errors)
8590
(let* ((level (flycheck-error-level err))
8691
(face (if (eq level 'info) 'success level))
87-
(msg (flycheck-error-message err)))
92+
(msg (flycheck-error-message err))
93+
(checker (flycheck-error-checker err)))
94+
(when sideline-flycheck-show-checker-name
95+
(setq msg (format "%s (%s)" msg checker)))
8896
(add-face-text-property 0 (length msg) face nil msg)
8997
(unless (ht-contains-p sideline-flycheck--errors msg)
90-
(ht-set sideline-flycheck--errors msg nil)
98+
(ht-set sideline-flycheck--errors msg nil) ; doesn't care about value
9199
(push msg msgs))))
92100
(funcall sideline-flycheck--callback msgs))))
93101

0 commit comments

Comments
 (0)