diff options
Diffstat (limited to 'crates/ra_ide_api_light/src/assists.rs')
-rw-r--r-- | crates/ra_ide_api_light/src/assists.rs | 12 |
1 files changed, 6 insertions, 6 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)] |
94 | pub struct AssistCtx<'a> { | 94 | pub struct AssistCtx<'a> { |
95 | source_file: &'a SourceFile, | 95 | source_file: &'a SourceFile, |