@@ -1029,6 +1029,24 @@ fn reload(
1032+/// Update the [`Document`] if it has been modified.
1034+ cx: &mut compositor::Context,
1036+ event: PromptEvent,
1037+) -> anyhow::Result<()> {
1038+ if event != PromptEvent::Validate {
1042+ let (_view, doc) = current!(cx.editor);
1043+ if doc.is_modified() {
1044+ write(cx, args, event)
1032fn lsp_restart(
1050fn lsp_restart(
1033 cx: &mut compositor::Context,
1051 cx: &mut compositor::Context,
1034 _args: &[Cow<str>],
1052 _args: &[Cow<str>],
@@ -1957,6 +1975,13 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
1957 fun: reload,
1975 fun: reload,
1958 completer: None,
1976 completer: None,
1981+ doc: "Write changes only if the file has been modified.",
1960 TypableCommand {
1985 TypableCommand {
1961 name: "lsp-restart",
1986 name: "lsp-restart",
1962 aliases: &[],
1987 aliases: &[],