diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index 3d20e1b3e..1939e88c7 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -1,37 +1,23 @@
use helix_core::syntax;
-use helix_lsp::{lsp, LspProgressMap};
-use helix_view::{document::Mode, graphics::Rect, theme, Document, Editor, Theme, View};
-
-use crate::{
- args::Args,
- compositor::Compositor,
- config::Config,
- job::Jobs,
- keymap::Keymaps,
- ui::{self, Spinner},
-};
+use helix_lsp::{lsp, util::lsp_pos_to_pos, LspProgressMap};
+use helix_view::{theme, Editor};
+
+use crate::{args::Args, compositor::Compositor, config::Config, job::Jobs, ui};
-use log::{error, info};
+use log::error;
use std::{
- collections::HashMap,
- future::Future,
- io::{self, stdout, Stdout, Write},
- path::PathBuf,
- pin::Pin,
+ io::{stdout, Write},
sync::Arc,
- time::Duration,
};
-use anyhow::{Context, Error};
+use anyhow::Error;
use crossterm::{
event::{Event, EventStream},
execute, terminal,
};
-use futures_util::{future, stream::FuturesUnordered};
-
pub struct Application {
compositor: Compositor,
editor: Editor,
@@ -239,10 +225,9 @@ impl Application {
.into_iter()
.filter_map(|diagnostic| {
use helix_core::{
- diagnostic::{Range, Severity, Severity::*},
+ diagnostic::{Range, Severity::*},
Diagnostic,
};
- use helix_lsp::{lsp, util::lsp_pos_to_pos};
use lsp::DiagnosticSeverity;
let language_server = doc.language_server().unwrap();
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index fa251ff02..e3accaeb3 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -1,20 +1,21 @@
use helix_core::{
comment, coords_at_pos, find_first_non_whitespace_char, find_root, graphemes, indent,
line_ending::{
- get_line_ending, get_line_ending_of_str, line_end_char_index, rope_end_without_line_ending,
+ get_line_ending_of_str, line_end_char_index, rope_end_without_line_ending,
str_is_line_ending,
},
match_brackets,
movement::{self, Direction},
object, pos_at_coords,
regex::{self, Regex},
- register::{self, Register, Registers},
- search, selection, Change, ChangeSet, LineEnding, Position, Range, Rope, RopeGraphemes,
- RopeSlice, Selection, SmallVec, Tendril, Transaction, DEFAULT_LINE_ENDING,
+ register::Register,
+ search, selection, LineEnding, Position, Range, Rope, RopeGraphemes, RopeSlice, Selection,
+ SmallVec, Tendril, Transaction,
};
use helix_view::{
document::{IndentStyle, Mode},
+ editor::Action,
input::KeyEvent,
keyboard::KeyCode,
view::{View, PADDING},
@@ -25,19 +26,19 @@ use anyhow::anyhow;
use helix_lsp::{
lsp,
util::{lsp_pos_to_pos, lsp_range_to_range, pos_to_lsp_pos, range_to_lsp_range},
- LspProgressMap, OffsetEncoding,
+ OffsetEncoding,
};
use insert::*;
use movement::Movement;
use crate::{
- compositor::{self, Callback, Component, Compositor},
- ui::{self, Completion, Picker, Popup, Prompt, PromptEvent},
+ compositor::{self, Component, Compositor},
+ ui::{self, Picker, Popup, Prompt, PromptEvent},
};
-use crate::job::{self, Job, JobFuture, Jobs};
+use crate::job::{self, Job, Jobs};
use futures_util::{FutureExt, TryFutureExt};
-use std::{fmt, future::Future, path::Display, str::FromStr};
+use std::{fmt, future::Future};
use std::{
borrow::Cow,
@@ -1148,7 +1149,6 @@ mod cmd {
cx: &mut compositor::Context,
path: Option
,
) -> Result>, anyhow::Error> {
- use anyhow::anyhow;
let jobs = &mut cx.jobs;
let (view, doc) = current!(cx.editor);
@@ -1723,7 +1723,6 @@ fn command_mode(cx: &mut Context) {
// simple heuristic: if there's no just one part, complete command name.
// if there's a space, per command completion kicks in.
if parts.len() <= 1 {
- use std::{borrow::Cow, ops::Range};
let end = 0..;
cmd::TYPABLE_COMMAND_LIST
.iter()
@@ -1753,8 +1752,6 @@ fn command_mode(cx: &mut Context) {
}
}, // completion
move |cx: &mut compositor::Context, input: &str, event: PromptEvent| {
- use helix_view::editor::Action;
-
if event != PromptEvent::Validate {
return;
}
@@ -1792,7 +1789,6 @@ fn file_picker(cx: &mut Context) {
}
fn buffer_picker(cx: &mut Context) {
- use std::path::{Path, PathBuf};
let current = view!(cx.editor).doc;
let picker = Picker::new(
@@ -1815,7 +1811,6 @@ fn buffer_picker(cx: &mut Context) {
}
},
|editor: &mut Editor, (id, _path): &(DocumentId, Option), _action| {
- use helix_view::editor::Action;
editor.switch(*id, Action::Replace);
},
);
@@ -2145,8 +2140,6 @@ fn goto_impl(
locations: Vec,
offset_encoding: OffsetEncoding,
) {
- use helix_view::editor::Action;
-
push_jump(editor);
fn jump_to(
@@ -3181,7 +3174,6 @@ fn completion(cx: &mut Context) {
if items.is_empty() {
return;
}
- use crate::compositor::AnyComponent;
let size = compositor.size();
let ui = compositor
.find(std::any::type_name::())
@@ -3332,11 +3324,7 @@ fn rotate_view(cx: &mut Context) {
}
// split helper, clear it later
-use helix_view::editor::Action;
-
-use self::cmd::TypableCommand;
fn split(cx: &mut Context, action: Action) {
- use helix_view::editor::Action;
let (view, doc) = current!(cx.editor);
let id = doc.id();
let selection = doc.selection(view.id).clone();
diff --git a/helix-term/src/compositor.rs b/helix-term/src/compositor.rs
index ba8c4bc74..46da04beb 100644
--- a/helix-term/src/compositor.rs
+++ b/helix-term/src/compositor.rs
@@ -2,7 +2,6 @@
// Q: how does this work with popups?
// cursive does compositor.screen_mut().add_layer_at(pos::absolute(x, y), )
use helix_core::Position;
-use helix_lsp::LspProgressMap;
use helix_view::graphics::{CursorKind, Rect};
use crossterm::event::Event;
diff --git a/helix-term/src/config.rs b/helix-term/src/config.rs
index 3c05144a1..b5ccbdfb0 100644
--- a/helix-term/src/config.rs
+++ b/helix-term/src/config.rs
@@ -1,10 +1,10 @@
-use anyhow::{Error, Result};
use serde::Deserialize;
-use std::collections::HashMap;
-use crate::commands::Command;
use crate::keymap::Keymaps;
+#[cfg(test)]
+use crate::commands::Command;
+
#[derive(Debug, Default, Clone, PartialEq, Deserialize)]
pub struct Config {
pub theme: Option,
diff --git a/helix-term/src/job.rs b/helix-term/src/job.rs
index 4b59c81c5..c28735138 100644
--- a/helix-term/src/job.rs
+++ b/helix-term/src/job.rs
@@ -3,7 +3,7 @@ use helix_view::Editor;
use crate::compositor::Compositor;
use futures_util::future::{self, BoxFuture, Future, FutureExt};
-use futures_util::stream::{self, FuturesUnordered, Select, StreamExt};
+use futures_util::stream::{FuturesUnordered, StreamExt};
pub type Callback = Box;
pub type JobFuture = BoxFuture<'static, anyhow::Result