aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r--crates/ra_ide_api/src/completion.rs2
-rw-r--r--crates/ra_ide_api/src/completion/complete_fn_param.rs2
-rw-r--r--crates/ra_ide_api/src/goto_definition.rs8
-rw-r--r--crates/ra_ide_api/src/hover.rs4
-rw-r--r--crates/ra_ide_api/src/impls.rs4
-rw-r--r--crates/ra_ide_api/src/lib.rs10
-rw-r--r--crates/ra_ide_api/src/mock_analysis.rs2
-rw-r--r--crates/ra_ide_api/src/references.rs6
-rw-r--r--crates/ra_ide_api/src/symbol_index.rs12
9 files changed, 25 insertions, 25 deletions
diff --git a/crates/ra_ide_api/src/completion.rs b/crates/ra_ide_api/src/completion.rs
index 83c243944..2b94931c6 100644
--- a/crates/ra_ide_api/src/completion.rs
+++ b/crates/ra_ide_api/src/completion.rs
@@ -30,7 +30,7 @@ pub use crate::completion::completion_item::{CompletionItem, CompletionItemKind,
30/// incomplete and can look really weird. 30/// incomplete and can look really weird.
31/// 31///
32/// Once the context is collected, we run a series of completion routines which 32/// Once the context is collected, we run a series of completion routines which
33/// look at the context and produce completion items. One subtelty about this 33/// look at the context and produce completion items. One subtlety about this
34/// phase is that completion engine should not filter by the substring which is 34/// phase is that completion engine should not filter by the substring which is
35/// already present, it should give all possible variants for the identifier at 35/// already present, it should give all possible variants for the identifier at
36/// the caret. In other words, for 36/// the caret. In other words, for
diff --git a/crates/ra_ide_api/src/completion/complete_fn_param.rs b/crates/ra_ide_api/src/completion/complete_fn_param.rs
index 43532226f..4d6416284 100644
--- a/crates/ra_ide_api/src/completion/complete_fn_param.rs
+++ b/crates/ra_ide_api/src/completion/complete_fn_param.rs
@@ -7,7 +7,7 @@ use rustc_hash::FxHashMap;
7 7
8use crate::completion::{CompletionContext, Completions, CompletionKind, CompletionItem}; 8use crate::completion::{CompletionContext, Completions, CompletionKind, CompletionItem};
9 9
10/// Complete repeated parametes, both name and type. For example, if all 10/// Complete repeated parameters, both name and type. For example, if all
11/// functions in a file have a `spam: &mut Spam` parameter, a completion with 11/// functions in a file have a `spam: &mut Spam` parameter, a completion with
12/// `spam: &mut Spam` insert text/label and `spam` lookup string will be 12/// `spam: &mut Spam` insert text/label and `spam` lookup string will be
13/// suggested. 13/// suggested.
diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs
index 413720960..96ed8c8e9 100644
--- a/crates/ra_ide_api/src/goto_definition.rs
+++ b/crates/ra_ide_api/src/goto_definition.rs
@@ -93,10 +93,10 @@ pub(crate) fn reference_definition(
93 return Exact(nav); 93 return Exact(nav);
94 } 94 }
95 Some(Resolution::GenericParam(..)) => { 95 Some(Resolution::GenericParam(..)) => {
96 // TODO go to the generic param def 96 // TODO: go to the generic param def
97 } 97 }
98 Some(Resolution::SelfType(_impl_block)) => { 98 Some(Resolution::SelfType(_impl_block)) => {
99 // TODO go to the implemented type 99 // TODO: go to the implemented type
100 } 100 }
101 None => {} 101 None => {}
102 } 102 }
@@ -133,8 +133,8 @@ mod tests {
133 133
134 use crate::mock_analysis::analysis_and_position; 134 use crate::mock_analysis::analysis_and_position;
135 135
136 fn check_goto(fixuture: &str, expected: &str) { 136 fn check_goto(fixture: &str, expected: &str) {
137 let (analysis, pos) = analysis_and_position(fixuture); 137 let (analysis, pos) = analysis_and_position(fixture);
138 138
139 let mut navs = analysis.goto_definition(pos).unwrap().unwrap().info; 139 let mut navs = analysis.goto_definition(pos).unwrap().unwrap().info;
140 assert_eq!(navs.len(), 1); 140 assert_eq!(navs.len(), 1);
diff --git a/crates/ra_ide_api/src/hover.rs b/crates/ra_ide_api/src/hover.rs
index 60b81567c..0888ab6de 100644
--- a/crates/ra_ide_api/src/hover.rs
+++ b/crates/ra_ide_api/src/hover.rs
@@ -71,8 +71,8 @@ pub(crate) fn type_of(db: &RootDatabase, frange: FileRange) -> Option<String> {
71 } 71 }
72} 72}
73 73
74// FIXME: this should not really use navigation target. Rather, approximatelly 74// FIXME: this should not really use navigation target. Rather, approximately
75// resovled symbol should return a `DefId`. 75// resolved symbol should return a `DefId`.
76fn doc_text_for(db: &RootDatabase, nav: NavigationTarget) -> Option<String> { 76fn doc_text_for(db: &RootDatabase, nav: NavigationTarget) -> Option<String> {
77 match (nav.description(db), nav.docs(db)) { 77 match (nav.description(db), nav.docs(db)) {
78 (Some(desc), Some(docs)) => Some("```rust\n".to_string() + &*desc + "\n```\n\n" + &*docs), 78 (Some(desc), Some(docs)) => Some("```rust\n".to_string() + &*desc + "\n```\n\n" + &*docs),
diff --git a/crates/ra_ide_api/src/impls.rs b/crates/ra_ide_api/src/impls.rs
index 444c4aeb2..681bd808d 100644
--- a/crates/ra_ide_api/src/impls.rs
+++ b/crates/ra_ide_api/src/impls.rs
@@ -78,8 +78,8 @@ fn impls_for_trait(
78mod tests { 78mod tests {
79 use crate::mock_analysis::analysis_and_position; 79 use crate::mock_analysis::analysis_and_position;
80 80
81 fn check_goto(fixuture: &str, expected: &[&str]) { 81 fn check_goto(fixture: &str, expected: &[&str]) {
82 let (analysis, pos) = analysis_and_position(fixuture); 82 let (analysis, pos) = analysis_and_position(fixture);
83 83
84 let navs = analysis.goto_implementation(pos).unwrap().unwrap().info; 84 let navs = analysis.goto_implementation(pos).unwrap().unwrap().info;
85 assert_eq!(navs.len(), expected.len()); 85 assert_eq!(navs.len(), expected.len());
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs
index 2d090d9b4..de3ec4e0a 100644
--- a/crates/ra_ide_api/src/lib.rs
+++ b/crates/ra_ide_api/src/lib.rs
@@ -7,7 +7,7 @@
7//! However, IDE specific bits of the analysis (most notably completion) happen 7//! However, IDE specific bits of the analysis (most notably completion) happen
8//! in this crate. 8//! in this crate.
9//! 9//!
10//! The sibling `ra_ide_api_light` handles thouse bits of IDE functionality 10//! The sibling `ra_ide_api_light` handles those bits of IDE functionality
11//! which are restricted to a single file and need only syntax. 11//! which are restricted to a single file and need only syntax.
12 12
13// For proving that RootDatabase is RefUnwindSafe. 13// For proving that RootDatabase is RefUnwindSafe.
@@ -67,7 +67,7 @@ pub use ra_db::{
67pub use hir::Documentation; 67pub use hir::Documentation;
68 68
69// We use jemalloc mainly to get heap usage statistics, actual performance 69// We use jemalloc mainly to get heap usage statistics, actual performance
70// differnece is not measures. 70// difference is not measures.
71#[cfg(feature = "jemalloc")] 71#[cfg(feature = "jemalloc")]
72#[global_allocator] 72#[global_allocator]
73static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; 73static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
@@ -221,12 +221,12 @@ impl Analysis {
221 self.db.line_index(file_id) 221 self.db.line_index(file_id)
222 } 222 }
223 223
224 /// Selects the next syntactic nodes encopasing the range. 224 /// Selects the next syntactic nodes encompassing the range.
225 pub fn extend_selection(&self, frange: FileRange) -> Cancelable<TextRange> { 225 pub fn extend_selection(&self, frange: FileRange) -> Cancelable<TextRange> {
226 self.with_db(|db| extend_selection::extend_selection(db, frange)) 226 self.with_db(|db| extend_selection::extend_selection(db, frange))
227 } 227 }
228 228
229 /// Returns position of the mathcing brace (all types of braces are 229 /// Returns position of the matching brace (all types of braces are
230 /// supported). 230 /// supported).
231 pub fn matching_brace(&self, position: FilePosition) -> Option<TextUnit> { 231 pub fn matching_brace(&self, position: FilePosition) -> Option<TextUnit> {
232 let file = self.db.parse(position.file_id); 232 let file = self.db.parse(position.file_id);
@@ -316,7 +316,7 @@ impl Analysis {
316 self.with_db(|db| references::find_all_refs(db, position)) 316 self.with_db(|db| references::find_all_refs(db, position))
317 } 317 }
318 318
319 /// Returns a short text descrbing element at position. 319 /// Returns a short text describing element at position.
320 pub fn hover(&self, position: FilePosition) -> Cancelable<Option<RangeInfo<String>>> { 320 pub fn hover(&self, position: FilePosition) -> Cancelable<Option<RangeInfo<String>>> {
321 self.with_db(|db| hover::hover(db, position)) 321 self.with_db(|db| hover::hover(db, position))
322 } 322 }
diff --git a/crates/ra_ide_api/src/mock_analysis.rs b/crates/ra_ide_api/src/mock_analysis.rs
index 8d8603062..017ac5de3 100644
--- a/crates/ra_ide_api/src/mock_analysis.rs
+++ b/crates/ra_ide_api/src/mock_analysis.rs
@@ -18,7 +18,7 @@ impl MockAnalysis {
18 } 18 }
19 /// Creates `MockAnalysis` using a fixture data in the following format: 19 /// Creates `MockAnalysis` using a fixture data in the following format:
20 /// 20 ///
21 /// ```notrust 21 /// ```rust,ignore
22 /// //- /main.rs 22 /// //- /main.rs
23 /// mod foo; 23 /// mod foo;
24 /// fn main() {} 24 /// fn main() {}
diff --git a/crates/ra_ide_api/src/references.rs b/crates/ra_ide_api/src/references.rs
index 2cb1cc9be..ca145f3e4 100644
--- a/crates/ra_ide_api/src/references.rs
+++ b/crates/ra_ide_api/src/references.rs
@@ -295,17 +295,17 @@ mod tests {
295 fn test_rename(text: &str, new_name: &str, expected: &str) { 295 fn test_rename(text: &str, new_name: &str, expected: &str) {
296 let (analysis, position) = single_file_with_position(text); 296 let (analysis, position) = single_file_with_position(text);
297 let source_change = analysis.rename(position, new_name).unwrap(); 297 let source_change = analysis.rename(position, new_name).unwrap();
298 let mut text_edit_bulder = ra_text_edit::TextEditBuilder::default(); 298 let mut text_edit_builder = ra_text_edit::TextEditBuilder::default();
299 let mut file_id: Option<FileId> = None; 299 let mut file_id: Option<FileId> = None;
300 if let Some(change) = source_change { 300 if let Some(change) = source_change {
301 for edit in change.source_file_edits { 301 for edit in change.source_file_edits {
302 file_id = Some(edit.file_id); 302 file_id = Some(edit.file_id);
303 for atom in edit.edit.as_atoms() { 303 for atom in edit.edit.as_atoms() {
304 text_edit_bulder.replace(atom.delete, atom.insert.clone()); 304 text_edit_builder.replace(atom.delete, atom.insert.clone());
305 } 305 }
306 } 306 }
307 } 307 }
308 let result = text_edit_bulder.finish().apply(&*analysis.file_text(file_id.unwrap())); 308 let result = text_edit_builder.finish().apply(&*analysis.file_text(file_id.unwrap()));
309 assert_eq_text!(expected, &*result); 309 assert_eq_text!(expected, &*result);
310 } 310 }
311} 311}
diff --git a/crates/ra_ide_api/src/symbol_index.rs b/crates/ra_ide_api/src/symbol_index.rs
index de0f46134..15348124b 100644
--- a/crates/ra_ide_api/src/symbol_index.rs
+++ b/crates/ra_ide_api/src/symbol_index.rs
@@ -5,20 +5,20 @@
5//! symbols. The backbone of the index is the **awesome** `fst` crate by 5//! symbols. The backbone of the index is the **awesome** `fst` crate by
6//! @BurntSushi. 6//! @BurntSushi.
7//! 7//!
8//! In a nutshell, you give a set of strings to the `fst`, and it builds a 8//! In a nutshell, you give a set of strings to `fst`, and it builds a
9//! finite state machine describing this set of strings. The strings which 9//! finite state machine describing this set of strings. The strings which
10//! could fuzzy-match a pattern can also be described by a finite state machine. 10//! could fuzzy-match a pattern can also be described by a finite state machine.
11//! What is freakingly cool is that you can now traverse both state machines in 11//! What is freaking cool is that you can now traverse both state machines in
12//! lock-step to enumerate the strings which are both in the input set and 12//! lock-step to enumerate the strings which are both in the input set and
13//! fuzz-match the query. Or, more formally, given two languages described by 13//! fuzz-match the query. Or, more formally, given two languages described by
14//! fsts, one can build an product fst which describes the intersection of the 14//! FSTs, one can build a product FST which describes the intersection of the
15//! languages. 15//! languages.
16//! 16//!
17//! `fst` does not support cheap updating of the index, but it supports unioning 17//! `fst` does not support cheap updating of the index, but it supports unioning
18//! of state machines. So, to account for changing source code, we build an fst 18//! of state machines. So, to account for changing source code, we build an FST
19//! for each library (which is assumed to never change) and an fst for each rust 19//! for each library (which is assumed to never change) and an FST for each Rust
20//! file in the current workspace, and run a query against the union of all 20//! file in the current workspace, and run a query against the union of all
21//! those fsts. 21//! those FSTs.
22use std::{ 22use std::{
23 cmp::Ordering, 23 cmp::Ordering,
24 hash::{Hash, Hasher}, 24 hash::{Hash, Hasher},