Skip to content

Commit 1a0fded

Browse files
committed
docs
1 parent 1d58f79 commit 1a0fded

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,28 @@
66
77
[![CI](https://github.com/jcs-elpa/sideline-flycheck/actions/workflows/test.yml/badge.svg)](https://github.com/jcs-elpa/sideline-flycheck/actions/workflows/test.yml)
88

9-
N/A
9+
*P.S. The implementation is extracted and modified from [lsp-ui-sideline](https://github.com/emacs-lsp/lsp-ui#lsp-ui-sideline)
10+
's code action*.
1011

1112
## 🔨 Quickstart
1213

1314
```elisp
14-
(setq sideline-backends-right '(sideline-lsp))
15+
(leaf sideline
16+
:init
17+
(setq sideline-backends-right '(sideline-lsp)))
18+
19+
(leaf lsp-mode :hook (lsp-mode-hook . sideline-mode)) ; enable it when lsp is on
1520
```
1621

22+
## 🔧 Customization
23+
24+
* `sideline-lsp-update-mode` - When set to 'line' the information will be updated
25+
when user changes current line otherwise the information will be updated when
26+
user changes current point
27+
* `sideline-lsp-ignore-duplicate` - Ignore duplicate code actions
28+
* `sideline-lsp-code-action` - Face used to highlight code action text.
29+
* `sideline-lsp-code-actions-prefix` - Prefix to insert before the code action title.
30+
1731
## Contribute
1832

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

sideline-lsp.el

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,7 @@ otherwise the actions will be updated when user changes current point."
7070
"Face used to highlight code action text."
7171
:group 'sideline-lsp)
7272

73-
(defcustom sideline-lsp-actions-symbol "💡"
74-
"Code action icon."
75-
:type 'string
76-
:group 'sideline-lsp)
77-
78-
(defcustom sideline-lsp-code-actions-prefix ""
73+
(defcustom sideline-lsp-code-actions-prefix "💡 "
7974
"Prefix to insert before the code action title.
8075
This can be used to insert, for example, an unicode character: 💡"
8176
:type 'string
@@ -147,13 +142,12 @@ Execute CALLBACK to display candidates in sideline."
147142
((title (->> (lsp:code-action-title action)
148143
(replace-regexp-in-string "[\n\t ]+" " ")
149144
(replace-regexp-in-string " " " ")
150-
(concat (unless sideline-lsp-actions-symbol
151-
sideline-lsp-code-actions-prefix))))
145+
(concat sideline-lsp-code-actions-prefix)))
152146
(code-action (lambda () (save-excursion (lsp-execute-code-action action))))
153147
(len (length title))
154148
(title (progn
155149
(add-face-text-property 0 len 'sideline-lsp-code-action nil title)
156-
(concat sideline-lsp-actions-symbol " " title))))
150+
title)))
157151
(when (or (not sideline-lsp-ignore-duplicate)
158152
(not (member title (ht-keys sideline-lsp--ht-code-actions))))
159153
(ht-set sideline-lsp--ht-code-actions title code-action))))

0 commit comments

Comments
 (0)