This extension exposes an authentication provider to connect to the Linear API.
You won't usually install this extension by yourself, it'll most likely be installed by another extension as a dependency.
If you're building a VS Code extension yourself and want to interact with the Linear API it's as easy as:
Add the linear-connect extension to the extensionDepedencies
inside your package.json
.
"extensionDependencies": [
"linear.linear-connect"
],
With linear-connect as your dependecy, you can now request a Linear session from our VS Code authentication provider and use it with our Linear SDK:
import * as vscode from "vscode";
import { LinearClient } from "@linear/sdk";
const session = await vscode.authentication.getSession(
"linear", // Linear VS Code authentication provider ID
["read"], // OAuth scopes we're requesting
{ createIfNone: true }
);
if (session) {
const linearClient = new LinearClient({
accessToken: session.accessToken,
});
console.log("Acquired a Linear API session", {
account: session.account,
});
} else {
console.error(
"Something went wrong, could not acquire a Linear API session."
);
}
To see a demo of how to use it in practice, check out our simple Open issue in Linear extension.
After cloning the repo, use yarn
to install all the package dependencies.
In VS Code you change the code and run the extension in a separate app window to test with F5 (Run > Start Debugging).
To publish a new version of the extension, first install the vsce package, that is used to build VS Code extension packages.
npm i -g vsce
Then make sure to:
- Update the version in
package.json
according to semver - Add appropriate changes to
CHANGELOG.md
Build the new extension package.
vsce package
This produces a new file linear-connect-1.0.1.vsix
, if your version was set to 1.0.1 in package.json
.
You can use this file to release a new version of the extension on the VS Code marketplace.