Skip to content

Commit

Permalink
docs: fix typos and add missing documentation (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
selemondev authored Oct 27, 2024
1 parent 41322e3 commit 9cd486f
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 17 deletions.
2 changes: 1 addition & 1 deletion docs/guide/command.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Commands trigger actions. Commands expose functionality to users, bind to actions in VS Code's UI, and implement internal logic.

There are some [built-in commands](https://code.visualstudio.com/api/references/commands) in VS Code, and you can also define your own commands.
There are some [built-in commands](https://code.visualstudio.com/api/references/commands) in VSCode, and you can also define your own commands.

## Define in Manifest <NonProprietary />

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/context.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export = defineExtension(() => {

Note that `contextA` and `contextB` are `ref`s, which means you can set them later, and the context will be updated accordingly. `contextC` is a `computed` value, which means it will be updated automatically when `contextA` changes.

For more information about when clause contexts, please refer to the [official documentation](https://code.visualstudio.com/api/references/when-clause-contexts).
For more information on `when` clause contexts, please refer to the [official documentation](https://code.visualstudio.com/api/references/when-clause-contexts).
6 changes: 3 additions & 3 deletions docs/guide/disposable.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Disposables

Although most of the VSCode API is covered by <ReactiveVscode />, sometimes you still need to work with `vscode::Disposable`, which is also described in [VSCode API Patterns](https://code.visualstudio.com/api/references/vscode-api#disposables).
Although most of the VSCode APIs are covered by <ReactiveVscode />, sometimes you still need to work with `vscode::Disposable`, which is also described in [VSCode API Patterns](https://code.visualstudio.com/api/references/vscode-api#disposables).

`reactive::useDisposable` accepts a disposable object and automatically disposes it when the current effect scope is disposed (e.g., when the extension is deactivated, if `vscode::useDisposable` is called in the extension's setup function). `reactive::useDisposable` returns the disposable object itself as is.
`reactive::useDisposable` accepts a disposable object and automatically disposes it when the current effect scope is disposed (e.g When the extension is deactivated, if `vscode::useDisposable` is called in the extension's setup function). `reactive::useDisposable` returns the disposable object itself as is.

```ts
import type { TextDocument } from 'vscode'
Expand All @@ -21,4 +21,4 @@ export = defineExtension(() => {
})
```

Note that you needn't to use `reactive::useDisposable` for disposables created by any <ReactiveVscode /> functions. They are automatically disposed when the current effect scope is disposed.
Note that you don't need to use `reactive::useDisposable` for disposables created by any <ReactiveVscode /> functions. They are automatically disposed when the current effect scope is disposed.
13 changes: 10 additions & 3 deletions docs/guide/editor.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Editor and Document

## Document

The `reactive::useDocumentText` composable can be used to get the text of the document.

```ts
import type { ExtensionContext } from 'vscode'
/* eslint-disable import/first */

import { computed, defineExtension, ref, useActiveTextEditor, useDocumentText, watchEffect } from 'reactive-vscode'

export = defineExtension(() => {
Expand Down Expand Up @@ -36,7 +43,7 @@ See `vscode::TextEditor.setDecorations` for more information. To create a decora

## Editor Selections

The following 4 composable can be used to **get and set** the selections of editors.
The following 4 composables can be used to **get and set** the selections of editors.

- `reactive::useTextEditorSelections` - All selections in the text editor.
- `reactive::useTextEditorSelection` - The primary selection in the text editor.
Expand All @@ -47,7 +54,7 @@ See their docs for more information. Note that `reactive::useTextEditorSelection

## Editor Viewport

The following 3 composable can be used to **get** the viewport information of editors.
The following 3 composables can be used to **get** the viewport information of editors.

- `reactive::useTextEditorViewColumn` - The view column of the text editor.
- `reactive::useTextEditorVisibleRanges` - The visible ranges of the text editor.
Expand Down
6 changes: 3 additions & 3 deletions docs/guide/event.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Events

Although most of the VSCode API is covered by <ReactiveVscode />, sometimes you still need to create or listen original [VSCode events](https://code.visualstudio.com/api/references/vscode-api#events).
Although most of the VSCode APIs are covered by <ReactiveVscode />, sometimes you still need to create or listen to the primitive [VSCode events](https://code.visualstudio.com/api/references/vscode-api#events).

`reactive::useEvent` converts an raw event to a auto-disposed event:
`reactive::useEvent` converts a raw event to an auto-disposed event:

```ts
import { defineExtension, useEvent } from 'reactive-vscode'
Expand All @@ -18,7 +18,7 @@ export = defineExtension(() => {
})
```

`reactive::useEventEmitter` creates a frindly event emitter, which still extends `vscode::EventEmitter`:
`reactive::useEventEmitter` creates a friendly event emitter which still extends `vscode::EventEmitter`:

<!-- eslint-disable import/first -->
```ts
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/view.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export = defineExtension(() => {
})
```

The `children` property in nodes is used to define the children of the node. The `treeItem` propert is required and is used to define the tree item of the node. It should be a `vscode::TreeItem` object, or a promise that resolves to a `vscode::TreeItem` object.
The `children` property in nodes is used to define the children of the node. The `treeItem` property is required and is used to define the tree item of the node. It should be a `vscode::TreeItem` object, or a promise that resolves to a `vscode::TreeItem` object.

If you want to trigger an update based on some reactive values that aren't tracked in `treeData`, you can pass them to the `watchSource` option.

Expand All @@ -65,7 +65,7 @@ If you want to trigger an update based on some reactive values that aren't track
:::

::: warning
For the above example, `useDemoTreeView` should **not** be called top-level in the module, because the extension context is not available at that time. Instead, you should **always** call it in the `setup` function.
For the above example, `useDemoTreeView` should **not** be called at the top-level in the module, because the extension context is not available at that time. Instead, you should **always** call it in the `setup` function.
:::

## Register Webview
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/vueuse.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ export = defineExtension(() => {

## Available Functions

Every VueUse function that is compatible with the Node.js environment and doesn't require Vue's rendering API is available in this package. Check out [`packages/vueuse/src/index.ts`](https://github.com/KermanX/reactive-vscode/blob/main/packages/vueuse/src/index.ts) for the full list.
Every VueUse function that is compatible with the Node.js environment and doesn't require Vue's rendering API is available in this package. Check it out [`packages/vueuse/src/index.ts`](https://github.com/KermanX/reactive-vscode/blob/main/packages/vueuse/src/index.ts) for the full list.
4 changes: 2 additions & 2 deletions docs/guide/why.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ The official API is event-based, which means you have to listen to events to wat

### The Disposables

Disposables are everywhere in a VSCode extension. You have to store all of them to `vscode::ExtensionContext.subscriptions`, or dispose them manually.
Disposables are everywhere in a VSCode extension. You have to store all of them in `vscode::ExtensionContext.subscriptions`, or dispose them manually.

### When to Initialize

Views in a VSCode extension are created lazily. If you want to access a view instance, you have to store it, and even listen to a event which is fired when the view is created.
Views in a VSCode extension are created lazily. If you want to access a view instance, you have to store it, and even listen to an event which is fired when the view is created.

### Want to use Vue

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/window.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ export = defineExtension(() => {
})
```

Note that you can pass one of an array of patterns to watch for changes in the file system. Multiple VSCode watchers are created for each pattern.
Note that you can pass an array of patterns to watch for changes in the file system. Multiple VSCode watchers will be created for each pattern.

0 comments on commit 9cd486f

Please sign in to comment.