Add initial support for defining language server adapters in WebAssembly-based extensions (#8645)
This PR adds **internal** ability to run arbitrary language servers via WebAssembly extensions. The functionality isn't exposed yet - we're just landing this in this early state because there have been a lot of changes to the `LspAdapter` trait, and other language server logic. ## Next steps * Currently, wasm extensions can only define how to *install* and run a language server, they can't yet implement the other LSP adapter methods, such as formatting completion labels and workspace symbols. * We don't have an automatic way to install or develop these types of extensions * We don't have a way to package these types of extensions in our extensions repo, to make them available via our extensions API. * The Rust extension API crate, `zed-extension-api` has not yet been published to crates.io, because we still consider the API a work in progress. Release Notes: - N/A --------- Co-authored-by: Marshall <marshall@zed.dev> Co-authored-by: Nathan <nathan@zed.dev> Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This commit is contained in:
parent
f3f2225a8e
commit
268fa1cbaf
84 changed files with 3714 additions and 1973 deletions
|
@ -616,11 +616,11 @@ impl LanguageServer {
|
|||
uri: root_uri,
|
||||
name: Default::default(),
|
||||
}]),
|
||||
client_info: Some(ClientInfo {
|
||||
name: release_channel::ReleaseChannel::global(cx)
|
||||
.display_name()
|
||||
.to_string(),
|
||||
version: Some(release_channel::AppVersion::global(cx).to_string()),
|
||||
client_info: release_channel::ReleaseChannel::try_global(cx).map(|release_channel| {
|
||||
ClientInfo {
|
||||
name: release_channel.display_name().to_string(),
|
||||
version: Some(release_channel::AppVersion::global(cx).to_string()),
|
||||
}
|
||||
}),
|
||||
locale: None,
|
||||
};
|
||||
|
@ -1055,6 +1055,7 @@ impl Drop for Subscription {
|
|||
#[cfg(any(test, feature = "test-support"))]
|
||||
#[derive(Clone)]
|
||||
pub struct FakeLanguageServer {
|
||||
pub binary: LanguageServerBinary,
|
||||
pub server: Arc<LanguageServer>,
|
||||
notifications_rx: channel::Receiver<(String, String)>,
|
||||
}
|
||||
|
@ -1063,6 +1064,7 @@ pub struct FakeLanguageServer {
|
|||
impl FakeLanguageServer {
|
||||
/// Construct a fake language server.
|
||||
pub fn new(
|
||||
binary: LanguageServerBinary,
|
||||
name: String,
|
||||
capabilities: ServerCapabilities,
|
||||
cx: AsyncAppContext,
|
||||
|
@ -1084,6 +1086,7 @@ impl FakeLanguageServer {
|
|||
|_| {},
|
||||
);
|
||||
let fake = FakeLanguageServer {
|
||||
binary,
|
||||
server: Arc::new(LanguageServer::new_internal(
|
||||
LanguageServerId(0),
|
||||
stdout_writer,
|
||||
|
@ -1302,8 +1305,16 @@ mod tests {
|
|||
cx.update(|cx| {
|
||||
release_channel::init("0.0.0", cx);
|
||||
});
|
||||
let (server, mut fake) =
|
||||
FakeLanguageServer::new("the-lsp".to_string(), Default::default(), cx.to_async());
|
||||
let (server, mut fake) = FakeLanguageServer::new(
|
||||
LanguageServerBinary {
|
||||
path: "path/to/language-server".into(),
|
||||
arguments: vec![],
|
||||
env: None,
|
||||
},
|
||||
"the-lsp".to_string(),
|
||||
Default::default(),
|
||||
cx.to_async(),
|
||||
);
|
||||
|
||||
let (message_tx, message_rx) = channel::unbounded();
|
||||
let (diagnostics_tx, diagnostics_rx) = channel::unbounded();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue