diff options
Diffstat (limited to 'crates/server/src/main_loop/handlers.rs')
-rw-r--r-- | crates/server/src/main_loop/handlers.rs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/crates/server/src/main_loop/handlers.rs b/crates/server/src/main_loop/handlers.rs index bd0e6825b..f51909280 100644 --- a/crates/server/src/main_loop/handlers.rs +++ b/crates/server/src/main_loop/handlers.rs | |||
@@ -5,7 +5,7 @@ use languageserver_types::{ | |||
5 | Command, TextDocumentIdentifier, WorkspaceEdit, | 5 | Command, TextDocumentIdentifier, WorkspaceEdit, |
6 | SymbolInformation, Location, | 6 | SymbolInformation, Location, |
7 | }; | 7 | }; |
8 | use libanalysis::{World}; | 8 | use libanalysis::{World, Query}; |
9 | use libeditor; | 9 | use libeditor; |
10 | use libsyntax2::TextUnit; | 10 | use libsyntax2::TextUnit; |
11 | use serde_json::{to_value, from_value}; | 11 | use serde_json::{to_value, from_value}; |
@@ -100,7 +100,20 @@ pub fn handle_workspace_symbol( | |||
100 | params: req::WorkspaceSymbolParams, | 100 | params: req::WorkspaceSymbolParams, |
101 | ) -> Result<Option<Vec<SymbolInformation>>> { | 101 | ) -> Result<Option<Vec<SymbolInformation>>> { |
102 | let mut acc = Vec::new(); | 102 | let mut acc = Vec::new(); |
103 | for (path, symbol) in world.world_symbols(¶ms.query).take(128) { | 103 | |
104 | let query = { | ||
105 | let all_symbols = params.query.contains("#"); | ||
106 | let query: String = params.query.chars() | ||
107 | .filter(|&c| c != '#') | ||
108 | .collect(); | ||
109 | let mut q = Query::new(query); | ||
110 | if !all_symbols { | ||
111 | q.only_types(); | ||
112 | } | ||
113 | q | ||
114 | }; | ||
115 | |||
116 | for (path, symbol) in world.world_symbols(query).take(128) { | ||
104 | let line_index = world.file_line_index(path)?; | 117 | let line_index = world.file_line_index(path)?; |
105 | 118 | ||
106 | let info = SymbolInformation { | 119 | let info = SymbolInformation { |