-
-
Notifications
You must be signed in to change notification settings - Fork 30.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
gh-63075: IDLE editor - Auto insertion of the closers #3520
base: main
Are you sure you want to change the base?
Conversation
adds fg color, bg color, font, and underline options for parens highlighting
How did the change to the __doc__ of append not get fixed in the tests earlier?
Used incorrect / old python for testing.
per terryjreedy request.
Fixing code conflict ate highlighting options. Needed to be re-introduced.
…eight as non-core keybinding test example.
idleConf expects a string bool, not type bool. whoops.
In use, it was irritating for me to have both perform the action. This way, users can pick one or both or none.
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.
Now that we are no longer implementing new features as extensions, this patch needs to be rewritten before it can be properly review in action. If someone else wants to do so before I get to it, please say so in a comment.
The comments below indicate the major changes needed.
@@ -0,0 +1,115 @@ | |||
""" |
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.
Add ParenClose to parenmatch.py.
Lib/idlelib/ParenClose.py
Outdated
When you hit left paren or tick, | ||
automatically creates the closing paren or tick. | ||
|
||
Author: Charles M. Wohlganger |
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.
Remove. This already has input from 3 other people. I will list Charles as original author in the news entry.
Add to the end of config-extensions.def : | ||
|
||
[ParenClose] | ||
enable = True |
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.
Delete.
paren_close = True | ||
tick_close = True | ||
skip_closures = True | ||
mutual_delete = True |
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.
I think defaults should be 'off', as in no change from current behavior. I am not sure what latter 2 mean. See below.
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.
Changing the specification of the new feature by adding action on deletion should have been discussed on the issue. (This applies generally to changing specs.) Notepad++ does do anything special on deletion. Binding the deletion keys here prevents binding them elsewhere, and I have an idea of where it might be needed, as opposed to optional. I also think sometimes delete more and sometimes not is confusing. The deletion part of 2f19ca8 and anything later should be reverted unless and until there is a clear agreement on adding this.
tick_close = True | ||
skip_closures = True | ||
mutual_delete = True | ||
[ParenClose_cfgBindings] |
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.
Delete section. Not needed for hard-coded features.
deleted before the new one is typed, effectively skipping over the closure. | ||
If the cursor is between two closures and mutual_delete or mutual_backspace | ||
is True, when the respective command is given, both closures are deleted. | ||
''' |
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.
I don't really understand these.
@@ -63,3 +63,17 @@ z-text= Z | |||
z-in= <Control-Shift-KeyRelease-Insert> | |||
[ZzDummy_bindings] | |||
z-out= <Control-Shift-KeyRelease-Delete> | |||
|
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.
As I said above, put in config-general.
eq(iGE(), ['ZzDummy', 'ParenClose']) | ||
eq(iGE(editor_only=True), ['ZzDummy', 'ParenClose']) | ||
eq(iGE(active_only=False), ['ZzDummy', 'ParenClose', 'DISABLE']) | ||
eq(iGE(active_only=False, editor_only=True), ['ZzDummy', 'ParenClose', 'DISABLE']) |
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.
I believe that all these changes to test_config only apply to extensions, and are therefore not needed.
@@ -0,0 +1,97 @@ | |||
'''Test idlelib.parenclose. |
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.
Add MockEvent and ParenCloseTest to test_parenmatch. I have not reviewed in detail, but have a couple of comments.
delete = p.delete_event | ||
for paren_close_set, tick_close_set, skip_closures_set, mutual_b_set, \ | ||
mutual_d_set, insert, func, pos, char, result, posend in [ | ||
(1, 1, 1, 1, 1, 'def abuse', p_open, '1.9', '(', |
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.
for test_tuple in [<list of tuples>]
would allow test_tuple to be passed to a helper function.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Trigger a retest to see if CI produces same odd failures as on another PR.
I would like to help out, but I believe Charles would need to make the changes. I don't have 'push access' to his branch. |
Hi, Is it possible to somehow include this patch manually, after installation of Python, even if it's not fully worked-on here? |
This PR makes a unrelated changes to the unix file mode of Tools/ssl/multissltests.py. This must be reverted between this can be applied. I don't think I can do so in Windows. Clicking ... to the right gives an option to 'Delete file'. I have the impression that this actually adds file deletion to the PR rather than removing the file change from the PR. |
There is no patch to the IDLE doc. I now think that this perhaps even be the first thing to do, rather than a possibly delayed afterthought. |
This PR is stale because it has been open for 30 days with no activity. |
This PR is stale because it has been open for 30 days with no activity. |
This PR is stale because it has been open for 30 days with no activity. |
This patch is for Auto insertion of the closing parens, brackets, and braces enhancement. It includes necessary changes to config-extensions.def, and idlelib.test.test_config. It has its own test which covers all non - init statements. As of writing this, idlelib.tests passes on all tests other than calltips, which appears to be a preexisting problem.
https://bugs.python.org/issue18875