mirror of
https://github.com/typst/typst
synced 2025-05-13 12:36:23 +08:00
Don't complete in comments
This commit is contained in:
parent
7726e8aa4d
commit
151765bb3e
@ -23,7 +23,8 @@ pub fn autocomplete(
|
|||||||
) -> Option<(usize, Vec<Completion>)> {
|
) -> Option<(usize, Vec<Completion>)> {
|
||||||
let mut ctx = CompletionContext::new(world, source, cursor, explicit)?;
|
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_imports(&mut ctx)
|
||||||
|| complete_rules(&mut ctx)
|
|| complete_rules(&mut ctx)
|
||||||
|| complete_params(&mut ctx)
|
|| complete_params(&mut ctx)
|
||||||
@ -67,6 +68,11 @@ pub enum CompletionKind {
|
|||||||
Symbol(char),
|
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.
|
/// Complete in markup mode.
|
||||||
fn complete_markup(ctx: &mut CompletionContext) -> bool {
|
fn complete_markup(ctx: &mut CompletionContext) -> bool {
|
||||||
// Bail if we aren't even in markup.
|
// Bail if we aren't even in markup.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user