An Interest In:
Web News this Week
- April 2, 2024
- April 1, 2024
- March 31, 2024
- March 30, 2024
- March 29, 2024
- March 28, 2024
- March 27, 2024
June 7, 2022 08:53 pm GMT
Original Link: https://dev.to/codepo8/github-copilot-explaining-code-and-translating-it-from-one-language-to-another-3i6e
GitHub Copilot explaining code and translating it from one language to another
GitHub Copilot is already the dog's bollocks, but I just installed the GitHub Labs extension and my jaw is still open.
Code explanation
This one allows you to highlight a piece of code and get explanations of what it does:
For example:
async function downloadZipFile(downloadUrl) { await fs.remove('out/edge'); const file = fs.createWriteStream('edge.zip'); https.get(downloadUrl, function(response) { response.pipe(file); response.on('end', async ()=>{ await fs.createReadStream('edge.zip').pipe(unzipper.Extract({path: 'out/edge/'})); await fs.unlink('edge.zip', () => {} ); const outdir = path.join(__dirname, 'out', 'edge'); console.log(`Edge files extracted to: ${outdir}`); }); });}
Turns into:
- We first delete the 'out/edge' folder.
- We downoad the Edge.zip file from the GitHub release page.
- We unzip the Edge zip file to the 'out/edge' folder.
- We print a message to the console.
Code translation
You can also highlight a piece of code and it gets translated to another language. For example, JavaScript to PHP.
I am so looking forward to where this is all going!
Original Link: https://dev.to/codepo8/github-copilot-explaining-code-and-translating-it-from-one-language-to-another-3i6e
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To