Skip to main content

Posts

Showing posts with the label Visual Studio Code

How to exclude specific content when using GitHub Copilot

GitHub Copilot is a powerful AI coding assistant and I couldn't miss it anymore. But there are times when you need to prevent it from accessing certain files or directories. Whether it's sensitive configuration files, proprietary code, or files that would add unnecessary noise to suggestions, exclusions help you maintain control over what Copilot sees. Why exclude content? You might want to exclude content from Copilot for several reasons: Security and privacy : Keep API keys, passwords, and other secrets away from AI processing Proprietary code : Protect sensitive business logic or algorithms Noise reduction : Exclude generated files, dependencies, or build artifacts that don't help with suggestions Performance : Reduce the context window size for faster suggestions Reasons enough to spend some time configuring your content exclusions. GitHub Copilot content exclusion settings Content exclusion is a Copilot Business or Enterprise feature and can...

Github Copilot–Auto model select

With the ever growing list of supported AI models in Github Copilot, there is one question that is getting harder to answer. Which model should I use?  You can try to safe some money and stay away from the premium request models, but even then you have a lot of options to choose from. You also could check out the model recommendations based on the task you try to achieve but isn’t there a better way? Enter Auto mode With the latest update of GitHub Copilot in Visual Studio Code now a new Auto option is available. When you select Auto from the model picker, Copilot will select an appropriate model for you.   It is not clear what criteria are used to select a model but you can find out the chosen model at the bottom of the response:   Be aware that it is be possible that Auto mode could choose a premium request model, although a discount of 10% is applied when auto mode selects a premium requests model (if you are using a paid plan). For example, Sonn...

Disable NuGet Central Package Management for specific projects

Centralized Package Management is a NuGet feature that allows you to manage NuGet package dependencies for multiple projects from a single location. This is particularly useful for large solutions with many projects, as it simplifies the process of keeping package versions consistent across the entire solution. After enabling Central Package Management for an existing solution and committing those changes, one of our build pipelines started to fail. When we took a look at the logs we encountered the following error message: ##[error]The nuget command failed with exit code(1) and error(NU1008: Projects that use central package version management should not define the version on the PackageReference items but on the PackageVersion items: Dapper;Microsoft.Data.SqlClient;Microsoft.Extensions.Configuration;Microsoft.Extensions.Configuration.Binder;Microsoft.Extensions.Configuration.Json;Microsoft.Extensions.Http;Spectre.Console;Spectre.Console.Json. What is happening? The reason we...

Extend Github Copilot capabilities through the Copilot Marketplace

I already talked about custom instructions in Github Copilot as a way to tweak Github Copilot. Today I want to show another way to extend the capabilities of your Copilot; Copilot Extensions, a set of third party tools, services, and data available (in preview) through the Copilot marketplace :     What are Copilot Extensions? Copilot extensions are third-party tools, services, and data integrations that enhance the functionality of GitHub Copilot. They allow you to leverage additional features and capabilities directly within your coding environment. Whether you need help with code quality, security, documentation, or project management, there's likely a Copilot extension that can assist you. At the moment of writing this post Copilot Extensions is still in preview and the list of available extension is still limited. Extension usage is not possible in every IDE. Here is the list of supported IDEs:   How to get started with Copilot Extensions Getting star...

Github Copilot Edits

I continue my journey on getting the most out of Github Copilot. Today I want to take a look at Copilot Edits as another way to use AI in your day-to-day coding experience. Until recently, you either had to use completions or the chat experience.  With Copilot Edits, a third option is added to the list. Why Copilot Edits? Where the completions or the chat experience are a great fit for single file changes, they can be cumbersome for bigger changes that span multiple files. When using Copilot Edits, you can specify a set of files that should edited and then ask Copilot to do some changes.  Remark: At the moment of writing Copilot Edits seems only to be available inside VS Code and not (yet) in Visual Studio. Let’s give it a try… Click on the Github Copilot icon at the top and choose Open Copilot Edits from the dropdown(or just hit CTRL-Shift-I) This will open up the Copilot Edits view where we can start a new editing session .   First we need t...

Multi model support in Github Copilot

Today I want to point out a new feature that was recently introduced in Github Copilot chat; support for multiple large language models. It is now possible to choose between different models so that you can choose the model that aligns best with the needs you have in your specific project. Models that are supported today are GPT-4o, o1, o1-mini and Claud Sonnet 3.5. Remark: To be exact, I have to point out that Github Copilot was leveraging multiple LLMs already for different use cases. Let me show you how this feature works… VS Code Open Github Copilot Chat inside VSCode Click on the ‘Pick model’ dropdown and select a different model   That’s it! Visual Studio Open Github Copilot Chat inside Visual Studio Click on the ‘Pick model’ dropdown and select a different model   That’s it! Remark: I noticed that the Claud Sonnet 3.5 model is not yet available inside Visual Studio. More information https://github.blog/changelog/20...

Running a fully local AI Code Assistant with Continue–Part 1–Introduction

When I‘m coding, I'm assisted today by Github Copilot. And although Github does a lot of effort to keep your data private, not every organisation allows to use it. If you are working for such an organisation, does this mean that you cannot use an AI code assistant? Luckily, the answer is no. In this post I’ll show you how to combine Continue , an open-source AI code assistent with Ollama to run a fully local Code Assistant. Keep reading… Note: This post is part of a bigger series. Check out the other posts here: Part 1 – Introduction Part 2 -  Configuration Part 3 – Editing and Actions Part 4  -  Learning from your codebase Part 5 – Read your documentation Part 6 – Troubleshooting What is Continue? Continue is an open-source AI code assistant that can be easily integrated in popular IDEs like like VS Code and JetBrains , providing custom autocomplete and chat experiences. It offers features you expect from most code assistants like autocomplete, code explanation...

Learning CodeQL

If you tried the Github Secure Code Game I blogged about before, you got a first introduction on code scanning with CodeQL. In this post I want to share some other resources that can help you to get a deeper understanding in what CodeQL is and how it can help you to find security vulnerabilities in your code. What is CodeQL? CodeQL is a static analysis tool that can scan your code for vulnerabilities. CodeQL lets you query code as though it were data. By writing queries you can find  variants of a vulnerability. Remark: CodeQL is free for research and open source. How to run CodeQL? The easiest way to try out CodeQL is by enabling the code scanning with CodeQL GitHub Action on a repository. Behind the scenes this will create a CodeQL database. This database is a relational representation of the code base, which contains information about the different source code elements, such as classes and functions, and puts each of those into a separate table of data. Each langu...

Convert a project to use centralised package management

If you have never heard about Central Package Management(CPM), first have a look at my blog post a few months ago. Done reading? Ok, we continue... To summarize, with CPM you bring all your dependencies in one place (the Directory.Packages.props file). This makes it easier to manage your dependencies for a large multiproject solution and helps you to avoid version drift where multiple versions of the same package are used inside your solution. Remark: CPM works both in Visual Studio and in JetBrains Rider . Convert your .NET solution to CPM manually If you want to start using CPM for your existing solutions, there are a few steps you need to repeat for every project inside your solution: Go through all of the csproj files and copy the references into the centralised Directory.Packages.props file Remove all the versions from the package reference entries in the csproj files. Although not that hard to do, it would be nice if this can be done automatically. Auto...

.NET 7 - The StringSyntaxAttribute

With the release of .NET 7, a new attribute was introduced; the StringSyntaxAttribute . What does the StringSyntaxAttribute do? The StringSyntaxAttribute allows you to tag strings. It can be applied to fields, properties, and parameters and provides tools like Visual Studio with information about the nature of the string. The compiler will use this information to provide the correct syntax highlighting: In this release following string formats can be used out of the box (and it is possible to create custom ones): CompositeFormat: The syntax identifier for strings containing composite formats for string formatting. DateOnlyFormat: The syntax identifier for strings containing date format specifiers. DateTimeFormat: The syntax identifier for strings containing date and time format specifiers. EnumFormat: The syntax identifier for strings containing Enum format specifiers. GuidFormat: The syntax identifier for strings containing Guid format specifiers. J...

Visual Studio Code–Timeline view

One of the nice features of Visual Studio Code is the Timeline view. It's a lot more than a view of your Git commits as it brings you a unified view for visualizing any kind of time series events(of course Git commits, but also file saves, test runs,...) for a file. The Timeline view is enabled by default and can be found at the bottom of the File Explorer: When you expand it, you see all the changes for the selected file: And if you click on a specific line in the Timeline view you get a diff of the changes: Nice! This allows you to see what has changed without needing your Git commits as the only source.