5 ms·
Copilot has been working great for me thus far, but it's limited by its interface. It seems like it only knows how to make predictions for the next bit of text.
by lordnacho 3y ago
Copilot has been working great for me thus far, but it's limited by its interface. It seems like it only knows how to make predictions for the next bit of text.
Is anyone working on a code AI that can suggest refactorings?
"You should pull these lines into a function, it's repetitive"
"You should change this structure so it is easier to use"
Etc
- artificialLimbs 3y agoI let mine generate whatever it likes, then add a comment below such as "# Refactor the above to foo.." Works fairly well at times.
- lordnacho 3y agoCan it suggest deletions? Just seems like I don't know how to use it.
- make3 3y agoThere's an instruct model in there, you can definitely use it for this, that's one of the objectives. An instruct model means that you can ask it to do what you want, including asking it to give you refactoring ideas from the code you will give it.
- regularfry 3y agoSounds like what's needed is a bit of tooling in the background consistently asking the LLM "How would you improve this code?" so you don't need to actually ask it.
- lordnacho 3y agoHow do I access it from my IDE? Jetbrains/VSCode?
- phillipcarter 3y agoSourceGraph Cody is going in that direction, as is Copilot Chat. But it's still early days. I don't think there's anything robust here yet.
- adocomplete 3y agoGive Cody a try! (Cody.dev) With Cody you can create embeddings for your entire repo, so Cody will have much greater context about your code base and the problems you're trying to solve. Disclaimer: I just joined Sourcegraph a few weeks ago.
- stuzenz 3y agoCody is great, it had become my go-to (and I pay for Github Co-pilot). With that said, they have recently changed the architecture, with the local install required, and I have not managed (yet) to get it working with NixOS. Once I have some more time, I will try again - it looks like there will be some hoops to go through. https://nixos.org/manual/nixpkgs/stable/#ssec-pkgs-appimageTools-wrapping https://nixos.org/manual/nixpkgs/stable/#ssec-pkgs-appimageT... Kudos to the Source Graph team, Source Graph's original product was nicely thought out and ahead of it's time. Nice to see how the original product gave a nice basis for building out Cody.
- beyang 3y agoHello, Sourcegrapher here! We are making some simplifications to eliminate the need for the separate local app install. Should be out in the next month or so. Until then, apologies for the added friction here, we're working hard to smooth it out.
- armchairhacker 3y agoCopilot calls these "Code Brushes" https://githubnext.com/projects/code-brushes/ https://githubnext.com/projects/code-brushes/ Last I heard they are in beta and don't work very well (even on the examples page: the "add types" brush is too strict, since `a` and `b` are checked for `null`, and the "fix simple bug" is a typo)
- claytongrassick 3y agoI've been using Cursor (https://www.cursor.so/ https://www.cursor.so/) and it can do embeddings of the entire codebase, refactoring entire classes, etc. I had it rewrite a UI to add state to show one item at a time and have a selection list to the left and it executed it perfectly in MUI controls, first try.
- sestinj 3y agoYou can use Continue for all of this, as easy as highlighting code and making the request. We also support using Code Llama: https://continue.dev/docs/walkthroughs/codellama https://continue.dev/docs/walkthroughs/codellama
- thewataccount 3y agoAny plans to support IntelliJ?
- fpgaminer 3y agohttps://docs.github.com/en/copilot/github-copilot-chat/using-github-copilot-chat https://docs.github.com/en/copilot/github-copilot-chat/using... can basically do that if you're in the beta.
- nvm0n2 3y agoNeither of those tasks require AI. IntelliJ IDEA will happily suggest both for you today, locally. It can find large chunks of duplicated code and automatically refactor them out to functions for you. And it has many inspections that suggest refactorings to make code clearer.
- kateklink 3y agoat refact.ai we have different functions for code refactoring, making it shorter, simplifying complexity, etc