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)]
|
#[derive(Serialize, Deserialize)]
|
||||||
#[serde(remote = "Delimiter")]
|
#[serde(remote = "Delimiter")]
|
||||||
struct DelimiterDef {
|
struct DelimiterDef {
|
||||||
#[serde(with = "TokenIdDef")]
|
#[serde(
|
||||||
|
with = "TokenIdDef",
|
||||||
|
default = "tt::TokenId::unspecified",
|
||||||
|
skip_serializing_if = "token_id_def::skip_if"
|
||||||
|
)]
|
||||||
id: TokenId,
|
id: TokenId,
|
||||||
#[serde(with = "DelimiterKindDef")]
|
#[serde(with = "DelimiterKindDef")]
|
||||||
kind: DelimiterKind,
|
kind: DelimiterKind,
|
||||||
|
@ -116,7 +120,11 @@ enum LeafDef {
|
||||||
#[serde(remote = "Literal")]
|
#[serde(remote = "Literal")]
|
||||||
struct LiteralDef {
|
struct LiteralDef {
|
||||||
text: SmolStr,
|
text: SmolStr,
|
||||||
#[serde(with = "TokenIdDef")]
|
#[serde(
|
||||||
|
with = "TokenIdDef",
|
||||||
|
default = "tt::TokenId::unspecified",
|
||||||
|
skip_serializing_if = "token_id_def::skip_if"
|
||||||
|
)]
|
||||||
id: TokenId,
|
id: TokenId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +134,11 @@ struct PunctDef {
|
||||||
char: char,
|
char: char,
|
||||||
#[serde(with = "SpacingDef")]
|
#[serde(with = "SpacingDef")]
|
||||||
spacing: Spacing,
|
spacing: Spacing,
|
||||||
#[serde(with = "TokenIdDef")]
|
#[serde(
|
||||||
|
with = "TokenIdDef",
|
||||||
|
default = "tt::TokenId::unspecified",
|
||||||
|
skip_serializing_if = "token_id_def::skip_if"
|
||||||
|
)]
|
||||||
id: TokenId,
|
id: TokenId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,10 +153,20 @@ enum SpacingDef {
|
||||||
#[serde(remote = "Ident")]
|
#[serde(remote = "Ident")]
|
||||||
struct IdentDef {
|
struct IdentDef {
|
||||||
text: SmolStr,
|
text: SmolStr,
|
||||||
#[serde(with = "TokenIdDef")]
|
#[serde(
|
||||||
|
with = "TokenIdDef",
|
||||||
|
default = "tt::TokenId::unspecified",
|
||||||
|
skip_serializing_if = "token_id_def::skip_if"
|
||||||
|
)]
|
||||||
id: TokenId,
|
id: TokenId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mod token_id_def {
|
||||||
|
pub(super) fn skip_if(value: &tt::TokenId) -> bool {
|
||||||
|
*value == tt::TokenId::unspecified()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mod opt_delimiter_def {
|
mod opt_delimiter_def {
|
||||||
use super::{Delimiter, DelimiterDef};
|
use super::{Delimiter, DelimiterDef};
|
||||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||||
|
|
Loading…
Reference in a new issue