-
-
Notifications
You must be signed in to change notification settings - Fork 39.8k
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
[Core] Add getreuer's Autocorrect feature to core #15699
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, Drashna! This is awesome. Here are a few nits and suggestions.
74c0033
to
bbddc69
Compare
I'm not sure how to fix this. Nor these:
Also, if "english_words" is added to requirements.txt, the unit tests fail (presumably because it's asking to install dependencies), and if it's not, cli ci fails |
Some style changes to hopefully address lint errors that came up in qmk/qmk_firmware#15699. * Break up `parse_file()` into several functions. * Avoid using `lambda`. * Better error message if node link exceeds 64KB limit.
Drashna, thank you for all your work on getting this together! Here are some suggestions that hopefully fix these lint errors. I also just made these style fixes in my repo in getreuer/qmk-keymap@c28e526 to show concretely what I suggest below.
This is saying there are too many branches and loops in
and then call this function in the loop in
The lint message is (tersely) saying that we should rewrite an assigned lambda like
as
Thanks again! =) |
Thanks! I think i got most of it working. Though, the try part is causing the pytest stuff to error out, because it's being called in every python file, I think (due to how the cli stuff is configured). I think it would work if the try import was moved into parse_file function instead. But I'm not exactly sure how to handle that, and properly set the (i'm definitely not a python person) |
got it mostly working, but still got pytest errors. Mostly, just running into this:
And I'm not sure how to correct it. |
Well, got it passing all the tests, and it does appear to be working correctly. So looks like it's good to go. |
Awesome! Great work, Drashna! 🥳 |
Thanks! And documents added. |
Hi Drashna, I wanted to try this out, but after locally checking out your PR and enabling the feature in my Apologies if this is the wrong place to ask. |
keymap config is zero'ed by default, so that would cause this feature to be disabled by default. You'd need to hit the |
No change, even after I add AUTOCRT to my keymap and tap it |
6a51e1e
to
cbff3bf
Compare
Odd. I can confirm that it does work, even from this branch directly. |
d805d20
to
e59d902
Compare
3de96bb
to
8a572f5
Compare
8a572f5
to
c6d1488
Compare
13f7756
to
695779a
Compare
and json support added. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
info.json
having context of headers bleeds implementation details into something that should be fairly generic. Its also questionable if the feature should be enabled at the keyboard level, which makes the schema/mappings changes not required. My view would be that it should never be.
Providing a default header to fall back on, and then warning seems a tad strange. I'm not really sure what use case that is trying to cover (especially if you take the viewpoint above).
fca16b1
to
c65ef0a
Compare
e717f19
to
e22731e
Compare
dca76c8
to
9c746c7
Compare
9c746c7
to
849ea4a
Compare
63f1e1a
to
19b9401
Compare
19b9401
to
5dfc383
Compare
Fix compilation issues Clean up names Reformat python cleanup add support for swap hands Add support for -km and -kb Ugly hack to get working Make output pretty Add support for --output Fix lint issue hopefully address cli ci errors Fix double space additional tweaks Apply suggestions from code review Update lib/python/qmk/cli/generate/autocorrect_data.py Apply suggestions from code review Co-authored-by: Albert Y <[email protected]> adddep Apply cli ci suggestion' Attempt to fix linter remove english_words dep Brute force hack to pass CI Fix issue with autocorrect leave english words enabled Fix pytest issues? Get cli python code working pass on line_number get tests passed Add documentation minor tweaks Fixes based on feedback Add fixes based on feedback Fix rebase conflicts add one more backspace if it's needed Add fixes move pressed processing improvements based on feedback "Fix" formatting fix error output fix linting fix linting, more brute force python formatting fix test this fix compilation issues with mods Add user callback for which keycodes to handle Allow configurable data file fix pr linting better handle keycodes fix some compiler issues Add doxygen comment Fix some edge cases Remove special case - not sure why I added it Make buffer check a switch Add comments Additional improvements (mods+) Update quantum/process_keycode/process_autocorrect.c Co-authored-by: Albert Y <[email protected]> fix oneshot check Co-authored-by: Albert Y <[email protected]> Add fixes and commenting from filterpaper Co-authored-by: Albert Y <[email protected]> Fix up switch case Ignore "dead" keys when features are disabled fix check Co-authored-by: Albert Y <[email protected]> Apply suggestions from code review Co-authored-by: Albert Y <[email protected]> apply documentation suggetion Co-authored-by: Albert Y <[email protected]> Expand handling for autocorrect triggering Fix functions and add more docs Apply suggestions from code review Co-authored-by: Albert Y <[email protected]> Rename apply function clarify pointier parameter Apply suggestions from code review Co-authored-by: Albert Y <[email protected]> fix docs Co-authored-by: Albert Y <[email protected]> Enable autocorrect by default Add on/off keycodes for autocorrect Move autocorrect to be after existing keycodes Update generate-autocorrect-data file Remove empty line Move svg to be local It\'s not imgur compatible so host it locally Switch to imgur hosted png Fix overflow issue on AVR Co-authored-by: Albert Y <[email protected]> Attempt to add tests? Add config.h for test fix formatting Prevent autocorrect test warning remove tests Add tests for autocorrect (wooooo!!!) Thanks karlk90!! Re-add autocorrect define to hide no default warning Add functions for state behavior Add enable/disable checks Fix lint issues Add additional test cases Clarify names Revert changes to drashna userspace for a cleaner commit history Add info.json support Add state check Don't ignore autocorrect h file Update docs Changes based on feedback Remove changes to json stuff
5dfc383
to
eac3795
Compare
tests/autocorrect/config.h
Outdated
|
||
#define AUTOCORRECT_DATA_H "quantum/process_keycode/autocorrect_data_default.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#define AUTOCORRECT_DATA_H "quantum/process_keycode/autocorrect_data_default.h" |
tests/autocorrect/config.h
Outdated
@@ -0,0 +1,21 @@ | |||
/* Copyright 2021 Stefan Kerkmann |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably be yourself.
tests/autocorrect/test.mk
Outdated
@@ -0,0 +1,20 @@ | |||
# Copyright 2021 Stefan Kerkmann |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably be yourself.
@@ -0,0 +1,217 @@ | |||
/* Copyright 2017 Fred Sundvik |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably be yourself.
@@ -0,0 +1,17 @@ | |||
// Copyright 2021 Google LLC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the Google thing because it matches their OSS policy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's because that's what the original code is.
https://github.com/getreuer/qmk-keymap/blob/a1f62991a99b205b7d493dcc1fdea3946cbb575c/features/autocorrection.c#L1-L13
And yeah, because of their OSS policies, IIRC>
@@ -0,0 +1,287 @@ | |||
// Copyright 2021 Google LLC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the Google thing because it matches their OSS policy?
@@ -0,0 +1,289 @@ | |||
# Copyright 2021 Google LLC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the Google thing because it matches their OSS policy?
Co-authored-by: Albert Y <[email protected]>
Description
As title.
It's a super cool feature, works well, and would be a great addition to QMK.
Types of Changes
Checklist