🩹 default to first selected range with /edit
This commit is contained in:
parent
8375ee3271
commit
2fc57ea57e
1 changed files with 6 additions and 1 deletions
|
|
@ -206,10 +206,15 @@ const EditSlashCommand: SlashCommand = {
|
|||
name: "edit",
|
||||
description: "Edit selected code",
|
||||
run: async function* ({ ide, llm, input, history, contextItems, params }) {
|
||||
const contextItemToEdit = contextItems.find(
|
||||
let contextItemToEdit = contextItems.find(
|
||||
(item: ContextItemWithId) =>
|
||||
item.editing && item.id.providerTitle === "code"
|
||||
);
|
||||
if (!contextItemToEdit) {
|
||||
contextItemToEdit = contextItems.find(
|
||||
(item: ContextItemWithId) => item.id.providerTitle === "code"
|
||||
);
|
||||
}
|
||||
|
||||
if (!contextItemToEdit) {
|
||||
yield "Select (highlight and press `cmd+shift+M` (MacOS) / `ctrl+shift+M` (Windows)) the code that you want to edit first";
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue