Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Tell HN: File in GitHub Copilot is great
9 points by brushfoot on May 17, 2024 | hide | past | favorite | 1 comment
Title is supposed to read "#file", not "File". HN reformatted it.

I was mostly using Copilot for boilerplate until I discovered #file. It vastly improves the quality/types of code that Copilot can generate.

How it works:

- Type #file into Copilot Chat as part of your message. A dropdown pops up.

- Start typing the name of a file.

- It fuzzy searches the filenames in your workspace.

- Press Enter to select a file.

- Copilot reads its contents into its context.

The real power here is in including multiple files, which you can do by using #file multiple times in a single message.

Copilot can write entire classes this way with some decent prompts and enough context. Of course you still need to code review and test it. But it's much closer to the promise of an engineering assistant than without.

I'm sure this is old news to many using Copilot, but just wanted to share.



How much easier than writing the code yourself, given that you have the problem and solution in mind and need to provide the context and detailed description for the copilot code generator? I find writing the code itself to be a similar amount of effort and more satisfying.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: