mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Fix some typos
This commit is contained in:
parent
a36e310229
commit
4fd3613434
26 changed files with 69 additions and 65 deletions
|
@ -30,7 +30,7 @@ pub use crate::completion::completion_item::{CompletionItem, CompletionItemKind,
|
|||
/// incomplete and can look really weird.
|
||||
///
|
||||
/// Once the context is collected, we run a series of completion routines which
|
||||
/// look at the context and produce completion items. One subtelty about this
|
||||
/// look at the context and produce completion items. One subtlety about this
|
||||
/// phase is that completion engine should not filter by the substring which is
|
||||
/// already present, it should give all possible variants for the identifier at
|
||||
/// the caret. In other words, for
|
||||
|
|
|
@ -7,7 +7,7 @@ use rustc_hash::FxHashMap;
|
|||
|
||||
use crate::completion::{CompletionContext, Completions, CompletionKind, CompletionItem};
|
||||
|
||||
/// Complete repeated parametes, both name and type. For example, if all
|
||||
/// Complete repeated parameters, both name and type. For example, if all
|
||||
/// functions in a file have a `spam: &mut Spam` parameter, a completion with
|
||||
/// `spam: &mut Spam` insert text/label and `spam` lookup string will be
|
||||
/// suggested.
|
||||
|
|
|
@ -93,10 +93,10 @@ pub(crate) fn reference_definition(
|
|||
return Exact(nav);
|
||||
}
|
||||
Some(Resolution::GenericParam(..)) => {
|
||||
// TODO go to the generic param def
|
||||
// TODO: go to the generic param def
|
||||
}
|
||||
Some(Resolution::SelfType(_impl_block)) => {
|
||||
// TODO go to the implemented type
|
||||
// TODO: go to the implemented type
|
||||
}
|
||||
None => {}
|
||||
}
|
||||
|
@ -133,8 +133,8 @@ mod tests {
|
|||
|
||||
use crate::mock_analysis::analysis_and_position;
|
||||
|
||||
fn check_goto(fixuture: &str, expected: &str) {
|
||||
let (analysis, pos) = analysis_and_position(fixuture);
|
||||
fn check_goto(fixture: &str, expected: &str) {
|
||||
let (analysis, pos) = analysis_and_position(fixture);
|
||||
|
||||
let mut navs = analysis.goto_definition(pos).unwrap().unwrap().info;
|
||||
assert_eq!(navs.len(), 1);
|
||||
|
|
|
@ -71,8 +71,8 @@ pub(crate) fn type_of(db: &RootDatabase, frange: FileRange) -> Option<String> {
|
|||
}
|
||||
}
|
||||
|
||||
// FIXME: this should not really use navigation target. Rather, approximatelly
|
||||
// resovled symbol should return a `DefId`.
|
||||
// FIXME: this should not really use navigation target. Rather, approximately
|
||||
// resolved symbol should return a `DefId`.
|
||||
fn doc_text_for(db: &RootDatabase, nav: NavigationTarget) -> Option<String> {
|
||||
match (nav.description(db), nav.docs(db)) {
|
||||
(Some(desc), Some(docs)) => Some("```rust\n".to_string() + &*desc + "\n```\n\n" + &*docs),
|
||||
|
|
|
@ -78,8 +78,8 @@ fn impls_for_trait(
|
|||
mod tests {
|
||||
use crate::mock_analysis::analysis_and_position;
|
||||
|
||||
fn check_goto(fixuture: &str, expected: &[&str]) {
|
||||
let (analysis, pos) = analysis_and_position(fixuture);
|
||||
fn check_goto(fixture: &str, expected: &[&str]) {
|
||||
let (analysis, pos) = analysis_and_position(fixture);
|
||||
|
||||
let navs = analysis.goto_implementation(pos).unwrap().unwrap().info;
|
||||
assert_eq!(navs.len(), expected.len());
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
//! However, IDE specific bits of the analysis (most notably completion) happen
|
||||
//! in this crate.
|
||||
//!
|
||||
//! The sibling `ra_ide_api_light` handles thouse bits of IDE functionality
|
||||
//! The sibling `ra_ide_api_light` handles those bits of IDE functionality
|
||||
//! which are restricted to a single file and need only syntax.
|
||||
|
||||
// For proving that RootDatabase is RefUnwindSafe.
|
||||
|
@ -67,7 +67,7 @@ pub use ra_db::{
|
|||
pub use hir::Documentation;
|
||||
|
||||
// We use jemalloc mainly to get heap usage statistics, actual performance
|
||||
// differnece is not measures.
|
||||
// difference is not measures.
|
||||
#[cfg(feature = "jemalloc")]
|
||||
#[global_allocator]
|
||||
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
|
||||
|
@ -221,12 +221,12 @@ impl Analysis {
|
|||
self.db.line_index(file_id)
|
||||
}
|
||||
|
||||
/// Selects the next syntactic nodes encopasing the range.
|
||||
/// Selects the next syntactic nodes encompassing the range.
|
||||
pub fn extend_selection(&self, frange: FileRange) -> Cancelable<TextRange> {
|
||||
self.with_db(|db| extend_selection::extend_selection(db, frange))
|
||||
}
|
||||
|
||||
/// Returns position of the mathcing brace (all types of braces are
|
||||
/// Returns position of the matching brace (all types of braces are
|
||||
/// supported).
|
||||
pub fn matching_brace(&self, position: FilePosition) -> Option<TextUnit> {
|
||||
let file = self.db.parse(position.file_id);
|
||||
|
@ -316,7 +316,7 @@ impl Analysis {
|
|||
self.with_db(|db| references::find_all_refs(db, position))
|
||||
}
|
||||
|
||||
/// Returns a short text descrbing element at position.
|
||||
/// Returns a short text describing element at position.
|
||||
pub fn hover(&self, position: FilePosition) -> Cancelable<Option<RangeInfo<String>>> {
|
||||
self.with_db(|db| hover::hover(db, position))
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ impl MockAnalysis {
|
|||
}
|
||||
/// Creates `MockAnalysis` using a fixture data in the following format:
|
||||
///
|
||||
/// ```notrust
|
||||
/// ```rust,ignore
|
||||
/// //- /main.rs
|
||||
/// mod foo;
|
||||
/// fn main() {}
|
||||
|
|
|
@ -295,17 +295,17 @@ mod tests {
|
|||
fn test_rename(text: &str, new_name: &str, expected: &str) {
|
||||
let (analysis, position) = single_file_with_position(text);
|
||||
let source_change = analysis.rename(position, new_name).unwrap();
|
||||
let mut text_edit_bulder = ra_text_edit::TextEditBuilder::default();
|
||||
let mut text_edit_builder = ra_text_edit::TextEditBuilder::default();
|
||||
let mut file_id: Option<FileId> = None;
|
||||
if let Some(change) = source_change {
|
||||
for edit in change.source_file_edits {
|
||||
file_id = Some(edit.file_id);
|
||||
for atom in edit.edit.as_atoms() {
|
||||
text_edit_bulder.replace(atom.delete, atom.insert.clone());
|
||||
text_edit_builder.replace(atom.delete, atom.insert.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
let result = text_edit_bulder.finish().apply(&*analysis.file_text(file_id.unwrap()));
|
||||
let result = text_edit_builder.finish().apply(&*analysis.file_text(file_id.unwrap()));
|
||||
assert_eq_text!(expected, &*result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,20 +5,20 @@
|
|||
//! symbols. The backbone of the index is the **awesome** `fst` crate by
|
||||
//! @BurntSushi.
|
||||
//!
|
||||
//! In a nutshell, you give a set of strings to the `fst`, and it builds a
|
||||
//! In a nutshell, you give a set of strings to `fst`, and it builds a
|
||||
//! finite state machine describing this set of strings. The strings which
|
||||
//! could fuzzy-match a pattern can also be described by a finite state machine.
|
||||
//! What is freakingly cool is that you can now traverse both state machines in
|
||||
//! What is freaking cool is that you can now traverse both state machines in
|
||||
//! lock-step to enumerate the strings which are both in the input set and
|
||||
//! fuzz-match the query. Or, more formally, given two languages described by
|
||||
//! fsts, one can build an product fst which describes the intersection of the
|
||||
//! FSTs, one can build a product FST which describes the intersection of the
|
||||
//! languages.
|
||||
//!
|
||||
//! `fst` does not support cheap updating of the index, but it supports unioning
|
||||
//! of state machines. So, to account for changing source code, we build an fst
|
||||
//! for each library (which is assumed to never change) and an fst for each rust
|
||||
//! of state machines. So, to account for changing source code, we build an FST
|
||||
//! for each library (which is assumed to never change) and an FST for each Rust
|
||||
//! file in the current workspace, and run a query against the union of all
|
||||
//! those fsts.
|
||||
//! those FSTs.
|
||||
use std::{
|
||||
cmp::Ordering,
|
||||
hash::{Hash, Hasher},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue