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

Feature: AI code refactoring #82

Closed
1 of 2 tasks
bdougie opened this issue May 17, 2023 · 7 comments
Closed
1 of 2 tasks

Feature: AI code refactoring #82

bdougie opened this issue May 17, 2023 · 7 comments
Assignees

Comments

@bdougie
Copy link
Member

bdougie commented May 17, 2023

Type of feature

🍕 Feature

Current behavior

With #79 winding down and getting ready for completion, thinking of the next AI feature ideas.

feel free to discuss other ideas in the discord

My pitch is to use the inline comment on the file changes to generate suggested changes

Suggested solution

A user can use suggested changes to generate new code using the [suggested changes feature]

The example below is me pointing at the "suggested changes" button. I am suggesting an enum instead of a case statement and using the AI to generate the enum.

(https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/incorporating-feedback-in-your-pull-request) and OpenSauced.ai
Group 5 (1)

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Contributing Docs

  • I agree to follow this project's Contribution Docs
@a0m0rajab
Copy link
Contributor

You can use the default selection code for this one:

function getSelectionText() {
    var text = "";
    if (window.getSelection) {
        text = window.getSelection().toString();
    } else if (document.selection && document.selection.type != "Control") {
        text = document.selection.createRange().text;
    }
    return text;
}

Source: https://stackoverflow.com/questions/5379120/get-the-highlighted-selected-text

@a0m0rajab
Copy link
Contributor

For the selected lines in the GitHub UI, you can use this:

document.querySelectorAll('.code-review.selected-line ')

@diivi
Copy link
Contributor

diivi commented May 18, 2023

Thanks for your inputs @a0m0rajab, I'll try this and make a PR where you can comment!

@a0m0rajab
Copy link
Contributor

Thank you for that, I would love to see the implementation of it though!
As for the prompts what do you have in mind to send to the API?

@diivi
Copy link
Contributor

diivi commented May 18, 2023

I'll test things out and both of us will know only when I create the PR :p

@a0m0rajab
Copy link
Contributor

It would be great to see the PR :)
here is a list that I have seen previously: https://github.com/PickleBoxer/dev-chatgpt-prompts

@Anush008
Copy link
Member

Resolved by #90.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

4 participants