diff options
author | Norbert Preining <norbert@preining.info> | 2021-10-11 03:02:08 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2021-10-11 03:02:08 +0000 |
commit | aac7fdc4c391b318efbdee17381ac83783b2fbbb (patch) | |
tree | a9e0357ea02c4fa81e0c8c6edb2e9343b79fff35 /support/texlab/src/component_db.rs | |
parent | e55f5510950cf773d024770b0a0d66b13e37dae0 (diff) |
CTAN sync 202110110302
Diffstat (limited to 'support/texlab/src/component_db.rs')
-rw-r--r-- | support/texlab/src/component_db.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/support/texlab/src/component_db.rs b/support/texlab/src/component_db.rs index a0c728a7ae..7676feff5c 100644 --- a/support/texlab/src/component_db.rs +++ b/support/texlab/src/component_db.rs @@ -1,3 +1,6 @@ +use std::io::Read; + +use flate2::read::GzDecoder; use itertools::Itertools; use lsp_types::{MarkupContent, MarkupKind}; use once_cell::sync::Lazy; @@ -131,7 +134,11 @@ pub struct ComponentMetadata { pub description: Option<String>, } -const JSON: &str = include_str!("../data/components.json"); +const JSON_GZ: &[u8] = include_bytes!("../data/components.json.gz"); -pub static COMPONENT_DATABASE: Lazy<ComponentDatabase> = - Lazy::new(|| serde_json::from_str(JSON).unwrap()); +pub static COMPONENT_DATABASE: Lazy<ComponentDatabase> = Lazy::new(|| { + let mut decoder = GzDecoder::new(JSON_GZ); + let mut buf = String::new(); + decoder.read_to_string(&mut buf).unwrap(); + serde_json::from_str(&buf).unwrap() +}); |