fix issue with /edit not acknowledging highlighted code after retrying

This commit is contained in:
Nithish 2024-03-25 23:33:32 +05:30
parent adcd079271
commit 010978d4de
2 changed files with 6 additions and 5 deletions

View file

@ -29,7 +29,7 @@ import useHistory from "../../hooks/useHistory";
import useUpdatingRef from "../../hooks/useUpdatingRef";
import { useWebviewListener } from "../../hooks/useWebviewListener";
import { defaultModelSelector } from "../../redux/selectors/modelSelectors";
import { setEditingContextItemAtIndex } from "../../redux/slices/stateSlice";
import { addHighlightedCode, setEditingContextItemAtIndex } from "../../redux/slices/stateSlice";
import { RootState } from "../../redux/store";
import { isMetaEquivalentKeyPressed } from "../../util";
import { isJetBrains, postToIde } from "../../util/ide";
@ -497,6 +497,7 @@ function TipTapEditor(props: TipTapEditorProps) {
editor.commands.blur();
editor.commands.focus("end");
}, 20);
dispatch(addHighlightedCode({rangeInFileWithContents: rif, edit: true}));
}
setIgnoreHighlightedCode(false);
},

View file

@ -239,7 +239,7 @@ export const stateSlice = createSlice({
contextItems: [],
});
state.contextItems = [];
state.contextItems = state.contextItems;
state.active = true;
},
initNewActiveMessage: (
@ -262,7 +262,7 @@ export const stateSlice = createSlice({
},
contextItems: [],
});
state.contextItems = [];
state.contextItems = state.contextItems;
state.active = true;
},
setMessageAtIndex: (
@ -402,7 +402,7 @@ export const stateSlice = createSlice({
const lineNums = `(${
payload.rangeInFileWithContents.range.start.line + 1
}-${payload.rangeInFileWithContents.range.end.line + 1})`;
contextItems.push({
contextItems = [{
name: `${base} ${lineNums}`,
description: payload.rangeInFileWithContents.filepath,
id: {
@ -412,7 +412,7 @@ export const stateSlice = createSlice({
content: payload.rangeInFileWithContents.contents,
editing: true,
editable: true,
});
}];
return { ...state, contextItems };
},