Skip to content

Commit c9a2efd

Browse files
Merge pull request #755 from mcecode/integration-docs
docs: update integrations section
2 parents 0da3835 + 8abfb4e commit c9a2efd

File tree

15 files changed

+422
-315
lines changed

15 files changed

+422
-315
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,14 @@ Just make sure to read [our contribution guidelines first.](https://github.com/a
4343
## Links
4444

4545
- [Frequently Asked Questions](https://writewithharper.com/docs/faq)
46+
- [Obsidian Documentation](https://writewithharper.com/docs/integrations/obsidian)
4647
- [`harper-ls` Documentation](https://writewithharper.com/docs/integrations/language-server)
47-
- [Neovim Support](https://writewithharper.com/docs/integrations/neovim)
48+
- Supported Editors' Documentation
49+
- [Visual Studio Code](https://writewithharper.com/docs/integrations/visual-studio-code)
50+
- [Neovim](https://writewithharper.com/docs/integrations/neovim)
51+
- [Helix](https://writewithharper.com/docs/integrations/helix)
52+
- [Emacs](https://writewithharper.com/docs/integrations/emacs)
53+
- [Zed](https://writewithharper.com/docs/integrations/zed)
4854
- [`harper.js` Documentation](https://writewithharper.com/docs/harperjs/introduction)
4955
- [Official Discord Server](https://discord.com/invite/JBqcAaKrzQ)
5056

packages/vscode-plugin/README.md

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,9 @@
11
# Harper for VS Code
22

3-
Harper is the next-generation grammar checker for your code. It catches common stylistic errors, as well as complex grammatical or layout-related problems. It works for almost [all common programming languages](./language-server#Supported-Languages) and a number of markup formats.
3+
Harper is the next-generation grammar checker for your code. It catches common stylistic errors, as well as complex grammatical or layout-related problems. It works for almost [all common programming languages](https://writewithharper.com/docs/integrations/language-server#Supported-Languages) and a number of markup formats.
44

55
If you use Rust, Java, JavaScript, or any number of other programming languages, your comments may end up as part of your API's documentation. If that's the case, grammatical mistakes in your code could be down-ranking your site on search results and tarnishing your reputation for quality.
66

77
Most importantly, Harper runs on-device and uses barely any memory at all. That means you can get feedback on your work in milliseconds, dramatically increasing your iteration speed.
88

9-
## Installation
10-
11-
Installation should be relatively straightforward.
12-
It just depends on which editor and marketplace you're using.
13-
14-
If you use the official Microsoft Visual Studio Code release, go ahead and go to the marketplace and search for "Harper" and click "Install".
15-
You can also visit our [official page](https://marketplace.visualstudio.com/items?itemName=elijah-potter.harper&ssr=false#overview).
16-
17-
If you use OpenVSX, for instance if you use VSCodium, you'll want to install from [here](https://open-vsx.org/extension/elijah-potter/harper).
18-
19-
### Commands
20-
21-
| Command | Id | Description |
22-
| ------------------------------- | ------------------------------- | ------------------- |
23-
| Harper: Restart Language Server | `harper.languageserver.restart` | Restart `harper-ls` |
24-
25-
### Settings
26-
27-
| Setting | Type | Default Value | Description |
28-
| ------------------------------ | ------------------------------------------------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
29-
| `harper-ls.path` | `string` | `""` | Optional path to a `harper-ls` executable to use. Primarily useful if the bundled binary doesn't work in your system like in immutable Linux distributions. |
30-
| `harper-ls.linters.*` | `boolean` | Varies | Detect and provide suggestions in a variety of common situations. |
31-
| `harper-ls.diagnosticSeverity` | `"error"`, `"hint"`, `"information"`, `"warning"` | `"information"` | How severe do you want diagnostics to appear in the editor? |
32-
33-
## Developing and Contributing
34-
35-
See the [Development Guide](/packages/vscode-plugin/development-guide.md).
9+
You can learn more about [this extension](https://writewithharper.com/docs/integrations/visual-studio-code) and [Harper](https://writewithharper.com/docs/about) over at our [official website](https://writewithharper.com).
Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,3 @@
11
# Development Guide
22

3-
This document details how to develop the extension locally. If you're interested in how it's packaged for distribution, you can checkout the [Package VS Code Plugin](/.github/workflows/package_vscode_plugin.yml) workflow.
4-
5-
## Notes
6-
7-
- The extension code and its tests live in the `src` directory. Most changes you'll need to make will be there.
8-
- 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.
9-
- You can look at the project's [`justfile`](/justfile) to see exactly what running the `just` recipes below do.
10-
11-
## Prerequisites
12-
13-
- Make sure to read the [Contributing guide](/CONTRIBUTING.md) and follow the "Setup Your Environment" section.
14-
- 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.
15-
16-
## Running the Extension
17-
18-
1. Open the Run and Debug view by selecting it from the Activity Bar or by pressing `Ctrl+Shift+D`.
19-
2. Choose `Run Extension`, if not chosen already.
20-
3. Click the play (Start Debugging) button or press `F5`.
21-
22-
## Running the Tests
23-
24-
### Using VS Code's Debugger
25-
26-
1. Open the Run and Debug view by selecting it from the Activity Bar or by pressing `Ctrl+Shift+D`.
27-
2. Choose `Test Extension`, if not chosen already.
28-
3. Click the play (Start Debugging) button or press `F5`.
29-
30-
### Using the Command Line
31-
32-
```console
33-
just test-vscode
34-
```
35-
36-
## Packaging and Installing the Extension
37-
38-
1. Package the extension:
39-
40-
```console
41-
just package-vscode
42-
```
43-
44-
2. Install the extension:
45-
46-
```console
47-
code --install-extension path/to/created/.vsix
48-
```
3+
This document has been moved to the [official documentation](https://writewithharper.com/docs/contributors/visual-studio-code).

packages/vscode-plugin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"scope": "resource",
8282
"type": "boolean",
8383
"default": false,
84-
"description": "Make code actions appear in \"stable\" positions by placing code actions that should always be available like adding misspelled words in the dictionary first."
84+
"description": "Make code actions appear in \"stable\" positions by placing code actions that should always be available, like adding misspelled words in the dictionary, first."
8585
},
8686
"harper.diagnosticSeverity": {
8787
"scope": "resource",

packages/web/src/app.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
@apply list-disc pl-4;
88
}
99

10+
ol {
11+
@apply list-decimal pl-4;
12+
}
13+
1014
h1 {
1115
@apply text-5xl py-4;
1216
}
@@ -19,6 +23,10 @@
1923
@apply text-xl sm:text-xl lg:text-2xl py-4;
2024
}
2125

26+
h4 {
27+
@apply font-bold;
28+
}
29+
2230
p {
2331
@apply lg:text-base md:text-lg xl:text-lg py-4;
2432
}

packages/web/src/routes/docs/contributors/review/+page.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ Most of our build tooling exists for Harper's various integrations.
2424
If you are testing `harper-core`, you can skip all the fluff and compile the patch using [Cargo](https://doc.rust-lang.org/cargo/) directly.
2525

2626
```bash
27-
cargo install --git https://github.com/automattic/harper --branch <branch-name> <binary-artifact>
27+
cargo install --git https://github.com/automattic/harper --branch <branch-name> <binary-artifact> --locked
2828
```
2929

3030
For example, for [PR #445](https://github.com/Automattic/harper/pull/455), we can install the patched version of the `harper-cli` debug tool with the following command:
3131

3232
```bash
33-
cargo install --git https://github.com/automattic/harper --branch somewhat-something harper-cli
33+
cargo install --git https://github.com/automattic/harper --branch somewhat-something harper-cli --locked
3434
```
3535

3636
From there, you can run the tool on any file with `harper-cli lint <path>`.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: Visual Studio Code
3+
---
4+
5+
This document details how to develop the Visual Studio Code extension locally. If you're interested in how it's packaged and distributed, you can checkout the [Release VS Code Plugin](https://github.com/Automattic/harper/blob/master/.github/workflows/release_vscode_plugin.yml) workflow.
6+
7+
## Notes
8+
9+
- The extension code and its tests live in the `packages/vscode-plugin/src` directory. Most changes you'll need to make will be there.
10+
- 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.
11+
- You can look at the project's [`justfile`](https://github.com/Automattic/harper/blob/master/justfile) to see exactly what running the `just` recipes below do.
12+
13+
## Prerequisites
14+
15+
- Make sure to [set up your environment](./environment).
16+
- 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.
17+
18+
## Running the Extension
19+
20+
1. Open the Run and Debug view by selecting it from the Activity Bar or by pressing `Ctrl+Shift+D`.
21+
2. Choose `Run Extension`, if not chosen already.
22+
3. Click the play (Start Debugging) button or press `F5`.
23+
24+
## Running the Tests
25+
26+
### Using VS Code's Debugger
27+
28+
1. Open the Run and Debug view by selecting it from the Activity Bar or by pressing `Ctrl+Shift+D`.
29+
2. Choose `Test Extension`, if not chosen already.
30+
3. Click the play (Start Debugging) button or press `F5`.
31+
32+
### Using the Command Line
33+
34+
```bash
35+
just test-vscode
36+
```
37+
38+
## Packaging and Installing the Extension
39+
40+
1. Package the extension:
41+
42+
```bash
43+
just package-vscode
44+
```
45+
46+
2. Install the extension:
47+
48+
```bash
49+
code --install-extension path/to/created/.vsix
50+
```

packages/web/src/routes/docs/faq/+page.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ title: Frequently Asked Questions
77
**Short answer**: not yet.
88

99
**Long answer:** at the time of writing, we've just released our first version of `harper.js` ([documentation here](./harperjs/introduction)), which will make it significantly easier to build such a product.
10-
That said, our road map has higher priority items at the moment, so don't expect the offical Harper maintainers to make an attempt in the near future.
10+
That said, our road map has higher priority items at the moment, so don't expect the official Harper maintainers to make an attempt in the near future.
1111

1212
If you're interested in trying to make one, let us know how it goes.
1313
We might be able to help.
@@ -21,6 +21,6 @@ We are entirely open to PRs that add support.
2121
If you just want to be able to run grammar checking on your code's comments, it's actually quite straightforward.
2222
You can use [this PR as a model for what to do](https://github.com/Automattic/harper/pull/332).
2323

24-
### Where Did the Name Harper Come From?
24+
## Where Did the Name Harper Come From?
2525

2626
See [this blog post](https://elijahpotter.dev/articles/naming_harper).

packages/web/src/routes/docs/integrations/emacs/+page.md

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,59 @@
22
title: Emacs
33
---
44

5-
Our Emacs support is limited and primarily provided by the community.
6-
You can see the longer discussion [here](https://github.com/Automattic/harper/discussions/150).
5+
Our Emacs integration is powered by [`harper-ls`](./language-server).
6+
7+
## Required Setup
8+
9+
Make sure you have [`harper-ls` installed](./language-server#Installation) on your system and available in your `PATH`.
10+
11+
Since version 29, Emacs has had native support for the Language Server Protocol through [Eglot](https://www.gnu.org/software/emacs/manual/html_mono/eglot.html), so all you have to do is configure it to use `harper-ls` in your `init.el`:
12+
13+
```elisp title=init.el
14+
(with-eval-after-load 'eglot
15+
(add-to-list 'eglot-server-programs
16+
'(text-mode . ("harper-ls" "--stdio"))))
17+
```
18+
19+
where `text-mode` can be set to any, some, or all major modes that correspond to the [languages `harper-ls` supports](./language-server#Supported-Languages). Typically, if you may want to use `harper-ls` to edit Markdown files and you have [`markdown-mode`](https://jblevins.org/projects/markdown-mode) installed, you can configure it like this:
20+
21+
```elisp title=init.el
22+
(with-eval-after-load 'eglot
23+
(add-to-list 'eglot-server-programs
24+
'(markdown-mode . ("harper-ls" "--stdio"))))
25+
```
26+
27+
## Optional Configuration
28+
29+
Additionally, you can also configure things like which linters to use or how you want code actions to appear. Below is an example config where everything is set to their default values:
30+
31+
```elisp title=init.el
32+
(setq-default eglot-workspace-configuration
33+
'(:harper-ls (:userDictPath ""
34+
:fileDictPath ""
35+
:linters (:SpellCheck t
36+
:SpelledNumbers :json-false
37+
:AnA t
38+
:SentenceCapitalization t
39+
:UnclosedQuotes t
40+
:WrongQuotes :json-false
41+
:LongSentences t
42+
:RepeatedWords t
43+
:Spaces t
44+
:Matcher t
45+
:CorrectNumberSuffix t)
46+
:codeActions (:ForceStable :json-false)
47+
:markdown (:IgnoreLinkTitle :json-false)
48+
:diagnosticSeverity "hint"
49+
:isolateEnglish :json-false)))
50+
```
51+
52+
:::note
53+
This example only contains some of the available linters, check out our [rules page](../rules) to view the full list.
54+
:::
55+
56+
For more information on what each of these configs do, you can head over to the [configuration section](./language-server#Configuration) of our `harper-ls` documentation.
57+
58+
## Additional Links
59+
60+
- [Community discussion on configuring `harper-ls` for Emacs](https://github.com/Automattic/harper/discussions/150)
Lines changed: 67 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,77 @@
11
---
2-
title: Helix Support
2+
title: Helix
33
---
44

5-
To use Harper in [Helix](https://helix-editor.com/), you'll need to have `harper-ls` installed.
5+
Our Helix integration is powered by [`harper-ls`](./language-server).
66

7-
Once you do, add this to you configuration:
7+
## Required Setup
88

9-
```toml
9+
Make sure you have [`harper-ls` installed](./language-server#Installation) on your system and available in your `PATH`.
10+
11+
Helix supports language servers [out-of-the-box](https://docs.helix-editor.com/languages.html), but you'll still need to configure it to use `harper-ls`. First, you need to tell Helix how it should run `harper-ls`:
12+
13+
```toml title=languages.toml
1014
[language-server.harper-ls]
1115
command = "harper-ls"
1216
args = ["--stdio"]
1317
```
1418

15-
Helix has [official documentation](https://github.com/helix-editor/helix/wiki/Language-Server-Configurations#harper-ls) as well.
19+
Then, for all the [languages `harper-ls` supports](./language-server#Supported-Languages) that you want it to be enabled for, you need to declare the following in your `languages.toml`:
20+
21+
```toml title=languages.toml
22+
[[language]]
23+
name = "language-id"
24+
language-servers = ["default-servers", "harper-ls"]
25+
```
26+
27+
where `language-id` is the language ID of the language you want `harper-ls` to be used for and `default-servers` are any of the [default language servers](https://docs.helix-editor.com/lang-support.html) supported by Helix that you use for that language. For example, if you want to configure it for Markdown and you use both Marksman and Markdown-Oxide, you'd end up with this:
28+
29+
```toml title=languages.toml
30+
[[language]]
31+
name = "markdown"
32+
language-servers = ["marksman", "markdown-oxide", "harper-ls"]
33+
```
34+
35+
You need to include the default language servers since there currently isn't a way to append a language server to the default `language-servers` list. Of course, you can also add other language servers you use before or after `harper-ls`.
36+
37+
## Optional Configuration
38+
39+
Additionally, you can also configure things like which linters to use or how you want code actions to appear. Below is an example config where everything is set to their default values:
40+
41+
```toml title=languages.toml
42+
[language-server.harper-ls.config.harper-ls]
43+
userDictPath = ""
44+
fileDictPath = ""
45+
diagnosticSeverity = "hint"
46+
isolateEnglish = false
47+
48+
[language-server.harper-ls.config.harper-ls.linters]
49+
SpellCheck = true
50+
SpelledNumbers = false
51+
AnA = true
52+
SentenceCapitalization = true
53+
UnclosedQuotes = true
54+
WrongQuotes = false
55+
LongSentences = true
56+
RepeatedWords = true
57+
Spaces = true
58+
Matcher = true
59+
CorrectNumberSuffix = true
60+
61+
[language-server.harper-ls.config.harper-ls.codeActions]
62+
ForceStable = false
63+
64+
[language-server.harper-ls.config.harper-ls.markdown]
65+
IgnoreLinkTitle = false
66+
```
67+
68+
:::note
69+
This example only contains some of the available linters, check out our [rules page](../rules) to view the full list.
70+
:::
71+
72+
For more information on what each of these configs do, you can head over to the [configuration section](./language-server#Configuration) of our `harper-ls` documentation.
73+
74+
## Additional Links
75+
76+
- [Helix's official documentation on `harper-ls`](https://github.com/helix-editor/helix/wiki/Language-Server-Configurations#harper-ls)
77+
- [Community discussion on configuring `harper-ls` for Helix](https://github.com/Automattic/harper/discussions/135)

0 commit comments

Comments
 (0)