first pass of merging in warp (doesn't build)

This commit is contained in:
Ryan Ward
2026-07-01 16:08:58 -05:00
parent 2f64909469
commit 4770ac06b5
3662 changed files with 414574 additions and 89772 deletions
+48 -23
View File
@@ -6,8 +6,11 @@ pub mod diff_size_limits;
pub mod diff_state;
pub mod editor_state;
pub(crate) mod find_model;
pub(crate) mod git_actions;
pub(crate) mod git_dialog;
pub mod git_status_update;
pub mod git_repo_model;
mod git_repo_models;
pub mod github_repo_model;
mod hidden_lines;
pub mod telemetry_event;
#[cfg_attr(not(feature = "local_fs"), allow(unused_imports))]
@@ -18,18 +21,20 @@ pub(crate) mod comment_rendering;
pub mod comments;
pub(crate) mod diff_menu;
pub(crate) mod diff_selector;
#[cfg_attr(not(feature = "local_fs"), allow(dead_code))]
pub(crate) mod file_invalidation_queue;
use code_review_view::CodeReviewAction;
use galaxyui::keymap::{EditableBinding, FixedBinding};
use galaxyui::{
id,
keymap::{EditableBinding, FixedBinding},
AppContext, Entity, EntityId, ModelContext, SingletonEntity, WeakViewHandle, WindowId,
id, AppContext, Entity, EntityId, ModelContext, SingletonEntity, WeakViewHandle, WindowId,
};
use std::path::{Path, PathBuf};
use crate::code::buffer_location::LocalOrRemotePath;
use crate::code_review::telemetry_event::CodeReviewPaneEntrypoint;
use crate::terminal::{view::TerminalView, CLIAgent};
use crate::terminal::view::TerminalView;
use crate::terminal::CLIAgent;
use crate::util::bindings::CustomAction;
/// Arguments needed to open or toggle the code review panel.
@@ -37,7 +42,7 @@ use crate::util::bindings::CustomAction;
/// review and perform follow-up work without relying on event ordering.
#[derive(Clone)]
pub struct CodeReviewPanelArg {
pub repo_path: Option<PathBuf>,
pub repo_path: Option<LocalOrRemotePath>,
pub terminal_view: WeakViewHandle<TerminalView>,
pub entrypoint: CodeReviewPaneEntrypoint,
pub focus_new_pane: bool,
@@ -48,9 +53,14 @@ pub struct CodeReviewPanelArg {
#[derive(Clone, Debug, PartialEq)]
pub enum DiffSetScope {
All,
File(PathBuf),
/// A single repo-relative file path in the diff set.
File(String),
}
/// The keystroke that submits in the code review panel. Meant to mirror the keystroke for
/// [`EditorViewEvent::CmdEnter`].
pub const CODE_REVIEW_SUBMIT_KEYSTROKE: &str = "cmdorctrl-enter";
/// Register keybindings for code review functionality.
pub fn init(app: &mut AppContext) {
app.register_editable_bindings([
@@ -69,14 +79,30 @@ pub fn init(app: &mut AppContext) {
.with_context_predicate(id!("CodeReviewView"))
.with_key_binding("cmdorctrl-f")
.with_enabled(|| crate::features::FeatureFlag::CodeReviewFind.is_enabled()),
EditableBinding::new(
"code_review:toggle_file_navigation",
"Toggle file navigation in code review",
CodeReviewAction::ToggleFileSidebar,
)
.with_context_predicate(id!("CodeReviewView_NotEditing"))
.with_key_binding("f")
.with_enabled(|| crate::features::FeatureFlag::GitOperationsInCodeReview.is_enabled()),
]);
app.register_fixed_bindings([FixedBinding::custom(
CustomAction::Undo,
CodeReviewAction::UndoRevert,
"Undo",
id!("CodeReviewView") & !id!("IMEOpen"),
)]);
app.register_fixed_bindings([
FixedBinding::custom(
CustomAction::Undo,
CodeReviewAction::UndoRevert,
"Undo",
id!("CodeReviewView") & !id!("IMEOpen"),
),
FixedBinding::new(
CODE_REVIEW_SUBMIT_KEYSTROKE,
CodeReviewAction::SubmitReviewComments,
id!("CodeReviewView_NotEditing"),
)
.with_command_description("Send code review comments to agent"),
]);
diff_menu::init(app);
diff_selector::init(app);
@@ -84,17 +110,17 @@ pub fn init(app: &mut AppContext) {
}
/// Uses heuristics to determine if a file is auto-generated.
fn is_file_autogenerated(file_path: &Path, content: Option<&str>) -> bool {
///
/// `file_path` is expected to be a repo-relative path (as a string),
/// matching the way file paths are stored on `FileDiff`.
fn is_file_autogenerated(file_path: &str, content: Option<&str>) -> bool {
const AUTOGEN_HEADERS: [&str; 3] = [
"Code generated by",
"This file is automatically generated",
"AUTO-GENERATED FILE",
];
let file_name = file_path
.file_name()
.and_then(|name| name.to_str())
.unwrap_or("");
let file_name = file_path.rsplit('/').next().unwrap_or("");
// Check for specific lock files and autogenerated files by exact name
match file_name {
@@ -117,10 +143,9 @@ fn is_file_autogenerated(file_path: &Path, content: Option<&str>) -> bool {
}
// Check for directory structure hints.
let file_path_str = file_path.to_string_lossy();
if file_path_str.contains("__generated__/")
|| file_path_str.contains(".auto/")
|| file_path_str.contains("codegen/")
if file_path.contains("__generated__/")
|| file_path.contains(".auto/")
|| file_path.contains("codegen/")
{
return true;
}
@@ -145,7 +170,7 @@ fn is_file_autogenerated(file_path: &Path, content: Option<&str>) -> bool {
/// A [`SingletonEntity`] that the tracks events for the code review model throughought the app.
/// We need this because toasts are emitted in the Workspace, and want a click handler that triggers
/// behavior in a _specific_ review pane. We use this model get around restrictions that make it hard
/// to emit a CodeReviewView typed action from the toast because it's not in the view reponder chain of the
/// to emit a CodeReviewView typed action from the toast because it's not in the view responder chain of the
/// Workspace.
pub struct GlobalCodeReviewModel;