aboutsummaryrefslogtreecommitdiff
path: root/crates/libanalysis/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/libanalysis/src/lib.rs')
-rw-r--r--crates/libanalysis/src/lib.rs23
1 files changed, 14 insertions, 9 deletions
diff --git a/crates/libanalysis/src/lib.rs b/crates/libanalysis/src/lib.rs
index 80cde079f..b4b7a6a30 100644
--- a/crates/libanalysis/src/lib.rs
+++ b/crates/libanalysis/src/lib.rs
@@ -9,12 +9,17 @@ extern crate rayon;
9extern crate relative_path; 9extern crate relative_path;
10#[macro_use] 10#[macro_use]
11extern crate crossbeam_channel; 11extern crate crossbeam_channel;
12extern crate im;
13extern crate salsa;
12 14
13mod symbol_index; 15mod symbol_index;
14mod module_map; 16mod module_map;
15mod imp; 17mod imp;
16mod job; 18mod job;
17mod roots; 19mod roots;
20mod db;
21mod queries;
22mod descriptors;
18 23
19use std::{ 24use std::{
20 sync::Arc, 25 sync::Arc,
@@ -161,8 +166,8 @@ impl Analysis {
161 pub fn file_syntax(&self, file_id: FileId) -> File { 166 pub fn file_syntax(&self, file_id: FileId) -> File {
162 self.imp.file_syntax(file_id).clone() 167 self.imp.file_syntax(file_id).clone()
163 } 168 }
164 pub fn file_line_index(&self, file_id: FileId) -> LineIndex { 169 pub fn file_line_index(&self, file_id: FileId) -> Arc<LineIndex> {
165 self.imp.file_line_index(file_id).clone() 170 self.imp.file_line_index(file_id)
166 } 171 }
167 pub fn extend_selection(&self, file: &File, range: TextRange) -> TextRange { 172 pub fn extend_selection(&self, file: &File, range: TextRange) -> TextRange {
168 libeditor::extend_selection(file, range).unwrap_or(range) 173 libeditor::extend_selection(file, range).unwrap_or(range)
@@ -172,19 +177,19 @@ impl Analysis {
172 } 177 }
173 pub fn syntax_tree(&self, file_id: FileId) -> String { 178 pub fn syntax_tree(&self, file_id: FileId) -> String {
174 let file = self.imp.file_syntax(file_id); 179 let file = self.imp.file_syntax(file_id);
175 libeditor::syntax_tree(file) 180 libeditor::syntax_tree(&file)
176 } 181 }
177 pub fn join_lines(&self, file_id: FileId, range: TextRange) -> SourceChange { 182 pub fn join_lines(&self, file_id: FileId, range: TextRange) -> SourceChange {
178 let file = self.imp.file_syntax(file_id); 183 let file = self.imp.file_syntax(file_id);
179 SourceChange::from_local_edit(file_id, "join lines", libeditor::join_lines(file, range)) 184 SourceChange::from_local_edit(file_id, "join lines", libeditor::join_lines(&file, range))
180 } 185 }
181 pub fn on_eq_typed(&self, file_id: FileId, offset: TextUnit) -> Option<SourceChange> { 186 pub fn on_eq_typed(&self, file_id: FileId, offset: TextUnit) -> Option<SourceChange> {
182 let file = self.imp.file_syntax(file_id); 187 let file = self.imp.file_syntax(file_id);
183 Some(SourceChange::from_local_edit(file_id, "add semicolon", libeditor::on_eq_typed(file, offset)?)) 188 Some(SourceChange::from_local_edit(file_id, "add semicolon", libeditor::on_eq_typed(&file, offset)?))
184 } 189 }
185 pub fn file_structure(&self, file_id: FileId) -> Vec<StructureNode> { 190 pub fn file_structure(&self, file_id: FileId) -> Vec<StructureNode> {
186 let file = self.imp.file_syntax(file_id); 191 let file = self.imp.file_syntax(file_id);
187 libeditor::file_structure(file) 192 libeditor::file_structure(&file)
188 } 193 }
189 pub fn symbol_search(&self, query: Query, token: &JobToken) -> Vec<(FileId, FileSymbol)> { 194 pub fn symbol_search(&self, query: Query, token: &JobToken) -> Vec<(FileId, FileSymbol)> {
190 self.imp.world_symbols(query, token) 195 self.imp.world_symbols(query, token)
@@ -203,15 +208,15 @@ impl Analysis {
203 } 208 }
204 pub fn runnables(&self, file_id: FileId) -> Vec<Runnable> { 209 pub fn runnables(&self, file_id: FileId) -> Vec<Runnable> {
205 let file = self.imp.file_syntax(file_id); 210 let file = self.imp.file_syntax(file_id);
206 libeditor::runnables(file) 211 libeditor::runnables(&file)
207 } 212 }
208 pub fn highlight(&self, file_id: FileId) -> Vec<HighlightedRange> { 213 pub fn highlight(&self, file_id: FileId) -> Vec<HighlightedRange> {
209 let file = self.imp.file_syntax(file_id); 214 let file = self.imp.file_syntax(file_id);
210 libeditor::highlight(file) 215 libeditor::highlight(&file)
211 } 216 }
212 pub fn completions(&self, file_id: FileId, offset: TextUnit) -> Option<Vec<CompletionItem>> { 217 pub fn completions(&self, file_id: FileId, offset: TextUnit) -> Option<Vec<CompletionItem>> {
213 let file = self.imp.file_syntax(file_id); 218 let file = self.imp.file_syntax(file_id);
214 libeditor::scope_completion(file, offset) 219 libeditor::scope_completion(&file, offset)
215 } 220 }
216 pub fn assists(&self, file_id: FileId, range: TextRange) -> Vec<SourceChange> { 221 pub fn assists(&self, file_id: FileId, range: TextRange) -> Vec<SourceChange> {
217 self.imp.assists(file_id, range) 222 self.imp.assists(file_id, range)