Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zed_postgres_model_context"
version = "0.0.3"
version = "0.0.4"
edition = "2021"
publish = false
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion extension.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
id = "postgres-context-server"
name = "Postgres Context Server"
description = "Model Context Server for PostgreSQL"
version = "0.0.3"
version = "0.0.4"
schema_version = 1
authors = ["Max Brunsfeld <max@zed.dev>"]
repository = "https://github.com/zed-extensions/postgres-context-server"
Expand Down
44 changes: 22 additions & 22 deletions src/postgres_model_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,6 @@ use zed_extension_api::{
const PACKAGE_NAME: &str = "@zeddotdev/postgres-context-server";
const SERVER_PATH: &str = "node_modules/@zeddotdev/postgres-context-server/index.mjs";

/// Extensions to the Zed extension API that have not yet stabilized.
mod zed_ext {
/// Sanitizes the given path to remove the leading `/` on Windows.
///
/// On macOS and Linux this is a no-op.
///
/// This is a workaround for https://github.com/bytecodealliance/wasmtime/issues/10415.
pub fn sanitize_windows_path(path: std::path::PathBuf) -> std::path::PathBuf {
use zed_extension_api::{current_platform, Os};

let (os, _arch) = current_platform();
match os {
Os::Mac | Os::Linux => path,
Os::Windows => path
.to_string_lossy()
.to_string()
.trim_start_matches('/')
.into(),
}
}
}

struct PostgresModelContextExtension;

#[derive(Debug, Deserialize, JsonSchema)]
Expand Down Expand Up @@ -96,3 +74,25 @@ impl zed::Extension for PostgresModelContextExtension {
}

zed::register_extension!(PostgresModelContextExtension);

/// Extensions to the Zed extension API that have not yet stabilized.
mod zed_ext {
/// Sanitizes the given path to remove the leading `/` on Windows.
///
/// On macOS and Linux this is a no-op.
///
/// This is a workaround for https://github.com/bytecodealliance/wasmtime/issues/10415.
pub fn sanitize_windows_path(path: std::path::PathBuf) -> std::path::PathBuf {
use zed_extension_api::{current_platform, Os};

let (os, _arch) = current_platform();
match os {
Os::Mac | Os::Linux => path,
Os::Windows => path
.to_string_lossy()
.to_string()
.trim_start_matches('/')
.into(),
}
}
}