aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api_light
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api_light')
-rw-r--r--crates/ra_ide_api_light/src/assists.rs12
-rw-r--r--crates/ra_ide_api_light/src/formatting.rs2
-rw-r--r--crates/ra_ide_api_light/src/lib.rs6
3 files changed, 10 insertions, 10 deletions
diff --git a/crates/ra_ide_api_light/src/assists.rs b/crates/ra_ide_api_light/src/assists.rs
index a27ef5da7..aea8397c9 100644
--- a/crates/ra_ide_api_light/src/assists.rs
+++ b/crates/ra_ide_api_light/src/assists.rs
@@ -1,5 +1,5 @@
1//! This modules contains various "assists": suggestions for source code edits 1//! This modules contains various "assists": suggestions for source code edits
2//! which are likely to occur at a given cursor positon. For example, if the 2//! which are likely to occur at a given cursor position. For example, if the
3//! cursor is on the `,`, a possible assist is swapping the elements around the 3//! cursor is on the `,`, a possible assist is swapping the elements around the
4//! comma. 4//! comma.
5 5
@@ -62,22 +62,22 @@ fn non_trivia_sibling(node: &SyntaxNode, direction: Direction) -> Option<&Syntax
62 62
63/// `AssistCtx` allows to apply an assist or check if it could be applied. 63/// `AssistCtx` allows to apply an assist or check if it could be applied.
64/// 64///
65/// Assists use a somewhat overengeneered approach, given the current needs. The 65/// Assists use a somewhat overengineered approach, given the current needs. The
66/// assists workflow consists of two phases. In the first phase, a user asks for 66/// assists workflow consists of two phases. In the first phase, a user asks for
67/// the list of available assists. In the second phase, the user picks a 67/// the list of available assists. In the second phase, the user picks a
68/// particular assist and it gets applied. 68/// particular assist and it gets applied.
69/// 69///
70/// There are two peculiarities here: 70/// There are two peculiarities here:
71/// 71///
72/// * first, we ideally avoid computing more things then neccessary to answer 72/// * first, we ideally avoid computing more things then necessary to answer
73/// "is assist applicable" in the first phase. 73/// "is assist applicable" in the first phase.
74/// * second, when we are appling assist, we don't have a gurantee that there 74/// * second, when we are applying assist, we don't have a guarantee that there
75/// weren't any changes between the point when user asked for assists and when 75/// weren't any changes between the point when user asked for assists and when
76/// they applied a particular assist. So, when applying assist, we need to do 76/// they applied a particular assist. So, when applying assist, we need to do
77/// all the checks from scratch. 77/// all the checks from scratch.
78/// 78///
79/// To avoid repeating the same code twice for both "check" and "apply" 79/// To avoid repeating the same code twice for both "check" and "apply"
80/// functions, we use an approach remeniscent of that of Django's function based 80/// functions, we use an approach reminiscent of that of Django's function based
81/// views dealing with forms. Each assist receives a runtime parameter, 81/// views dealing with forms. Each assist receives a runtime parameter,
82/// `should_compute_edit`. It first check if an edit is applicable (potentially 82/// `should_compute_edit`. It first check if an edit is applicable (potentially
83/// computing info required to compute the actual edit). If it is applicable, 83/// 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
89/// 89///
90/// Note, however, that we don't actually use such two-phase logic at the 90/// Note, however, that we don't actually use such two-phase logic at the
91/// moment, because the LSP API is pretty awkward in this place, and it's much 91/// moment, because the LSP API is pretty awkward in this place, and it's much
92/// easier to just compute the edit eagarly :-) 92/// easier to just compute the edit eagerly :-)
93#[derive(Debug, Clone)] 93#[derive(Debug, Clone)]
94pub struct AssistCtx<'a> { 94pub struct AssistCtx<'a> {
95 source_file: &'a SourceFile, 95 source_file: &'a SourceFile,
diff --git a/crates/ra_ide_api_light/src/formatting.rs b/crates/ra_ide_api_light/src/formatting.rs
index 599e3cdcb..ca0fdb928 100644
--- a/crates/ra_ide_api_light/src/formatting.rs
+++ b/crates/ra_ide_api_light/src/formatting.rs
@@ -5,7 +5,7 @@ use ra_syntax::{
5 algo::generate, 5 algo::generate,
6}; 6};
7 7
8/// If the node is on the begining of the line, calculate indent. 8/// If the node is on the beginning of the line, calculate indent.
9pub(crate) fn leading_indent(node: &SyntaxNode) -> Option<&str> { 9pub(crate) fn leading_indent(node: &SyntaxNode) -> Option<&str> {
10 let prev = prev_leaf(node)?; 10 let prev = prev_leaf(node)?;
11 let ws_text = ast::Whitespace::cast(prev)?.text(); 11 let ws_text = ast::Whitespace::cast(prev)?.text();
diff --git a/crates/ra_ide_api_light/src/lib.rs b/crates/ra_ide_api_light/src/lib.rs
index bc9bee752..72fba9402 100644
--- a/crates/ra_ide_api_light/src/lib.rs
+++ b/crates/ra_ide_api_light/src/lib.rs
@@ -1,7 +1,7 @@
1//! This crate provides thouse IDE features which use only a single file. 1//! This crate provides those IDE features which use only a single file.
2//! 2//!
3//! This usually means functions which take sytnax tree as an input and produce 3//! This usually means functions which take syntax tree as an input and produce
4//! an edit or some auxilarly info. 4//! an edit or some auxiliary info.
5 5
6pub mod assists; 6pub mod assists;
7mod extend_selection; 7mod extend_selection;