News for hackers. Stuff that matters.
Re:Code Llama, an AI tool for coding by lordnacho on Thursday August 24, 2023 @11:54AM (#37250370)
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

Re:Code Llama, an AI tool for coding by adocomplete on Thursday August 24, 2023 @12:09PM (#37250594)
Give 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.

Re:Code Llama, an AI tool for coding by stuzenz on Thursday August 24, 2023 @05:02PM (#37254508)
Cody 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-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.

Re:Code Llama, an AI tool for coding by beyang on Friday August 25, 2023 @01:17PM (#37264374)
Hello, 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.
Re:Code Llama, an AI tool for coding by phillipcarter on Thursday August 24, 2023 @11:58AM (#37250429)
SourceGraph 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.
Re:Code Llama, an AI tool for coding by armchairhacker on Thursday August 24, 2023 @12:11PM (#37250632)
Copilot calls these "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)

Re:Code Llama, an AI tool for coding by make3 on Thursday August 24, 2023 @11:58AM (#37250428)
There'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.

Re:Code Llama, an AI tool for coding by lordnacho on Thursday August 24, 2023 @12:37PM (#37251020)
How do I access it from my IDE? Jetbrains/VSCode?
Re:Code Llama, an AI tool for coding by regularfry on Thursday August 24, 2023 @12:11PM (#37250626)
Sounds 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.
Re:Code Llama, an AI tool for coding by artificialLimbs on Thursday August 24, 2023 @11:58AM (#37250426)
I let mine generate whatever it likes, then add a comment below such as "# Refactor the above to foo.." Works fairly well at times.
Re:Code Llama, an AI tool for coding by lordnacho on Thursday August 24, 2023 @12:38PM (#37251030)
Can it suggest deletions? Just seems like I don't know how to use it.
Re:Code Llama, an AI tool for coding by claytongrassick on Thursday August 24, 2023 @01:06PM (#37251540)
I've been using Cursor (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.
Re:Code Llama, an AI tool for coding by sestinj on Thursday August 24, 2023 @01:41PM (#37252107)
You 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
Re:Code Llama, an AI tool for coding by thewataccount on Thursday August 24, 2023 @01:54PM (#37252308)
Any plans to support IntelliJ?
Re:Code Llama, an AI tool for coding by GordonS on Thursday August 24, 2023 @03:17PM (#37253334)
I'd also be really keen on this.
Re:Code Llama, an AI tool for coding by vunderba on Thursday August 24, 2023 @06:50PM (#37255564)
Yeah this would be a crucial feature - interoperability with Jetbrains IDEs.
Re:Code Llama, an AI tool for coding by fpgaminer on Thursday August 24, 2023 @03:16PM (#37253329)
https://docs.github.com/en/copilot/github-copilot-chat/using... can basically do that if you're in the beta.
Re:Code Llama, an AI tool for coding by nvm0n2 on Thursday August 24, 2023 @03:34PM (#37253541)
Neither 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.
Re:Code Llama, an AI tool for coding by kateklink on Friday August 25, 2023 @06:34AM (#37260088)
at refact.ai we have different functions for code refactoring, making it shorter, simplifying complexity, etc