Elffuss BraidHub

kikocis/continue public

fix: prevent entering edit mode without editor

previously, edit mode was triggered even without an active editor and
the existing fallback mechanism failed silently if no active editor was
available.

this commit ensures that there is a validation check before entering
edit mode to ensure codeToEdit exists. It shows a toast message when
trying to switch to edit mode using '⌘I'. It also removes the fallback
check that occurs after edit mode is already activated.
Changesetb40c72ceceee3c8c5176258d95d0264cf38e4ffbe35da42b06001f30ba1837c7
AuthorKeerthana Panyam <panyam.k@northeastern.edu> · 2025-07-08 10:03 -04:00
CommitterKeerthana Panyam <panyam.k@northeastern.edu> · 2025-07-08 10:03 -04:00
Parentsb49f18a43c86

Browse the files at this changeset

2 files changed

modified gui/src/components/mainInput/Lump/LumpToolbar/EditToolbar.tsx +1 −3
@@ -30,9 +30,7 @@
3030 <span className="truncate">
3131 Editing:{" "}
3232 <span className="italic">
33- {codeToEdit
34- ? getEditFilenameAndRangeText(codeToEdit)
35- : "⚠️ No file selected"}
33+ {getEditFilenameAndRangeText(codeToEdit)}
3634 </span>
3735 </span>
3836 </div>
modified gui/src/redux/thunks/edit.ts +8 −4
@@ -133,6 +133,14 @@
133133 return;
134134 }
135135
136+ if (!state.editModeState.codeToEdit[0]) {
137+ extra.ideMessenger.post("showToast", [
138+ "info",
139+ "Please open a file to use Edit mode",
140+ ]);
141+ return;
142+ }
143+
136144 dispatch(setMainEditorContentTrigger({}));
137145 dispatch(setPreviousModeEditorContent(editorContent));
138146
@@ -148,9 +156,5 @@
148156 );
149157
150158 dispatch(setIsInEdit(true));
151-
152- if (!state.editModeState.codeToEdit[0]) {
153- extra.ideMessenger.post("edit/addCurrentSelection", undefined);
154- }
155159 },
156160 );