use anyhow::anyhow; use collections::{HashMap, HashSet}; use futures::{ channel::{mpsc, oneshot}, pin_mut, SinkExt, StreamExt, }; use gpui::{AppContext, AsyncApp, Context, Entity, EventEmitter, SharedString, Task, WeakEntity}; use mlua::{ExternalResult, Lua, MultiValue, Table, UserData, UserDataMethods}; use parking_lot::Mutex; use project::{search::SearchQuery, Fs, Project}; use regex::Regex; use std::{ cell::RefCell, path::{Path, PathBuf}, sync::Arc, }; use util::{paths::PathMatcher, ResultExt}; use crate::{SCRIPT_END_TAG, SCRIPT_START_TAG}; struct ForegroundFn(Box, AsyncApp) + Send>); pub struct ScriptSession { project: Entity, // TODO Remove this fs_changes: Arc>>>, foreground_fns_tx: mpsc::Sender, _invoke_foreground_fns: Task<()>, scripts: Vec