From 103b5125e4bc51965d98a38cdbeed2151ed816fa Mon Sep 17 00:00:00 2001 From: RustyStriker Date: Sun, 28 Nov 2021 03:19:54 +0200 Subject: Detect filetype on :write (#1141) fixes #1136 * removed a log::info * removed temp.rs * cargo clippy no longer complains * new get_lang_server function * get_lang_server is now launch_language_server * launch_lang_server will now close the previous one * better code readability * remove resfresh_ls(and a wrong comment)--- helix-term/src/commands.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'helix-term/src/commands.rs') diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index ff8d7a4f..8e57ef30 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1907,7 +1907,7 @@ mod cmd { let jobs = &mut cx.jobs; let (_, doc) = current!(cx.editor); - if let Some(path) = path { + if let Some(ref path) = path { doc.set_path(Some(path.as_ref())) .context("invalid filepath")?; } @@ -1927,6 +1927,11 @@ mod cmd { }); let future = doc.format_and_save(fmt); cx.jobs.add(Job::new(future).wait_before_exiting()); + + if path.is_some() { + let id = doc.id(); + let _ = cx.editor.refresh_language_server(id); + } Ok(()) } -- cgit v1.2.3-70-g09d2