Skip to content

Commit

Permalink
feat: support config files (typos.toml etc.) (#8)
Browse files Browse the repository at this point in the history
supports a config file read from the workspace folder or its parents.

also, debug logs now print client requests as json

resolves #6
  • Loading branch information
tekumara authored Aug 13, 2023
1 parent 09cf9ff commit f16a143
Show file tree
Hide file tree
Showing 7 changed files with 330 additions and 31 deletions.
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

0 comments on commit f16a143

Please sign in to comment.