* feat: mass nouns after a/an etc.
Work-in-progress
Looks for mass nouns being treated as singular or plural nouns.
- group and sort `sequence_expr` `gen_then_from_is` etc.
- Added a new `agreement` `TokenKind` and added it to two other linters.
- Adding singular/plural & countable/mass flags to dictionary.
Does not yet handle adjectives between the determiner/quantifier and the noun.
Does not yet handle the case where the mass noun is part of a compound noun and therefor not an error.
Does not yet offer specific synonym such as "a tip" for "an advice".
* refactor: should appease precommit
Will also make planned enhancements easier.
* refactor: enum tuple variants
* refactor: specific countable synonyms
* chore: don't flag compound nouns
Default unit "piece" doesn't fit with some mass nouns like "traffic".
Fix some weird dictionary entries. Comment others.
* chore: can now suggest compound nouns
* chore: merge snapshot tests
* chore: update snapshot after merge
* fix: get rid of `assert_top5_suggestion_result`
---------
Co-authored-by: Elijah Potter <me@elijahpotter.dev>
* feat: phrase set corrections to group phrase corrections
* fix: appease Precommit
* chore: move all 1:1 lints to `phrase_set_corrections`
By which I mean that ones that only detect one variant of the bad phrase, and only offer one suggestion.
* feat: support many to many mappings
* chore: finish moving sets of phrase corrections
* docs: Updated documentation per Elija's request
I changed the first `phrase_corrections` example from "mute point" since it's now been moved to `phrase_set_corrections`. I picked "all of the sudden" as a common and straightforward one.
The "mute point" example actually had an error where the `[]` surrounding the offending phrase were missing.
I added examples for `phrase_corrections` showing how to handle multiple offending phrases and multiple correct phrases.
Also:
- Removed "chock full" as it has its own broader linter now.
- Expanded and renamed `InAndOfItself` to suggest both "in itself" and "in and of itself".
- Added a new set for "rise the question" that only seems to be common in two forms.
- Some of the tests were not in alphabetical order.
* feat: add `clojure` support
* test: add clojure example file
* feat: add support for more clojure dialect filetypes
* fix(comments): give test more descriptive name
---------
Co-authored-by: Elijah Potter <me@elijahpotter.dev>
* chore: rename `affixes.json` to `annotations.json`
The name was getting further and further from the function of the file. And the file is very important so a more representative name makes it less abstract when learning how Harper works.
* fix: mention old name `affixes.json`
I also noticed two fields in the sample entry had outdated names.
---------
Co-authored-by: Elijah Potter <me@elijahpotter.dev>
* chore: augment and refactor metadata
Add `0` flag to `affixes.json` for singular nouns. Only needed for nouns which are both singular and plural. Nouns marked neither are singular by default.
Mark a few dozen words in the dictionary which are both singular and plural.
Ensure the proper heirarchy of metadata properties and methods is respected:
`TokenKind` is the highest level with `WordMetadata` being a lower level for tokens representing words.
`token_kind.rs` implements `is_xxx()` methods on `TokenKind`.
They can call each other (`nominal` might combine `noun` and `pronoun` methods).
They can call `is_yyy()` methods on `WordMetadata`.
They must not use the low-level properties of `WordMetaData` directly when there are methods for them.
This ensures properties with special behaviour such as defaults that are not `false` only have to be implemented in one place.
`word_metadata.rs` implements `is_yyy()` methods on `WordMetadata`.
They can call each other (`nominal` might combine `noun` and `pronoun` methods).
They can use the low-level properties of `WordMetadata` directly.
They can implement special logic such as properties that do not default to false. In particular the new `singular` noun flag `0` does not have to be applied to every word in `dictionary.dict` and nouns will be treated as singular if they either have `singular` set to `Some(true)` or if they have both `singular` and `plural` set to either `None` or `Some(false)`.
(In the next stage, countable nouns will be implemented this same way.)
Tests in `word_metadata.rs` must use the `WordMetadata` `is_yyy` methods and must not use the low-level properties directly.
All `is_xxx()` and `is_yyy()` methods in both files have been standardized as above.
Un-`ignore`d all the tests on `singular` nouns and they all now pass.
Comments have been added to `token_kind.rs` in the `impl TokenKind` blocks to label the `is_xxx()` vs other methods, the word `is_yyy()` methods vs other token types `is_yyy()` methods, and the parts of speech of the various `is_yyy()` methods on words. In a following step I will group them and sort them. Until then this commit will be much easier to compare against the old code.
* fix: appease precommit and add a unit test to ensure the changed code behaves correctly
(also sort lint kinds alphabetically)
* feat: noun countability (mass vs count)
- `m` and `w` added to `affixes.json` for mass nouns and countable+mass nouns respectively. Nouns with neither flag in their annotation default to countable only.
- The auxiliary verb property flag was moved from `m` to `A`.
- A dozen or so words in `dictionary.dict` annotated for countability.
- `is_countable_noun` and `is_mass_noun` methods added to `TokenKind`.
- Also added the missing `is_singular_xxx` methods for `_nominal`, `_noun`, and `_pronoun`
- A first couple of tests added to `token_kind.rs`
- `is_countable` and `is_mass` properties added to `WordMetadata`
- `is_countable_noun` and `is_non_countable_noun` methods added to `WordMetaData`
- countable and mass noun unit tests added to `word_metadata.rs`
This will help make possible linting for errors like `source codes` and `an advice` etc.
I did not add countable and mass information to the snapshots. Let me know if it's needed.
I also removed a few bogus entries I spotted in the dictionary.
* refactor: generate `is_xxx methods` by macro
The `delegate_to_metadata` macro is in the spirit of the one in `word_metadata.rs` but simpler.
* chore: group and order methods
* chore: mark more mass nouns
* feat: add `LintKind` colours to the Playwright HTML report
* chore: `just format`
* fix: address precommit problem
* fix: fix the precommit error in a way that still works with the svelte files
* feat: in the cards ⇔ on the cards
* feat: correct wrong regional variant of in/on the cards
* fix(core): `WordSet` now supports typographic punct
* fix: appease clippy
* fix: add colours for new `Regionalism` lint kind
Also adds new colours for lint kinds that were sharing colours with other lint kinds
As a bonus I sorted them by lint kind and added colour descriptions in comments.
* chore: `just format`
---------
Co-authored-by: Elijah Potter <me@elijahpotter.dev>
* feat(harper-comments): add solidity support
* feat(harper-tree-sitter): merge overlapping spans
* feat(harper-comments): add specific solidity parser
* perf(harper-comments): early return
* test(harper-comments): add multiline solidity test
* test(harper-comments): add ignore test
* feat(vscode-plugin): add solidity support
* docs: add Solidity to documentation
* test: fix offset
* test: comment out solidity tests for vscode-plugin
* chore: fix justfile to use /usr/bin/env
The commands don't work on nixOS
* chore: fix more commands
* fix: return Dart support
---------
Co-authored-by: Elijah Potter <me@elijahpotter.dev>
* feat: split affixes and properties and support propagating properties
* refactor: use serde's default
* refactor: add comment
* fix: Fixed tagging of derived words of program
* docs(core): update docs
---------
Co-authored-by: Elijah Potter <me@elijahpotter.dev>
* feat(ls): make max document length configurable
* feat(ls): add `maxFileLength` to VS Code config
Add `maxFileLength` to `package.json`.
* docs: fix heading level
* docs: document `maxFileLength`
* docs(ls): clarify `maxFileLength` setting
`maxFileLength` is currently measured in bytes; ensure that the
documentation clearly states this.
* fix(ls): clear lints when file becomes too large
Ensure we clear existing lints when we stop linting a file due to it
becoming too large.
---------
Co-authored-by: Elijah Potter <me@elijahpotter.dev>
* docs(wordpress): put title in frontmatter
* docs(faq): move and update browser extension answer
* docs(chrome-ext): add link to technical post
---------
Co-authored-by: Elijah Potter <me@elijahpotter.dev>