Visual Studio Github Copilot

Code completion using artificial intelligence GitHub Copilot – the machine pair programmer

Microsoft donates a helper to GitHub that helps with writing code. Copilot is supposed to be like the colleague you work with when pair programming – and who is always open to a “How does that go again?”. Vendors on the topic GitHub Copilot is meant to become nothing less than the friendly tandem programmer next door. (Image: GitHub / Microsoft) GitHub Copilot was announced back in mid-2021, but is not yet freely available. Currently, the AI tool is running as a Technical Preview, access is available via a waiting list – which, according to experience, may well take a few months. Of course, the interest is huge! Copilot is based on OpenAI Codex, a system that translates natural language into code. If you want to use Codex to remove leading spaces from a text, for example, all you need to do is issue a statement like “Delete all leading spaces” – and the system will create corresponding code in JavaScript, Go, Perl, PHP, Ruby, Swift or Shell, for example. GitHub Copilot in action in Visual Studio Code. (Image: Lang / Microsoft) Copilot doesn’t go quite that far; you basically have to write code. However, the help just goes far beyond simple autocomplete. Copilot also understands over a dozen languages, with Python, JavaScript, TypeScript, Ruby, Java and Go currently being explicitly highlighted. The promising AI tool can be used via extensions for Neovim, JetBrains and Visual Studio Code. Once landed in the desired IDE, Copilot is supposed to work as follows: The user provides a context, for example the (speaking) name of a function or a comment, and Copilot then delivers very concrete sample code – in the form of complete functions and calls. The delivered code is based on training data from publicly available code, such as GitHub repositories. In the best case, this support can actually save a lot of time. Firstly, because redundant code can be implemented more quickly. If you needed, say, ten nearly identical lines to define variables, you only have to write the first one completely, and Copilot can more or less insert the rest so that you only have to change minor details. Secondly, because it can save a lot of searching for concrete syntax examples or suitable places in the documentation. However, GitHub also says right away that this is not always executable code! Not even necessarily meaningful code. So if you thought that beginners without any programming knowledge would be able to implement entire projects, you are completely wrong. For developers with at least basic knowledge, however, Copilot could provide the one crucial hint every now and then, regarding syntax or structure of a code block.

A little practice

Working with GitHub Copilot is basically trivial, here using Visual Studio Code as an example: Currently, you still need to sign up for the preview and get put on the waiting list. Once unlocked, you install the plug-in via the Visual Studio marketplace directly in the IDE itself. Now, once you’ve created a new file and selected an associated programming language, Copilot begins its work. Suppose you need a function to swap tabs for spaces and type the following: function changeTabsTo Then Copilot will immediately suggest “changeTabsToSpaces” – understandable, after all this task should occur thousands of times in the training data. With “TAB” such suggestions can be accepted, with “ALT+PLUS” and “ALT+MINUS” alternatives are displayed. Or you can directly open a separate window with all copilot suggestions. As soon as the first line of the function is accepted, Copilot starts producing “real” code – in different qualities. Here are the suggested variants for swapping tabs for spaces once in JavaScript and once in Python. First JavaScript: function changeTabsToSpaces(text) { var newText = text.replace(/\t/g, " "); return newText; And here for Python: function changeTabsToSpaces() { sed -i 's/\t/ /g' $1 } The basic idea is identical in both cases and quite correct, namely file-wide search-and-replace using the appropriate regular expressions. Without going into the code quality – which is by no means representative – it should be clear at first glance that the task could be solved a bit more elegantly in Python than calling an external sed statement – which was confirmed by a second attempt: function changeTabsToSpaces(fileName): file = open(fileName, 'r') fileContent = file.close() fileContent = fileContent.replace('\t', ' ') file = open(fileName, 'w') file.write(fileContent) file.close() Even though the JavaScript code looks much better and could certainly be helpful, executable looks different, as a second example shows – still trivial, but a bit more complex: retrieving the status of smart Philips Hue lamps. Only the function name was given. function getStatusOfHueLamp(ip, id) { var url = "http://" + ip + "/api/" + id + "/lights/" + id + "/state"; var xhr = new XMLHttpRequest();"GET", url, false); xhr.send(); var response = JSON.parse(xhr.responseText); return response.state.on; } At least the URL we put together isn’t completely wrong, even if the retrieval doesn’t actually require a “/state” at the end. While this code snippet doesn’t work in the form, it does provide significantly more clues to the solution than a blank piece of paper.

What to expect?

GitHub Copilot is certainly not yet a revolution, but it is certainly more than the natural evolution of autocomplete. The potential to massively increase productivity and enormously simplify learning is definitely there – especially since one must not forget that it is still a preview and AI systems naturally continuously improve over time and through use. However, the Free Software Foundation [] raises questions around the legal aspects of Copilot. Among other things, there is the question of whether training neural networks with publicly available data falls under fair use – a question that could become much more complicated in this country, where, to the chagrin of many, there is no fair use regulation at all. In the meantime, the question of possible copyright infringements remains, since Copilot independently inserts larger chunks of code into projects. According to GitHub, however, the company’s own investigation has revealed only very few suggestions that were taken over 1:1 from the training data, unless they were completely universal solutions. One reason for this is probably the context: Copilot does not just consider the current input, but the document as a whole. In an empty document, the chances of getting good individual suggestions are therefore lower. Apropos: Of course, personal data of the owners of the repositories can be found in the training data from time to time – and such data can also end up in the suggestions. These are only two of many aspects that the FSF raises. A sometimes exciting question for license specialists: If Copilot learns from AGPL-licensed code, is that already a violation of the AGPL? In contrast to the GPL, the Affero GPL does not only apply when the code is distributed, but already when it is accessed via a network. An interesting treatise on the subject with a completely contrary point of view can be found by Julia Reda, who, for example, addresses the issue of the level of creation: “Copyright has so far only been applicable to intellectual creations – where there is no creator, there is no work.” Machine-generated code like that of GitHub’s Copilot thus does not constitute a work in the copyright sense, Reda says, and thus also not a derivative work. Leaving it at that, however, it certainly doesn’t take a supervillain to create a dumb AI that reads in protected third-party content and modifies it so minimally that it suddenly qualifies as a machine’s copyright-irrelevant output. To summarize: GitHub Copilot is a very promising syntax assistant in a very early stage that will still raise a lot of questions away from pure technology. But it has long been clear in theory that artificial intelligence will increasingly occupy not only STEM scientists but also philosophers. Now the practical side is following suit. (ID:47848612)

  1. GitHub working on speech-to-code feature for AI programming aid Copilot
    • Copilot for enterprise
    • Codespaces for all
    • Trendradar Octoverse Report

Code hosting and version control platform GitHub is testing how developers can use voice commands to operate AI programming assistant Copilot. The company unveiled the feature, called “Hey, GitHub!” as part of its GitHub Universe developer conference, which returns in person for the first time this year. “Hey, GitHub!” is part of the GitHub Next prototype program and is currently still under development. So far, it is only possible to replace keyboard input with voice commands within Visual Studio Code, but the GitHub Next team is working on making “Hey, GitHub!” accessible to other development environments. In particular, people who are unable to work with a keyboard on a permanent basis due to a physical limitation or injury, for example, are likely to benefit from the feature. Those who want to try out Copilot’s voice control can sign up for a waiting list.

Recommended editorial content

With your consent, an external YouTube video (Google Ireland Limited) is loaded here. Always load YouTube video I agree to external content being displayed to me. This may transmit personal data to third-party platforms (Google Ireland Limited). More about this in our privacy policy.

Copilot for businesses

GitHub Copilot had exited beta in June and has since been available for individual accounts in the form of a subscription model for $10 a month. Now, an offering for enterprise customers is to follow, allowing administrators to manage developers’ Copilot licenses. Copilot for enterprise is scheduled to be available in December 2022. Meanwhile, the AI programming assistant is facing headwind in the form of a class action lawsuit it is seeking, which alleges, among other things, that Copilot violates the Digital Millennium Copyright Act (DMCA).

Codespaces for all

GitHub’s cloud development environment Codespaces is now available to all GitHub users and is no longer reserved for teams and companies. Codespaces creates reproducible development environments and saves users from having to install dependencies and libraries on their local system. Each account will be credited with 60 hours of Codespaces per month in the base VM configuration with 2 CPU cores, 4 GB of RAM and 32 GB of storage. GitHub CEO Thomas Dohme tells c’t that the free offer also includes more performant configurations. For example, developers can configure Codespace with twice the number of CPU cores, and the available Codespaces time is halved accordingly. Codespaces is now available for all accounts. In addition, GitHub introduces a new workflow to confidentially report security vulnerabilities to project owners, presents new CI/CD features and launches support programs for open source developers and startups. Interested parties can read all the announcements in the blog post on the GitHub website.

Trend Radar Octoverse Report

As part of the conference, GitHub released this year’s State of the Octoverse report. The study analyzes code on the platform and shows trends in the developer community. JavaScript remains the most used programming language on the platform. Hashicorp’s HCL (Hashicorp Configuration Language) saw the biggest increase, up 56 percent year-over-year, which the report attributes to a rise in popularity of tools like Terraform for IaC (Infrastructure-as-Code). Rust is up 50 percent, and Python is up 22.5 percent. GitHub now has 94 million users, of which 20.5 users have registered this year. (ndi) Visual Studio Github Copilot.

Leave a comment

Your email address will not be published. Required fields are marked *