Skip to content

Commit 1d0afa5

Browse files
timtmokjuliasilge
andauthored
Add how to use isPositron context (#27)
* Add how to use isPositron context * Update first go at extension development docs * Refine docs a little more * Move this back to bottom of the page --------- Co-authored-by: Julia Silge <julia.silge@gmail.com>
1 parent 6f7926f commit 1d0afa5

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

_quarto.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ website:
7070
- run-interactive-apps.qmd
7171
- remote-ssh.qmd
7272
- updating.qmd
73+
- extension-development.qmd
7374

7475
- title: "Help"
7576
style: "docked"

extension-development.qmd

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: "Extension Development"
3+
---
4+
5+
Positron is compatible with VS Code extensions so you can create extensions [as you would for VS Code](https://code.visualstudio.com/api/get-started/your-first-extension). You can use Positron to develop your extension and run it in a new **Extension Development Host** window.
6+
7+
## Context keys
8+
9+
When defining your extension's manifest, you can use the `isPositron` context key for enablement or in a `when` clause.
10+
11+
```json
12+
"commands": [
13+
{
14+
"category": "My Extension",
15+
"command": "myExtension.myCommand",
16+
"title": "My Extension Command",
17+
"enablement": "isPositron"
18+
}
19+
]
20+
```
21+
22+
This allows your extension to enable commands, keybindings, menu items, and any other contribution points only for Positron.
23+
24+
## Positron API
25+
26+
Positron provides [all the normal contribution points and the VS Code API](https://code.visualstudio.com/api/extension-capabilities/overview) to extensions, but also additionally new APIs to use. We plan to make the extension development experience better (for example, [safely wrapping](https://github.com/posit-dev/positron/issues/458) and [providing typing for](https://github.com/posit-dev/positron/issues/809) the Positron API), but in the meantime, we recommend you [take a look at the Positron API details directly](https://github.com/posit-dev/positron/tree/main/src/positron-dts).

extensions.qmd

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Positron doesn't currently bundle the [Shiny](https://open-vsx.org/extension/pos
1010

1111
### Installing extensions
1212

13-
Positron has an Extensions view, just like VS Code. The primary difference is that when you browse extensions in Positron, the extensions don't come from VS Code's Marketplace. Instead, they come from a third-party marketplace, [OpenVSX](https://open-vsx.org/). This is necessary for licensing reasons; Microsoft doesn't permit access to the Marketplace from non-official clients.
13+
Positron has an Extensions view, just like VS Code. The primary difference is that when you browse extensions in Positron, the extensions don't come from VS Code's Marketplace. Instead, they come from a third-party marketplace, [OpenVSX](https://open-vsx.org/). This is necessary for licensing reasons; Microsoft doesn't permit access to the Marketplace from non-official clients.
1414

1515
OpenVSX includes most popular VS Code extensions, but not all; some authors don't bother to publish their extensions to OpenVSX (it's an extra step) and others don't keep the OpenVSX version of the extension up to date. Open VSX has a suggested [template](https://github.com/open-vsx/publish-extensions/blob/master/docs/external_contribution_request.md) to request that the authors of an extension cross-publish their extension on the Open VSX Registry.
1616

@@ -35,3 +35,7 @@ if (interactive() && Sys.getenv("RSTUDIO") == "" && Sys.getenv("POSITRON") == ""
3535
- [Python extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python): Positron bundles a fork of this extension that's built to work with Positron and offers support for the console, help, and other features. If there is anything from the original Python extension that doesn't work for you, please let us know.
3636

3737
There may be extensions that aren't available for Positron for licensing rather than technical reasons. These extensions would typically contain proprietary Microsoft code and are only licensed for use with Microsoft's proprietary VS Code product.
38+
39+
:::{.callout-tip}
40+
See [Extension Development](extension-development.qmd) for information on creating extensions specifically for Positron.
41+
:::

0 commit comments

Comments
 (0)