Limit the extension tasks in the modal to current language only (#10207)

Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov
2024-04-06 00:18:32 +03:00
committed by GitHub
parent c851e6edba
commit 7b636d9774
9 changed files with 128 additions and 186 deletions
+3 -4
View File
@@ -10,7 +10,7 @@ use gpui::ModelContext;
use static_source::RevealStrategy;
use std::any::Any;
use std::borrow::Cow;
use std::path::{Path, PathBuf};
use std::path::PathBuf;
use std::sync::Arc;
pub use vscode_format::VsCodeTaskFile;
@@ -148,10 +148,9 @@ pub trait Task {
pub trait TaskSource: Any {
/// A way to erase the type of the source, processing and storing them generically.
fn as_any(&mut self) -> &mut dyn Any;
/// Collects all tasks available for scheduling, for the path given.
fn tasks_for_path(
/// Collects all tasks available for scheduling.
fn tasks_to_schedule(
&mut self,
path: Option<&Path>,
cx: &mut ModelContext<Box<dyn TaskSource>>,
) -> Vec<Arc<dyn Task>>;
}
+1 -2
View File
@@ -89,9 +89,8 @@ impl TaskSource for OneshotSource {
self
}
fn tasks_for_path(
fn tasks_to_schedule(
&mut self,
_path: Option<&std::path::Path>,
_cx: &mut gpui::ModelContext<Box<dyn TaskSource>>,
) -> Vec<Arc<dyn Task>> {
self.tasks.clone()
+2 -3
View File
@@ -1,6 +1,6 @@
//! A source of tasks, based on a static configuration, deserialized from the tasks config file, and related infrastructure for tracking changes to the file.
use std::{borrow::Cow, path::Path, sync::Arc};
use std::{borrow::Cow, sync::Arc};
use collections::HashMap;
use futures::StreamExt;
@@ -268,9 +268,8 @@ impl StaticSource {
}
impl TaskSource for StaticSource {
fn tasks_for_path(
fn tasks_to_schedule(
&mut self,
_: Option<&Path>,
_: &mut ModelContext<Box<dyn TaskSource>>,
) -> Vec<Arc<dyn Task>> {
self.tasks