Skip to content

Instantly share code, notes, and snippets.

@satspeedy
Last active November 17, 2023 10:28
Show Gist options
  • Save satspeedy/c778912aadc1a5ac580ed3b644c4e365 to your computer and use it in GitHub Desktop.
Save satspeedy/c778912aadc1a5ac580ed3b644c4e365 to your computer and use it in GitHub Desktop.
copilot examples to experiment in vscode

Copilot demo

Download spring-petclinic

Q&A with copilot

  • open VetController
  • type // q: What is the difference between the two methods above?

Chat to add a further controller method with XML payload

  • open VetController
  • type command + i
  • type implement a method to return data in xml format

Suggest a further method implementation

  • open WelcomeController
  • type @GET.... /info
  • change return value to welcome
  • rerun application and call endpoint /info

Add furher method to get phone number

  • open WelcomeController
  • type command + i
  • type erstelle eine methode um telefonnummern entgegen zu nehmen

Check phone number with regex

  • open WelcomeController
  • type command + i
  • type füge ein regex hinzu um nur rufnummer als format +49 123 4567890 zu akzeptieren

create test for phone number method

  • open WelcomeController
  • type command + i
  • type create 3 tests for selected method in test class

add a new data table (and generate testdata)

  • open schema.sql in h2 folder
  • type command + i
  • type erstelle eine tabelle zur pflege von einer digitalen patientenakte je haustier und füge an dieser Stelle in der datei ein
  • additionally type INSERT... below to generate test data for the new table. Copy it finally to to data.sql

scaffold a soap web service with an apache library

  • open copilot chat
  • type @workspace /new scaffold a WS soap service call to fetch the current whether from the city ESSEN in Germany. And use an Apache library to implement the request.

review code and improve it

  • open BaseEntity
  • mark the last method below
  • open chat
  • type review marked code and provide more modern ways to implement such method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment