Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

extension api: Make server id types constructible, to ease writing tests (#45174)

Max Brunsfeld843a35a1a9e7
diff --git a/crates/extension_api/src/extension_api.rs b/crates/extension_api/src/extension_api.rs
index 94186232242..acd1cba47b0 100644
--- a/crates/extension_api/src/extension_api.rs
+++ b/crates/extension_api/src/extension_api.rs
@@ -331,7 +331,6 @@ static mut EXTENSION: Option<Box<dyn Extension>> = None;
pub static ZED_API_VERSION: [u8; 6] = *include_bytes!(concat!(env!("OUT_DIR"), "/version_bytes"));
mod wit {
-
wit_bindgen::generate!({
skip: ["init-extension"],
path: "./wit/since_v0.8.0",
@@ -524,6 +523,12 @@ impl wit::Guest for Component {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone)]
pub struct LanguageServerId(String);
+impl LanguageServerId {
+ pub fn new(value: String) -> Self {
+ Self(value)
+ }
+}
+
impl AsRef<str> for LanguageServerId {
fn as_ref(&self) -> &str {
&self.0
@@ -540,6 +545,12 @@ impl fmt::Display for LanguageServerId {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone)]
pub struct ContextServerId(String);
+impl ContextServerId {
+ pub fn new(value: String) -> Self {
+ Self(value)
+ }
+}
+
impl AsRef<str> for ContextServerId {
fn as_ref(&self) -> &str {
&self.0