mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Implement Serialize
and Deserialize
for completions
This commit is contained in:
parent
287556bc14
commit
4b29bf6ff6
@ -3,6 +3,7 @@ use std::collections::{BTreeSet, HashSet};
|
||||
|
||||
use ecow::{eco_format, EcoString};
|
||||
use if_chain::if_chain;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use unscanny::Scanner;
|
||||
|
||||
use super::analyze::analyze_labels;
|
||||
@ -46,7 +47,7 @@ pub fn autocomplete(
|
||||
}
|
||||
|
||||
/// An autocompletion option.
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Completion {
|
||||
/// The kind of item this completes to.
|
||||
pub kind: CompletionKind,
|
||||
@ -62,7 +63,8 @@ pub struct Completion {
|
||||
}
|
||||
|
||||
/// A kind of item that can be completed.
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
pub enum CompletionKind {
|
||||
/// A syntactical structure.
|
||||
Syntax,
|
||||
|
Loading…
x
Reference in New Issue
Block a user