| Crates.io | vscodehelper-macros |
| lib.rs | vscodehelper-macros |
| version | |
| created_at | 2025-04-03 02:46:09.557114+00 |
| updated_at | 2025-04-03 02:46:09.557114+00 |
| description | Macros for vscodehelper crate |
| homepage | |
| repository | https://github.com/TeamDman/VSCodeHelper |
| max_upload_size | |
| id | 1617576 |
| Cargo.toml error: | TOML parse error at line 20, column 1 | 20 | im-a-teapot = false | ^^^^^^^^^^^ unknown field `im-a-teapot`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `workspace`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autolib`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
| size | 0 |
A Rust library for interacting with Visual Studio Code's configuration and state files.
VSCodeHelper provides a convenient way to access and manipulate various VS Code configuration files, including:
storage.json - Contains information about open windows, workspaces, themes, and morestate.vscdb - SQLite database containing recently opened paths and other state informationstorage.json filestate.vscdb SQLite databaseuse vscodehelper::state_vscdb::keys::history_recently_opened_paths_list::HistoryRecentlyOpenedPathsListKey;
use vscodehelper::state_vscdb::state_vscdb::StateVscdb;
fn main() -> eyre::Result<()> {
let mut state_vscdb = StateVscdb::try_default()?;
let recently_opened = state_vscdb.read::<HistoryRecentlyOpenedPathsListKey>()?;
println!("Recently opened paths:");
for entry in recently_opened.entries.iter() {
println!(" - {:?}", entry);
}
Ok(())
}
use vscodehelper::storage_json::storage_json::VSCodeStorageJson;
use vscodehelper::storage_json::window::Window;
fn main() -> eyre::Result<()> {
let storage_json = VSCodeStorageJson::load_from_disk()?;
for window in &storage_json.windows_state.opened_windows {
match window {
Window::FolderWindow { folder, .. } => {
println!("{}", folder.as_path()?.display());
}
Window::WorkspaceWindow { workspace_identifier, .. } => {
let workspace_json = workspace_identifier.read()?;
for folder in workspace_json.folders {
println!("{}", folder.path.display());
}
}
}
}
Ok(())
}
use vscodehelper::storage_json::storage_json::VSCodeStorageJson;
fn main() -> eyre::Result<()> {
let storage_json = VSCodeStorageJson::load_from_disk()?;
println!("The active theme is {}", storage_json.theme);
Ok(())
}
src/storage_json/ - Types and functions for working with VS Code's storage.jsonsrc/state_vscdb/ - Types and functions for working with VS Code's state.vscdbsrc/workspace_json/ - Types for working with VS Code workspace filesvscodehelper-macros/ - Procedural macros for generating common trait implementationsAdd this to your Cargo.toml:
[dependencies]
vscodehelper = {git="https://github.com/TeamDman/VSCodeHelper"}