diff --git a/extensions/vscode/src/commands.ts b/extensions/vscode/src/commands.ts index 43115ae93..f41a308ae 100644 --- a/extensions/vscode/src/commands.ts +++ b/extensions/vscode/src/commands.ts @@ -218,10 +218,16 @@ async function processDiff( } else if (fullPath) { fullPath = getFullyQualifiedPath(ide, fullPath); } else { - console.warn(`Unable to resolve filepath: ${newFilepath}`); + const curFile = await ide.getCurrentFile(); + fullPath = curFile?.path; } - if (!fullPath) return; + if (!fullPath) { + console.warn( + `Unable to resolve filepath while attempting to resolve diff: ${newFilepath}`, + ); + return; + } await ide.openFile(fullPath); diff --git a/gui/src/components/StepContainer/AcceptRejectAllButtons.tsx b/gui/src/components/StepContainer/AcceptRejectAllButtons.tsx index d8a17ec8a..632468a65 100644 --- a/gui/src/components/StepContainer/AcceptRejectAllButtons.tsx +++ b/gui/src/components/StepContainer/AcceptRejectAllButtons.tsx @@ -2,6 +2,7 @@ import { useContext } from "react"; import { IdeMessengerContext } from "../../context/IdeMessenger"; import { CheckIcon, XMarkIcon } from "@heroicons/react/24/outline"; import { ApplyState } from "core"; +import { getMetaKeyLabel } from "../../util"; export interface AcceptRejectAllButtonsProps { pendingApplyStates: ApplyState[]; @@ -37,7 +38,7 @@ export default function AcceptRejectAllButtons({ > {hasSinglePendingApplyStates ? ( - Reject + Reject ({getMetaKeyLabel()}⇧⌫) ) : ( <> Reject @@ -52,7 +53,7 @@ export default function AcceptRejectAllButtons({ > {hasSinglePendingApplyStates ? ( - Accept + Accept ({getMetaKeyLabel()}⇧⏎) ) : ( <> Accept diff --git a/gui/src/pages/Edit/CodeToEdit.tsx b/gui/src/pages/Edit/CodeToEdit.tsx index 9de5847c3..4197488fc 100644 --- a/gui/src/pages/Edit/CodeToEdit.tsx +++ b/gui/src/pages/Edit/CodeToEdit.tsx @@ -11,16 +11,16 @@ import AddFileButton from "./AddFileButton"; export default function WorkingSet() { const dispatch = useDispatch(); const ideMessenger = useContext(IdeMessengerContext); - const editModeState = useSelector((state: RootState) => state.editModeState); - - const hasCodeToEdit = editModeState.codeToEdit.length > 0; + const codeToEdit = useSelector( + (state: RootState) => state.editModeState.codeToEdit, + ); const title = - editModeState.codeToEdit.length === 0 + codeToEdit.length === 0 ? "Code to edit" - : editModeState.codeToEdit.length === 1 + : codeToEdit.length === 1 ? "Code to edit (1 item)" - : `Code to edit (${editModeState.codeToEdit.length} items)`; + : `Code to edit (${codeToEdit.length} items)`; function onDelete(rif: RangeInFileWithContents) { dispatch(removeCodeToEdit(rif)); @@ -38,7 +38,7 @@ export default function WorkingSet() { } } - const codeToEditItems = [...editModeState.codeToEdit] + const codeToEditItems = [...codeToEdit] .reverse() .map((code, i) => ( -
+
{title}
- {hasCodeToEdit && ( + {codeToEdit.length > 0 && (
    {codeToEditItems}
diff --git a/gui/src/pages/Edit/CodeToEditListItem.tsx b/gui/src/pages/Edit/CodeToEditListItem.tsx index c7cb46ff5..e672b8f89 100644 --- a/gui/src/pages/Edit/CodeToEditListItem.tsx +++ b/gui/src/pages/Edit/CodeToEditListItem.tsx @@ -40,7 +40,10 @@ export default function CodeToEditListItem({ let title = filepath; if ("range" in code) { - title += ` (${code.range.start.line + 1} - ${code.range.end.line + 1})`; + const start = code.range.start.line + 1; + const end = code.range.end.line + 1; + title += + start === end ? ` - Inserting at line ${start}` : ` (${start} - ${end})`; } const source = diff --git a/manual-testing-sandbox/test.java b/manual-testing-sandbox/Calculator.java similarity index 99% rename from manual-testing-sandbox/test.java rename to manual-testing-sandbox/Calculator.java index 0f22df25a..b9b9147e9 100644 --- a/manual-testing-sandbox/test.java +++ b/manual-testing-sandbox/Calculator.java @@ -11,6 +11,7 @@ public class Calculator { return this; } + public double getResult() { return result; }