mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Fix some random typos
This commit is contained in:
parent
6fb13cd535
commit
f97a9921df
3 changed files with 10 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
||||||
//! This modules contains various "assists": suggestions for source code edits
|
//! This modules contains various "assists": suggestions for source code edits
|
||||||
//! which are likely to occur at a given cursor positon. For example, if the
|
//! which are likely to occur at a given cursor position. For example, if the
|
||||||
//! cursor is on the `,`, a possible assist is swapping the elements around the
|
//! cursor is on the `,`, a possible assist is swapping the elements around the
|
||||||
//! comma.
|
//! comma.
|
||||||
|
|
||||||
|
@ -62,22 +62,22 @@ fn non_trivia_sibling(node: &SyntaxNode, direction: Direction) -> Option<&Syntax
|
||||||
|
|
||||||
/// `AssistCtx` allows to apply an assist or check if it could be applied.
|
/// `AssistCtx` allows to apply an assist or check if it could be applied.
|
||||||
///
|
///
|
||||||
/// Assists use a somewhat overengeneered approach, given the current needs. The
|
/// Assists use a somewhat overengineered approach, given the current needs. The
|
||||||
/// assists workflow consists of two phases. In the first phase, a user asks for
|
/// assists workflow consists of two phases. In the first phase, a user asks for
|
||||||
/// the list of available assists. In the second phase, the user picks a
|
/// the list of available assists. In the second phase, the user picks a
|
||||||
/// particular assist and it gets applied.
|
/// particular assist and it gets applied.
|
||||||
///
|
///
|
||||||
/// There are two peculiarities here:
|
/// There are two peculiarities here:
|
||||||
///
|
///
|
||||||
/// * first, we ideally avoid computing more things then neccessary to answer
|
/// * first, we ideally avoid computing more things then necessary to answer
|
||||||
/// "is assist applicable" in the first phase.
|
/// "is assist applicable" in the first phase.
|
||||||
/// * second, when we are appling assist, we don't have a gurantee that there
|
/// * second, when we are applying assist, we don't have a guarantee that there
|
||||||
/// weren't any changes between the point when user asked for assists and when
|
/// weren't any changes between the point when user asked for assists and when
|
||||||
/// they applied a particular assist. So, when applying assist, we need to do
|
/// they applied a particular assist. So, when applying assist, we need to do
|
||||||
/// all the checks from scratch.
|
/// all the checks from scratch.
|
||||||
///
|
///
|
||||||
/// To avoid repeating the same code twice for both "check" and "apply"
|
/// To avoid repeating the same code twice for both "check" and "apply"
|
||||||
/// functions, we use an approach remeniscent of that of Django's function based
|
/// functions, we use an approach reminiscent of that of Django's function based
|
||||||
/// views dealing with forms. Each assist receives a runtime parameter,
|
/// views dealing with forms. Each assist receives a runtime parameter,
|
||||||
/// `should_compute_edit`. It first check if an edit is applicable (potentially
|
/// `should_compute_edit`. It first check if an edit is applicable (potentially
|
||||||
/// computing info required to compute the actual edit). If it is applicable,
|
/// computing info required to compute the actual edit). If it is applicable,
|
||||||
|
@ -89,7 +89,7 @@ fn non_trivia_sibling(node: &SyntaxNode, direction: Direction) -> Option<&Syntax
|
||||||
///
|
///
|
||||||
/// Note, however, that we don't actually use such two-phase logic at the
|
/// Note, however, that we don't actually use such two-phase logic at the
|
||||||
/// moment, because the LSP API is pretty awkward in this place, and it's much
|
/// moment, because the LSP API is pretty awkward in this place, and it's much
|
||||||
/// easier to just compute the edit eagarly :-)
|
/// easier to just compute the edit eagerly :-)
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct AssistCtx<'a> {
|
pub struct AssistCtx<'a> {
|
||||||
source_file: &'a SourceFile,
|
source_file: &'a SourceFile,
|
||||||
|
|
|
@ -5,7 +5,7 @@ use ra_syntax::{
|
||||||
algo::generate,
|
algo::generate,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// If the node is on the begining of the line, calculate indent.
|
/// If the node is on the beginning of the line, calculate indent.
|
||||||
pub(crate) fn leading_indent(node: &SyntaxNode) -> Option<&str> {
|
pub(crate) fn leading_indent(node: &SyntaxNode) -> Option<&str> {
|
||||||
let prev = prev_leaf(node)?;
|
let prev = prev_leaf(node)?;
|
||||||
let ws_text = ast::Whitespace::cast(prev)?.text();
|
let ws_text = ast::Whitespace::cast(prev)?.text();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//! This crate provides thouse IDE features which use only a single file.
|
//! This crate provides those IDE features which use only a single file.
|
||||||
//!
|
//!
|
||||||
//! This usually means functions which take sytnax tree as an input and produce
|
//! This usually means functions which take syntax tree as an input and produce
|
||||||
//! an edit or some auxilarly info.
|
//! an edit or some auxiliary info.
|
||||||
|
|
||||||
pub mod assists;
|
pub mod assists;
|
||||||
mod extend_selection;
|
mod extend_selection;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue