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

feat: support config files (typos.toml etc.) #8

Merged
merged 18 commits into from
Aug 13, 2023
8 changes: 6 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@
"out": true // set this to false to include "out" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off"
}
"typescript.tsc.autoDetect": "off",
"rust-analyzer.linkedProjects": [
"./crates/typos-lsp/Cargo.toml"
],
"rust-analyzer.runnables.extraEnv": { "RUST_LOG": "warn"}
}
8 changes: 8 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

> **Source code spell checker for Visual Studio Code**

A Visual Studio Code Extension and LSP server for [typos](https://github.com/crate-ci/typos) a low false-positive source code spell checker.
[typos](https://github.com/crate-ci/typos) is a low false-positive source code spell checker. This Visual Studio Code extension provides a fast, low memory, in-editor spell checker by integrating with typos through the Language Server Protocol (LSP).

## Features

Expand All @@ -16,6 +16,17 @@ Once installed `typos` will automatically execute when you open or edit any file

To disable `typos` per workspace, see [disable this extension](https://code.visualstudio.com/docs/editor/extension-marketplace#_disable-an-extension).

## Config file support

Supports [config fields](https://github.com/crate-ci/typos/blob/master/docs/reference.md) in `typos.toml`, `_typos.toml`, or `.typos.toml`, except:

- `files.ignore*` - have no effect.
- `default.check-filename` - file names are never spell checked.
- `default.check-file` - files are always checked.
- `*.binary` - binary files are always checked.

Config files will be read from the workspace folder or its parents. If there is no workspace folder, then no config file will be read and the typos defaults will be used.

## Settings

This extension contributes the following settings:
Expand All @@ -29,3 +40,8 @@ This extension contributes the following settings:
| Command | Description |
| -------------- | ------------------- |
| Typos: Restart | Restart the server. |

## Caveats

- File names are not spell checked.
- Server must be restarted after changing the config files (ie: typos.toml).
2 changes: 2 additions & 0 deletions crates/typos-lsp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ env_logger = "0.10.0"
typos = "0.10"
typos-cli = "1.16"
serde = { version = "1.0", features = ["derive"] }
ignore = "0.4.20"
matchit = "0.7.1"

[dev-dependencies]
test-log = { version = "0.2.11", features = ["trace"] }
Expand Down
Loading