-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Quotes and colons autocompletion #872
Comments
From ccordoba12 on 2011-12-07T09:03:09Z What do you mean exactly by "edit"? Please give us an example You can change how autocompletion works in:
Summary: Autocomplete edition |
From [email protected] on 2011-12-07T09:28:22Z In preferences you just activate or deactivate autocompletion. This are some examples of what i would like to add Auto complete single quotation marks. Putting a colon after parenthesis when defining a function. Putting a colon in front of each if...else statements (don't know if this is doable or pratical). Autoindent (at least on my spyder is not working don't know if this is already implemented...) I'm used to that so i think that would be a plus... |
From ccordoba12 on 2011-12-07T09:40:03Z Ok, I understand you now. The problem is these things have to be added to the source code. I don't think there is a way for users to add them. What do you mean by 'Auto complete single quotation marks'? Something like: if you write ' you want to get ''? Autoindentation can be turned on/off in Tools > Preferences > Editor > Advanced Settings. To make it work you have to write colons at the end of def's, if's, etc, though. Summary: Code completion enhancements |
From [email protected] on 2011-12-07T09:57:11Z In pydev for eclipse, when you put a single quotation mark it automatically adds the other one and the cursor stays between them for typing whatever you want... if colons were automatically placed after if or def's, indentation should work as it normally does... i guess it would save some time but i can't argue with you because you probably know more (a lot more) of python than i do! :) |
From [email protected] on 2011-12-08T03:45:40Z To me it is completely normal to add autocompletion enhancements to the source code. The difficulty is that the process is not documented. =) Carlos, can you provide an entrypoint for people who want to improve this part of Spyder to look at? |
From ccordoba12 on 2011-12-26T10:12:35Z Summary: Several edition enhancements |
From ccordoba12 on 2011-12-29T16:40:59Z Pierre, I added the possibility to automatically insert colons after an Enter keypress. I also added a config option so the user can decide if he/she wants to turn on/off this functionality. Should I update the UserConfig version because of this change, like you did f.ex in revision 7ef1137a0c95 ? |
From pierre.raybaut on 2011-12-30T05:07:16Z We need to change the configuration file version number only when changing the default value of an existing option (like I did in the revision you mentioned). If this is a new option (or section) in the configuration file, this is not necessary. I suppose that it's a new option here, so you shouldn't have to change the version number. |
From ccordoba12 on 2011-12-31T07:15:13Z Yep, I'm adding a new option. Thanks for the clarification. |
From ccordoba12 on 2011-12-31T07:15:49Z This issue was updated by revision 8cb13b3c5f93 . Status: Started |
From ccordoba12 on 2011-12-31T07:15:49Z This issue was updated by revision faa8ad54d476 . -. The user can decide at will if he/she wants to turn on/off this functionality Status: Fixed |
From ccordoba12 on 2011-12-31T07:21:46Z Nuno, I hope these additions cover all your suggestions. Thanks for taking the time to post them here, they're a great addition to Spyder's usability. Cheers, |
From [email protected] on 2011-12-31T10:40:49Z Yes, i believe that these additions make life easier for programmers... I'm glad i could contribute for the improvement of Spyder! it's a great tool! Regards, |
From [email protected] on 2012-01-01T05:49:14Z After the previous commits pressing "enter" at the end of the following lines adds (wrongly) a semicolon
I think a check should be a added for "" and for parentheses. Also there is a problem with the automatic insertion of the second quote. Par example. After inserting a double quote the cursor is at the position noted with "": Regards |
From [email protected] on 2012-01-01T06:11:35Z Clarifying my previous comment. Now, when you insert a quote you have the following |
From ccordoba12 on 2012-01-01T13:53:07Z Thanks Panos for your feedback. I'll improve our checking mechanism to cover the cases you describe for 'if' and 'for'. About double quotes, do you think it would be better to disable completely their automatic insertion? I think it's not that easy to check for open quotes to close them, as it is for parentheses but I'll have to think about it. Status: Started |
From [email protected] on 2012-01-01T14:23:40Z Hi Carlos, In regard of quotes, I think that it is a nice feauture to have, but in no way necessary. I tried to think of an algorithm implementing the correct behavior, but you are right, it is not very easy to find a generic and consistent algorithm. Of course, it is possible but probably it is not worth the effort, since the usefulness is limited (in contrast with parentheses). I don't know if it easy, or even possible, to add tests for spyder's editor, but I think that this problem would be much easier solved through test driven programming. I think that writing tests for this problem is easier than describing it :) |
From [email protected] on 2012-01-02T06:04:10Z perhaps the following issue could be merged with this one https://code.google.com/p/spyderlib/issues/detail?id=887 |
From ccordoba12 on 2012-01-05T15:41:34Z This issue was updated by revision 18efa83f9033 . Improve usability of automatic insertion of colons and quotes after pmav99 |
From ccordoba12 on 2012-01-05T15:45:50Z I added several changes that I think cover all your suggestions (including triple quotes). Please try them and let me now if they work for you. |
From [email protected] on 2012-01-07T12:54:23Z After the last changes, each time I press enter I get the following traceback at the internal console
changing line 1998 to the following one to
results in the following traceback
using unicode() instead of str() solves the problem but I don't know if there are other side-effects. |
From [email protected] on 2012-01-07T13:03:25Z In regard the issue with the quotes, it works ok, but there are problems when the quotes are nested. Try to do the following: (1) the cursor is at the asterisk. It is just before you insert the single quote (1) "Some text. A single quote follows " As you can see a second quote has been inserted. If it is easy, add a check for already open quotes (of any type). If it is bothersome leave it as it is. |
From [email protected] on 2012-01-07T14:40:28Z In continuation of comment 21 The need for unicode() comes up when I edit files with unicode characters (using from future import unicode_literals). I don't know if this has any side-effects. |
From [email protected] on 2012-01-07T14:42:58Z In regard of quotes, erasing the first quote, leaves the second one in place. The second one should be erased too. Current behavior: "*" # pressing backspace wanted behavior: "*" # pressing backspace |
From ccordoba12 on 2012-01-08T17:06:43Z Thanks Panos for your invaluable help on testing these changes and making me improve them. You're totally right about the use of unicode (I didn't noticed because I was using PySide). I'm going to correct it as soon as possible. Also, I'll try to implement the behavior you described in comment However, I don't follow you in comment 'Some text. A single quote follows *' Notice that here the first and last quotes are single ones, not double (as you wrote them). I'll see how easy it is to check for unmatched quotes but can't promise anything. |
From [email protected] on 2013-04-02T08:30:37Z So I just checked out a fresh copy (Spyder 2.2.0beta4 (b6204549563f+:2690+)) and tried out some of the auto-quote stuff, but the only thing I got was that if the cursor is between two quotes and you hit backspace it will delete both quotes. I didn't get any auto-inserting of quotes or moving past a quote if you type the quote. I also tested the Colon insertion and auto-indentation and came to the same conclusions as are listed on the wiki page. |
From [email protected] on 2013-04-02T08:34:15Z Also, quoting selected text isn't working ( issue #877 ) |
From ccordoba12 on 2013-04-02T11:57:31Z airdrik, I think you haven't activated the feature. In 2.2 auto-quotes are off by default and you have to explicitly turn them on. For that you have to go to Tools > Preferences > Editor > Advanced Settings > Source code and then select the option "Automatic insertion of closing quotes." By the way, issue #877 depends on this feature too. I'll add your recommendations for basic tests, thanks for your suggestions. |
From ccordoba12 on 2013-04-05T14:33:18Z Jed, could you help me test if everything is working according to our spec? |
From [email protected] on 2013-04-05T20:48:05Z Test results at revision b6204549563f on Windows 7. Colon insertion: Test cases A3, A5, B3, B5, C3, and E4 are not working. Quote insertion: I can't seem to get any of the test cases to work. I did enable the setting in Preferences, but it doesn't seem to matter. Auto indent: Test cases A3, A5, B3, and B5 are not working. |
From ccordoba12 on 2013-04-06T06:34:46Z Thanks Jed. About your results: Colon insertion: Your reported failures were expected because all correspond to multi-line statements, which I didn't fixed yet. Quote insertion: I don't know why is failing for you. I tested it on WinXP and Linux, and it's working fine for me. I'll investigate further. Auto indent: I haven't touched that part yet because it's not part of this issue. |
From [email protected] on 2013-04-06T12:12:46Z Ok, retesting quote insertion now that I understand the spec a little better :). Advanced test A4 requires that I enter four " symbols before the auto insert happens. There are still a couple of test cases that I'm not sure I completely understand, but as best I can tell they seem to be working. |
From [email protected] on 2013-04-08T15:50:51Z Going back and retesting the quotes insertion with the option enabled, I get the same results as Jed - everything works except that A4 requires typing a 4th quote to activate, but it should activate on the 3rd quote. Another (more advanced, feel free to veto) suggestion: if you hit enter inside of a fully-closed single or double-quote string to update the quotes to triple-quotes Which also brings up a couple more advanced indentation cases: indentation within and after triple-quote strings. |
From [email protected] on 2013-04-29T15:08:36Z Labels: MS-v2.2.1 |
From [email protected] on 2013-04-29T15:10:06Z Labels: -MS-v2.2 |
From ccordoba12 on 2013-06-10T18:47:16Z Labels: -MS-v2.2.1 MS-v2.3 |
From [email protected] on 2013-09-09T07:23:21Z |
From [email protected] on 2013-11-07T16:12:26Z Try this using 2.2.3:
After hitting enter, you will see this:
|
From ccordoba12 on 2013-12-11T12:18:17Z Labels: -MS-v2.3 MS-v2.3.1 |
From ccordoba12 on 2014-08-17T18:36:20Z Labels: -MS-v2.3.1 MS-v2.4 |
From [email protected] on 2011-12-07T06:58:36Z
Hi,
How can i edit Spyder autocomplete feauture? I can't seem to find in preferences a way to do this...
thanks
Original issue: http://code.google.com/p/spyderlib/issues/detail?id=872
The text was updated successfully, but these errors were encountered: