Crates.io | vscodehelper |
lib.rs | vscodehelper |
version | 0.2.1 |
created_at | 2025-04-03 02:47:18.082915+00 |
updated_at | 2025-04-03 03:53:19.401669+00 |
description | Understanding the data that VSCode writes to disk |
homepage | |
repository | https://github.com/TeamDman/VSCodeHelper |
max_upload_size | |
id | 1617578 |
size | 55,561 |
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 implementationscargo add vscodehelper