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
PR: Fix several code snippets corner cases #10256
Conversation
@ccordoba12 @dalthviz, does this PR adresses all of your errors with code snippets? |
Thanks @andfoy! There are still some things not covered by this PR:
|
A couple more issues:
|
One more: if you enter the following code from pandas import pd
pd.concat(objs) and replace Traceback (most recent call last):
File "/home/carlos/Projects/spyder/github-repo/spyder/plugins/editor/extensions/snippets.py", line 201, in _on_key_pressed
self._process_text(text)
File "/home/carlos/Projects/spyder/github-repo/spyder/plugins/editor/extensions/snippets.py", line 49, in wrapper
return f(self, *args, **kwargs)
File "/home/carlos/Projects/spyder/github-repo/spyder/plugins/editor/extensions/snippets.py", line 209, in _process_text
self.insert_text(text, line, column)
File "/home/carlos/Projects/spyder/github-repo/spyder/plugins/editor/extensions/snippets.py", line 335, in insert_text
tokens = tokenize(text)
File "/home/carlos/Projects/spyder/github-repo/spyder/utils/snippets/lexer.py", line 91, in tokenize
if regex.match(temp_word) is not None: |
I'm very aware of this case, this is due to the Ctrl+Z behaviour of the CodeEditor, as opposed to the snippets one, while the first deletes the last sequence of characters, the latter stores a tree copy for n and c keypresses. Thus, when the undo call is applied, we backtrack to the "n" tree, rather to delete the "n" and "c" trees. Is there any way to get the length of the undo text? |
You'll have to look for it because I don't know, sorry. |
@andfoy if I do the following import json
json.dumps(123, 123)
# Entering snippet mode type 123 tab 123, then selecting all (while I still see the
# snippet squares) and delete everything I get self.insert_text(text, line, column)
File "/Users/gpena-castellanos/Google Drive/develop/quansight/spyder/spyder/plugins/editor/extensions/snippets.py", line 339, in insert_text
if node.name == 'EPSILON':
AttributeError: 'NoneType' object has no attribute 'name' |
Does this happens with this PR? |
Yes, it still happens qith this Pr |
@goanpeca Could you please and try again? |
Sure! After lunch 🥗:-) |
Hello @andfoy! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2019-09-28 18:09:56 UTC |
@ccordoba12 Does the last commit fixes all the undo behaviour? |
@andfoy, I'm still seeing #10256 (comment) with this PR. |
@ccordoba12 I cannot reproduce that one: |
03bcf70
to
050a56f
Compare
@andfoy, |
@ccordoba12 The azure test fail is unrelated to this one |
@andfoy, please skip |
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 a lot @andfoy!! Great work here!
Description of Changes
This PR addresses all of the code snippets errors reported on #10230
Issue(s) Resolved
Fixes #10289.
Fixes #10230
Affirmation
By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.
I certify the above statement is true and correct:
@andfoy