mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 04:23:25 +00:00
Trim down IPC json size
This commit is contained in:
parent
d702f10fb3
commit
a2950fcb05
1 changed files with 26 additions and 4 deletions
|
@ -77,7 +77,11 @@ struct TokenIdDef(u32);
|
|||
#[derive(Serialize, Deserialize)]
|
||||
#[serde(remote = "Delimiter")]
|
||||
struct DelimiterDef {
|
||||
#[serde(with = "TokenIdDef")]
|
||||
#[serde(
|
||||
with = "TokenIdDef",
|
||||
default = "tt::TokenId::unspecified",
|
||||
skip_serializing_if = "token_id_def::skip_if"
|
||||
)]
|
||||
id: TokenId,
|
||||
#[serde(with = "DelimiterKindDef")]
|
||||
kind: DelimiterKind,
|
||||
|
@ -116,7 +120,11 @@ enum LeafDef {
|
|||
#[serde(remote = "Literal")]
|
||||
struct LiteralDef {
|
||||
text: SmolStr,
|
||||
#[serde(with = "TokenIdDef")]
|
||||
#[serde(
|
||||
with = "TokenIdDef",
|
||||
default = "tt::TokenId::unspecified",
|
||||
skip_serializing_if = "token_id_def::skip_if"
|
||||
)]
|
||||
id: TokenId,
|
||||
}
|
||||
|
||||
|
@ -126,7 +134,11 @@ struct PunctDef {
|
|||
char: char,
|
||||
#[serde(with = "SpacingDef")]
|
||||
spacing: Spacing,
|
||||
#[serde(with = "TokenIdDef")]
|
||||
#[serde(
|
||||
with = "TokenIdDef",
|
||||
default = "tt::TokenId::unspecified",
|
||||
skip_serializing_if = "token_id_def::skip_if"
|
||||
)]
|
||||
id: TokenId,
|
||||
}
|
||||
|
||||
|
@ -141,10 +153,20 @@ enum SpacingDef {
|
|||
#[serde(remote = "Ident")]
|
||||
struct IdentDef {
|
||||
text: SmolStr,
|
||||
#[serde(with = "TokenIdDef")]
|
||||
#[serde(
|
||||
with = "TokenIdDef",
|
||||
default = "tt::TokenId::unspecified",
|
||||
skip_serializing_if = "token_id_def::skip_if"
|
||||
)]
|
||||
id: TokenId,
|
||||
}
|
||||
|
||||
mod token_id_def {
|
||||
pub(super) fn skip_if(value: &tt::TokenId) -> bool {
|
||||
*value == tt::TokenId::unspecified()
|
||||
}
|
||||
}
|
||||
|
||||
mod opt_delimiter_def {
|
||||
use super::{Delimiter, DelimiterDef};
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
|
|
Loading…
Reference in a new issue