Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{
"permissions": {
"allow": [
"Bash(cargo test:*)",
"Bash(cargo clippy:*)",
"Bash(git -C /Users/blopker/code/codebook log --oneline -20)"
]
"allow": ["Bash(cargo test:*)", "Bash(cargo clippy:*)"]
}
}
94 changes: 33 additions & 61 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ lazy_static = "1.5.0"
log = "0.4.22"
lru = "0.16"
regex = "1.11.1"
reqwest = { version = "<0.14", default-features = false, features = ["blocking", "rustls-tls", "json"] }
reqwest = { version = "^0.13.0", default-features = false, features = ["blocking", "rustls", "json"] }
rustls = { version = "<0.24", features = ["aws-lc-rs"] }
rustls-platform-verifier = "0.6.0"
serde = { version = "1", features = ["derive", "serde_derive"] }
Expand Down
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,7 @@ flag_words = ["todo", "fixme"]
ignore_paths = ["target/**/*", "**/*.json", ".git/**/*"]

# List of regex patterns to ignore when spell checking
# Patterns are matched against each line of text, not individual words
# Useful for domain-specific strings or patterns
# For code files: patterns match against the full source, tokens within matches are skipped
# Tip: Use single quotes for literal strings to avoid escaping backslashes
# Default: []
ignore_patterns = [
Expand Down Expand Up @@ -314,7 +313,12 @@ The `ignore_patterns` configuration allows you to define custom regex patterns t
- Git commit hashes: `\b[0-9a-fA-F]{7,40}\b`
- Markdown links: `\[([^\]]+)\]\(([^)]+)\)`

**Line-by-Line Matching**: Regex patterns are applied to each line of text, not individual words. This means your patterns should account for the line context.
**How Patterns Are Matched**:
- Patterns are matched against the full source text
- Words that fall entirely within a matched range are skipped
- **Multiline mode is enabled**: `^` and `$` match line boundaries, not just start/end of file
- Example: `'^vim\..*'` skips all words on lines starting with `vim.`
- Example: `'vim\.opt\.[a-z]+'` matches `vim.opt.showmode`, so `showmode` is skipped

**TOML Literal Strings**: Use single quotes for regex patterns to avoid escaping backslashes:
- `'\b'` for word boundaries (no escaping needed)
Expand All @@ -325,13 +329,13 @@ The `ignore_patterns` configuration allows you to define custom regex patterns t
```toml
ignore_patterns = [
'\b[ATCG]+\b', # DNA sequences with word boundaries
'^\s*//.*$', # Comment lines starting with //
'https?://[^\s]+', # URLs (no escaping needed)
'\$[a-zA-Z_][a-zA-Z0-9_]*', # Variables starting with $
'^vim\..*', # Lines starting with vim.
'^\s*//.*', # Lines that are // comments
'https?://[^\s]+', # URLs
]
```

**Migration Note**: If you're upgrading from an older version, patterns that used `^` and `$` anchors may need adjustment since matching now occurs line-by-line rather than word-by-word.
**Tip**: Include the identifier in your pattern. `'vim\.opt\.[a-z]+'` skips `showmode` in `vim.opt.showmode`, but `'vim\.opt\.'` alone won't (it only matches up to the dot).

### LSP Initialization Options

Expand Down
9 changes: 5 additions & 4 deletions crates/codebook/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ impl Codebook {
// call spell check on each dictionary
let language = self.resolve_language(language, file_path);
let dictionaries = self.get_dictionaries(Some(language));
let mut regex_patterns = get_default_skip_patterns().clone();
if let Some(config_patterns) = self.config.get_ignore_patterns() {
regex_patterns.extend(config_patterns);
// Combine default and user patterns
let mut all_patterns = get_default_skip_patterns().clone();
if let Some(user_patterns) = self.config.get_ignore_patterns() {
all_patterns.extend(user_patterns);
}
parser::find_locations(
text,
Expand All @@ -71,7 +72,7 @@ impl Codebook {
}
false
},
&regex_patterns,
&all_patterns,
)
}

Expand Down
Loading