From ec0e5e48210cea1b2f61e221215b1068114bdfa7 Mon Sep 17 00:00:00 2001 From: Dongdong Zhou Date: Thu, 17 Dec 2020 18:16:37 +0000 Subject: [PATCH] start panel --- Cargo.lock | 49 ++++------------- Cargo.toml | 34 ++++++------ core/src/buffer.rs | 6 ++ core/src/command.rs | 2 + core/src/editor.rs | 124 ++++++++++++++++++++++++++++-------------- core/src/lib.rs | 1 + core/src/movement.rs | 8 +++ core/src/panel.rs | 75 +++++++++++++++++++++++++ core/src/window.rs | 3 +- lsp/src/lsp_plugin.rs | 6 +- proxy/Cargo.toml | 1 + proxy/src/buffer.rs | 14 ++++- proxy/src/dispatch.rs | 33 +++++++++++ src/.editor.rs.swp | Bin 16384 -> 0 bytes src/main.rs | 13 +++-- 15 files changed, 262 insertions(+), 107 deletions(-) create mode 100644 core/src/panel.rs delete mode 100644 src/.editor.rs.swp diff --git a/Cargo.lock b/Cargo.lock index 20bafa9b..fc46f758 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -406,7 +406,7 @@ dependencies = [ "block", "cocoa-foundation", "core-foundation 0.9.1", - "core-graphics 0.22.1", + "core-graphics 0.22.2", "foreign-types", "libc", "objc", @@ -506,9 +506,9 @@ dependencies = [ [[package]] name = "core-graphics" -version = "0.22.1" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc239bba52bab96649441699533a68de294a101533b0270b2d65aa402b29a7f9" +checksum = "269f35f69b542b80e736a20a89a05215c0ce80c2c03c514abb2e318b78379d86" dependencies = [ "bitflags", "core-foundation 0.9.1", @@ -548,7 +548,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2c7f46e8b820fd5f4b28528104b28b0a91cbe9e9c5bde8017087fb44bc93a60" dependencies = [ "core-foundation 0.9.1", - "core-graphics 0.22.1", + "core-graphics 0.22.2", "foreign-types", "libc", ] @@ -747,7 +747,7 @@ dependencies = [ "cairo-rs", "cfg-if 0.1.10", "cocoa", - "core-graphics 0.22.1", + "core-graphics 0.22.2", "foreign-types", "gdk", "gdk-pixbuf", @@ -1630,27 +1630,10 @@ dependencies = [ name = "lapce" version = "0.0.1" dependencies = [ - "anyhow", "cc", "druid", - "fzyr", - "include_dir", "lapce-core", - "lazy_static 1.4.0", - "lsp-types 0.61.0", "parking_lot 0.11.0", - "serde", - "serde_json", - "strum 0.19.2", - "strum_macros 0.19.2", - "syntect", - "toml", - "tree-sitter", - "tree-sitter-highlight", - "uuid 0.7.4", - "xi-core-lib", - "xi-rope", - "xi-rpc", ] [[package]] @@ -1667,7 +1650,7 @@ dependencies = [ "jsonrpc-lite", "lapce-proxy", "lazy_static 1.4.0", - "lsp-types 0.82.0", + "lsp-types", "openssh", "parking_lot 0.11.0", "regex", @@ -1713,11 +1696,12 @@ dependencies = [ "home", "jsonrpc-lite", "lapce-rpc", - "lsp-types 0.82.0", + "lsp-types", "parking_lot 0.11.0", "serde", "serde_json", "toml", + "xi-core-lib", "xi-rope", "xi-rpc", ] @@ -1850,19 +1834,6 @@ dependencies = [ "cfg-if 0.1.10", ] -[[package]] -name = "lsp-types" -version = "0.61.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa3268fbe8beb2795c2fb327bf44f4f3d24f5fe9ebc18d7e2980afd444d72bcf" -dependencies = [ - "bitflags", - "serde", - "serde_json", - "serde_repr", - "url 2.1.1", -] - [[package]] name = "lsp-types" version = "0.82.0" @@ -2380,7 +2351,7 @@ dependencies = [ "cairo-rs", "cairo-sys-rs", "cfg-if 1.0.0", - "core-graphics 0.22.1", + "core-graphics 0.22.2", "piet", "piet-cairo", "piet-coregraphics", @@ -2396,7 +2367,7 @@ version = "0.2.0-pre6" dependencies = [ "core-foundation 0.9.1", "core-foundation-sys 0.8.1", - "core-graphics 0.22.1", + "core-graphics 0.22.2", "core-text 19.1.0", "foreign-types", "piet", diff --git a/Cargo.toml b/Cargo.toml index f8801ab8..4bde9f71 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,23 +7,23 @@ edition = "2018" [dependencies] lapce-core = { path = "./core" } parking_lot = { version = "0.11.0", features = ["deadlock_detection"] } -include_dir = "0.6.0" -tree-sitter-highlight = "0.3.0" -tree-sitter = "0.17.0" -toml = "0.5.6" -anyhow = "1.0.32" -strum = "0.19" -strum_macros = "0.19" -lazy_static = "1.4.0" -serde = "1.0" -serde_json = "1.0" -syntect = "3.2" -xi-core-lib = { path = "../xi-editor/rust/core-lib/" } -xi-rope = { path = "../xi-editor/rust/rope/" } -xi-rpc = { path = "../xi-editor/rust/rpc/" } -fzyr = "0.1.2" -uuid = { version = "0.7.4", features = ["v4"] } -lsp-types = "0.61.0" +# include_dir = "0.6.0" +# tree-sitter-highlight = "0.3.0" +# tree-sitter = "0.17.0" +# toml = "0.5.6" +# anyhow = "1.0.32" +# strum = "0.19" +# strum_macros = "0.19" +# lazy_static = "1.4.0" +# serde = "1.0" +# serde_json = "1.0" +# syntect = "3.2" +# xi-core-lib = { path = "../xi-editor/rust/core-lib/" } +# xi-rope = { path = "../xi-editor/rust/rope/" } +# xi-rpc = { path = "../xi-editor/rust/rpc/" } +# fzyr = "0.1.2" +# uuid = { version = "0.7.4", features = ["v4"] } +# lsp-types = "0.61.0" druid = { path = "../druid/druid", features = ["svg"] } [build-dependencies] diff --git a/core/src/buffer.rs b/core/src/buffer.rs index 66155bb8..7fb2c834 100644 --- a/core/src/buffer.rs +++ b/core/src/buffer.rs @@ -676,6 +676,8 @@ pub fn indent_on_line(&self, line: usize) -> String { } pub fn line_of_offset(&self, offset: usize) -> usize { + let max = self.len(); + let offset = if offset > max { max } else { offset }; self.rope.line_of_offset(offset) } @@ -684,10 +686,14 @@ pub fn offset_of_line(&self, line: usize) -> usize { } pub fn offset_to_line_col(&self, offset: usize) -> (usize, usize) { + let max = self.len(); + let offset = if offset > max { max } else { offset }; LogicalLines.offset_to_line_col(&self.rope, offset) } pub fn offset_to_position(&self, offset: usize) -> Position { + let max = self.len(); + let offset = if offset > max { max } else { offset }; let (line, col) = LogicalLines.offset_to_line_col(&self.rope, offset); Position { line: line as u64, diff --git a/core/src/command.rs b/core/src/command.rs index 327c9140..7d9da2a8 100644 --- a/core/src/command.rs +++ b/core/src/command.rs @@ -135,6 +135,8 @@ pub enum LapceCommand { Yank, #[strum(serialize = "paste")] Paste, + #[strum(serialize = "clipboard_paste")] + ClipboardPaste, #[strum(serialize = "undo")] Undo, #[strum(serialize = "redo")] diff --git a/core/src/editor.rs b/core/src/editor.rs index 1e273b3f..7efa53fe 100644 --- a/core/src/editor.rs +++ b/core/src/editor.rs @@ -32,7 +32,6 @@ }; use anyhow::{anyhow, Result}; use bit_vec::BitVec; -use druid::FileDialogOptions; use druid::{ kurbo::Line, piet::PietText, theme, widget::IdentityWrapper, widget::Padding, widget::SvgData, Affine, BoxConstraints, Color, Command, Data, Env, Event, @@ -44,6 +43,7 @@ piet::{PietTextLayout, Text, TextAttribute, TextLayoutBuilder}, FontWeight, }; +use druid::{Application, FileDialogOptions}; use fzyr::{has_match, locate}; use lsp_types::{ CodeActionOrCommand, CodeActionResponse, CompletionItem, CompletionResponse, @@ -104,6 +104,7 @@ pub struct EditorState { pub saved_buffer_id: BufferId, pub saved_selection: Selection, pub saved_scroll_offset: Vec2, + last_movement: Movement, } #[derive(Clone, Debug)] @@ -138,6 +139,7 @@ pub fn new( current_location: 0, saved_buffer_id: BufferId(0), saved_selection: Selection::new_simple(), + last_movement: Movement::Left, saved_scroll_offset: Vec2::ZERO, } } @@ -320,9 +322,10 @@ pub fn do_move( env: &Env, count: Option, ) { - if movement.is_jump() { + if movement.is_jump() && movement != &self.last_movement { self.save_jump_location(buffer); } + self.last_movement = movement.clone(); self.selection = buffer.do_move( ctx, ui_state, @@ -2361,6 +2364,33 @@ pub fn run_command( LapceCommand::DeleteOperator => { self.operator = Some(EditorOperator::Delete(EditorCount(count))); } + LapceCommand::ClipboardPaste => { + if let Some(s) = Application::global().clipboard().get_string() { + let editor = self.editors.get_mut(&self.active)?; + let buffer_id = editor.buffer_id.as_ref()?; + let buffer = self.buffers.get_mut(buffer_id)?; + let buffer_ui_state = ui_state.get_buffer_mut(buffer_id); + let mut selection = match &self.mode { + Mode::Visual => editor.get_selection( + buffer, + &self.mode, + &self.visual_mode, + false, + ), + Mode::Normal => Selection::caret( + editor.selection.get_cursor_offset() + 1, + ), + Mode::Insert => editor.selection.clone(), + }; + let delta = + buffer.edit(ctx, buffer_ui_state, &s, &selection, true); + selection = + selection.apply_delta(&delta, true, InsertDrift::Default); + editor.selection = + Selection::caret(selection.get_cursor_offset() - 1); + self.mode = Mode::Normal; + } + } LapceCommand::Paste => { let editor = self.editors.get_mut(&self.active)?; let buffer_id = editor.buffer_id.as_ref()?; @@ -2526,47 +2556,53 @@ pub fn run_command( buffer.id, buffer.offset_to_position(offset), Box::new(move |result| { - let state = - LAPCE_APP_STATE.get_tab_state(&window_id, &tab_id); - let editor_split = state.editor_split.lock(); - let editor = - editor_split.editors.get(&editor_split.active).unwrap(); - if offset != editor.selection.get_cursor_offset() { - println!("not the previous offset ,quit"); - return; - } - if let Ok(value) = result { - let resp: Result< - GotoDefinitionResponse, - serde_json::Error, - > = serde_json::from_value(value); - if let Ok(resp) = resp { - if let Some(location) = match resp { - GotoDefinitionResponse::Scalar(location) => { - Some(location) - } - GotoDefinitionResponse::Array(locations) => { - if locations.len() > 0 { - Some(locations[0].clone()) - } else { - None + thread::spawn(move || { + let state = + LAPCE_APP_STATE.get_tab_state(&window_id, &tab_id); + let editor_split = state.editor_split.lock(); + let editor = editor_split + .editors + .get(&editor_split.active) + .unwrap(); + if offset != editor.selection.get_cursor_offset() { + println!("not the previous offset ,quit"); + return; + } + if let Ok(value) = result { + let resp: Result< + GotoDefinitionResponse, + serde_json::Error, + > = serde_json::from_value(value); + if let Ok(resp) = resp { + if let Some(location) = match resp { + GotoDefinitionResponse::Scalar(location) => { + Some(location) + } + GotoDefinitionResponse::Array(locations) => { + if locations.len() > 0 { + Some(locations[0].clone()) + } else { + None + } + } + GotoDefinitionResponse::Link( + location_links, + ) => None, + } { + if location.range.start == prev_position { + editor_split.get_references(); + } else { + LAPCE_APP_STATE.submit_ui_command( + LapceUICommand::GotoLocation( + location, + ), + editor_split.widget_id, + ); } - } - GotoDefinitionResponse::Link(location_links) => { - None - } - } { - if location.range.start == prev_position { - editor_split.get_references(); - } else { - LAPCE_APP_STATE.submit_ui_command( - LapceUICommand::GotoLocation(location), - editor_split.widget_id, - ); } } } - } + }); }), ); // LAPCE_APP_STATE @@ -3530,11 +3566,17 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceUIState, env: &Env) { let buffer = editor_split.buffers.get(buffer_id.unwrap()).unwrap(); let last_line = buffer.last_line(); + let max_offset = buffer.len() - 1; let rects = ctx.region().rects().to_vec(); let active = editor_split.active; let editor = editor_split.editors.get(&self.view_id).unwrap(); - let (current_line, _) = - buffer.offset_to_line_col(editor.selection.get_cursor_offset()); + let offset = editor.selection.get_cursor_offset(); + let offset = if offset > max_offset { + max_offset + } else { + offset + }; + let (current_line, _) = buffer.offset_to_line_col(offset); for rect in rects { let start_line = (rect.y0 / line_height).floor() as usize; let num_lines = (rect.height() / line_height).floor() as usize; diff --git a/core/src/lib.rs b/core/src/lib.rs index 4b999887..da8d8231 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -10,6 +10,7 @@ pub mod lsp; pub mod movement; pub mod palette; +pub mod panel; pub mod plugin; pub mod proxy; pub mod scroll; diff --git a/core/src/movement.rs b/core/src/movement.rs index 60de4784..3c04d1c8 100644 --- a/core/src/movement.rs +++ b/core/src/movement.rs @@ -311,12 +311,14 @@ pub fn apply_delta( } } +#[derive(Clone)] pub enum LinePosition { First, Last, Line(usize), } +#[derive(Clone)] pub enum Movement { Left, Right, @@ -334,6 +336,12 @@ pub enum Movement { MatchPairs, } +impl PartialEq for Movement { + fn eq(&self, other: &Self) -> bool { + std::mem::discriminant(self) == std::mem::discriminant(other) + } +} + impl Movement { pub fn is_vertical(&self) -> bool { match self { diff --git a/core/src/panel.rs b/core/src/panel.rs new file mode 100644 index 00000000..a464e9a5 --- /dev/null +++ b/core/src/panel.rs @@ -0,0 +1,75 @@ +use std::{collections::HashMap, sync::Arc}; + +use parking_lot::Mutex; + +#[derive(Eq, PartialEq, Hash, Clone)] +pub enum PanelPosition { + LeftTop, + LeftBottom, + BottomLeft, + BottomRight, + RightTop, + RightBottom, +} + +pub trait PanelProperty { + fn position(&self) -> &PanelPosition; + fn active(&self) -> usize; + fn size(&self) -> (usize, f64); +} + +pub struct PanelState { + pub panels: Vec>>, + pub shown: HashMap, +} + +impl PanelState { + pub fn is_shown(&self, position: &PanelPosition) -> bool { + *self.shown.get(position).unwrap_or(&false) + } + + pub fn size(&self, position: &PanelPosition) -> Option<(usize, f64)> { + let mut active_panel = None; + let mut active = 0; + for panel in self.panels.iter() { + let local_panel = panel.clone(); + let panel = panel.lock(); + if panel.position() == position { + let panel_active = panel.active(); + if panel_active > active { + active_panel = Some(local_panel); + active = panel_active; + } + } + } + active_panel.map(|p| p.lock().size()) + } + + pub fn shown_panels( + &self, + ) -> HashMap>)>> { + let mut shown_panels = HashMap::new(); + for (postion, shown) in self.shown.iter() { + if *shown { + shown_panels.insert(postion.clone(), None); + } + } + + for panel in self.panels.iter() { + let local_panel = panel.clone(); + let panel = panel.lock(); + let position = panel.position(); + let active = panel.active(); + if let Some(p) = shown_panels.get_mut(&position) { + if p.is_none() { + *p = Some((active, local_panel)); + } else { + if active > p.as_ref().unwrap().0 { + *p = Some((active, local_panel)) + } + } + } + } + shown_panels + } +} diff --git a/core/src/window.rs b/core/src/window.rs index e359683b..c774c7c8 100644 --- a/core/src/window.rs +++ b/core/src/window.rs @@ -18,7 +18,7 @@ LifeCycleCtx, PaintCtx, Point, Rect, RenderContext, Size, TextLayout, UpdateCtx, Widget, WidgetId, WidgetPod, WindowId, }; -use std::sync::Arc; +use std::{collections::HashMap, sync::Arc}; pub struct LapceTab { window_id: WindowId, @@ -146,6 +146,7 @@ fn layout( ) -> druid::Size { let self_size = bc.max(); let status_size = self.status.layout(ctx, bc, data, env); + let main_split_size = Size::new(self_size.width, self_size.height - status_size.height); let main_split_bc = BoxConstraints::new(Size::ZERO, main_split_size); diff --git a/lsp/src/lsp_plugin.rs b/lsp/src/lsp_plugin.rs index 2b441d52..afbdf635 100644 --- a/lsp/src/lsp_plugin.rs +++ b/lsp/src/lsp_plugin.rs @@ -61,8 +61,10 @@ fn initialize(&mut self, core: CoreProxy) { "rust-analyzer-mac", "rust", Some(json!({ - "diagnostics.enable": false, - "diagnostics.enableExperimental": false, + "diagnostics": { + "enable": false, + "enableExperimental": false, + }, })), ); } diff --git a/proxy/Cargo.toml b/proxy/Cargo.toml index c5599e4d..382f306f 100644 --- a/proxy/Cargo.toml +++ b/proxy/Cargo.toml @@ -6,6 +6,7 @@ edition = "2018" [dependencies] lapce-rpc = { path = "../rpc" } +xi-core-lib = { path = "../../xi-editor/rust/core-lib/" } xi-rpc = { path = "../../xi-editor/rust/rpc/" } xi-rope = { path = "../../xi-editor/rust/rope/", features = ["serde"] } serde = { version = "1.0", features = ["derive"] } diff --git a/proxy/src/buffer.rs b/proxy/src/buffer.rs index 1d3ea237..5b805d90 100644 --- a/proxy/src/buffer.rs +++ b/proxy/src/buffer.rs @@ -1,11 +1,11 @@ use anyhow::{anyhow, Result}; use crossbeam_channel::Sender; -use std::borrow::Cow; use std::ffi::OsString; use std::fs::File; use std::io::Read; use std::io::Write; use std::path::PathBuf; +use std::{borrow::Cow, path::Path, time::SystemTime}; use std::{fs, str::FromStr}; use lsp_types::*; @@ -25,6 +25,7 @@ pub struct Buffer { pub path: PathBuf, pub rev: u64, sender: Sender<(BufferId, u64)>, + pub mod_time: Option, } impl Buffer { @@ -39,6 +40,7 @@ pub fn new( Rope::from("") }; let language_id = language_id_from_path(&path).unwrap_or("").to_string(); + let mod_time = get_mod_time(&path); Buffer { id, rope, @@ -46,6 +48,7 @@ pub fn new( language_id, rev: 0, sender, + mod_time, } } @@ -184,3 +187,12 @@ fn get_document_content_changes( None } + +/// Returns the modification timestamp for the file at a given path, +/// if present. +fn get_mod_time>(path: P) -> Option { + File::open(path) + .and_then(|f| f.metadata()) + .and_then(|meta| meta.modified()) + .ok() +} diff --git a/proxy/src/dispatch.rs b/proxy/src/dispatch.rs index 94b82a0b..206b478d 100644 --- a/proxy/src/dispatch.rs +++ b/proxy/src/dispatch.rs @@ -18,10 +18,13 @@ use std::thread; use std::{cmp, fs}; use std::{collections::HashMap, io}; +use xi_core_lib::watcher::{FileWatcher, Notify, WatchToken}; use xi_rope::{RopeDelta, RopeInfo}; use xi_rpc::RpcPeer; use xi_rpc::{Handler, RpcCtx}; +pub const OPEN_FILE_EVENT_TOKEN: WatchToken = WatchToken(2); + #[derive(Clone)] pub struct Dispatcher { pub sender: Arc>, @@ -30,6 +33,24 @@ pub struct Dispatcher { pub buffers: Arc>>, plugins: Arc>, pub lsp: Arc>, + pub watcher: Arc>>, +} + +impl Notify for Dispatcher { + fn notify(&self) { + let dispatcher = self.clone(); + thread::spawn(move || { + for (token, event) in + { dispatcher.watcher.lock().as_mut().unwrap().take_events() } + .drain(..) + { + match token { + OPEN_FILE_EVENT_TOKEN => {} + _ => (), + } + } + }); + } } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -142,7 +163,9 @@ pub fn new(sender: Sender) -> Dispatcher { buffers: Arc::new(Mutex::new(HashMap::new())), plugins: Arc::new(Mutex::new(plugins)), lsp: Arc::new(Mutex::new(LspCatalog::new())), + watcher: Arc::new(Mutex::new(None)), }; + *dispatcher.watcher.lock() = Some(FileWatcher::new(dispatcher.clone())); dispatcher.lsp.lock().dispatcher = Some(dispatcher.clone()); dispatcher.plugins.lock().reload(); dispatcher.plugins.lock().start_all(dispatcher.clone()); @@ -270,6 +293,11 @@ fn handle_notification(&self, rpc: Notification) { } } } + self.watcher.lock().as_mut().unwrap().watch( + workspace.as_path(), + true, + OPEN_FILE_EVENT_TOKEN, + ); self.send_notification( "list_dir", json!({ @@ -431,6 +459,11 @@ fn handle_request(&self, id: RequestId, rpc: Request) { } } +fn get_git_changes(workspace_path: &PathBuf) -> Option<()> { + let repo = Repository::open(workspace_path.to_str()?).ok()?; + None +} + #[derive(Clone, Debug)] pub struct DiffHunk { pub old_start: u32, diff --git a/src/.editor.rs.swp b/src/.editor.rs.swp deleted file mode 100644 index 663d6c6bc1f80b5d64e787c6ce78aeb202e9c09e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16384 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 EUy@%5t^fc4 diff --git a/src/main.rs b/src/main.rs index 55dd2a9c..b8243a20 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,8 +7,8 @@ use lapce_core::{editor::Editor, window::LapceTab, window::LapceWindow}; use druid::{ - piet::Color, theme, FontDescriptor, FontFamily, FontWeight, Key, Size, Target, - WidgetId, + piet::Color, theme, FontDescriptor, FontFamily, FontWeight, Key, MenuDesc, Size, + Target, WidgetId, }; use druid::{ widget::IdentityWrapper, @@ -22,11 +22,11 @@ use lapce_core::state::{ LapceTabState, LapceUIState, LapceWindowState, LAPCE_APP_STATE, }; -use tree_sitter::{Language, Parser}; +// use tree_sitter::{Language, Parser}; -extern "C" { - fn tree_sitter_rust() -> Language; -} +// extern "C" { +// fn tree_sitter_rust() -> Language; +// } struct Delegate { windows: Vec, @@ -143,6 +143,7 @@ pub fn main() { .insert(window_id.clone(), window_state); let mut window = WindowDesc::new(move || build_app(window_id.clone())) .title(LocalizedString::new("lapce").with_placeholder("Lapce")) + .menu(MenuDesc::empty()) .window_size(Size::new(800.0, 600.0)) .with_min_size(Size::new(800.0, 600.0)); window.id = window_id;