Extension authoring · code.visualstudio.com

Update 1.63.1: The update addresses these security issues.

Update 1.63.2: The update addresses these issues.

Downloads: Windows: x64 Arm64 | Mac: Universal Intel silicon | Linux: deb rpm tarball Arm snap


Welcome to the November 2021 release of Visual Studio Code. There are many updates in this version that we hope you will like, some of the key highlights include:

If you'd like to read these release notes online, go to Updates on code.visualstudio.com.

Watch a highlight of the new features in this version at the VS Code team's release party. You can find the recording of the event on our YouTube channel.

Insiders: Want to try new features as soon as possible? You can download the nightly Insiders build and try the latest updates as soon as they are available.

Workbench

Preview themes before installing

You can now preview themes available on the Marketplace before installing them. From the Color Themes dropdown (⌘K ⌘T (Windows, Linux Ctrl+K Ctrl+T)), select Browse Additional Color Themes to list the Marketplace themes. The VS Code UI will preview the Color Theme as you navigate the dropdown.

Press Enter on a theme entry to install the extension.

Configure Problems navigation order

You can now define the order for Go to Next Problem (⌥F8 (Windows, Linux Alt+F8)) and Go to Previous Problem (⇧⌥F8 (Windows, Linux Shift+Alt+F8)) navigation. In previous versions, the order of navigation was based on severity, going to errors first, then warnings, then the rest. The new Problems: Sort Order (problems.sortOrder) setting lets you navigate problems by either their severity or position. When using "problems.sortOrder": "position", a warning on line 5 will be shown before an error on line 13, etc.

Multiple language specific editor settings

You can now configure language specific editor settings for multiple languages at once. The following example shows how you can customize settings for javascript and typescript languages together in your settings.json file:

"workbench.editorAssociations": {
  "*.md": "vscode.markdown.preview.editor"
}

Markdown Preview incremental updating

The built-in Markdown preview now more intelligently updates itself as you type. Instead of replacing the entire Markdown preview document for every update, the preview now uses DOM diffing to only replace the elements in the preview document that have changed. This reduces the jittering that would sometime occur while typing.

JSON language indicator

When editing in a JSON file, there's now a language indicator {} that shows whether the content was validated against one or more JSON schemas. Hovering over the indicator shows the validation state and a link to open the schema.

JSON language selector

JSON schema caching

JSON schemas from the schema store (json.schemastore.org) are now cached locally. This saves network bandwidth and helps when working off-line.

Emmet Remove Tag command improvement

The Emmet: Remove Tag command now removes the line with the tag, along with excess empty lines as applicable, when the tag is on its own line before the removal. It also re-indents the remaining lines properly now, when there are empty lines in between the tags to be removed.

VS Code for the Web

Azure Repos

This milestone we have partnered with the Azure DevOps engineering team to add a new keyboard shortcut to the Files hub in Azure Repos. When browsing a repository in the Files hub, you can press . to open the repository in https://vscode.dev.

We have also added a new entry point to your Azure Repos repository. You can now use the new Open Repository from Azure Repos... menu item under the Open Remote Repositories... menu item in the remote picker to connect to your Azure Repos repository from within https://vscode.dev.

Additionally, you can now open an Azure Repos repository using the legacy Azure DevOps URL format (for example, https://<org>.visualstudio.com) in vscode.dev by prefixing the URL with https://vscode.dev.

Three additional commands now appear in the Remote menu:

Contributions to extensions

Java

The Extension Pack for Java now has an in-product welcome experience to help you configure and learn about Java in VS Code. The walkthroughs cover installing the Java runtime and useful frameworks, opening and debugging your project, and running tests directly inside VS Code.

Extension Pack for Java walkthrough

You can also check out the Java tutorials and user guides at https://code.visualstudio.com/docs/java to help get you started.

Jupyter

Performance improvements

There were a number of performance improvements made to the startup of Jupyter kernels, specifically Python. Users who have previously opened a notebook will see a 2x speedup when starting a kernel. Restarting Python kernels should also be faster.

For more details on the changes made to improve the performance, you can review the following issues:

  • Support pre-warming kernels to improve startup experience of notebooks. (#7903)
  • Faster activation of Python environments such as Conda. (#8342)
  • Avoid starting default kernel when starting jupyter. (#8185)
  • Avoid looking for IPyKernel when we've found it once before. (#8196)
  • Avoid unnecessarily searching for Jupyter packages when Jupyter runtime isn't required to start kernels. (#8350, #8352)

Improvements in handling kernel failures

A diagnostic message along with a Quick Fix has been added to warn about the usage of !pip install when installing Python packages. The Quick Fix will help users choose the right command %pip install.

Several improvements have been made to provide better and more meaningful error messages when kernels fail to start or stop during execution. Errors are now displayed in the cells outputs along with instructions on how to fix the issue. This ensures that users are aware of the issue and can fix it, in case they miss the error displayed on the bottom right of VS Code.

Python

Limited support for untrusted and virtual workspaces

The Python extension now has limited support for untrusted workspaces (see Workspace Trust) or is on a virtual file system (for example, if a remote GitHub repository is opened). Only partial IntelliSense is provided in such cases and other features of the extension are not available:

  • Hover, same file completion, and completion for built-ins like print are available, but the extension is limited to only working with your currently opened files.
  • For untrusted workspaces, only the Pylance language server is supported.
  • For virtual workspaces, only Jedi and Pylance are supported.

The language item in Status bar is updated to indicate these situations:

Limited support for Python in an untrusted workspace

Module rename refactoring

You can now more easily rename modules with the Python and Pylance extensions. Once you rename a Python module, you'll be prompted to choose whether you'd like to change all imports and references throughout your code. If you're not sure, you can first preview what the changes will look like before you make the decision. Once you're confident, you can select Apply Refactoring or Discard Refactoring to not have the proposed changes applied.

Remote Development

Work continues on the Remote Development extensions, which allow you to use a container, remote machine, or the Windows Subsystem for Linux (WSL) as a full-featured development environment.

Feature highlights in 1.63 include:

  • You can now open a folder in a container when working on an SSH server with the Reopen in Container command.
  • Improved forwarded port security avoids unsafe ports.
  • Configurable WSL connection method lets you use wsl.exe or a socket connection to talk to the server.
  • Advanced container configuration videos covering how to change the default location of your project and improve performance on Windows.

You can learn about new extension features and bug fixes in the Remote Development release notes.

GitHub Pull Requests and Issues

Work continues on the GitHub Pull Requests and Issues extension, which allows you to work on, create, and manage pull requests and issues. Check out the changelog for the 0.34.0 release of the extension to see the highlights.

Updated API proposal structure

We have changed how API proposals are managed. Before, there was a single file that contained all proposals, vscode.proposed.d.ts. This file had grown and it was hard to tell what proposals an extension was using and if a certain proposal was already in the stable API. There is now a file per proposal.

For example:

Each proposal has a unique name and extensions wanting to use a proposed API need to list those names in their package.json. The enableProposedApi property in package.json is replaced by the new enabledApiProposals, which is a string array of proposal names and has IntelliSense and validation support.

IntelliSense when authoring the enabledApiProposals property

The updated flow for API proposals should be like this:

  1. Find a proposal that you want to try and add its name to package.json#enabledApiProposals.
  2. Use the latest vscode-dts and run vscode-dts dev. It will download the corresponding d.ts files into your workspace.
  3. You can now program against the proposal.

A detailed migration guide and sample migrations can be found in issue #136964. Also note that the restrictions around proposed API usages haven't changed. Extensions using a proposed API cannot be published and cannot be used as-is.

Quick Pick API improvements

This iteration, we are finalizing a couple of APIs for the QuickPick in VS Code.

QuickPickItem inline buttons

Being able to provide rich input experiences is a goal of our extension API and using the familiarity of VS Code's Quick Pick allows for powerful yet simple UI flows. One addition is that extensions can now add buttons to individual QuickPickItems.

QuickPickItem buttons

Clicking on a button triggers the onDidTriggerItemButton event that exists on a QuickPick object. We look forward to seeing how you use these buttons in your extensions.

Ability to keep scroll position when updating items

Along with the ability to add buttons to QuickPickItems, you may also want to keep the scroll position when updating the items. This is a common use case for extensions who want to:

  • Implement a "remove this item from the list" (for example, Ctrl/Cmd + P x QuickPickItemButton).
  • Implement a "toggle this item in some way" (such as an "Insert Snippet" command).
  • Asynchronously loading items in the Quick Pick.

The keepScrollPosition property on the QuickPick object that comes back from window.createQuickPick() allows you to control whether or not the scroll position (cursorTop) in the Quick Pick moves back to the top of the list.

Authentication API improvements

This iteration, we are finalizing several APIs related to authentication in VS Code.

Force the creation of a new session

Sometimes, when you get a session using authentication.getSession(), it may be valid for some resources but not valid for others, and by going through the sign-in flow again, this situation can be fixed.

An example is GitHub Single Sign On's Security Assertion Markup Language (SAML) support. By default, a token generated for you with repo scope will have the ability to access your own personal repositories. However, if you are in an organization with GitHub's Single Sign On turned on, you will have to explicitly grant a session the ability to access repositories in that organization.

In this example, the GitHub Authentication provider won't know the difference between a token that is properly SAML'd for what you're trying to access or not and so to rectify that behavior, you can now force the creation of a new session.

AuthenticationGetSessionOptions now has a forceNewSession property that lets you ask the user to sign in again. If you set this to true, the user will see:

Forcing sign in

You can also specify an object with a detail string, if you want to show a more descriptive message to the user.

Silently retrieve a session if an extension has one

A common pattern we've seen is that some extensions, when they activate, will check to see if they have an authentication session available. If so, they will use it to pre-load data and do other tasks ahead of time to speed up performance later on. The downside of this was that if a user hasn't given that extension access to an authentication session, a badge would be displayed on the account menu and an item in the menu will be added asking the user to sign in.

This is fine for some cases, but in others it's not desirable and clutters the screen for the user. To help with this, there is a new property on AuthenticationGetSessionOptions called silent, which lets you ask for a session without showing any indication that the extension asked for it. That way, the extension can do what it wants if it has the ability to get a session, but if it doesn't, it doesn't pester the user.

Note: This API will only return an authenticated session if the extension has already been granted access to the session in the past (in other words, it's a "trusted extension"). An extension will never be given a session that the user didn't consent to.

Settings editor improvements

Ordered settings

Individual settings can now be ordered with the order field. Ordered settings always come before unordered ones within the same category, and the ordering is relative.

Ungrouped category support

Settings can also be grouped under the main extension header instead of a specific category. To do that, set the category title of one of the categories to be the same as the extension display name.

Notice in the example below that the Conf > Language: Show Size setting is directly under the Configuration Sample header.

Settings appearing directly under the extension header

Support for number and integer objects

Objects with non-nullable number/integer values are now supported in the Settings editor.

An object setting in the Settings editor with number/integer values

New type signature for executeCommand

In previous versions of VS Code, vscode.commands.executeCommand was typed to always return a promise of a potentially undefined value:

export function executeCommand<T = unknown>(command: string, ...rest: any[]): Thenable<T>;

This means that if a command can return undefined, you must explicitly pass in | undefined as part of the type parameter:

"configurationDefaults": {
      "files.autoSave": "onFocusChange"
}

Note: Configurations with application or machine scopes cannot be overridden.

Replace content in Output channel

In this milestone, a new replace API on the OutputChannel object can replace the content in the output channel.

vsce publish --pre-release

The VS Code Marketplace only supports major.minor.patch for extension versions and does not yet support semver pre-release tags. We therefore recommend that extensions use major.EVEN_NUMBER.patch for release versions and major.ODD_NUMBER.patch for pre-release versions. For example: 0.2.* for release and 0.3.* for pre-release. VS Code will auto update extensions to the highest version available, so even if a user opted into a pre-release version, once there is an extension released with a higher version, that user will be updated to the released version.

More information about pre-release extensions can be found in the Pre-release Extensions topic.

Language Server Protocol

A new next version of the Language Server Protocol, together with the corresponding npm modules, has been published. Besides various minor improvements, the new version contains a proposed implementation for inline values.

Debug Adapter Protocol

New important category for the Output event

The Output event of the Debug Adapter Protocol is used to send the stdout and stderr streams of the debuggee as well as informational messages from the debugger to the Debug Console. This stream of messages can be a lot for a user to process and critical things can go unnoticed. For this reason, a new category important was added to the Output event, which can be used by a debug adapter to display critical messages that need to stand out and not get overlooked by the user. The important category is a hint for the client to show important information in a highly visible UI, for example as a popup notification. Since this category is a hint, clients might ignore the hint and assume the default category (console ).

Clarifications and improvements for the execution control requests

Previously the Debug Adapter Protocol specified that all "execution control" requests (continue, next, stepIn, stepOut, stepBack, reverseContinue) operate on a single thread but that an implementation could decide to ignore the thread argument and operate on all threads. Since this fuzzy "single thread" semantics is not really useful, typically debug adapters implement something more useful:

  • "step" requests that step the current thread while allowing others threads to run freely by resuming them.
  • "continue" requests that resume all threads.

Since the current spec is impractical for execution control requests, we have changed the spec for all execution control requests (continue, next, stepIn, stepOut, stepBack, reverseContinue) so that it matches what is typically implemented.

In addition, some debug adapters have a need for an "alternative semantic" where step or continue operate only on the current thread but keep all other threads in the suspended state. For this "alternative behavior", a new optional singleThread property has been added to all execution control requests. A corresponding new capability supportsSingleThreadExecutionRequests must be used by a debug adapter to indicate to the client that the execution control requests support the singleThread property.

Proposed extension APIs

Every milestone comes with new proposed APIs and extension authors can try them out. As always, we want your feedback. Here are the steps to try out a proposed API:

  1. Find a proposal that you want to try and add its name to package.json#enabledApiProposals.
  2. Use the latest vscode-dts and run vscode-dts dev. It will download the corresponding d.ts files into your workspace.
  3. You can now program against the proposal.

You cannot publish an extension that uses a proposed API. There may be breaking changes in the next release and we never want to break existing extensions.

QuickPickItem separators

This iteration we are introducing the ability for extensions to add separators (also known as "categories") to a Quick Pick via a proposed API (vscode.proposed.quickPickSeparators.d.ts). This is useful for grouping items or just having a bit of space between items:

Quick Pick separators

To add a separator to your existing Quick Pick, you can add a new QuickPickItem to your existing list of items but specify the kind property on the QuickPickItem and set it to QuickPickItemKind.Separator.

In the example above, you would add the following object to your list of items:

">PR #2748
            

Read the original on code.visualstudio.com ↗