Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: insert full code at cursor #282

Merged
merged 4 commits into from
Jul 18, 2023
Merged

fix: insert full code at cursor #282

merged 4 commits into from
Jul 18, 2023

Conversation

abeatrix
Copy link
Contributor

@abeatrix abeatrix commented Jul 17, 2023

close: #281

Fix issue where inserted code snippets removes $s

Cause: editor.action.insertSnippet would reformat the copied text that caused the inserted text to look different

await vscode.commands.executeCommand('editor.action.insertSnippet', {
                snippet: copiedText,
            })

Fix: Use WorkspaceEdit instead to replace current selection with the copied text

See Loom for fix: https://www.loom.com/share/7c238dfeda014e00b98b51aa1b5511ea?sid=ebca9d01-7f1b-4301-97b3-0451bbdc53ab

Test Plan

Select code that has $ in it, click on explain code recipe:

  • copy the code should contain the correct code snippet with all $ included
  • insert the code at the cursor should contain the correct code snippet with all $ included

@abeatrix abeatrix requested a review from a team July 17, 2023 22:49
@abeatrix abeatrix merged commit 38b504f into main Jul 18, 2023
5 checks passed
@abeatrix abeatrix deleted the bee/fix-insert branch July 18, 2023 16:04
})
return button
}

function getSelectedTextWithin(element: HTMLElement | null): string | null {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abeatrix I noticed we removed the feature where you can select only a portion of the code block to insert. Was that intentional, or too tricky to keep?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember honestly lol I can take a look when I'm back tmr.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a priority! No one has noticed from what I can tell, but it wasn't a very visible feature. We can look at it when improving how our insert code stuff works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: cody remove $ from code when insert at cursor
3 participants