@@ -1,20 +1,21 @@
1use helix_core::{
1use helix_core::{
2 comment, coords_at_pos, find_first_non_whitespace_char, find_root, graphemes, indent,
2 comment, coords_at_pos, find_first_non_whitespace_char, find_root, graphemes, indent,
3 line_ending::{
3 line_ending::{
4− get_line_ending, get_line_ending_of_str, line_end_char_index, rope_end_without_line_ending,
4+ get_line_ending_of_str, line_end_char_index, rope_end_without_line_ending,
5 str_is_line_ending,
5 str_is_line_ending,
7 match_brackets,
7 match_brackets,
8 movement::{self, Direction},
8 movement::{self, Direction},
9 object, pos_at_coords,
9 object, pos_at_coords,
10 regex::{self, Regex},
10 regex::{self, Regex},
11− register::{self, Register, Registers},
11+ register::Register,
12− search, selection, Change, ChangeSet, LineEnding, Position, Range, Rope, RopeGraphemes,
12+ search, selection, LineEnding, Position, Range, Rope, RopeGraphemes, RopeSlice, Selection,
13− RopeSlice, Selection, SmallVec, Tendril, Transaction, DEFAULT_LINE_ENDING,
13+ SmallVec, Tendril, Transaction,
16use helix_view::{
16use helix_view::{
17 document::{IndentStyle, Mode},
17 document::{IndentStyle, Mode},
18 input::KeyEvent,
19 input::KeyEvent,
19 keyboard::KeyCode,
20 keyboard::KeyCode,
20 view::{View, PADDING},
21 view::{View, PADDING},
@@ -25,19 +26,19 @@ use anyhow::anyhow;
25use helix_lsp::{
26use helix_lsp::{
27 util::{lsp_pos_to_pos, lsp_range_to_range, pos_to_lsp_pos, range_to_lsp_range},
28 util::{lsp_pos_to_pos, lsp_range_to_range, pos_to_lsp_pos, range_to_lsp_range},
28− LspProgressMap, OffsetEncoding,
29+ OffsetEncoding,
30use insert::*;
31use insert::*;
31use movement::Movement;
32use movement::Movement;
33use crate::{
34use crate::{
34− compositor::{self, Callback, Component, Compositor},
35+ compositor::{self, Component, Compositor},
35− ui::{self, Completion, Picker, Popup, Prompt, PromptEvent},
36+ ui::{self, Picker, Popup, Prompt, PromptEvent},
38−use crate::job::{self, Job, JobFuture, Jobs};
39+use crate::job::{self, Job, Jobs};
39use futures_util::{FutureExt, TryFutureExt};
40use futures_util::{FutureExt, TryFutureExt};
40−use std::{fmt, future::Future, path::Display, str::FromStr};
41+use std::{fmt, future::Future};
43 borrow::Cow,
44 borrow::Cow,
@@ -59,7 +60,7 @@ pub struct Context<'a> {
60impl<'a> Context<'a> {
61impl<'a> Context<'a> {
61 /// Push a new component onto the compositor.
62 /// Push a new component onto the compositor.
62− pub fn push_layer(&mut self, mut component: Box<dyn Component>) {
63+ pub fn push_layer(&mut self, component: Box<dyn Component>) {
63 self.callback = Some(Box::new(|compositor: &mut Compositor| {
64 self.callback = Some(Box::new(|compositor: &mut Compositor| {
64 compositor.push(component)
65 compositor.push(component)
@@ -515,7 +516,7 @@ fn extend_next_word_start(cx: &mut Context) {
515 let (view, doc) = current!(cx.editor);
516 let (view, doc) = current!(cx.editor);
516 doc.set_selection(
517 doc.set_selection(
518− doc.selection(view.id).clone().transform(|mut range| {
519+ doc.selection(view.id).clone().transform(|range| {
519 let word = movement::move_next_word_start(doc.text().slice(..), range, count);
520 let word = movement::move_next_word_start(doc.text().slice(..), range, count);
520 let pos = word.head;
521 let pos = word.head;
521 Range::new(range.anchor, pos)
522 Range::new(range.anchor, pos)
@@ -528,7 +529,7 @@ fn extend_prev_word_start(cx: &mut Context) {
528 let (view, doc) = current!(cx.editor);
529 let (view, doc) = current!(cx.editor);
529 doc.set_selection(
530 doc.set_selection(
531− doc.selection(view.id).clone().transform(|mut range| {
532+ doc.selection(view.id).clone().transform(|range| {
532 let word = movement::move_prev_word_start(doc.text().slice(..), range, count);
533 let word = movement::move_prev_word_start(doc.text().slice(..), range, count);
533 let pos = word.head;
534 let pos = word.head;
534 Range::new(range.anchor, pos)
535 Range::new(range.anchor, pos)
@@ -541,7 +542,7 @@ fn extend_next_word_end(cx: &mut Context) {
541 let (view, doc) = current!(cx.editor);
542 let (view, doc) = current!(cx.editor);
542 doc.set_selection(
543 doc.set_selection(
544− doc.selection(view.id).clone().transform(|mut range| {
545+ doc.selection(view.id).clone().transform(|range| {
545 let word = movement::move_next_word_end(doc.text().slice(..), range, count);
546 let word = movement::move_next_word_end(doc.text().slice(..), range, count);
546 let pos = word.head;
547 let pos = word.head;
547 Range::new(range.anchor, pos)
548 Range::new(range.anchor, pos)
@@ -592,7 +593,7 @@ where
593 doc.set_selection(
594 doc.set_selection(
595− doc.selection(view.id).clone().transform(|mut range| {
596+ doc.selection(view.id).clone().transform(|range| {
596 search_fn(doc.text().slice(..), ch, range.head, count, inclusive).map_or(
597 search_fn(doc.text().slice(..), ch, range.head, count, inclusive).map_or(
@@ -986,7 +987,7 @@ fn search_impl(doc: &mut Document, view: &mut View, contents: &str, regex: &Rege
987// TODO: use one function for search vs extend
988// TODO: use one function for search vs extend
988fn search(cx: &mut Context) {
989fn search(cx: &mut Context) {
989− let (view, doc) = current!(cx.editor);
990+ let (_, doc) = current!(cx.editor);
991 // TODO: could probably share with select_on_matches?
992 // TODO: could probably share with select_on_matches?
@@ -994,7 +995,6 @@ fn search(cx: &mut Context) {
994 // feed chunks into the regex yet
995 // feed chunks into the regex yet
995 let contents = doc.text().slice(..).to_string();
996 let contents = doc.text().slice(..).to_string();
997− let view_id = view.id;
998 let prompt = ui::regex_prompt(
998 let prompt = ui::regex_prompt(
1000 "search:".to_string(),
1000 "search:".to_string(),
@@ -1046,7 +1046,7 @@ fn extend_line(cx: &mut Context) {
1046 let line_start = text.char_to_line(pos.anchor);
1046 let line_start = text.char_to_line(pos.anchor);
1047 let start = text.line_to_char(line_start);
1047 let start = text.line_to_char(line_start);
1048 let line_end = text.char_to_line(pos.head);
1048 let line_end = text.char_to_line(pos.head);
1049− let mut end = line_end_char_index(&text.slice(..), line_end);
1049+ let mut end = line_end_char_index(&text.slice(..), line_end + count.saturating_sub(1));
1051 if pos.anchor == start && pos.head == end && line_end < (text.len_lines() - 2) {
1051 if pos.anchor == start && pos.head == end && line_end < (text.len_lines() - 2) {
1052 end = line_end_char_index(&text.slice(..), line_end + 1);
1052 end = line_end_char_index(&text.slice(..), line_end + 1);
@@ -1065,7 +1065,6 @@ fn delete_selection_impl(reg: &mut Register, doc: &mut Document, view_id: ViewId
1066 // then delete
1066 // then delete
1067 let transaction = Transaction::change_by_selection(doc.text(), &selection, |range| {
1067 let transaction = Transaction::change_by_selection(doc.text(), &selection, |range| {
1068− let line = text.char_to_line(range.head);
1069 (range.from(), range.to(), None)
1068 (range.from(), range.to(), None)
1071 doc.apply(&transaction, view_id);
1070 doc.apply(&transaction, view_id);
@@ -1175,7 +1174,7 @@ mod cmd {
1175 pub completer: Option<Completer>,
1174 pub completer: Option<Completer>,
1178− fn quit(cx: &mut compositor::Context, args: &[&str], event: PromptEvent) {
1177+ fn quit(cx: &mut compositor::Context, _args: &[&str], _event: PromptEvent) {
1179 // last view and we have unsaved changes
1178 // last view and we have unsaved changes
1180 if cx.editor.tree.views().count() == 1 && buffers_remaining_impl(cx.editor) {
1179 if cx.editor.tree.views().count() == 1 && buffers_remaining_impl(cx.editor) {
@@ -1184,16 +1183,16 @@ mod cmd {
1184 .close(view!(cx.editor).id, /* close_buffer */ false);
1183 .close(view!(cx.editor).id, /* close_buffer */ false);
1187− fn force_quit(cx: &mut compositor::Context, args: &[&str], event: PromptEvent) {
1186+ fn force_quit(cx: &mut compositor::Context, _args: &[&str], _event: PromptEvent) {
1188 cx.editor
1187 cx.editor
1189 .close(view!(cx.editor).id, /* close_buffer */ false);
1188 .close(view!(cx.editor).id, /* close_buffer */ false);
1192− fn open(cx: &mut compositor::Context, args: &[&str], event: PromptEvent) {
1191+ fn open(cx: &mut compositor::Context, args: &[&str], _event: PromptEvent) {
1193 match args.get(0) {
1192 match args.get(0) {
1194 Some(path) => {
1193 Some(path) => {
1195 // TODO: handle error
1194 // TODO: handle error
1196− cx.editor.open(path.into(), Action::Replace);
1195+ let _ = cx.editor.open(path.into(), Action::Replace);
1198 None => {
1197 None => {
1199 cx.editor.set_error("wrong argument count".to_string());
1198 cx.editor.set_error("wrong argument count".to_string());
@@ -1205,9 +1204,8 @@ mod cmd {
1205 cx: &mut compositor::Context,
1204 cx: &mut compositor::Context,
1206 path: Option<P>,
1205 path: Option<P>,
1207 ) -> Result<tokio::task::JoinHandle<Result<(), anyhow::Error>>, anyhow::Error> {
1206 ) -> Result<tokio::task::JoinHandle<Result<(), anyhow::Error>>, anyhow::Error> {
1208− use anyhow::anyhow;
1209 let jobs = &mut cx.jobs;
1207 let jobs = &mut cx.jobs;
1210− let (view, doc) = current!(cx.editor);
1208+ let (_, doc) = current!(cx.editor);
1212 if let Some(path) = path {
1210 if let Some(path) = path {
1213 if let Err(err) = doc.set_path(path.as_ref()) {
1211 if let Err(err) = doc.set_path(path.as_ref()) {
@@ -1231,7 +1229,7 @@ mod cmd {
1231 Ok(tokio::spawn(doc.format_and_save(fmt)))
1229 Ok(tokio::spawn(doc.format_and_save(fmt)))
1234− fn write(cx: &mut compositor::Context, args: &[&str], event: PromptEvent) {
1232+ fn write(cx: &mut compositor::Context, args: &[&str], _event: PromptEvent) {
1235 match write_impl(cx, args.first()) {
1233 match write_impl(cx, args.first()) {
1236 Err(e) => cx.editor.set_error(e.to_string()),
1234 Err(e) => cx.editor.set_error(e.to_string()),
1237 Ok(handle) => {
1235 Ok(handle) => {
@@ -1241,11 +1239,11 @@ mod cmd {
1244− fn new_file(cx: &mut compositor::Context, args: &[&str], event: PromptEvent) {
1242+ fn new_file(cx: &mut compositor::Context, _args: &[&str], _event: PromptEvent) {
1245 cx.editor.new_file(Action::Replace);
1243 cx.editor.new_file(Action::Replace);
1248− fn format(cx: &mut compositor::Context, args: &[&str], event: PromptEvent) {
1246+ fn format(cx: &mut compositor::Context, _args: &[&str], _event: PromptEvent) {
1249 let (_, doc) = current!(cx.editor);
1247 let (_, doc) = current!(cx.editor);
1251 if let Some(format) = doc.format() {
1249 if let Some(format) = doc.format() {
@@ -1255,7 +1253,7 @@ mod cmd {
1258− fn set_indent_style(cx: &mut compositor::Context, args: &[&str], event: PromptEvent) {
1256+ fn set_indent_style(cx: &mut compositor::Context, args: &[&str], _event: PromptEvent) {
1259 use IndentStyle::*;
1257 use IndentStyle::*;
1261 // If no argument, report current indent style.
1259 // If no argument, report current indent style.
@@ -1293,7 +1291,7 @@ mod cmd {
1295 /// Sets or reports the current document's line ending setting.
1293 /// Sets or reports the current document's line ending setting.
1296− fn set_line_ending(cx: &mut compositor::Context, args: &[&str], event: PromptEvent) {
1294+ fn set_line_ending(cx: &mut compositor::Context, args: &[&str], _event: PromptEvent) {
1297 use LineEnding::*;
1295 use LineEnding::*;
1299 // If no argument, report current line ending setting.
1297 // If no argument, report current line ending setting.
@@ -1332,7 +1330,7 @@ mod cmd {
1335− fn earlier(cx: &mut compositor::Context, args: &[&str], event: PromptEvent) {
1333+ fn earlier(cx: &mut compositor::Context, args: &[&str], _event: PromptEvent) {
1336 let uk = match args.join(" ").parse::<helix_core::history::UndoKind>() {
1334 let uk = match args.join(" ").parse::<helix_core::history::UndoKind>() {
1337 Ok(uk) => uk,
1335 Ok(uk) => uk,
1338 Err(msg) => {
1336 Err(msg) => {
@@ -1344,7 +1342,7 @@ mod cmd {
1344 doc.earlier(view.id, uk)
1342 doc.earlier(view.id, uk)
1347− fn later(cx: &mut compositor::Context, args: &[&str], event: PromptEvent) {
1345+ fn later(cx: &mut compositor::Context, args: &[&str], _event: PromptEvent) {
1348 let uk = match args.join(" ").parse::<helix_core::history::UndoKind>() {
1346 let uk = match args.join(" ").parse::<helix_core::history::UndoKind>() {
1349 Ok(uk) => uk,
1347 Ok(uk) => uk,
1350 Err(msg) => {
1348 Err(msg) => {
@@ -1372,7 +1370,6 @@ mod cmd {
1374 fn force_write_quit(cx: &mut compositor::Context, args: &[&str], event: PromptEvent) {
1372 fn force_write_quit(cx: &mut compositor::Context, args: &[&str], event: PromptEvent) {
1375− let (view, doc) = current!(cx.editor);
1376 match write_impl(cx, args.first()) {
1373 match write_impl(cx, args.first()) {
1377 Ok(handle) => {
1374 Ok(handle) => {
1378 if let Err(e) = helix_lsp::block_on(handle) {
1375 if let Err(e) = helix_lsp::block_on(handle) {
@@ -1414,20 +1411,22 @@ mod cmd {
1415 fn write_all_impl(
1412 fn write_all_impl(
1416 editor: &mut Editor,
1413 editor: &mut Editor,
1417− args: &[&str],
1414+ _args: &[&str],
1418− event: PromptEvent,
1415+ _event: PromptEvent,
1419 quit: bool,
1416 quit: bool,
1420 force: bool,
1417 force: bool,
1422 let mut errors = String::new();
1419 let mut errors = String::new();
1424 // save all documents
1421 // save all documents
1425− for (id, mut doc) in &mut editor.documents {
1422+ for (_, doc) in &mut editor.documents {
1426 if doc.path().is_none() {
1423 if doc.path().is_none() {
1427 errors.push_str("cannot write a buffer without a filename\n");
1424 errors.push_str("cannot write a buffer without a filename\n");
1428 continue;
1425 continue;
1428+ // TODO: handle error.
1430− helix_lsp::block_on(tokio::spawn(doc.save()));
1429+ let _ = helix_lsp::block_on(tokio::spawn(doc.save()));
1432 editor.set_error(errors);
1431 editor.set_error(errors);
@@ -1456,7 +1455,7 @@ mod cmd {
1456 write_all_impl(&mut cx.editor, args, event, true, true)
1455 write_all_impl(&mut cx.editor, args, event, true, true)
1459− fn quit_all_impl(editor: &mut Editor, args: &[&str], event: PromptEvent, force: bool) {
1458+ fn quit_all_impl(editor: &mut Editor, _args: &[&str], _event: PromptEvent, force: bool) {
1460 if !force && buffers_remaining_impl(editor) {
1459 if !force && buffers_remaining_impl(editor) {
@@ -1476,7 +1475,7 @@ mod cmd {
1476 quit_all_impl(&mut cx.editor, args, event, true)
1475 quit_all_impl(&mut cx.editor, args, event, true)
1479− fn theme(cx: &mut compositor::Context, args: &[&str], event: PromptEvent) {
1478+ fn theme(cx: &mut compositor::Context, args: &[&str], _event: PromptEvent) {
1480 let theme = if let Some(theme) = args.first() {
1479 let theme = if let Some(theme) = args.first() {
1482 } else {
1481 } else {
@@ -1487,11 +1486,15 @@ mod cmd {
1487 cx.editor.set_theme_from_name(theme);
1486 cx.editor.set_theme_from_name(theme);
1490− fn yank_main_selection_to_clipboard(cx: &mut compositor::Context, _: &[&str], _: PromptEvent) {
1489+ fn yank_main_selection_to_clipboard(
1490+ cx: &mut compositor::Context,
1492+ _event: PromptEvent,
1491 yank_main_selection_to_clipboard_impl(&mut cx.editor);
1494 yank_main_selection_to_clipboard_impl(&mut cx.editor);
1494− fn yank_joined_to_clipboard(cx: &mut compositor::Context, args: &[&str], _: PromptEvent) {
1497+ fn yank_joined_to_clipboard(cx: &mut compositor::Context, args: &[&str], _event: PromptEvent) {
1495 let (_, doc) = current!(cx.editor);
1498 let (_, doc) = current!(cx.editor);
1496 let separator = args
1499 let separator = args
1497 .first()
1500 .first()
@@ -1500,15 +1503,19 @@ mod cmd {
1500 yank_joined_to_clipboard_impl(&mut cx.editor, separator);
1503 yank_joined_to_clipboard_impl(&mut cx.editor, separator);
1503− fn paste_clipboard_after(cx: &mut compositor::Context, _: &[&str], _: PromptEvent) {
1506+ fn paste_clipboard_after(cx: &mut compositor::Context, _args: &[&str], _event: PromptEvent) {
1504 paste_clipboard_impl(&mut cx.editor, Paste::After);
1507 paste_clipboard_impl(&mut cx.editor, Paste::After);
1507− fn paste_clipboard_before(cx: &mut compositor::Context, _: &[&str], _: PromptEvent) {
1510+ fn paste_clipboard_before(cx: &mut compositor::Context, _args: &[&str], _event: PromptEvent) {
1508 paste_clipboard_impl(&mut cx.editor, Paste::After);
1511 paste_clipboard_impl(&mut cx.editor, Paste::After);
1511− fn replace_selections_with_clipboard(cx: &mut compositor::Context, _: &[&str], _: PromptEvent) {
1514+ fn replace_selections_with_clipboard(
1515+ cx: &mut compositor::Context,
1517+ _event: PromptEvent,
1512 let (view, doc) = current!(cx.editor);
1519 let (view, doc) = current!(cx.editor);
1514 match cx.editor.clipboard_provider.get_contents() {
1521 match cx.editor.clipboard_provider.get_contents() {
@@ -1529,12 +1536,12 @@ mod cmd {
1532− fn show_clipboard_provider(cx: &mut compositor::Context, _: &[&str], _: PromptEvent) {
1539+ fn show_clipboard_provider(cx: &mut compositor::Context, _args: &[&str], _event: PromptEvent) {
1533 cx.editor
1540 cx.editor
1534 .set_status(cx.editor.clipboard_provider.name().into());
1541 .set_status(cx.editor.clipboard_provider.name().into());
1537− fn change_current_directory(cx: &mut compositor::Context, args: &[&str], _: PromptEvent) {
1544+ fn change_current_directory(cx: &mut compositor::Context, args: &[&str], _event: PromptEvent) {
1538 let dir = match args.first() {
1545 let dir = match args.first() {
1539 Some(dir) => dir,
1546 Some(dir) => dir,
1540 None => {
1547 None => {
@@ -1562,7 +1569,7 @@ mod cmd {
1565− fn show_current_directory(cx: &mut compositor::Context, args: &[&str], _: PromptEvent) {
1572+ fn show_current_directory(cx: &mut compositor::Context, _args: &[&str], _event: PromptEvent) {
1566 match std::env::current_dir() {
1573 match std::env::current_dir() {
1567 Ok(cwd) => cx
1574 Ok(cwd) => cx
@@ -1782,7 +1789,6 @@ fn command_mode(cx: &mut Context) {
1782 // simple heuristic: if there's no just one part, complete command name.
1789 // simple heuristic: if there's no just one part, complete command name.
1783 // if there's a space, per command completion kicks in.
1790 // if there's a space, per command completion kicks in.
1784 if parts.len() <= 1 {
1791 if parts.len() <= 1 {
1785− use std::{borrow::Cow, ops::Range};
1786 let end = 0..;
1792 let end = 0..;
1787 cmd::TYPABLE_COMMAND_LIST
1793 cmd::TYPABLE_COMMAND_LIST
@@ -1812,8 +1818,6 @@ fn command_mode(cx: &mut Context) {
1813 }, // completion
1819 }, // completion
1814 move |cx: &mut compositor::Context, input: &str, event: PromptEvent| {
1820 move |cx: &mut compositor::Context, input: &str, event: PromptEvent| {
1815− use helix_view::editor::Action;
1817 if event != PromptEvent::Validate {
1821 if event != PromptEvent::Validate {
@@ -1851,7 +1855,6 @@ fn file_picker(cx: &mut Context) {
1853fn buffer_picker(cx: &mut Context) {
1857fn buffer_picker(cx: &mut Context) {
1854− use std::path::{Path, PathBuf};
1855 let current = view!(cx.editor).doc;
1858 let current = view!(cx.editor).doc;
1857 let picker = Picker::new(
1860 let picker = Picker::new(
@@ -1874,7 +1877,6 @@ fn buffer_picker(cx: &mut Context) {
1876 |editor: &mut Editor, (id, _path): &(DocumentId, Option<PathBuf>), _action| {
1879 |editor: &mut Editor, (id, _path): &(DocumentId, Option<PathBuf>), _action| {
1877− use helix_view::editor::Action;
1878 editor.switch(*id, Action::Replace);
1880 editor.switch(*id, Action::Replace);
@@ -1900,7 +1902,7 @@ fn symbol_picker(cx: &mut Context) {
1900 nested_to_flat(list, file, child);
1902 nested_to_flat(list, file, child);
1903− let (view, doc) = current!(cx.editor);
1905+ let (_, doc) = current!(cx.editor);
1905 let language_server = match doc.language_server() {
1907 let language_server = match doc.language_server() {
1906 Some(language_server) => language_server,
1908 Some(language_server) => language_server,
@@ -1993,7 +1995,7 @@ async fn make_format_callback(
1993 format: impl Future<Output = helix_lsp::util::LspFormatting> + Send + 'static,
1995 format: impl Future<Output = helix_lsp::util::LspFormatting> + Send + 'static,
1994) -> anyhow::Result<job::Callback> {
1996) -> anyhow::Result<job::Callback> {
1995 let format = format.await;
1997 let format = format.await;
1996− let call: job::Callback = Box::new(move |editor: &mut Editor, compositor: &mut Compositor| {
1998+ let call: job::Callback = Box::new(move |editor: &mut Editor, _compositor: &mut Compositor| {
1997 let view_id = view!(editor).id;
1999 let view_id = view!(editor).id;
1998 if let Some(doc) = editor.document_mut(doc_id) {
2000 if let Some(doc) = editor.document_mut(doc_id) {
1999 if doc.version() == doc_version {
2001 if doc.version() == doc_version {
@@ -2168,9 +2170,6 @@ fn goto_mode(cx: &mut Context) {
2168 (_, 't') | (_, 'm') | (_, 'b') => {
2170 (_, 't') | (_, 'm') | (_, 'b') => {
2169 let (view, doc) = current!(cx.editor);
2171 let (view, doc) = current!(cx.editor);
2171− let pos = doc.selection(view.id).cursor();
2172− let line = doc.text().char_to_line(pos);
2174 let scrolloff = PADDING.min(view.area.height as usize / 2); // TODO: user pref
2173 let scrolloff = PADDING.min(view.area.height as usize / 2); // TODO: user pref
2176 let last_line = view.last_line(doc);
2175 let last_line = view.last_line(doc);
@@ -2207,8 +2206,6 @@ fn goto_impl(
2207 locations: Vec<lsp::Location>,
2206 locations: Vec<lsp::Location>,
2208 offset_encoding: OffsetEncoding,
2207 offset_encoding: OffsetEncoding,
2210− use helix_view::editor::Action;
2212 push_jump(editor);
2209 push_jump(editor);
2214 fn jump_to(
2211 fn jump_to(
@@ -2221,7 +2218,7 @@ fn goto_impl(
2222 .to_file_path()
2219 .to_file_path()
2223 .expect("unable to convert URI to filepath");
2220 .expect("unable to convert URI to filepath");
2224− let id = editor.open(path, action).expect("editor.open failed");
2221+ let _id = editor.open(path, action).expect("editor.open failed");
2225 let (view, doc) = current!(editor);
2222 let (view, doc) = current!(editor);
2226 let definition_pos = location.range.start;
2223 let definition_pos = location.range.start;
2227 // TODO: convert inside server
2224 // TODO: convert inside server
@@ -2243,7 +2240,7 @@ fn goto_impl(
2243 editor.set_error("No definition found.".to_string());
2240 editor.set_error("No definition found.".to_string());
2245 _locations => {
2242 _locations => {
2246− let mut picker = ui::Picker::new(
2243+ let picker = ui::Picker::new(
2247 locations,
2244 locations,
2248 |location| {
2245 |location| {
2249 let file = location.uri.as_str();
2246 let file = location.uri.as_str();
@@ -2410,9 +2407,8 @@ fn goto_pos(editor: &mut Editor, pos: usize) {
2411fn goto_first_diag(cx: &mut Context) {
2408fn goto_first_diag(cx: &mut Context) {
2412 let editor = &mut cx.editor;
2409 let editor = &mut cx.editor;
2413− let (view, doc) = current!(editor);
2410+ let (_, doc) = current!(editor);
2415− let cursor_pos = doc.selection(view.id).cursor();
2416 let diag = if let Some(diag) = doc.diagnostics().first() {
2412 let diag = if let Some(diag) = doc.diagnostics().first() {
2417 diag.range.start
2413 diag.range.start
2418 } else {
2414 } else {
@@ -2424,9 +2420,8 @@ fn goto_first_diag(cx: &mut Context) {
2425fn goto_last_diag(cx: &mut Context) {
2421fn goto_last_diag(cx: &mut Context) {
2426 let editor = &mut cx.editor;
2422 let editor = &mut cx.editor;
2427− let (view, doc) = current!(editor);
2423+ let (_, doc) = current!(editor);
2429− let cursor_pos = doc.selection(view.id).cursor();
2430 let diag = if let Some(diag) = doc.diagnostics().last() {
2425 let diag = if let Some(diag) = doc.diagnostics().last() {
2431 diag.range.start
2426 diag.range.start
2432 } else {
2427 } else {
@@ -2498,8 +2493,8 @@ fn signature_help(cx: &mut Context) {
2499 cx.callback(
2494 cx.callback(
2501− move |editor: &mut Editor,
2496+ move |_editor: &mut Editor,
2502− compositor: &mut Compositor,
2497+ _compositor: &mut Compositor,
2503 response: Option<lsp::SignatureHelp>| {
2498 response: Option<lsp::SignatureHelp>| {
2504 if let Some(signature_help) = response {
2499 if let Some(signature_help) = response {
2505 log::info!("{:?}", signature_help);
2500 log::info!("{:?}", signature_help);
@@ -3080,8 +3075,10 @@ fn format_selections(cx: &mut Context) {
3080 .map(|range| range_to_lsp_range(doc.text(), *range, language_server.offset_encoding()))
3075 .map(|range| range_to_lsp_range(doc.text(), *range, language_server.offset_encoding()))
3081 .collect();
3076 .collect();
3078+ // TODO: all of the TODO's and commented code inside the loop,
3079+ // to make this actually work.
3083− for range in ranges {
3080+ for _range in ranges {
3084− let language_server = match doc.language_server() {
3081+ let _language_server = match doc.language_server() {
3085 Some(language_server) => language_server,
3082 Some(language_server) => language_server,
3086 None => return,
3083 None => return,
@@ -3129,7 +3126,7 @@ fn join_selections(cx: &mut Context) {
3129 changes.reserve(lines.len());
3126 changes.reserve(lines.len());
3131 for line in lines {
3128 for line in lines {
3132− let mut start = line_end_char_index(&slice, line);
3129+ let start = line_end_char_index(&slice, line);
3133 let mut end = text.line_to_char(line + 1);
3130 let mut end = text.line_to_char(line + 1);
3134 end = skip_while(slice, end, |ch| matches!(ch, ' ' | '\t')).unwrap_or(end);
3131 end = skip_while(slice, end, |ch| matches!(ch, ' ' | '\t')).unwrap_or(end);
@@ -3252,7 +3249,6 @@ fn completion(cx: &mut Context) {
3252 if items.is_empty() {
3249 if items.is_empty() {
3255− use crate::compositor::AnyComponent;
3256 let size = compositor.size();
3252 let size = compositor.size();
3257 let ui = compositor
3253 let ui = compositor
3258 .find(std::any::type_name::<ui::EditorView>())
3254 .find(std::any::type_name::<ui::EditorView>())
@@ -3306,7 +3302,7 @@ fn hover(cx: &mut Context) {
3306 // skip if contents empty
3302 // skip if contents empty
3308 let contents = ui::Markdown::new(contents, editor.syn_loader.clone());
3304 let contents = ui::Markdown::new(contents, editor.syn_loader.clone());
3309− let mut popup = Popup::new(contents);
3305+ let popup = Popup::new(contents);
3310 compositor.push(Box::new(popup));
3306 compositor.push(Box::new(popup));
@@ -3350,7 +3346,7 @@ fn match_brackets(cx: &mut Context) {
3351fn jump_forward(cx: &mut Context) {
3347fn jump_forward(cx: &mut Context) {
3352 let count = cx.count();
3348 let count = cx.count();
3353− let (view, doc) = current!(cx.editor);
3349+ let (view, _doc) = current!(cx.editor);
3355 if let Some((id, selection)) = view.jumps.forward(count) {
3351 if let Some((id, selection)) = view.jumps.forward(count) {
3356 view.doc = *id;
3352 view.doc = *id;
@@ -3403,11 +3399,7 @@ fn rotate_view(cx: &mut Context) {
3405// split helper, clear it later
3401// split helper, clear it later
3406−use helix_view::editor::Action;
3408−use self::cmd::TypableCommand;
3409fn split(cx: &mut Context, action: Action) {
3402fn split(cx: &mut Context, action: Action) {
3410− use helix_view::editor::Action;
3411 let (view, doc) = current!(cx.editor);
3403 let (view, doc) = current!(cx.editor);
3412 let id = doc.id();
3404 let id = doc.id();
3413 let selection = doc.selection(view.id).clone();
3405 let selection = doc.selection(view.id).clone();
@@ -3563,10 +3555,7 @@ fn match_mode(cx: &mut Context) {
3563 'm' => match_brackets(cx),
3555 'm' => match_brackets(cx),
3564 's' => surround_add(cx),
3556 's' => surround_add(cx),
3565 'r' => surround_replace(cx),
3557 'r' => surround_replace(cx),
3567− surround_delete(cx);
3558+ 'd' => surround_delete(cx),
3568− let (view, doc) = current!(cx.editor);
3570 _ => (),
3559 _ => (),
@@ -3588,7 +3577,7 @@ fn surround_add(cx: &mut Context) {
3588 let (open, close) = surround::get_pair(ch);
3577 let (open, close) = surround::get_pair(ch);
3590 let mut changes = Vec::new();
3579 let mut changes = Vec::new();
3591− for (i, range) in selection.iter().enumerate() {
3580+ for range in selection.iter() {
3592 changes.push((range.from(), range.from(), Some(Tendril::from_char(open))));
3581 changes.push((range.from(), range.from(), Some(Tendril::from_char(open))));
3593 changes.push((range.to(), range.to(), Some(Tendril::from_char(close))));
3582 changes.push((range.to(), range.to(), Some(Tendril::from_char(close))));