aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
Diffstat (limited to 'editors')
-rw-r--r--editors/emacs/ra.el36
1 files changed, 36 insertions, 0 deletions
diff --git a/editors/emacs/ra.el b/editors/emacs/ra.el
index 099f611be..a0b17f3af 100644
--- a/editors/emacs/ra.el
+++ b/editors/emacs/ra.el
@@ -83,5 +83,41 @@
83 "Set selections cache for current buffer state and START END." 83 "Set selections cache for current buffer state and START END."
84 (setq ra--selections-cache `(,(buffer-modified-tick) 0 ,(ra--selections start end)))) 84 (setq ra--selections-cache `(,(buffer-modified-tick) 0 ,(ra--selections start end))))
85 85
86
87(require 'eglot)
88(require 'ivy)
89(require 'counsel)
90
91
92(defun workspace-symbols ()
93 (interactive)
94 (let ((buf (current-buffer)))
95 (ivy-read "Symbol name: "
96 (lambda (str)
97 (with-current-buffer buf
98 (let ((backend (eglot-xref-backend)))
99 (mapcar
100 (lambda (xref)
101 (let ((loc (xref-item-location xref)))
102 (propertize
103 (concat
104 (when (xref-file-location-p loc)
105 (with-slots (file line column) loc
106 (format "%s:%s:%s:"
107 (propertize (file-relative-name file)
108 'face 'compilation-info)
109 (propertize (format "%s" line)
110 'face 'compilation-line
111 )
112 column)))
113 (xref-item-summary xref))
114 'xref xref)))
115 (xref-backend-apropos backend str))
116 )))
117 :dynamic-collection t
118 :action (lambda (item)
119 (xref--pop-to-location (get-text-property 0 'xref item))))))
120
121(add-to-list 'eglot-server-programs '(rust-mode . ("ra_lsp_server")))
86(provide 'ra) 122(provide 'ra)
87;;; ra.el ends here 123;;; ra.el ends here