Extensions registering tasks (#9572)

This PR also introduces built-in tasks for Rust and Elixir. Note that
this is not a precedent for future PRs to include tasks for more
languages; we simply want to find the rough edges with tasks & language
integrations before proceeding to task contexts provided by extensions.

As is, we'll load tasks for all loaded languages, so in order to get
Elixir tasks, you have to open an Elixir buffer first. I think it sort
of makes sense (though it's not ideal), as in the future where
extensions do provide their own tasks.json, we'd like to limit the # of
tasks surfaced to the user to make them as relevant to the project at
hand as possible.

Release Notes:

- Added built-in tasks for Rust and Elixir files.
This commit is contained in:
Piotr Osiewicz 2024-03-22 16:18:33 +01:00 committed by GitHub
parent cb4f868815
commit 4dc61f7ccd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 416 additions and 169 deletions

View file

@ -18,6 +18,7 @@ pub use open_listener::*;
use anyhow::Context as _;
use assets::Assets;
use futures::{channel::mpsc, select_biased, StreamExt};
use language::LanguageSource;
use project::TaskSourceKind;
use project_panel::ProjectPanel;
use quick_action_bar::QuickActionBar;
@ -33,6 +34,7 @@ use task::{
oneshot_source::OneshotSource,
static_source::{StaticSource, TrackedFile},
};
use terminal_view::terminal_panel::{self, TerminalPanel};
use util::{
asset_str,
@ -177,6 +179,11 @@ pub fn initialize_workspace(app_state: Arc<AppState>, cx: &mut AppContext) {
},
cx,
);
inventory.add_source(
TaskSourceKind::Buffer,
|cx| LanguageSource::new(app_state.languages.clone(), cx),
cx,
);
})
});
}