diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-01-18 13:00:43 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-01-18 13:00:43 +0000 |
commit | 3a7724e44181ccd5c248589538bd82458b5a9407 (patch) | |
tree | e7dfad0f3f90e709580040a3a8894658ee926fe4 /editors/emacs | |
parent | d1d91dfe4d52856403a17e2644a22c919690010d (diff) | |
parent | 18ec4e3403854995d44841a066ff3b190d8115e6 (diff) |
Merge #2875
2875: Improve parameter hints a bit & add emacs support r=matklad a=flodiebold
- just include the name, not e.g. `mut`
- don't return empty hints (or `_`)
CC @brotzeit for the Emacs change
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'editors/emacs')
-rw-r--r-- | editors/emacs/rust-analyzer.el | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/editors/emacs/rust-analyzer.el b/editors/emacs/rust-analyzer.el index 8ba98bf61..06db4f15f 100644 --- a/editors/emacs/rust-analyzer.el +++ b/editors/emacs/rust-analyzer.el | |||
@@ -210,9 +210,9 @@ | |||
210 | ;; inlay hints | 210 | ;; inlay hints |
211 | (defun rust-analyzer--update-inlay-hints (buffer) | 211 | (defun rust-analyzer--update-inlay-hints (buffer) |
212 | (if (and (rust-analyzer--initialized?) (eq buffer (current-buffer))) | 212 | (if (and (rust-analyzer--initialized?) (eq buffer (current-buffer))) |
213 | (lsp-send-request-async | 213 | (lsp-request-async |
214 | (lsp-make-request "rust-analyzer/inlayHints" | 214 | "rust-analyzer/inlayHints" |
215 | (list :textDocument (lsp--text-document-identifier))) | 215 | (list :textDocument (lsp--text-document-identifier)) |
216 | (lambda (res) | 216 | (lambda (res) |
217 | (remove-overlays (point-min) (point-max) 'rust-analyzer--inlay-hint t) | 217 | (remove-overlays (point-min) (point-max) 'rust-analyzer--inlay-hint t) |
218 | (dolist (hint res) | 218 | (dolist (hint res) |
@@ -221,9 +221,16 @@ | |||
221 | (overlay (make-overlay beg end))) | 221 | (overlay (make-overlay beg end))) |
222 | (overlay-put overlay 'rust-analyzer--inlay-hint t) | 222 | (overlay-put overlay 'rust-analyzer--inlay-hint t) |
223 | (overlay-put overlay 'evaporate t) | 223 | (overlay-put overlay 'evaporate t) |
224 | (overlay-put overlay 'after-string (propertize (concat ": " label) | 224 | (cond |
225 | 'font-lock-face 'font-lock-comment-face))))) | 225 | ((string= kind "TypeHint") |
226 | 'tick)) | 226 | (overlay-put overlay 'after-string (propertize (concat ": " label) |
227 | 'font-lock-face 'font-lock-comment-face))) | ||
228 | ((string= kind "ParameterHint") | ||
229 | (overlay-put overlay 'before-string (propertize (concat label ": ") | ||
230 | 'font-lock-face 'font-lock-comment-face))) | ||
231 | ) | ||
232 | ))) | ||
233 | :mode 'tick)) | ||
227 | nil) | 234 | nil) |
228 | 235 | ||
229 | (defvar-local rust-analyzer--inlay-hints-timer nil) | 236 | (defvar-local rust-analyzer--inlay-hints-timer nil) |