mirror of
https://github.com/typst/typst
synced 2025-05-15 17:45:27 +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 ecow::{eco_format, EcoString};
|
||||||
use if_chain::if_chain;
|
use if_chain::if_chain;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
use unscanny::Scanner;
|
use unscanny::Scanner;
|
||||||
|
|
||||||
use super::analyze::analyze_labels;
|
use super::analyze::analyze_labels;
|
||||||
@ -46,7 +47,7 @@ pub fn autocomplete(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// An autocompletion option.
|
/// An autocompletion option.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct Completion {
|
pub struct Completion {
|
||||||
/// The kind of item this completes to.
|
/// The kind of item this completes to.
|
||||||
pub kind: CompletionKind,
|
pub kind: CompletionKind,
|
||||||
@ -62,7 +63,8 @@ pub struct Completion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A kind of item that can be completed.
|
/// A kind of item that can be completed.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
#[serde(rename_all = "kebab-case")]
|
||||||
pub enum CompletionKind {
|
pub enum CompletionKind {
|
||||||
/// A syntactical structure.
|
/// A syntactical structure.
|
||||||
Syntax,
|
Syntax,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user