-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: DragonBillow <[email protected]>
- Loading branch information
Showing
15 changed files
with
158 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/target | ||
**/target/ | ||
.vscode | ||
.direnv/ | ||
Cargo.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[formatting] | ||
align_entries = true | ||
align_entries = false | ||
inline_table_expand = true | ||
array_auto_collapse = false | ||
array_auto_expand = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[package] | ||
name = "vscode" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
reqwest = { version = "0.11.22", default-features = false, features = ["rustls-tls", "json", "gzip"] } | ||
serde = { version = "1.0.193", features = ["derive"] } | ||
serde_json = "1.0.108" | ||
vscode_derive = { path = "./vscode_derive" } |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pub mod apis; | ||
pub mod models; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
pub mod extension; | ||
pub mod extension_file; | ||
pub mod extension_property; | ||
pub mod extension_publisher; | ||
pub mod extension_statistics; | ||
pub mod extension_version; | ||
|
||
pub use extension::*; | ||
pub use extension_file::*; | ||
pub use extension_property::*; | ||
pub use extension_publisher::*; | ||
pub use extension_statistics::*; | ||
pub use extension_version::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use super::*; | ||
use vscode_derive::api; | ||
|
||
#[api(Default)] | ||
pub struct Extension { | ||
pub extension_id: String, | ||
pub extension_name: String, | ||
pub display_name: String, | ||
pub short_description: String, | ||
pub publisher: ExtensionPublisher, | ||
pub versions: Vec<ExtensionVersion>, | ||
pub statistics: Vec<ExtensionStatistics>, | ||
pub tags: Vec<String>, | ||
pub release_date: String, | ||
pub published_date: String, | ||
pub last_updated: String, | ||
pub categories: Vec<String>, | ||
pub flags: String, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
use vscode_derive::api; | ||
|
||
#[api(Default)] | ||
pub struct ExtensionFile { | ||
pub asset_type: String, | ||
pub source: String, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
use vscode_derive::api; | ||
|
||
#[api(Default)] | ||
pub struct ExtensionProperty { | ||
pub key: String, | ||
pub value: String, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use vscode_derive::api; | ||
|
||
#[api(Default)] | ||
pub struct ExtensionPublisher { | ||
pub display_name: String, | ||
pub publisher_id: String, | ||
pub publisher_name: String, | ||
pub domain: Option<String>, | ||
pub is_domain_verified: bool, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
use vscode_derive::api; | ||
|
||
#[api(Default)] | ||
pub struct ExtensionStatistics { | ||
statistic_name: String, | ||
value: usize, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use vscode_derive::api; | ||
|
||
use super::*; | ||
|
||
#[api(Default)] | ||
pub struct ExtensionVersion { | ||
pub version: String, | ||
pub last_updated: String, | ||
pub asset_uri: String, | ||
pub fallback_asset_uri: String, | ||
pub files: Vec<ExtensionFile>, | ||
pub properties: Vec<ExtensionProperty>, | ||
pub target_platform: String, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[package] | ||
name = "vscode_derive" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[lib] | ||
proc-macro = true | ||
|
||
[dependencies] | ||
syn = { version = "2.0.41", features = ["full", "extra-traits"] } | ||
quote = "1.0.33" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
use proc_macro::TokenStream; | ||
use quote::quote; | ||
use syn::{ | ||
parse::{Parse, Parser}, | ||
parse_macro_input, parse_quote, | ||
}; | ||
|
||
#[derive(Debug, Default)] | ||
struct ApiAttr { | ||
default: bool, | ||
} | ||
|
||
impl Parse for ApiAttr { | ||
fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> { | ||
let mut res = Self::default(); | ||
let id: syn::Ident = input.parse()?; | ||
|
||
if id.to_string().to_lowercase() == "default" { | ||
res.default = true; | ||
} | ||
|
||
Ok(res) | ||
} | ||
} | ||
|
||
#[proc_macro_attribute] | ||
pub fn api(attr: TokenStream, input: TokenStream) -> TokenStream { | ||
let attr = Parser::parse2(ApiAttr::parse, attr.into()).unwrap_or_default(); | ||
let mut input = parse_macro_input!(input as syn::ItemStruct); | ||
input.attrs.push(parse_quote! { | ||
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] | ||
}); | ||
if attr.default { | ||
input.attrs.push(parse_quote! { | ||
#[derive(Default)] | ||
}); | ||
} | ||
input.attrs.push(parse_quote! { | ||
#[serde(default)] | ||
}); | ||
input.attrs.push(parse_quote! { | ||
#[serde(rename_all = "camelCase")] | ||
}); | ||
|
||
quote! { | ||
#input | ||
} | ||
.into() | ||
} |