August 2, 2023
Pair program effectively with GitHub Copilot and CFML
Comments
(1)
August 2, 2023
Pair program effectively with GitHub Copilot and CFML
(1)

Introduction 

GitHub Copilot is an AI pair programmer that offers autocomplete-style suggestions as you code. You receive suggestions from GitHub Copilot when writing the code, or by writing a natural language comment describing what you want the code to do.

GitHub Copilot is trained on all languages that appear in public repositories. For each language, the quality of suggestions you receive may depend on the volume and diversity of training data for that language.

How to set up Copilot in VS Code?

 To know the prerequisites for Copilot you can go through Copilot Prerequisites, once you have received confirmation from GitHub via email that you have been included in the GitHub Copilot, follow these steps. For more information, see the Quickstart guide for Github Copilot. For the licensing information of GitHub Copilot, you can refer to the links in the references.

  • Run VS Code and click on the extension icon.
            VS Code Extension Icon
  • Type “Copilot” in the search bar located in the top left-hand side of the “Extensions: Marketplace” window.
  • Select GitHub Copilot and click install.

  • Sign-in using the GitHub Copilot account you received confirmation from GitHub via email that you have been included into GitHub Copilot preview when prompted.

Using GitHub Copilot

You can interact with GitHub Copilot using natural language. For example, you can describe the functionality you want in a comment, and Copilot will attempt to generate the relevant code to fulfil that requirement.

CFM files would not be recognized by default in VS Code; for that, you might have to install the ColdFusion Extension. For the Adobe ColdFusion Extension, you can get it from Adobe ColdFusion Builder Extension

Here are a few examples to demonstrate how GitHub Copilot autocomplete works with CFML.

Based on the comment GitHub Copilot understands the context and suggests a code snippet.

  • Generating code to send an email.
  • Generating code to read a spreadsheet document and insert the data into a database.
  • Generating code to create a webservice.
  • Generating code to get data from a database.
  • Generating code to create a component and its object.

Conclusion

We can see that GitHub Copilot works as expected to an extent with ColdFusion tag syntax.

With script syntax, however, the results could be inconsistent, but GitHub Copilot is designed to learn and improve over time based on user interactions when more users start using it.

References

1 Comment
2023-08-09 12:55:13
2023-08-09 12:55:13

Thanks, Dattanand. Nice, succinct intro for those new to the capability–and who may not have considered it for cfml.

Two modest suggestions, though. First, I must say that the text in the videos are almost unreadable on a phone. I suspect you captured them on a large monitor. And as the videos are all about the text shown, that really detracts. Could you please consider revising them? Being so brief and few, hopefully that would not be at all arduous.

Second, and while you’re at it: I wonder if a slight tweak to the title may better reach some folks. Instead of, “Pair program effectively with GitHub Copilot and CFML” (which emphasizes better pair programming), how about, “GitHub Copilot and CFML: Pair program with an AI partner”. That emphasizes the tool, its use with cfml, and its benefit for those without a pair programming partner, while also catching the wind of current enthusiasm for all things AI. 🙂

Like
(3)
Add Comment