diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-02-24 14:22:34 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-02-24 14:22:34 +0100 |
| commit | 151765bb3ef3c87a461b6922d97a1d98ff1c2fac (patch) | |
| tree | b8aa4aa0743ff6877371bd8969858f76986baf86 /src/ide | |
| parent | 7726e8aa4d1a30193ffb07abf80086bf98a92549 (diff) | |
Don't complete in comments
Diffstat (limited to 'src/ide')
| -rw-r--r-- | src/ide/complete.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ide/complete.rs b/src/ide/complete.rs index 30b98fc8..a24eb7e2 100644 --- a/src/ide/complete.rs +++ b/src/ide/complete.rs @@ -23,7 +23,8 @@ pub fn autocomplete( ) -> Option<(usize, Vec<Completion>)> { let mut ctx = CompletionContext::new(world, source, cursor, explicit)?; - let _ = complete_field_accesses(&mut ctx) + let _ = complete_comments(&mut ctx) + || complete_field_accesses(&mut ctx) || complete_imports(&mut ctx) || complete_rules(&mut ctx) || complete_params(&mut ctx) @@ -67,6 +68,11 @@ pub enum CompletionKind { Symbol(char), } +/// Complete in comments. Or rather, don't! +fn complete_comments(ctx: &mut CompletionContext) -> bool { + matches!(ctx.leaf.kind(), SyntaxKind::LineComment | SyntaxKind::BlockComment) +} + /// Complete in markup mode. fn complete_markup(ctx: &mut CompletionContext) -> bool { // Bail if we aren't even in markup. |
