All that you need to do is install the plugin from the Visual Studio Marketplace and set up your API key. You can then go ahead, select the code, code comment or function and generate the required results.
1. Ensure that VS Code has been installed in your system. Next, click on this link and then click on the ‘Install’ button on the plugin page. This will open a popup window where you must click on the button ‘Open Visual Studio Code’.
2. As per the message in the popup window, VS Code will automatically be launched and then you must click on the ‘Install’ button to install the plugin.
3. As stated earlier, you must configure your API Key for Ask Bard to function. Click on this link to get your free API key and follow the steps below to set it up in CS Code.
4. Click on File | Preferences | Settings and then expand the ‘Extensions’ section in the left-side panel. Next, click on ‘Bard API key’ and paste the API key in the textbox. It will be saved automatically.
5. Ask Bard is now ready to work for you. To generate a Code Snippet, open the program file and select the code comment for which you wish to generate the code. Remember to select the entire comment including the comment markers.
6. Click the right mouse button and choose ‘Ask Bard for code’. Wait for a few seconds and you will observe that Ask Bard will insert the code below your selected comment.
7. To generate Unit Tests, you must select the code for which you want to generate the unit tests, right-click and choose the option ‘Ask Bard for unit tests’.
8. Like in the previous case, Ask Bard will insert the unit tests below your selected code.
9. You can use the same procedure as mentioned above to insert Docstrings. Just select the corresponding function, right-click and select the option ‘Ask Bard for docstring’ and the plugin will insert the docstring in the function.
“In general, Ask Bard proves to be an excellent free VS Code plugin, enabling you to effortlessly create Code Snippets, Unit Tests, Docstrings, and more by harnessing the power of Google PaLM AI. It extends its support to various programming languages and ensures a swift and user-friendly experience.”
Click here to get the Ask Bard plugin from Visual Studio Marketplace.