aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_lsp_server/src/main.rs25
-rw-r--r--editors/emacs/ra.el36
2 files changed, 60 insertions, 1 deletions
diff --git a/crates/ra_lsp_server/src/main.rs b/crates/ra_lsp_server/src/main.rs
index c07eb0140..4d555d488 100644
--- a/crates/ra_lsp_server/src/main.rs
+++ b/crates/ra_lsp_server/src/main.rs
@@ -29,7 +29,6 @@ fn main() -> Result<()> {
29 } 29 }
30 } 30 }
31} 31}
32
33fn main_inner() -> Result<()> { 32fn main_inner() -> Result<()> {
34 let (receiver, sender, threads) = stdio_transport(); 33 let (receiver, sender, threads) = stdio_transport();
35 let cwd = ::std::env::current_dir()?; 34 let cwd = ::std::env::current_dir()?;
@@ -50,3 +49,27 @@ fn main_inner() -> Result<()> {
50 info!("... IO is down"); 49 info!("... IO is down");
51 Ok(()) 50 Ok(())
52} 51}
52
53/*
54 (let ((backend (eglot-xref-backend)))
55 (mapcar
56 (lambda (xref)
57 (let ((loc (xref-item-location xref)))
58 (propertize
59 (concat
60 (when (xref-file-location-p loc)
61 (with-slots (file line column) loc
62 (format "%s:%s:%s:"
63 (propertize (file-relative-name file)
64 'face 'compilation-info)
65 (propertize (format "%s" line)
66 'face 'compilation-line
67 )
68 column)))
69 (xref-item-summary xref))
70 'xref xref)))
71 (xref-backend-apropos backend "Analysis"))
72 )
73
74
75*/
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