Merge some imports.

This commit is contained in:
Blaž Hrastnik 2021-03-22 12:40:07 +09:00
parent c4792efead
commit cbcacb1063
15 changed files with 46 additions and 45 deletions

View File

@ -51,8 +51,7 @@ pub(crate) fn find_first_non_whitespace_char(text: RopeSlice, line_num: usize) -
pub use {regex, tree_sitter}; pub use {regex, tree_sitter};
pub use position::{coords_at_pos, pos_at_coords, Position}; pub use position::{coords_at_pos, pos_at_coords, Position};
pub use selection::Range; pub use selection::{Range, Selection};
pub use selection::Selection;
pub use syntax::Syntax; pub use syntax::Syntax;
pub use diagnostic::Diagnostic; pub use diagnostic::Diagnostic;

View File

@ -1,12 +1,13 @@
use crate::{Change, Rope, RopeSlice, Transaction}; use crate::{Change, Rope, RopeSlice, Transaction};
pub use helix_syntax::Lang; pub use helix_syntax::{get_language, get_language_name, Lang};
pub use helix_syntax::{get_language, get_language_name};
use std::borrow::Cow; use std::{
use std::cell::RefCell; borrow::Cow,
use std::collections::HashMap; cell::RefCell,
use std::path::{Path, PathBuf}; collections::HashMap,
use std::sync::Arc; path::{Path, PathBuf},
sync::Arc,
};
use once_cell::sync::{Lazy, OnceCell}; use once_cell::sync::{Lazy, OnceCell};
@ -355,9 +356,11 @@ pub struct LanguageLayer {
pub(crate) tree: Option<Tree>, pub(crate) tree: Option<Tree>,
} }
use crate::coords_at_pos; use crate::{
use crate::transaction::{ChangeSet, Operation}; coords_at_pos,
use crate::Tendril; transaction::{ChangeSet, Operation},
Tendril,
};
impl LanguageLayer { impl LanguageLayer {
// pub fn new() -> Self { // pub fn new() -> Self {

View File

@ -1,6 +1,5 @@
use crate::{Range, Rope, Selection, State, Tendril}; use crate::{Range, Rope, Selection, State, Tendril};
use std::borrow::Cow; use std::{borrow::Cow, convert::TryFrom};
use std::convert::TryFrom;
/// (from, to, replacement) /// (from, to, replacement)
pub type Change = (usize, usize, Option<Tendril>); pub type Change = (usize, usize, Option<Tendril>);

View File

@ -1,15 +1,15 @@
//! An unbounded set of streams //! An unbounded set of streams
use core::fmt::{self, Debug}; use core::{
use core::iter::FromIterator; fmt::{self, Debug},
use core::pin::Pin; iter::FromIterator,
pin::Pin,
};
use smol::ready; use smol::{ready, stream::Stream};
use smol::stream::Stream;
use std::task::{Context, Poll}; use std::task::{Context, Poll};
use futures_util::stream::FusedStream; use futures_util::stream::{FusedStream, FuturesUnordered, StreamExt, StreamFuture};
use futures_util::stream::{FuturesUnordered, StreamExt, StreamFuture};
/// An unbounded set of streams /// An unbounded set of streams
/// ///

View File

@ -2,8 +2,7 @@
use helix_view::{document::Mode, Document, Editor, Theme, View}; use helix_view::{document::Mode, Document, Editor, Theme, View};
use crate::compositor::Compositor; use crate::{compositor::Compositor, ui};
use crate::ui;
use log::{error, info}; use log::{error, info};
@ -139,9 +138,8 @@ pub async fn handle_language_server_message(&mut self, call: Option<helix_lsp::C
.diagnostics .diagnostics
.into_iter() .into_iter()
.map(|diagnostic| { .map(|diagnostic| {
use helix_core::diagnostic::Severity::*;
use helix_core::{ use helix_core::{
diagnostic::{Range, Severity}, diagnostic::{Range, Severity, Severity::*},
Diagnostic, Diagnostic,
}; };
use helix_lsp::{lsp, util::lsp_pos_to_pos}; use helix_lsp::{lsp, util::lsp_pos_to_pos};

View File

@ -10,8 +10,10 @@
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use crate::compositor::Compositor; use crate::{
use crate::ui::{self, Popup, Prompt, PromptEvent}; compositor::Compositor,
ui::{self, Popup, Prompt, PromptEvent},
};
use std::path::PathBuf; use std::path::PathBuf;

View File

@ -5,8 +5,7 @@
use crossterm::event::Event; use crossterm::event::Event;
use helix_core::Position; use helix_core::Position;
use smol::Executor; use smol::Executor;
use tui::buffer::Buffer as Surface; use tui::{buffer::Buffer as Surface, layout::Rect};
use tui::layout::Rect;
pub type Callback = Box<dyn FnOnce(&mut Compositor, &mut Editor)>; pub type Callback = Box<dyn FnOnce(&mut Compositor, &mut Editor)>;

View File

@ -1,7 +1,9 @@
use crate::commands; use crate::{
use crate::compositor::{Component, Compositor, Context, EventResult}; commands,
use crate::keymap::{self, Keymaps}; compositor::{Component, Compositor, Context, EventResult},
use crate::ui::text_color; keymap::{self, Keymaps},
ui::text_color,
};
use helix_core::{ use helix_core::{
indent::TAB_WIDTH, indent::TAB_WIDTH,

View File

@ -1,7 +1,7 @@
use crate::compositor::{Component, Compositor, Context, EventResult}; use crate::compositor::{Component, Compositor, Context, EventResult};
use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers}; use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
use tui::buffer::Buffer as Surface;
use tui::{ use tui::{
buffer::Buffer as Surface,
layout::Rect, layout::Rect,
style::{Color, Style}, style::{Color, Style},
text::Text, text::Text,

View File

@ -1,7 +1,7 @@
use crate::compositor::{Component, Compositor, Context, EventResult}; use crate::compositor::{Component, Compositor, Context, EventResult};
use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers}; use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
use tui::buffer::Buffer as Surface;
use tui::{ use tui::{
buffer::Buffer as Surface,
layout::Rect, layout::Rect,
style::{Color, Style}, style::{Color, Style},
widgets::{Block, Borders}, widgets::{Block, Borders},

View File

@ -1,7 +1,7 @@
use crate::compositor::{Component, Compositor, Context, EventResult}; use crate::compositor::{Component, Compositor, Context, EventResult};
use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers}; use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
use tui::buffer::Buffer as Surface;
use tui::{ use tui::{
buffer::Buffer as Surface,
layout::Rect, layout::Rect,
style::{Color, Style}, style::{Color, Style},
widgets::{Block, Borders}, widgets::{Block, Borders},

View File

@ -1,7 +1,7 @@
use crate::compositor::{Component, Compositor, Context, EventResult}; use crate::compositor::{Component, Compositor, Context, EventResult};
use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers}; use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
use tui::buffer::Buffer as Surface;
use tui::{ use tui::{
buffer::Buffer as Surface,
layout::Rect, layout::Rect,
style::{Color, Style}, style::{Color, Style},
widgets::{Block, Borders}, widgets::{Block, Borders},
@ -107,8 +107,10 @@ fn required_size(&mut self, viewport: (u16, u16)) -> Option<(u16, u16)> {
} }
fn render(&self, viewport: Rect, surface: &mut Surface, cx: &mut Context) { fn render(&self, viewport: Rect, surface: &mut Surface, cx: &mut Context) {
use tui::text::Text; use tui::{
use tui::widgets::{Paragraph, Widget, Wrap}; text::Text,
widgets::{Paragraph, Widget, Wrap},
};
cx.scroll = Some(self.scroll); cx.scroll = Some(self.scroll);

View File

@ -1,8 +1,7 @@
use crate::compositor::{Component, Compositor, Context, EventResult}; use crate::compositor::{Component, Compositor, Context, EventResult};
use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers}; use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
use helix_core::Position; use helix_core::Position;
use helix_view::Editor; use helix_view::{Editor, Theme};
use helix_view::Theme;
use std::{borrow::Cow, ops::RangeFrom}; use std::{borrow::Cow, ops::RangeFrom};
pub struct Prompt { pub struct Prompt {

View File

@ -1,7 +1,7 @@
use crate::compositor::{Component, Compositor, Context, EventResult}; use crate::compositor::{Component, Compositor, Context, EventResult};
use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers}; use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
use tui::buffer::Buffer as Surface;
use tui::{ use tui::{
buffer::Buffer as Surface,
layout::Rect, layout::Rect,
style::{Color, Style}, style::{Color, Style},
}; };

View File

@ -1,6 +1,4 @@
use crate::theme::Theme; use crate::{theme::Theme, tree::Tree, Document, View};
use crate::tree::Tree;
use crate::{Document, View};
use std::path::PathBuf; use std::path::PathBuf;