-
Notifications
You must be signed in to change notification settings - Fork 15
feat: allow overriding languageCheckService #93
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
Merged
illia-romanenko
merged 13 commits into
solid-software:main
from
andrew-bekhiet-solid:allow-providing-custom-lang-tool-service
Aug 28, 2025
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
777f3da
feat: allow overriding languageCheckService
andrew-bekhiet-solid 8f2b230
fix: make sure language changes propagate to language check service
andrew-bekhiet-solid cdadc31
docs: add changelog
andrew-bekhiet-solid 0016152
Merge branch 'feat-add-is-enabled-toggle'
andrew-bekhiet-solid 36a9e5d
Merge branch 'allow-providing-custom-lang-tool-service'
andrew-bekhiet-solid 3031fe1
docs: squash chnages with v1.0.0
andrew-bekhiet-solid 8a35322
Merge branch 'main' into allow-providing-custom-lang-tool-service
andrew-bekhiet-solid 054459f
refactor: merge named constructor with the unnamed one
andrew-bekhiet-solid 9157f8c
refactor!: hide debouncing and throttling fields from public API
andrew-bekhiet-solid 978ec9f
docs: update changelog
andrew-bekhiet-solid 487e96b
rename throttling/debounce language tool service to language check se…
andrew-bekhiet-solid ebdfdb2
docs: update changelog
andrew-bekhiet-solid 8290948
fix: rename export
andrew-bekhiet-solid File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import 'package:languagetool_textfield/src/domain/language_check_service.dart'; | ||
| import 'package:languagetool_textfield/src/domain/mistake.dart'; | ||
| import 'package:languagetool_textfield/src/utils/result.dart'; | ||
| import 'package:throttling/throttling.dart'; | ||
|
|
||
| /// A language check service with debouncing. | ||
| class DebounceLanguageCheckService extends LanguageCheckService { | ||
| /// A base language check service. | ||
| final LanguageCheckService _languageCheckService; | ||
|
|
||
| /// A debouncing used to debounce the API calls. | ||
| final Debouncing<Future<Result<List<Mistake>>?>> _debouncing; | ||
|
|
||
| @override | ||
| String get language => _languageCheckService.language; | ||
|
|
||
| @override | ||
| set language(String language) { | ||
| _languageCheckService.language = language; | ||
| } | ||
|
|
||
| /// Creates a new instance of the [DebounceLanguageCheckService] class. | ||
| DebounceLanguageCheckService( | ||
| this._languageCheckService, | ||
| Duration debouncingDuration, | ||
| ) : _debouncing = Debouncing(duration: debouncingDuration); | ||
|
|
||
| @override | ||
| Future<Result<List<Mistake>>?> findMistakes(String text) async { | ||
| return await _debouncing | ||
| .debounce(() => _languageCheckService.findMistakes(text)); | ||
| } | ||
|
|
||
| // ignore: proper_super_calls | ||
| @override | ||
| Future<void> dispose() async { | ||
| _debouncing.close(); | ||
| await _languageCheckService.dispose(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import 'package:languagetool_textfield/src/domain/language_check_service.dart'; | ||
| import 'package:languagetool_textfield/src/domain/mistake.dart'; | ||
| import 'package:languagetool_textfield/src/utils/result.dart'; | ||
| import 'package:throttling/throttling.dart'; | ||
|
|
||
| /// A language check service with debouncing. | ||
| class ThrottlingLanguageCheckService extends LanguageCheckService { | ||
| /// A base language check service that is used to interact | ||
| /// with the language check API. | ||
| final LanguageCheckService _languageCheckService; | ||
|
|
||
| /// A throttling used to throttle the API calls. | ||
| final Throttling<Future<Result<List<Mistake>>?>> _throttling; | ||
|
|
||
| @override | ||
| String get language => _languageCheckService.language; | ||
|
|
||
| @override | ||
| set language(String language) { | ||
| _languageCheckService.language = language; | ||
| } | ||
|
|
||
| /// Creates a new instance of the [ThrottlingLanguageCheckService] class. | ||
| ThrottlingLanguageCheckService( | ||
| this._languageCheckService, | ||
| Duration throttlingDuration, | ||
| ) : _throttling = Throttling(duration: throttlingDuration); | ||
|
|
||
| @override | ||
| Future<Result<List<Mistake>>?> findMistakes(String text) async { | ||
| return await _throttling | ||
| .throttle(() => _languageCheckService.findMistakes(text)); | ||
| } | ||
|
|
||
| // ignore: proper_super_calls | ||
| @override | ||
| Future<void> dispose() async { | ||
| _throttling.close(); | ||
| await _languageCheckService.dispose(); | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.