|
34 | 34 | ;;; Code: |
35 | 35 |
|
36 | 36 | (require 'dash) |
37 | | -(require 'find-func) |
38 | | -(require 'face-remap) |
39 | | - |
40 | 37 | (require 'lsp-protocol) |
41 | | - |
42 | | -;; |
43 | | -;;; Util |
44 | | - |
45 | | -(defmacro lsp-ui--mute-apply (&rest body) |
46 | | - "Execute BODY without message." |
47 | | - (declare (indent 0) (debug t)) |
48 | | - `(let (message-log-max) |
49 | | - (with-temp-message (or (current-message) nil) |
50 | | - (let ((inhibit-message t)) ,@body)))) |
51 | | - |
52 | | -(defmacro lsp-ui--with-no-redisplay (&rest body) |
53 | | - "Execute BODY without any redisplay execution." |
54 | | - (declare (indent 0) (debug t)) |
55 | | - `(let ((inhibit-redisplay t) |
56 | | - (inhibit-modification-hooks t) |
57 | | - (inhibit-point-motion-hooks t) |
58 | | - buffer-list-update-hook |
59 | | - display-buffer-alist |
60 | | - window-configuration-change-hook |
61 | | - after-focus-change-function) |
62 | | - ,@body)) |
63 | | - |
64 | | -(defun lsp-ui-kill-timer (timer) |
65 | | - "Safely kill the TIMER." |
66 | | - (when (timerp timer) (cancel-timer timer))) |
67 | | - |
68 | | -(defun lsp-ui-delete-overlay (overlay) |
69 | | - "Safely delete the OVERLAY." |
70 | | - (when (overlayp overlay) (delete-overlay overlay))) |
71 | | - |
72 | | -(defun lsp-ui-line-number-display-width () |
73 | | - "Safe way to get value from function `line-number-display-width'." |
74 | | - (if (bound-and-true-p display-line-numbers-mode) |
75 | | - ;; For some reason, function `line-number-display-width' gave |
76 | | - ;; us error `args-out-of-range' even we do not pass anything towards |
77 | | - ;; to it function. See the following links, |
78 | | - ;; |
79 | | - ;; - https://github.com/emacs-lsp/lsp-ui/issues/294 |
80 | | - ;; - https://github.com/emacs-lsp/lsp-ui/issues/533 (duplicate) |
81 | | - (+ (or (ignore-errors (line-number-display-width)) 0) 2) |
82 | | - 0)) |
| 38 | +(require 'find-func) |
83 | 39 |
|
84 | 40 | (defconst lsp-ui-resources-dir |
85 | 41 | (--> (or load-file-name (buffer-file-name)) |
|
89 | 45 | (and (file-directory-p it) it)) |
90 | 46 | "Resource folder for package `lsp-ui'.") |
91 | 47 |
|
| 48 | +(require 'lsp-ui-sideline) |
| 49 | +(require 'lsp-ui-peek) |
| 50 | +(require 'lsp-ui-imenu) |
| 51 | +(require 'lsp-ui-doc) |
| 52 | + |
92 | 53 | (defgroup lsp-ui nil |
93 | 54 | "‘lsp-ui’ contains a series of useful UI integrations for ‘lsp-mode’." |
94 | 55 | :group 'tools |
|
103 | 64 | (when (and (boundp 'winum-ignored-buffers-regexp) lsp-ui-doc-winum-ignore) |
104 | 65 | (add-to-list 'winum-ignored-buffers-regexp lsp-ui-doc--buffer-prefix))) |
105 | 66 |
|
| 67 | +(defun lsp-ui-peek--render (major string) |
| 68 | + (with-temp-buffer |
| 69 | + (insert string) |
| 70 | + (delay-mode-hooks |
| 71 | + (let ((inhibit-message t)) (funcall major)) |
| 72 | + (ignore-errors (font-lock-ensure))) |
| 73 | + (buffer-string))) |
| 74 | + |
106 | 75 | (defun lsp-ui--workspace-path (path) |
107 | 76 | "Return the PATH relative to the workspace. |
108 | 77 | If the PATH is not in the workspace, it returns the original PATH." |
@@ -203,5 +172,6 @@ Both should have the form (FILENAME LINE COLUMN)." |
203 | 172 | (cons idx (length refs))) |
204 | 173 | (cons 0 0)))) |
205 | 174 |
|
| 175 | + |
206 | 176 | (provide 'lsp-ui) |
207 | 177 | ;;; lsp-ui.el ends here |
0 commit comments