Skip to content

Commit 26e8127

Browse files
committed
add README
1 parent 6d62ff9 commit 26e8127

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

README.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# code-d-api
2+
3+
Extend `code-d` in vscode with custom features.
4+
5+
This API provides:
6+
7+
- support for registering custom snippets depending on installed APIs
8+
9+
## Usage
10+
11+
Add code-d as dependency to your vscode extension inside the package.json:
12+
13+
```js
14+
"extensionDependencies": ["webfreak.code-d"]
15+
```
16+
17+
To use, simply get the extension using this code:
18+
```ts
19+
import * from "code-d-api";
20+
21+
export function activate(context: vscode.ExtensionContext) {
22+
const api: coded.CodedAPI | undefined;
23+
const codedExtension = vscode.extensions.getExtension<coded.CodedAPI>(coded.codedExtensionId);
24+
if (codedExtension) {
25+
api = codedExtension.exports;
26+
27+
// do your API stuff
28+
}
29+
}
30+
```
31+
32+
If you only want to optionally depend on code-d, make sure you use the `.activate()` call instead of `.exports` and await it or use it with a `.then(() => {})` clause.

0 commit comments

Comments
 (0)