Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
docs(ls): transfer config docs from neovim page + some updates/fixes
Matthew Espino2b0ee6061fb5
diff --git a/packages/vscode-plugin/package.json b/packages/vscode-plugin/package.jsonindex 68957ab0e..a179ab8a2 100644--- a/packages/vscode-plugin/package.json+++ b/packages/vscode-plugin/package.json@@ -81,7 +81,7 @@"scope": "resource","type": "boolean","default": false,- "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."+ "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."},"harper.diagnosticSeverity": {"scope": "resource",diff --git a/packages/web/src/routes/docs/integrations/language-server/+page.md b/packages/web/src/routes/docs/integrations/language-server/+page.mdindex 22ab03904..8be0336c5 100644--- a/packages/web/src/routes/docs/integrations/language-server/+page.md+++ b/packages/web/src/routes/docs/integrations/language-server/+page.md@@ -77,44 +77,137 @@ If none of the previous installation methods are available to you, we also provi## Dictionaries-`harper-ls` has three kinds of dictionaries: user, file-local, and static dictionaries.+`harper-ls` has three kinds of dictionaries: user, file-local, and static dictionaries. All three dictionaries are combined and used together when spell checking files.### User Dictionary-Each user of `harper-ls` has their own dictionary, located in the following directories on each operating system:+Each user of `harper-ls` has their own dictionary, which by default, is located in the following directories on each operating system:-| Operating System | Location |-| :--------------- | ---------------------------------------------: |-| Linux | `$XDG_CONFIG_HOME/harper-ls/` |-| MacOS | `$HOME/Library/Application Support/harper-ls/` |-| Windows | `FOLDERID_LocalAppData/harper-ls/` |+| Operating System | Location |+| :--------------- | --------------------------------------------------------: |+| Linux | `$XDG_CONFIG_HOME/harper-ls` or `$HOME/.config/harper-ls` |+| macOS | `$HOME/Library/Application Support/harper-ls` |+| Windows | `%FOLDERID_RoamingAppData%/harper-ls` |-This dictionary is a simple line-separated word list in plain-text.-You can add and remove words at will.-Code actions on misspelled words allow you to add elements to this list.--This was added in response to [issue #89](https://github.com/automattic/harper/issues/89).+This dictionary is a simple line-separated word list in plaintext. You can add and remove words at will. Code actions on misspelled words allow you to add elements to this list. Additionally, [its location is configurable](#Dictionaries_).### File-Local Dictionary-Sometimes, you'll encounter a word (or name) that is only valid within the context of a specific file.-In this case, you can use the code action that adds the word to the file-local dictionary.-Any words added to this dictionary will, like the name implies, only be included in the dictionary when performing corrections on the file at that specific path.+Sometimes, you'll encounter a word (or name) that is only valid within the context of a specific file. In this case, you can add this file-specific word to a file-local dictionary using code actions. Any words added to this dictionary will only be included in the combined dictionary when spell checking a file at that specific path.-You can find the file-local dictionaries in the following directories on each operation system:+You can find the file-local dictionaries in the following directories by default on each operation system:| Operating System | Location || :--------------- | -----------------------------------------------------------------------------------------------: || Linux | `$XDG_DATA_HOME/harper-ls/file_dictionaries` or `$HOME/.local/share/harper-ls/file_dictionaries` |-| MacOS | `$HOME/Library/Application Support/harper-ls/file_dictionaries` |-| Windows | `FOLDERID_LocalAppData/harper-ls/file_dictionaries` |+| macOS | `$HOME/Library/Application Support/harper-ls/file_dictionaries` |+| Windows | `%FOLDERID_LocalAppData%/harper-ls/file_dictionaries` |++The format of these files is identical to user dictionaries and [their location can also be configured](#Dictionaries_).++### Static Dictionary++The static dictionary is built into the binary and is (as of now) immutable. It contains almost all words you could possibly encounter.++We _do_ take pull requests or issues for adding words to the static dictionary. [Read the documentation on the matter before you do](../contributors/dictionary).++## Configuration++`harper-ls` expects a JSON object with a `harper-ls` key that contains your configs:-The format of these files is identical to user dictionaries.+```json+{+ "harper-ls": {+ // Your config goes here...+ }+}+```++### Dictionaries++| Config | Type | Default Value | Description |+| -------------- | -------- | ------------- | --------------------------------------------------------------- |+| `userDictPath` | `string` | `""` | Set the directory where the user dictionary is located |+| `fileDictPath` | `string` | `""` | Set the directory where the file-local dictionaries are located |++### Linters-### Configuration+These configs are under the `linters` key:++```json+{+ "harper-ls": {+ "linters": {+ // Your linter configs go here...+ }+ }+}+```++The list of linters together with their descriptions can be found at our [rules page](../rules). All linters are of `boolean` type. Here's an example config with some of them and their default values:++```json+{+ "harper-ls": {+ "linters": {+ "SpellCheck": true,+ "SpelledNumbers": false,+ "AnA": true,+ "SentenceCapitalization": true,+ "UnclosedQuotes": true,+ "WrongQuotes": false,+ "LongSentences": true,+ "RepeatedWords": true,+ "Spaces": true,+ "Matcher": true,+ "CorrectNumberSuffix": true+ }+ }+}+```-Configuration of `harper-ls` varies by editor.-If you use Neovim, [read this documentation](./neovim#Configuration).+### Code Actions++These configs are under the `codeActions` key:++```json+{+ "harper-ls": {+ "codeActions": {+ // Your code action configs go here...+ }+ }+}+```++| Config | Type | Default Value | Description |+| ------------- | --------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |+| `ForceStable` | `boolean` | `false` | Make code actions appear in "stable" positions by placing code actions that should always be available, like adding misspelled words in the dictionary, first. See [issue #89](https://github.com/automattic/harper/issues/89) for more details. |++### Markdown++These configs are under the `markdown` key:++```json+{+ "harper-ls": {+ "markdown": {+ // Your markdown go here...+ }+ }+}+```++| Config | Type | Default Value | Description |+| ----------------- | --------- | ------------- | ------------------------------------------------------------------------------------------------------------- |+| `IgnoreLinkTitle` | `boolean` | `false` | Skip linting link titles. See [issue #104](https://github.com/automattic/harper/issues/104) for more details. |++### Other Configs++| Config | Type | Default Value | Description |+| -------------------- | ------------------------------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| `diagnosticSeverity` | `"error"`, `"hint"`, `"information"`, `"warning"` | `"hint"` | Configure how severe you want diagnostics to appear in your editor |+| `isolateEnglish` | `boolean` | `false` | In documents that are a mixture of English and another language, only lint English text. This feature is incredibly new and unstable. Do not expect it to work perfectly. |## Supported Languages@@ -153,11 +246,3 @@ If you use Neovim, [read this documentation](./neovim#Configuration).Want your language added?Let us know by [commenting on this issue](https://github.com/Automattic/harper/issues/79).--### Static Dictionary--The static dictionary is built into the binary and is (as of now) immutable.-It contains almost all words you could possibly encounter.--I _do_ take pull requests or issues for adding words to the static dictionary.-[Read the documentation on the matter before you do.](../contributors/dictionary)diff --git a/packages/web/src/routes/docs/integrations/neovim/+page.md b/packages/web/src/routes/docs/integrations/neovim/+page.mdindex aa23c8946..26a98c691 100644--- a/packages/web/src/routes/docs/integrations/neovim/+page.md+++ b/packages/web/src/routes/docs/integrations/neovim/+page.md@@ -10,66 +10,14 @@ How you choose to install `harper-ls` depends on your use-case. For Neovim, we o## Configuration-Neovim is also one of the two primarily supported editors for `harper-ls`.-As such, you can view this page as canonical documentation for the available configuration options.-[Helix](./helix) and [Zed](./zed) users may also find it helpful.--### Markdown-Specific Config--The Markdown parser has its own configuration option, used to modify its behavior in specific ways.-For example, the title of a link is linted by default, but this behavior can be changed through the `ignore_link_title` key:--```lua-lspconfig.harper_ls.setup {- settings = {- ["harper-ls"] = {- markdown = {- IgnoreLinkTitle = true,- }- }- },-}-```--### Dictionaries--You do not have to stick with the default dictionary locations ([listed on this page](./language-server)).-If you use Neovim, you can set the location of the user dictionary with the `userDictPath` key, and the file dictionary with the `fileDictPath` key:--```lua-lspconfig.harper_ls.setup {- settings = {- ["harper-ls"] = {- userDictPath = "~/dict.txt",- fileDictPath = "~/.harper/",- }- },-}-```--For example, if you want to use Vim's dictionary, you can do something like this:--```lua-lspconfig.harper_ls.setup {- settings = {- ["harper-ls"] = {- userDictPath = vim.fn.stdpath("config") .. "/spell/en.utf-8.add",- }- },-}-```--See the [relevant issue for details](https://github.com/Automattic/harper/issues/143).--### Linters--Linters are grammatical rules Harper looks for to correct your work.-You can toggle them on or off to your liking.+Below is an example config where everything is set to their default values:```lualspconfig.harper_ls.setup {settings = {["harper-ls"] = {+ userDictPath = "",+ fileDictPath = "",linters = {SpellCheck = true,SpelledNumbers = false,@@ -82,61 +30,22 @@ lspconfig.harper_ls.setup {Spaces = true,Matcher = true,CorrectNumberSuffix = true,- }- }- },-}-```--<script>-import DefaultNeovimConfig from "$lib/DefaultNeovimConfig.svelte"-</script>--<DefaultNeovimConfig/>--By default, `harper-ls` will mark all diagnostics with HINT.-If you want to configure this, refer below:--```lua-lspconfig.harper_ls.setup {- settings = {- ["harper-ls"] = {- diagnosticSeverity = "hint" -- Can also be "information", "warning", or "error"- }- },-}-```--You can also configure how `harper-ls` displays code actions.-For example, to make code actions appear in "stable" positions, use the following configuration:--```lua-lspconfig.harper_ls.setup {- settings = {- ["harper-ls"] = {+ },codeActions = {- ForceStable = true- }+ ForceStable = false+ },+ markdown = {+ IgnoreLinkTitle = false,+ },+ diagnosticSeverity = "hint",+ isolateEnglish = false}- },+ }}```-If you work with a lot of documents that are a mixture of English and another language, Harper can attempt to automatically detect which is which and only lint the English text.-To enable it, just set the `isolateEnglish` key.-:::note-This feature is incredibly new and unstable.-Do not expect it to work perfectly.-If improvements are important to you, feel free to [open an issue](https://github.com/Automattic/harper/issues/new?template=Blank+issue) to let us know.+This example only containes some of the available linters, head over to our [rules page](../rules) to view the full list.:::-```lua-lspconfig.harper_ls.setup {- settings = {- ["harper-ls"] = {- isolateEnglish = false- }- },-}-```+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.diff --git a/packages/web/src/routes/docs/integrations/visual-studio-code/+page.md b/packages/web/src/routes/docs/integrations/visual-studio-code/+page.mdindex ab6822298..318a43046 100644--- a/packages/web/src/routes/docs/integrations/visual-studio-code/+page.md+++ b/packages/web/src/routes/docs/integrations/visual-studio-code/+page.md@@ -16,9 +16,7 @@ Open the Extensions view in your editor by selecting the Extensions icon in the## Settings-<!-- TODO: Link to the `harper-ls` configuration section here when it's done. -->--The settings below are VS Code specific. You can head over to the `harper-ls` documentation to view other available settings.+The settings below are VS Code specific. You can head over to the `harper-ls` documentation to view [other available settings](./language-server#Configuration).| Setting | Type | Default Value | Description || ------------- | -------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |diff --git a/packages/web/vite.config.ts b/packages/web/vite.config.tsindex e2aad0bb3..4e1152905 100644--- a/packages/web/vite.config.ts+++ b/packages/web/vite.config.ts@@ -154,7 +154,8 @@ export default defineConfig({'scss','toml','rust',- 'lua'+ 'lua',+ 'json']}})