@@ -1545,7 +1545,7 @@ fn searcher(cx: &mut Context, direction: Direction) {
15451545 let reg = cx.register.unwrap_or('/');
15461546 let scrolloff = cx.editor.config.scrolloff;
15471547
1548− let (_, doc) = current!(cx.editor);
1548+ let doc = doc!(cx.editor);
15491549
15501550 // TODO: could probably share with select_on_matches?
15511551
@@ -2046,7 +2046,7 @@ pub mod cmd {
20462046
20472047 fn write_impl(cx: &mut compositor::Context, path: Option<&Cow<str>>) -> anyhow::Result<()> {
20482048 let jobs = &mut cx.jobs;
2049− let (_, doc) = current!(cx.editor);
2049+ let doc = doc_mut!(cx.editor);
20502050
20512051 if let Some(ref path) = path {
20522052 doc.set_path(Some(path.as_ref().as_ref()))
@@ -2099,8 +2099,7 @@ pub mod cmd {
20992099 _args: &[Cow<str>],
21002100 _event: PromptEvent,
21012101 ) -> anyhow::Result<()> {
2102− let (_, doc) = current!(cx.editor);
2103−
2102+ let doc = doc!(cx.editor);
21042103 if let Some(format) = doc.format() {
21052104 let callback =
21062105 make_format_callback(doc.id(), doc.version(), Modified::LeaveModified, format);
@@ -2409,7 +2408,7 @@ pub mod cmd {
24092408 args: &[Cow<str>],
24102409 _event: PromptEvent,
24112410 ) -> anyhow::Result<()> {
2412− let (_, doc) = current!(cx.editor);
2411+ let doc = doc!(cx.editor);
24132412 let default_sep = Cow::Borrowed(doc.line_ending.as_str());
24142413 let separator = args.first().unwrap_or(&default_sep);
24152414 yank_joined_to_clipboard_impl(cx.editor, separator, ClipboardType::Clipboard)
@@ -2428,7 +2427,7 @@ pub mod cmd {
24282427 args: &[Cow<str>],
24292428 _event: PromptEvent,
24302429 ) -> anyhow::Result<()> {
2431− let (_, doc) = current!(cx.editor);
2430+ let doc = doc!(cx.editor);
24322431 let default_sep = Cow::Borrowed(doc.line_ending.as_str());
24332432 let separator = args.first().unwrap_or(&default_sep);
24342433 yank_joined_to_clipboard_impl(cx.editor, separator, ClipboardType::Selection)
@@ -2555,7 +2554,7 @@ pub mod cmd {
25552554 args: &[Cow<str>],
25562555 _event: PromptEvent,
25572556 ) -> anyhow::Result<()> {
2558− let (_, doc) = current!(cx.editor);
2557+ let doc = doc_mut!(cx.editor);
25592558 if let Some(label) = args.first() {
25602559 doc.set_encoding(label)
25612560 } else {
@@ -3247,7 +3246,7 @@ fn symbol_picker(cx: &mut Context) {
32473246 nested_to_flat(list, file, child);
32483247 }
32493248 }
3250− let (_, doc) = current!(cx.editor);
3249+ let doc = doc!(cx.editor);
32513250
32523251 let language_server = match doc.language_server() {
32533252 Some(language_server) => language_server,
@@ -3268,7 +3267,7 @@ fn symbol_picker(cx: &mut Context) {
32683267 let symbols = match symbols {
32693268 lsp::DocumentSymbolResponse::Flat(symbols) => symbols,
32703269 lsp::DocumentSymbolResponse::Nested(symbols) => {
3271− let (_view, doc) = current!(editor);
3270+ let doc = doc!(editor);
32723271 let mut flat_symbols = Vec::new();
32733272 for symbol in symbols {
32743273 nested_to_flat(&mut flat_symbols, &doc.identifier(), symbol)
@@ -3310,17 +3309,15 @@ fn symbol_picker(cx: &mut Context) {
33103309}
33113310
33123311fn workspace_symbol_picker(cx: &mut Context) {
3313− let (_, doc) = current!(cx.editor);
3314−
3312+ let doc = doc!(cx.editor);
3313+ let current_path = doc.path().cloned();
33153314 let language_server = match doc.language_server() {
33163315 Some(language_server) => language_server,
33173316 None => return,
33183317 };
33193318 let offset_encoding = language_server.offset_encoding();
3320−
33213319 let future = language_server.workspace_symbols("".to_string());
33223320
3323− let current_path = doc_mut!(cx.editor).path().cloned();
33243321 cx.callback(
33253322 future,
33263323 move |_editor: &mut Editor,
@@ -3430,8 +3427,7 @@ pub fn code_action(cx: &mut Context) {
34303427}
34313428
34323429pub fn execute_lsp_command(editor: &mut Editor, cmd: lsp::Command) {
3433− let (_view, doc) = current!(editor);
3434−
3430+ let doc = doc!(editor);
34353431 let language_server = match doc.language_server() {
34363432 Some(language_server) => language_server,
34373433 None => return,
@@ -4185,27 +4181,21 @@ fn goto_pos(editor: &mut Editor, pos: usize) {
41854181}
41864182
41874183fn goto_first_diag(cx: &mut Context) {
4188− let editor = &mut cx.editor;
4189− let (_, doc) = current!(editor);
4190−
4184+ let doc = doc!(cx.editor);
41914185 let pos = match doc.diagnostics().first() {
41924186 Some(diag) => diag.range.start,
41934187 None => return,
41944188 };
4195−
4196− goto_pos(editor, pos);
4189+ goto_pos(cx.editor, pos);
41974190}
41984191
41994192fn goto_last_diag(cx: &mut Context) {
4200− let editor = &mut cx.editor;
4201− let (_, doc) = current!(editor);
4202−
4193+ let doc = doc!(cx.editor);
42034194 let pos = match doc.diagnostics().last() {
42044195 Some(diag) => diag.range.start,
42054196 None => return,
42064197 };
4207−
4208− goto_pos(editor, pos);
4198+ goto_pos(cx.editor, pos);
42094199}
42104200
42114201fn goto_next_diag(cx: &mut Context) {
@@ -5270,7 +5260,7 @@ pub fn completion(cx: &mut Context) {
52705260 move |editor: &mut Editor,
52715261 compositor: &mut Compositor,
52725262 response: Option<lsp::CompletionResponse>| {
5273− let (_, doc) = current!(editor);
5263+ let doc = doc!(editor);
52745264 if doc.mode() != Mode::Insert {
52755265 // we're not in insert mode anymore
52765266 return;