Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extension API #176

Merged
merged 7 commits into from
Jul 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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