Wrapping up bedrock implementation
This commit is contained in:
@@ -14,9 +14,6 @@ use crate::ui_components::icons::Icon;
|
||||
use crate::view_components::action_button::{
|
||||
ActionButton, ButtonSize, DangerNakedTheme, KeystrokeSource, NakedTheme, PrimaryTheme,
|
||||
};
|
||||
use pathfinder_color::ColorU;
|
||||
use pathfinder_geometry::vector::Vector2F;
|
||||
use std::cell::RefCell;
|
||||
use galaxy_core::ui::{appearance::Appearance, theme::Fill};
|
||||
use galaxy_editor::render::element::VerticalExpansionBehavior;
|
||||
use galaxyui::{
|
||||
@@ -30,6 +27,9 @@ use galaxyui::{
|
||||
AppContext, Element, Entity, FocusContext, ModelHandle, SingletonEntity, TypedActionView, View,
|
||||
ViewContext, ViewHandle,
|
||||
};
|
||||
use pathfinder_color::ColorU;
|
||||
use pathfinder_geometry::vector::Vector2F;
|
||||
use std::cell::RefCell;
|
||||
|
||||
/// Default width of the comment editor, in pixels.
|
||||
pub(crate) const DEFAULT_COMMENT_MAX_WIDTH: f32 = 750.0;
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
use std::{collections::HashMap, ops::Range, rc::Rc, sync::Arc};
|
||||
|
||||
use futures::stream::AbortHandle;
|
||||
use itertools::Itertools;
|
||||
use pathfinder_color::ColorU;
|
||||
use rangemap::RangeMap;
|
||||
use similar::{ChangeTag, DiffOp, TextDiff};
|
||||
use string_offset::CharOffset;
|
||||
use galaxy_core::ui::theme::Fill;
|
||||
use galaxy_editor::{
|
||||
content::{edit::TemporaryBlock, version::BufferVersion},
|
||||
@@ -16,6 +11,11 @@ use galaxy_editor::{
|
||||
render::model::{Decoration, LineCount, LineDecoration},
|
||||
};
|
||||
use galaxyui::{Entity, ModelContext};
|
||||
use itertools::Itertools;
|
||||
use pathfinder_color::ColorU;
|
||||
use rangemap::RangeMap;
|
||||
use similar::{ChangeTag, DiffOp, TextDiff};
|
||||
use string_offset::CharOffset;
|
||||
|
||||
use super::super::DiffResult;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use galaxy_editor::multiline::{MultilineStr, MultilineString};
|
||||
use rangemap::RangeMap;
|
||||
use unindent::Unindent as _;
|
||||
use galaxy_editor::multiline::{MultilineStr, MultilineString};
|
||||
|
||||
use crate::code::editor::diff::ChangeType;
|
||||
|
||||
|
||||
@@ -9,12 +9,6 @@ use std::{
|
||||
},
|
||||
};
|
||||
|
||||
use parking_lot::Mutex;
|
||||
use pathfinder_color::ColorU;
|
||||
use pathfinder_geometry::{
|
||||
rect::RectF,
|
||||
vector::{vec2f, Vector2F},
|
||||
};
|
||||
use galaxy_core::ui::{
|
||||
appearance::Appearance,
|
||||
theme::{color::internal_colors, Fill},
|
||||
@@ -45,6 +39,12 @@ use galaxyui::{
|
||||
AfterLayoutContext, AppContext, ClipBounds, Element, Event, EventContext, LayoutContext,
|
||||
ModelHandle, PaintContext, SingletonEntity, SizeConstraint,
|
||||
};
|
||||
use parking_lot::Mutex;
|
||||
use pathfinder_color::ColorU;
|
||||
use pathfinder_geometry::{
|
||||
rect::RectF,
|
||||
vector::{vec2f, Vector2F},
|
||||
};
|
||||
|
||||
use super::diff::{DiffHunkDisplay, DiffStatus};
|
||||
use super::model::DiffNavigationState;
|
||||
|
||||
@@ -3,13 +3,13 @@ use std::collections::HashMap;
|
||||
use std::str::FromStr;
|
||||
use std::sync::Arc;
|
||||
|
||||
use pathfinder_geometry::vector::{vec2f, Vector2F};
|
||||
use serde_yaml::Mapping;
|
||||
use uuid::Uuid;
|
||||
use galaxy_editor::content::markdown::MarkdownStyle;
|
||||
use galaxy_editor::editor::EmbeddedItemModel;
|
||||
use galaxy_editor::render::element::{RenderContext, RenderableBlock};
|
||||
use galaxy_editor::render::layout::TextLayout;
|
||||
use pathfinder_geometry::vector::{vec2f, Vector2F};
|
||||
use serde_yaml::Mapping;
|
||||
use uuid::Uuid;
|
||||
|
||||
use galaxy_editor::render::model::{
|
||||
viewport::ViewportItem, BlockSpacing, EmbeddedItem, EmbeddedItemHTMLRepresentation,
|
||||
|
||||
@@ -3,9 +3,9 @@ use super::{
|
||||
COMMENT_ID_MAPPING_KEY, ENTITY_ID_MAPPING_KEY, WINDOW_ID_MAPPING_KEY,
|
||||
};
|
||||
use crate::code_review::comments::CommentId;
|
||||
use serde_yaml::{Mapping, Value};
|
||||
use galaxy_editor::content::markdown::MarkdownStyle;
|
||||
use galaxyui::{EntityId, WindowId};
|
||||
use serde_yaml::{Mapping, Value};
|
||||
|
||||
#[test]
|
||||
fn test_comment_embedded_item_conversion_valid_input() {
|
||||
|
||||
@@ -13,7 +13,6 @@ use crate::ui_components::{blended_colors, icons::Icon};
|
||||
use crate::view_components::action_button::{ActionButton, DisabledSecondaryTheme, SecondaryTheme};
|
||||
use crate::view_components::find::FindDirection;
|
||||
use crate::{features::FeatureFlag, settings::AppEditorSettings};
|
||||
use pathfinder_color::ColorU;
|
||||
use galaxy_editor::editor::NavigationKey;
|
||||
use galaxy_editor::search::{SearchEvent, Searcher};
|
||||
use galaxyui::elements::MainAxisAlignment;
|
||||
@@ -36,6 +35,7 @@ use galaxyui::{
|
||||
};
|
||||
use galaxyui::{presenter::ChildView, ViewContext, ViewHandle};
|
||||
use galaxyui::{FocusContext, ModelHandle};
|
||||
use pathfinder_color::ColorU;
|
||||
|
||||
pub const FIND_BAR_WIDTH: f32 = 500.;
|
||||
const ICON_PADDING: f32 = 4.;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use std::ops::Range;
|
||||
use galaxy_editor::render::model::{LineCount, RenderLineLocation};
|
||||
use std::ops::Range;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum EditorLineLocation {
|
||||
|
||||
@@ -3,14 +3,6 @@
|
||||
|
||||
use crate::code::editor::line_iterator::LineIterator;
|
||||
use crate::code_review::CodeReviewTelemetryEvent;
|
||||
use num_traits::SaturatingSub;
|
||||
use rangemap::{RangeMap, RangeSet};
|
||||
use std::future::Future;
|
||||
use std::ops::Range;
|
||||
use std::path::Path;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
use std::{cmp, mem};
|
||||
use galaxy_core::platform::SessionPlatform;
|
||||
use galaxy_core::send_telemetry_from_ctx;
|
||||
use galaxy_core::ui::theme::Fill;
|
||||
@@ -23,6 +15,14 @@ use galaxy_editor::multiline::{AnyMultilineString, MultilineString, LF};
|
||||
use galaxy_editor::render::model::{AutoScrollMode, LineCount, StyleUpdateAction};
|
||||
use galaxy_editor::selection::TextDirection;
|
||||
use galaxyui::units::{IntoPixels, Pixels};
|
||||
use num_traits::SaturatingSub;
|
||||
use rangemap::{RangeMap, RangeSet};
|
||||
use std::future::Future;
|
||||
use std::ops::Range;
|
||||
use std::path::Path;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
use std::{cmp, mem};
|
||||
|
||||
use crate::util::link_detection::get_word_range_at_offset;
|
||||
use crate::{
|
||||
@@ -31,22 +31,6 @@ use crate::{
|
||||
};
|
||||
|
||||
use ai::diff_validation::DiffDelta;
|
||||
use itertools::Itertools;
|
||||
use languages::{language_by_filename, language_by_name, Language};
|
||||
use line_ending::LineEnding;
|
||||
use string_offset::CharOffset;
|
||||
use syntax_tree::{ColorMap, DecorationStateEvent, SyntaxTreeState};
|
||||
use vec1::{vec1, Vec1};
|
||||
use vim::vim::{
|
||||
BracketChar, CharacterMotion, Direction, FindCharMotion, FirstNonWhitespaceMotion,
|
||||
InsertPosition, LineMotion, MotionType, TextObjectInclusion, TextObjectType, VimOperator,
|
||||
VimTextObject, WordBound, WordMotion, WordType,
|
||||
};
|
||||
use vim::{
|
||||
find_next_paragraph_end, find_previous_paragraph_start, vim_a_block, vim_a_paragraph,
|
||||
vim_a_quote, vim_a_word, vim_find_char_on_line, vim_find_matching_bracket, vim_inner_block,
|
||||
vim_inner_paragraph, vim_inner_quote, vim_inner_word, vim_word_iterator_from_offset,
|
||||
};
|
||||
use galaxy_core::semantic_selection::SemanticSelection;
|
||||
use galaxy_editor::content::buffer::{ShouldAutoscroll, VimInsertPoint};
|
||||
use galaxy_editor::{
|
||||
@@ -73,6 +57,22 @@ use galaxyui::elements::{
|
||||
};
|
||||
use galaxyui::text::{point::Point, TextBuffer};
|
||||
use galaxyui::{AppContext, Entity, ModelContext, ModelHandle, SingletonEntity};
|
||||
use itertools::Itertools;
|
||||
use languages::{language_by_filename, language_by_name, Language};
|
||||
use line_ending::LineEnding;
|
||||
use string_offset::CharOffset;
|
||||
use syntax_tree::{ColorMap, DecorationStateEvent, SyntaxTreeState};
|
||||
use vec1::{vec1, Vec1};
|
||||
use vim::vim::{
|
||||
BracketChar, CharacterMotion, Direction, FindCharMotion, FirstNonWhitespaceMotion,
|
||||
InsertPosition, LineMotion, MotionType, TextObjectInclusion, TextObjectType, VimOperator,
|
||||
VimTextObject, WordBound, WordMotion, WordType,
|
||||
};
|
||||
use vim::{
|
||||
find_next_paragraph_end, find_previous_paragraph_start, vim_a_block, vim_a_paragraph,
|
||||
vim_a_quote, vim_a_word, vim_find_char_on_line, vim_find_matching_bracket, vim_inner_block,
|
||||
vim_inner_paragraph, vim_inner_quote, vim_inner_word, vim_word_iterator_from_offset,
|
||||
};
|
||||
|
||||
use super::super::DiffResult;
|
||||
use super::comments::{EditorCommentsModel, PendingComment, PendingCommentEvent};
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use futures::channel::oneshot;
|
||||
use std::path::Path;
|
||||
use vec1::vec1;
|
||||
use galaxy_editor::content::buffer::{InitialBufferState, SelectionOffsets};
|
||||
use galaxy_editor::multiline::MultilineString;
|
||||
use galaxy_util::content_version::ContentVersion;
|
||||
use galaxyui::App;
|
||||
use std::path::Path;
|
||||
use vec1::vec1;
|
||||
|
||||
use crate::{
|
||||
code::editor::line::EditorLineLocation, code::editor::view::code_text_styles,
|
||||
|
||||
+22
-21
@@ -30,16 +30,6 @@ use crate::{
|
||||
view_components::find::FindDirection,
|
||||
};
|
||||
use ai::diff_validation::DiffDelta;
|
||||
use lazy_static::lazy_static;
|
||||
use num_traits::SaturatingSub;
|
||||
use pathfinder_geometry::vector::vec2f;
|
||||
use std::fmt::Debug;
|
||||
use std::rc::Rc;
|
||||
use std::{collections::HashMap, ops::Range};
|
||||
use std::{collections::HashSet, path::Path};
|
||||
use string_offset::CharOffset;
|
||||
use vec1::{vec1, Vec1};
|
||||
use vim::vim::{Direction, InsertPosition, VimMode, VimModel, VimState, VimSubscriber};
|
||||
use galaxy_core::platform::SessionPlatform;
|
||||
use galaxy_editor::{
|
||||
content::{
|
||||
@@ -83,6 +73,16 @@ use galaxyui::{
|
||||
AppContext, BlurContext, Element, Entity, FocusContext, ModelHandle, SingletonEntity, View,
|
||||
ViewContext, ViewHandle, WeakViewHandle, WindowId,
|
||||
};
|
||||
use lazy_static::lazy_static;
|
||||
use num_traits::SaturatingSub;
|
||||
use pathfinder_geometry::vector::vec2f;
|
||||
use std::fmt::Debug;
|
||||
use std::rc::Rc;
|
||||
use std::{collections::HashMap, ops::Range};
|
||||
use std::{collections::HashSet, path::Path};
|
||||
use string_offset::CharOffset;
|
||||
use vec1::{vec1, Vec1};
|
||||
use vim::vim::{Direction, InsertPosition, VimMode, VimModel, VimState, VimSubscriber};
|
||||
|
||||
mod actions;
|
||||
pub use actions::init;
|
||||
@@ -997,17 +997,18 @@ impl CodeEditorView {
|
||||
if let Some(results) = self.searcher.as_ref(ctx).results() {
|
||||
if !results.matches.is_empty() {
|
||||
// Convert all match ranges to selection offsets
|
||||
let selection_offsets: Vec<galaxy_editor::content::buffer::SelectionOffsets> =
|
||||
results
|
||||
.matches
|
||||
.iter()
|
||||
.map(|match_result| {
|
||||
galaxy_editor::content::buffer::SelectionOffsets {
|
||||
head: match_result.end,
|
||||
tail: match_result.start,
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
let selection_offsets: Vec<
|
||||
galaxy_editor::content::buffer::SelectionOffsets,
|
||||
> = results
|
||||
.matches
|
||||
.iter()
|
||||
.map(
|
||||
|match_result| galaxy_editor::content::buffer::SelectionOffsets {
|
||||
head: match_result.end,
|
||||
tail: match_result.start,
|
||||
},
|
||||
)
|
||||
.collect();
|
||||
|
||||
// Set multiple selections on the editor to highlight all matches
|
||||
if let Ok(selections) = vec1::Vec1::try_from_vec(selection_offsets) {
|
||||
|
||||
@@ -12,12 +12,6 @@ use crate::{
|
||||
features::FeatureFlag, notebooks::editor::model::word_unit, send_telemetry_from_ctx,
|
||||
util::bindings::CustomAction,
|
||||
};
|
||||
use lazy_static::lazy_static;
|
||||
use rangemap::RangeSet;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::fmt::Debug;
|
||||
use std::ops::Range;
|
||||
use string_offset::CharOffset;
|
||||
use galaxy_editor::{
|
||||
content::version::BufferVersion,
|
||||
editor::{EmbeddedItemModel, RunnableCommandModel, TextDecoration},
|
||||
@@ -37,6 +31,12 @@ use galaxyui::{
|
||||
units::Pixels,
|
||||
AppContext, TypedActionView, ViewContext, WeakViewHandle,
|
||||
};
|
||||
use lazy_static::lazy_static;
|
||||
use rangemap::RangeSet;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::fmt::Debug;
|
||||
use std::ops::Range;
|
||||
use string_offset::CharOffset;
|
||||
|
||||
/// Limit the keybindings that conflict with the Agent Mode embedded editor.
|
||||
const NON_EDITABLE_KEYMAP_CONTEXT: &str = "NonEditableKeymapContext";
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
use std::sync::Arc;
|
||||
use galaxy_core::ui::appearance::Appearance;
|
||||
use galaxy_editor::render::element::VerticalExpansionBehavior;
|
||||
use galaxyui::{
|
||||
@@ -6,6 +5,7 @@ use galaxyui::{
|
||||
platform::WindowStyle,
|
||||
App, TypedActionView, ViewHandle, WindowId,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::{
|
||||
cloud_object::model::persistence::CloudModel,
|
||||
|
||||
@@ -7,11 +7,6 @@ use crate::{
|
||||
view_components::find::FindDirection,
|
||||
vim_registers::{RegisterContent, VimRegisters},
|
||||
};
|
||||
use vim::vim::{
|
||||
BracketChar, CharacterMotion, Direction, FindCharMotion, FirstNonWhitespaceMotion,
|
||||
InsertPosition, LineMotion, ModeTransition, MotionType, TextObjectType, VimHandler, VimMode,
|
||||
VimMotion, VimOperand, VimOperator, VimTextObject, WordMotion,
|
||||
};
|
||||
use galaxy_editor::{
|
||||
content::buffer::{
|
||||
AutoScrollBehavior, BufferEditAction, EditOrigin, SelectionOffsets,
|
||||
@@ -21,6 +16,11 @@ use galaxy_editor::{
|
||||
selection::{TextDirection, TextUnit},
|
||||
};
|
||||
use galaxyui::{text::point::Point, SingletonEntity, ViewContext};
|
||||
use vim::vim::{
|
||||
BracketChar, CharacterMotion, Direction, FindCharMotion, FirstNonWhitespaceMotion,
|
||||
InsertPosition, LineMotion, ModeTransition, MotionType, TextObjectType, VimHandler, VimMode,
|
||||
VimMotion, VimOperand, VimOperator, VimTextObject, WordMotion,
|
||||
};
|
||||
|
||||
impl VimHandler for CodeEditorView {
|
||||
fn insert_char(&mut self, c: char, ctx: &mut ViewContext<Self>) {
|
||||
|
||||
@@ -13,9 +13,6 @@ use crate::{
|
||||
workspace::sync_inputs::SyncedInputState,
|
||||
workspaces::user_workspaces::UserWorkspaces,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
use unindent::Unindent;
|
||||
use vim::vim::{MotionType, VimMode};
|
||||
use galaxy_core::{features::FeatureFlag, settings::Setting, ui::appearance::Appearance};
|
||||
use galaxy_editor::model::CoreEditorModel;
|
||||
use galaxy_editor::{
|
||||
@@ -28,6 +25,9 @@ use galaxyui::{
|
||||
keymap::Keystroke, platform::WindowStyle, App, SingletonEntity, TypedActionView, UpdateModel,
|
||||
ViewHandle,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
use unindent::Unindent;
|
||||
use vim::vim::{MotionType, VimMode};
|
||||
|
||||
// Await render/layout completion for a CodeEditorView in tests.
|
||||
async fn layout_editor_view(app: &mut App, editor: &ViewHandle<CodeEditorView>) {
|
||||
|
||||
Reference in New Issue
Block a user