use anyhow::anyhow; use collections::HashSet; use futures::{ channel::{mpsc, oneshot}, pin_mut, SinkExt, StreamExt, }; use gpui::{AppContext, AsyncApp, Context, Entity, Task, WeakEntity}; use mlua::{ExternalResult, Lua, MultiValue, Table, UserData, UserDataMethods}; use parking_lot::Mutex; use project::{search::SearchQuery, Fs, Project, ProjectPath, WorktreeId}; use regex::Regex; use std::{ path::{Path, PathBuf}, sync::Arc, }; use util::{paths::PathMatcher, ResultExt}; struct ForegroundFn(Box, AsyncApp) + Send>); pub struct ScriptingSession { project: Entity, foreground_fns_tx: mpsc::Sender, _invoke_foreground_fns: Task<()>, scripts: Vec