How to use CMFL with GitHub Copilot
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.
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.