From b04e4bb0f7b06fa10edb727a40b63d96b1402ee1 Mon Sep 17 00:00:00 2001 From: gibbz00 Date: Wed, 15 Feb 2023 14:17:48 +0100 Subject: [PATCH] revert some cleanup of use statements ...in the hopes that it simplifies review. The changes should have probably be codified into `cargo fmt`. --- helix-term/Cargo.toml | 1 + helix-term/src/application.rs | 40 ++++++++++++---------- helix-term/src/commands.rs | 58 ++++++++++++++++---------------- helix-term/src/commands/typed.rs | 3 +- 4 files changed, 54 insertions(+), 48 deletions(-) diff --git a/helix-term/Cargo.toml b/helix-term/Cargo.toml index d4df572fdb13d..603f37d39ab8f 100644 --- a/helix-term/Cargo.toml +++ b/helix-term/Cargo.toml @@ -36,6 +36,7 @@ helix-loader = { version = "0.6", path = "../helix-loader" } anyhow = "1" once_cell = "1.17" + which = "4.4" tokio = { version = "1", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot"] } diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 2ede96bad0191..98b59ff729f13 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -1,3 +1,13 @@ +use arc_swap::{access::Map, ArcSwap}; +use futures_util::Stream; +use helix_core::{ + diagnostic::{DiagnosticTag, NumberOrString}, + path::get_relative_path, + pos_at_coords, syntax, Selection, +}; +use serde_json::json; +use tui::backend::Backend; + use crate::{ args::Args, commands::apply_workspace_edit, @@ -7,22 +17,7 @@ use crate::{ keymap::Keymap, ui::{self, overlay::overlayed}, }; -use anyhow::{Context, Error}; -use arc_swap::{access::Map, ArcSwap}; -use crossterm::{ - event::{ - DisableBracketedPaste, DisableFocusChange, DisableMouseCapture, EnableBracketedPaste, - EnableFocusChange, EnableMouseCapture, Event as CrosstermEvent, - }, - execute, terminal, - tty::IsTty, -}; -use futures_util::Stream; -use helix_core::{ - diagnostic::{DiagnosticTag, NumberOrString}, - path::get_relative_path, - pos_at_coords, syntax, Selection, -}; + use helix_lsp::{lsp, util::lsp_pos_to_pos, LspProgressMap}; use helix_view::{ align_view, @@ -34,14 +29,23 @@ use helix_view::{ Align, Editor, }; use log::{debug, error, warn}; -use serde_json::json; use std::{ io::{stdin, stdout, Write}, sync::Arc, time::{Duration, Instant}, }; -use tui::backend::Backend; + +use anyhow::{Context, Error}; + +use crossterm::{ + event::{ + DisableBracketedPaste, DisableFocusChange, DisableMouseCapture, EnableBracketedPaste, + EnableFocusChange, EnableMouseCapture, Event as CrosstermEvent, + }, + execute, terminal, + tty::IsTty, +}; #[cfg(not(windows))] use { signal_hook::{consts::signal, low_level}, diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 4d9091e3e9581..6c1436a45d4f0 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -3,29 +3,10 @@ pub(crate) mod lsp; pub(crate) mod typed; pub use dap::*; +use helix_vcs::Hunk; pub use lsp::*; pub use typed::*; -use crate::{ - args, - commands::insert::*, - compositor::{self, Component, Compositor}, - filter_picker_entry, - job::{self, Callback, Jobs}, - keymap::CommandList, - ui::{ - self, - menu::{Cell, Row}, - overlay::overlayed, - FilePicker, Picker, Popup, Prompt, PromptEvent, - }, -}; - -use anyhow::{anyhow, bail, ensure, Context as _}; -use futures_util::StreamExt; -use fuzzy_matcher::FuzzyMatcher; -use grep_regex::RegexMatcherBuilder; -use grep_searcher::{sinks, BinaryDetection, SearcherBuilder}; use helix_core::{ char_idx_at_visual_offset, comment, doc_formatter::TextFormat, @@ -35,7 +16,7 @@ use helix_core::{ indent::IndentStyle, line_ending::{get_line_ending_of_str, line_end_char_index, str_is_line_ending}, match_brackets, - movement::{self, move_vertically_visual, Direction, Movement}, + movement::{self, move_vertically_visual, Direction}, object, pos_at_coords, regex::{self, Regex, RegexBuilder}, search::{self, CharMatcher}, @@ -47,7 +28,6 @@ use helix_core::{ visual_offset_from_block, LineEnding, Position, Range, Rope, RopeGraphemes, RopeSlice, Selection, SmallVec, Tendril, Transaction, }; -use helix_vcs::Hunk; use helix_view::{ clipboard::ClipboardType, document::{FormatterError, Mode, SCRATCH_BUFFER_NAME}, @@ -59,17 +39,37 @@ use helix_view::{ view::View, Document, DocumentId, Editor, ViewId, }; -use ignore::{DirEntry, WalkBuilder, WalkState}; -use once_cell::sync::Lazy; -use serde::de::{self, Deserialize, Deserializer}; + +use anyhow::{anyhow, bail, ensure, Context as _}; +use fuzzy_matcher::FuzzyMatcher; +use insert::*; +use movement::Movement; + +use crate::{ + args, + compositor::{self, Component, Compositor}, + filter_picker_entry, + job::Callback, + keymap::CommandList, + ui::{self, menu::{Cell, Row}, overlay::overlayed, FilePicker, Picker, Popup, Prompt, PromptEvent}, +}; + +use crate::job::{self, Jobs}; +use futures_util::StreamExt; +use std::{collections::HashMap, fmt, future::Future }; +use std::{collections::HashSet, num::NonZeroUsize}; + use std::{ borrow::Cow, - collections::{HashMap, HashSet}, - fmt, - future::Future, - num::NonZeroUsize, path::{Path, PathBuf}, }; + +use once_cell::sync::Lazy; +use serde::de::{self, Deserialize, Deserializer}; + +use grep_regex::RegexMatcherBuilder; +use grep_searcher::{sinks, BinaryDetection, SearcherBuilder}; +use ignore::{DirEntry, WalkBuilder, WalkState}; use tokio_stream::wrappers::UnboundedReceiverStream; pub type OnKeyCallback = Box; diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 241d281808ac4..740d978db9cce 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -1,9 +1,10 @@ use std::fmt::Write; use std::ops::Deref; -use super::*; use crate::job::*; +use super::*; + use helix_core::encoding; use helix_view::editor::{Action, CloseError, ConfigEvent}; use serde_json::Value;