on master help sign in
Merge some imports.
cbcacb1Blaž Hrastnik
helix-core/src/lib.rs+1−2
@@ -51,8 +51,7 @@ pub use tendril::StrTendril as Tendril;
51pub use {regex, tree_sitter};
51pub use {regex, tree_sitter};
52
52
53pub use position::{coords_at_pos, pos_at_coords, Position};
53pub use position::{coords_at_pos, pos_at_coords, Position};
54−pub use selection::Range;
54+pub use selection::{Range, Selection};
55−pub use selection::Selection;
56pub use syntax::Syntax;
55pub use syntax::Syntax;
57
56
58pub use diagnostic::Diagnostic;
57pub use diagnostic::Diagnostic;
helix-core/src/syntax.rs+14−11
@@ -1,12 +1,13 @@
1use crate::{Change, Rope, RopeSlice, Transaction};
1use crate::{Change, Rope, RopeSlice, Transaction};
2−pub use helix_syntax::Lang;
3−pub use helix_syntax::{get_language, get_language_name};
2+pub use helix_syntax::{get_language, get_language_name, Lang};
4−
3+
4+use std::{
5−use std::borrow::Cow;
5+ borrow::Cow,
6−use std::cell::RefCell;
6+ cell::RefCell,
7−use std::collections::HashMap;
7+ collections::HashMap,
8−use std::path::{Path, PathBuf};
8+ path::{Path, PathBuf},
9−use std::sync::Arc;
9+ sync::Arc,
10+};
10
11
11use once_cell::sync::{Lazy, OnceCell};
12use once_cell::sync::{Lazy, OnceCell};
12
13
@@ -355,9 +356,11 @@ pub struct LanguageLayer {
355 pub(crate) tree: Option<Tree>,
356 pub(crate) tree: Option<Tree>,
356}
357}
357
358
359+use crate::{
358−use crate::coords_at_pos;
360+ coords_at_pos,
359−use crate::transaction::{ChangeSet, Operation};
361+ transaction::{ChangeSet, Operation},
360−use crate::Tendril;
362+ Tendril,
363+};
361
364
362impl LanguageLayer {
365impl LanguageLayer {
363 // pub fn new() -> Self {
366 // pub fn new() -> Self {
helix-core/src/transaction.rs+1−2
@@ -1,6 +1,5 @@
1use crate::{Range, Rope, Selection, State, Tendril};
1use crate::{Range, Rope, Selection, State, Tendril};
2−use std::borrow::Cow;
2+use std::{borrow::Cow, convert::TryFrom};
3−use std::convert::TryFrom;
4
3
5/// (from, to, replacement)
4/// (from, to, replacement)
6pub type Change = (usize, usize, Option<Tendril>);
5pub type Change = (usize, usize, Option<Tendril>);
helix-lsp/src/select_all.rs+7−7
@@ -1,15 +1,15 @@
1//! An unbounded set of streams
1//! An unbounded set of streams
2
2
3+use core::{
3−use core::fmt::{self, Debug};
4+ fmt::{self, Debug},
4−use core::iter::FromIterator;
5+ iter::FromIterator,
5−use core::pin::Pin;
6+ pin::Pin,
7+};
6
8
7−use smol::ready;
9+use smol::{ready, stream::Stream};
8−use smol::stream::Stream;
9use std::task::{Context, Poll};
10use std::task::{Context, Poll};
10
11
11−use futures_util::stream::FusedStream;
12−use futures_util::stream::{FuturesUnordered, StreamExt, StreamFuture};
12+use futures_util::stream::{FusedStream, FuturesUnordered, StreamExt, StreamFuture};
13
13
14/// An unbounded set of streams
14/// An unbounded set of streams
15///
15///
helix-term/src/application.rs+2−4
@@ -2,8 +2,7 @@ use clap::ArgMatches as Args;
2
2
3use helix_view::{document::Mode, Document, Editor, Theme, View};
3use helix_view::{document::Mode, Document, Editor, Theme, View};
4
4
5−use crate::compositor::Compositor;
5+use crate::{compositor::Compositor, ui};
6−use crate::ui;
7
6
8use log::{error, info};
7use log::{error, info};
9
8
@@ -139,9 +138,8 @@ impl Application {
139 .diagnostics
138 .diagnostics
140 .into_iter()
139 .into_iter()
141 .map(|diagnostic| {
140 .map(|diagnostic| {
142− use helix_core::diagnostic::Severity::*;
143 use helix_core::{
141 use helix_core::{
144− diagnostic::{Range, Severity},
142+ diagnostic::{Range, Severity, Severity::*},
145 Diagnostic,
143 Diagnostic,
146 };
144 };
147 use helix_lsp::{lsp, util::lsp_pos_to_pos};
145 use helix_lsp::{lsp, util::lsp_pos_to_pos};
helix-term/src/commands.rs+4−2
@@ -10,8 +10,10 @@ use helix_core::{
10
10
11use once_cell::sync::Lazy;
11use once_cell::sync::Lazy;
12
12
13+use crate::{
13−use crate::compositor::Compositor;
14+ compositor::Compositor,
14−use crate::ui::{self, Popup, Prompt, PromptEvent};
15+ ui::{self, Popup, Prompt, PromptEvent},
16+};
15
17
16use std::path::PathBuf;
18use std::path::PathBuf;
17
19
helix-term/src/compositor.rs+1−2
@@ -5,8 +5,7 @@
5use crossterm::event::Event;
5use crossterm::event::Event;
6use helix_core::Position;
6use helix_core::Position;
7use smol::Executor;
7use smol::Executor;
8−use tui::buffer::Buffer as Surface;
8+use tui::{buffer::Buffer as Surface, layout::Rect};
9−use tui::layout::Rect;
10
9
11pub type Callback = Box<dyn FnOnce(&mut Compositor, &mut Editor)>;
10pub type Callback = Box<dyn FnOnce(&mut Compositor, &mut Editor)>;
12
11
helix-term/src/ui/editor.rs+6−4
@@ -1,7 +1,9 @@
1−use crate::commands;
1+use crate::{
2+ commands,
2−use crate::compositor::{Component, Compositor, Context, EventResult};
3+ compositor::{Component, Compositor, Context, EventResult},
3−use crate::keymap::{self, Keymaps};
4+ keymap::{self, Keymaps},
4−use crate::ui::text_color;
5+ ui::text_color,
6+};
5
7
6use helix_core::{
8use helix_core::{
7 indent::TAB_WIDTH,
9 indent::TAB_WIDTH,
helix-term/src/ui/markdown.rs+1−1
@@ -1,7 +1,7 @@
1use crate::compositor::{Component, Compositor, Context, EventResult};
1use crate::compositor::{Component, Compositor, Context, EventResult};
2use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
2use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
3−use tui::buffer::Buffer as Surface;
4use tui::{
3use tui::{
4+ buffer::Buffer as Surface,
5 layout::Rect,
5 layout::Rect,
6 style::{Color, Style},
6 style::{Color, Style},
7 text::Text,
7 text::Text,
helix-term/src/ui/menu.rs+1−1
@@ -1,7 +1,7 @@
1use crate::compositor::{Component, Compositor, Context, EventResult};
1use crate::compositor::{Component, Compositor, Context, EventResult};
2use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
2use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
3−use tui::buffer::Buffer as Surface;
4use tui::{
3use tui::{
4+ buffer::Buffer as Surface,
5 layout::Rect,
5 layout::Rect,
6 style::{Color, Style},
6 style::{Color, Style},
7 widgets::{Block, Borders},
7 widgets::{Block, Borders},
helix-term/src/ui/picker.rs+1−1
@@ -1,7 +1,7 @@
1use crate::compositor::{Component, Compositor, Context, EventResult};
1use crate::compositor::{Component, Compositor, Context, EventResult};
2use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
2use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
3−use tui::buffer::Buffer as Surface;
4use tui::{
3use tui::{
4+ buffer::Buffer as Surface,
5 layout::Rect,
5 layout::Rect,
6 style::{Color, Style},
6 style::{Color, Style},
7 widgets::{Block, Borders},
7 widgets::{Block, Borders},
helix-term/src/ui/popup.rs+5−3
@@ -1,7 +1,7 @@
1use crate::compositor::{Component, Compositor, Context, EventResult};
1use crate::compositor::{Component, Compositor, Context, EventResult};
2use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
2use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
3−use tui::buffer::Buffer as Surface;
4use tui::{
3use tui::{
4+ buffer::Buffer as Surface,
5 layout::Rect,
5 layout::Rect,
6 style::{Color, Style},
6 style::{Color, Style},
7 widgets::{Block, Borders},
7 widgets::{Block, Borders},
@@ -107,8 +107,10 @@ impl Component for Popup {
107 }
107 }
108
108
109 fn render(&self, viewport: Rect, surface: &mut Surface, cx: &mut Context) {
109 fn render(&self, viewport: Rect, surface: &mut Surface, cx: &mut Context) {
110+ use tui::{
110− use tui::text::Text;
111+ text::Text,
111− use tui::widgets::{Paragraph, Widget, Wrap};
112+ widgets::{Paragraph, Widget, Wrap},
113+ };
112
114
113 cx.scroll = Some(self.scroll);
115 cx.scroll = Some(self.scroll);
114
116
helix-term/src/ui/prompt.rs+1−2
@@ -1,8 +1,7 @@
1use crate::compositor::{Component, Compositor, Context, EventResult};
1use crate::compositor::{Component, Compositor, Context, EventResult};
2use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
2use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
3use helix_core::Position;
3use helix_core::Position;
4−use helix_view::Editor;
4+use helix_view::{Editor, Theme};
5−use helix_view::Theme;
6use std::{borrow::Cow, ops::RangeFrom};
5use std::{borrow::Cow, ops::RangeFrom};
7
6
8pub struct Prompt {
7pub struct Prompt {
helix-term/src/ui/text.rs+1−1
@@ -1,7 +1,7 @@
1use crate::compositor::{Component, Compositor, Context, EventResult};
1use crate::compositor::{Component, Compositor, Context, EventResult};
2use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
2use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
3−use tui::buffer::Buffer as Surface;
4use tui::{
3use tui::{
4+ buffer::Buffer as Surface,
5 layout::Rect,
5 layout::Rect,
6 style::{Color, Style},
6 style::{Color, Style},
7};
7};
helix-view/src/editor.rs+1−3
@@ -1,6 +1,4 @@
1−use crate::theme::Theme;
1+use crate::{theme::Theme, tree::Tree, Document, View};
2−use crate::tree::Tree;
3−use crate::{Document, View};
4
2
5use std::path::PathBuf;
3use std::path::PathBuf;
6
4