Skip to content

V1.3 features

Bill Ticehurst edited this page Mar 21, 2024 · 7 revisions

Formatting

You can now format Q# files. Either,

You can also select a block of code and format only the selection via the right-click menu (or the keyboard shortcut shown on that menu).

Formatting can be enabled/disabled through a checkbox on the VS Code settings for the Q# language:

image

Linting

Q# now has a linter! There are 3 rules in this first release, two that are on by default (and will show up as warnings in the editor). Example below:

image

User Configuration

These are the rules included in this release:

  • needlessParens
  • divisionByZero
  • redundantSemicolons

You can override the diagnostic level of each rule to one of three levels: allow, warn, or error.

You can set the lint levels from the qsharp.json file in a project as follows,

{
  "lints": [
    {
      "lint": "needlessParens",
      "level": "allow",
    },
    {
      "lint": "redundantSemicolons",
      "level": "warn",
    },
    {
      "lint": "divisionByZero",
      "level": "error",
    }
  ]
}

Create Project command

To ease creating the necessary project structure for a multi-file Q# project, there is now a Create Q# project command. This will create minimal ./qsharp.json and ./src/Main.qs files. If you run the command from the Command Palette, these will be created in the root of the open workspace folder. You can also right-click on the folder in the File Explorer to create the files in that folder, as shown below.

image

Connection string authentication

You can now authenticate to an Azure Quantum workspace using a connection string, rather than AzureAD authentication. See the Azure Quantum documentation on how to enable and locate a connection string.

When you click to add a quantum workspace (see https://github.com/microsoft/qsharp/wiki/Submitting-jobs-to-Azure-Quantum), you will first be asked to choose between AzureAD or a Connection String to authenticate. If you select Connection String, enter the connection string found from the Azure portal.

If you need to update the connection string, simply remove and re-add the workspace with the new connection string.

Azure workspace connection status

If the connection to an Azure Quantum workspace encounters issues, it will now show with an alert icon, and hovering the workspace will provider error information in the tooltip, as shown below.

image

Click the refresh icon at the top right of the workspace area to retry (or right-click on the workspace and remove it if necessary).