Skip to content

Commit

Permalink
Add extension API (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
Katsute committed Jul 22, 2023
1 parent a880f17 commit 872cf44
Show file tree
Hide file tree
Showing 8 changed files with 412 additions and 15 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
node_modules
dist

.vscode-test

test/__*

*.vsix
52 changes: 51 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,56 @@ This extension modifies an internal file to make backgrounds work, if VSCode sto

This extension also modifies `%LocalAppData%\Programs\Microsoft VS Code\resources\app\product.json`, replace with `product-backup.json` if VSCode stops working.

## 🔌 API

Add this extension to your `package.json`.

```json
{
...
"extensionDependencies": [
"katsute.code-background"
]
...
}
```

Access the api by using:

```js
const background = vscode.extensions.getExtension("katsute.code-background").exports;
```

* `install(): void`

Runs the `Background: Install` command.
* `uninstall(): void`

Runs the `Background: Uninstall` command.
* `reload(): void`

Runs the `Background: Reload` command.
* `get(ui): string[]?`
* `ui` : Background to get from; either `window`, `editor`, `sidebar`, `panel`.

Returns an array of globs for the specified background.
* `add(ui, glob): Promise<boolean>`
* `ui` : Background to add to; either `window`, `editor`, `sidebar`, `panel`.
* `glob`: Glob to add.

Returns true if successful.
* `replace(ui, old, glob): Promise<boolean>`
* `ui` : Background to replace from; either `window`, `editor`, `sidebar`, `panel`.
* `old`: Glob to replace.
* `glob`: Updated glob.

Returns true if successful.
* `remove(ui, glob): Promise<boolean>`
* `ui` : Background to remove from; either `window`, `editor`, `sidebar`, `panel`.
* `glob`: Glob to remove.

Returns true if successful.

## &nbsp;

<!-- Copilot -->
Expand All @@ -156,4 +206,4 @@ This extension also modifies `%LocalAppData%\Programs\Microsoft VS Code\resource
</table>
<!-- Copilot -->

This extension is released under the [GNU General Public License (GPL) v2.0](https://github.com/KatsuteDev/Background/blob/main/LICENSE).
This extension is released under the [GNU General Public License (GPL) v2.0](https://github.com/KatsuteDev/Background/blob/main/LICENSE).
196 changes: 192 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 872cf44

Please sign in to comment.