Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
feat(vscode-plugin): add and update docs
Matthew Espino2ce99b898891
diff --git a/packages/vscode-plugin/CHANGELOG.md b/packages/vscode-plugin/CHANGELOG.mdindex 69649e6ec..01ac6020b 100644--- a/packages/vscode-plugin/CHANGELOG.md+++ b/packages/vscode-plugin/CHANGELOG.md@@ -1,5 +1,10 @@# Changelog+## Unreleased++- `harper-ls` is now bundled with this extension, it no longer needs to be in your `PATH`.+- `harper-ls` can now be manually restarted using the `harper.languageserver.restart` command.+## 0.0.1- Initial releasediff --git a/packages/vscode-plugin/README.md b/packages/vscode-plugin/README.mdindex 45576c4c6..fef4e8ac6 100644--- a/packages/vscode-plugin/README.md+++ b/packages/vscode-plugin/README.md@@ -1,30 +1,38 @@# Harper for VS Code-Currently, `harper-ls` needs to be in your `PATH` for this extension to work. [Read here to see how to install it](/harper-ls/README.md#installation).--## Manually Packaging and Installing--### Requirements--- [`yarn`](https://classic.yarnpkg.com/en), as the package manager-- [`just`](https://just.systems), as the command runner--### Steps--1. Clone or download the Harper repository:-- ```console- git clone https://github.com/elijah-potter/harper && cd harper- ```--2. Package the extension:-- ```console- just package-vscode- ```--3. Install the extension:-- ```console- code --install-extension packages/vscode-plugin/harper-0.0.1.vsix- ```+Read [main readme](/README.md) or visit [website](https://writewithharper.com).++## Installation++## Features++### Commands++| Command | Id | Description |+| ------------------------------- | ------------------------------- | ------------------- |+| Harper: Restart Language Server | `harper.languageserver.restart` | Restart `harper-ls` |++### Settings++| Setting | Possible Values | Default Value | Description |+| ------------------------------------------------ | ------------------------------------------------- | --------------- | -------------------------------------------------------------------------- |+| `harper-ls.linters.spell_check` | `true`, `false` | `true` | Detect and provide suggestions for misspelled words. |+| `harper-ls.linters.spelled_numbers` | `true`, `false` | `false` | Detect and fix instances where small numbers should be spelled out. |+| `harper-ls.linters.an_a` | `true`, `false` | `true` | Detect and fix improper articles. |+| `harper-ls.linters.sentence_capitalization` | `true`, `false` | `true` | Ensure your sentences are capitalized. |+| `harper-ls.linters.unclosed_quotes` | `true`, `false` | `true` | Make sure you close your quotation marks. |+| `harper-ls.linters.wrong_quotes` | `true`, `false` | `false` | Make sure you use the correct unicode characters for your quotation marks. |+| `harper-ls.linters.long_sentences` | `true`, `false` | `true` | Warn about run-on sentences. |+| `harper-ls.linters.repeated_words` | `true`, `false` | `true` | Detect and fix commonly repeated words. |+| `harper-ls.linters.spaces` | `true`, `false` | `true` | Detect improper spacing between words. |+| `harper-ls.linters.matcher` | `true`, `false` | `true` | A collection of hand-crafted common grammar mistakes. |+| `harper-ls.linters.correct_number_suffix` | `true`, `false` | `true` | Make sure you provide the correct suffix for numbers. |+| `harper-ls.linters.number_suffix_capitalization` | `true`, `false` | `true` | Make sure you correctly capitalize your number suffixes. |+| `harper-ls.linters.multiple_sequential_pronouns` | `true`, `false` | `true` | Detect improper sequences of pronouns. |+| `harper-ls.linters.linking_verbs` | `true`, `false` | `true` | Detect improper use of linking verbs. |+| `harper-ls.linters.avoid_curses` | `true`, `false` | `true` | Catch use of curse/swear words. |+| `harper-ls.diagnosticSeverity` | `"error"`, `"hint"`, `"information"`, `"warning"` | `"information"` | How severe do you want diagnostics to appear in the editor? |++## Developing and Contributing++See the [Development Guide](/packages/vscode-plugin/development-guide.md).diff --git a/packages/vscode-plugin/development-guide.md b/packages/vscode-plugin/development-guide.mdnew file mode 100644index 000000000..3192196d3--- /dev/null+++ b/packages/vscode-plugin/development-guide.md@@ -0,0 +1,48 @@+# Development Guide++This document details how to develop the extension locally. If you're interested in how it's published, you can checkout the [Publish VS Code Plugin](/.github/workflows/publish_vscode_plugin.yml) workflow.++## Notes++- The extension code and its tests live in the `src` directory. Most changes you'll need to make will be there.+- VS Code can only pickup the tasks and launch configurations set in `packages/vscode-plugin/.vscode` if this directory, `packages/vscode-plugin`, not the root of the Harper repository, is open.+- You can look at the project's [`justfile`](/justfile) to see exactly what running the `just` recipes below do.++## Prerequisites++- Make sure to read the [Contributing guide](/CONTRIBUTING.md) and follow the "Setup Your Environment" section.+- Before running or testing the extension using VS Code's Debugger, make sure you have `harper-ls` in `packages/vscode-plugin/bin`. You can either manually create the directory, compile `harper-ls`, and put it there or you can run `just test-vscode` or `just package-vscode` which will do that for you.++## Running the Extension++1. Open the Run and Debug view by selecting it from the Activity Bar or by pressing `Ctrl+Shift+D`.+2. Choose `Run Extension`, if not chosen already.+3. Click the play (Start Debugging) button or press `F5`.++## Running the Tests++### Using VS Code's Debugger++1. Open the Run and Debug view by selecting it from the Activity Bar or by pressing `Ctrl+Shift+D`.+2. Choose `Test Extension`, if not chosen already.+3. Click the play (Start Debugging) button or press `F5`.++### Using the Command Line++```console+just test-vscode+```++## Packaging and Installing the Extension++1. Package the extension:++ ```console+ just package-vscode+ ```++2. Install the extension:++ ```console+ code --install-extension path/to/created/.vsix+ ```diff --git a/packages/vscode-plugin/package.json b/packages/vscode-plugin/package.jsonindex 9c8c2e080..8be1507b0 100644--- a/packages/vscode-plugin/package.json+++ b/packages/vscode-plugin/package.json@@ -50,7 +50,7 @@"contributes": {"commands": [{- "command": "harper-ls.restart",+ "command": "harper.languageserver.restart","title": "Harper: Restart Language Server","description": "Restart harper-ls"}@@ -87,13 +87,13 @@"scope": "resource","type": "boolean","default": true,- "description": "Make sure you close you quotation marks."+ "description": "Make sure you close your quotation marks."},"harper-ls.linters.wrong_quotes": {"scope": "resource","type": "boolean","default": false,- "description": "Make sure you use the correct unicode characters for you quotation marks."+ "description": "Make sure you use the correct unicode characters for your quotation marks."},"harper-ls.linters.long_sentences": {"scope": "resource",@@ -167,7 +167,7 @@"scripts": {"watch:esbuild": "node esbuild.cjs --watch","watch:tsc": "tsc --noEmit --watch",- "pretest": "yarn run lint && tsc && node esbuild.cjs",+ "pretest": "yarn lint && tsc && node esbuild.cjs","test": "node build/tests/runTests.js","vscode:prepublish": "yarn lint && tsc --noEmit && node esbuild.cjs --production","package": "vsce package",diff --git a/packages/vscode-plugin/src/extension.ts b/packages/vscode-plugin/src/extension.tsindex 069857ff6..8a780dbce 100644--- a/packages/vscode-plugin/src/extension.ts+++ b/packages/vscode-plugin/src/extension.ts@@ -59,7 +59,9 @@ export async function activate(context: ExtensionContext): Promise<void> {showError('Failed to import manifest file', error);}- context.subscriptions.push(commands.registerCommand('harper-ls.restart', startLanguageServer));+ context.subscriptions.push(+ commands.registerCommand('harper.languageserver.restart', startLanguageServer)+ );await startLanguageServer();}