![]() ![]() this is a standard VS Code command that we will eventually register in the extension. Next, we’re going to create the command that we’ll activate when we click on the CodeLens. If you want to see the end result or view the source code in full, head over to lannonbr/vscode-codelens-example. To dig into this further, I wanted to make a sample extension that we create a sample CodeLens to add a JS console.log snippet into the current file.Īs always, I start off with the Yeoman generator for VS Code and choose “New Extension (Typescript)“. There was a post in 2017 on the VS Code blog that went into a deeper look at Extensions using CodeLens which includes well known extensions like GitLens and plenty of others. They are similar to the decorator API to give more context to your code, but you can click on CodeLens to take actions based on it. In the latest PowerShell extension for VSCode you can enable Use Legacy Code Lens option which will enable Run tests on all Describe, Context and It blocks. They’re links that you see above lines in your vs code editor that give actions as well as extra information to your codebase. Table of ContentsĪs described by Wade Anderson, CodeLens are “actionable contextual information interspersed in your source code”. It represents an adornment, either a clickable number of references or the information. Let’s dig into building a simple extension to show off the API. CodeLens is a productivity feature of the Visual Studio editor. ![]() They’re interactions that allow context aware actions for portions of your code base. ![]() Visual Studio Code has taken many good features built from its sister project Visual Studio, and CodeLens is one of them. VS Code Extension API: Code Lens Febru4 minutes to read ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |