Allow wasm extensions to do arbitrary file I/O in their own directory to install language servers (#9043)
This PR provides WASM extensions with write access to their own specific working directory under the Zed `extensions` dir. This directory is set as the extensions `current_dir` when they run. Extensions can return relative paths from the `Extension::language_server_command` method, and those relative paths will be interpreted relative to this working dir. With this functionality, most language servers that we currently build into zed can be installed using extensions. Release Notes: - N/A
This commit is contained in:
parent
a550b9cecf
commit
51ebe0eb01
13 changed files with 421 additions and 215 deletions
|
@ -9385,7 +9385,7 @@ impl<P: AsRef<Path>> From<(WorktreeId, P)> for ProjectPath {
|
|||
}
|
||||
|
||||
struct ProjectLspAdapterDelegate {
|
||||
project: Model<Project>,
|
||||
project: WeakModel<Project>,
|
||||
worktree: worktree::Snapshot,
|
||||
fs: Arc<dyn Fs>,
|
||||
http_client: Arc<dyn HttpClient>,
|
||||
|
@ -9395,7 +9395,7 @@ struct ProjectLspAdapterDelegate {
|
|||
impl ProjectLspAdapterDelegate {
|
||||
fn new(project: &Project, worktree: &Model<Worktree>, cx: &ModelContext<Project>) -> Arc<Self> {
|
||||
Arc::new(Self {
|
||||
project: cx.handle(),
|
||||
project: cx.weak_model(),
|
||||
worktree: worktree.read(cx).snapshot(),
|
||||
fs: project.fs.clone(),
|
||||
http_client: project.client.http_client(),
|
||||
|
@ -9408,7 +9408,8 @@ impl ProjectLspAdapterDelegate {
|
|||
impl LspAdapterDelegate for ProjectLspAdapterDelegate {
|
||||
fn show_notification(&self, message: &str, cx: &mut AppContext) {
|
||||
self.project
|
||||
.update(cx, |_, cx| cx.emit(Event::Notification(message.to_owned())));
|
||||
.update(cx, |_, cx| cx.emit(Event::Notification(message.to_owned())))
|
||||
.ok();
|
||||
}
|
||||
|
||||
fn http_client(&self) -> Arc<dyn HttpClient> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue