spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.21k stars 1.59k forks source link

Quotes and colons autocompletion #872

Closed spyder-bot closed 8 years ago

spyder-bot commented 9 years ago

From nunoport...@gmail.com 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

spyder-bot commented 9 years ago

From ccordoba12 on 2012-02-21T07:34:12Z

That's a great idea Panos! I just made a wiki page with your initial suggestions: https://code.google.com/p/spyderlib/wiki/AutomaticColonAndQuotesInsertion I think anyone can edit it, so please add to it any other desired behavior I have to take into account while coding this feature. I will also be adding what we have right now.

spyder-bot commented 9 years ago

From pmav99@gmail.com on 2012-02-21T07:42:20Z

I am glad that you liked it :)

If I were you, I would wait until the specs are more complete before starting to code.

spyder-bot commented 9 years ago

From pmav99@gmail.com on 2012-02-21T11:28:35Z

Carlos, the wiki page is not editable by common users.

spyder-bot commented 9 years ago

From ccordoba12 on 2012-02-21T12:06:45Z

I see. I think Pierre is the only one who has rights to let you edit our wiki.

Pierre, could you grant Panos permission to do it?

spyder-bot commented 9 years ago

From techtonik@gmail.com on 2012-02-28T11:52:05Z

I also thought that 'specification first' approach will greatly help with debugging of this feature - https://groups.google.com/d/msg/spyderlib/ICWotnlS7bM/dqGaSzr62UYJ It is a pleasure to see the efforts in this direction.

It is possible to clone and edit wiki offline. https://code.google.com/p/spyderlib/source/browse?repo=wiki There is also an Edit link at the page source that allows common users to edit files online and send a patch through the tracker https://code.google.com/p/spyderlib/source/browse/AutomaticColonAndQuotesInsertion.wiki?repo=wiki but it lacks wiki preview, which is not fun.

spyder-bot commented 9 years ago

From pierre.raybaut on 2012-02-28T13:05:34Z

That is done, Carlos. Panos may now edit wiki pages, among other things.

Sorry for the delay, I tend to react slowly these days... (Anatoly woke me up!).

spyder-bot commented 9 years ago

From pmav99@gmail.com on 2012-02-28T15:24:23Z

I added some more test cases and rewrote some comments.

I also took the liberty to add content for more features (auto indentation) apart from the insertions of colons and quotes. I haven't added any content yet, but there are more features that would benefit from this type of specification, e.g. "smart indentation".

If it is ok, I was thinking that a more generic title would be more appropriate. Maybe something like "Specification for the text editor widget". If you agree, perhaps the url should change too.

spyder-bot commented 9 years ago

From techtonik@gmail.com on 2012-02-28T23:28:00Z

That's great. Can you rename the page to something like SpecAutocompletion? It would better reflect the status and purpose.

Summary: Autocompletion customization

spyder-bot commented 9 years ago

From techtonik@gmail.com on 2012-02-28T23:37:05Z

On the second thought more generic title is not that nice. Scope should be limited to a munchable chunks. Even SpecAutocompletion is a very broad term, which includes integration with rope. SpecColonsQuotesAndWhitespace is more appropriate? Or just SPEP001 with a description "Colons, quotes and whitespace autocompletion".

Summary: Quotes and colons autocompletion

spyder-bot commented 9 years ago

From ccordoba12 on 2012-03-01T07:08:45Z

Thanks for your efforts. The page is looking great and it would help me a lot to improve and finish this feature.

@-Pierre: No problem. Thanks for adding Panos. He's being of great help.

@-Anatoly: I think SpecColonsAndQuotesAutocompletion is the right name. Why did you add 'Whitespace'?

spyder-bot commented 9 years ago

From techtonik@gmail.com on 2012-03-02T00:52:53Z

Whitespace is to cover indentation part, because indentation may deserve its own separate spec. SpecColonsAndQuotesAutocompletion name is a bit excessive. I can't figure out what else can spec for colons and quotes define in editor if not auto completion, so SpecColonsAndQuotes is fine with me.

spyder-bot commented 9 years ago

From pierre.raybaut on 2012-03-18T13:45:59Z

Labels: -Milestone-Release2.2 Milestone-v2.2

spyder-bot commented 9 years ago

From pierre.raybaut on 2012-03-18T13:56:32Z

Labels: -Milestone-v2.2 MS-v2.2

spyder-bot commented 9 years ago

From pierre.raybaut on 2012-03-18T14:15:24Z

Labels: -Type-Enhancement Type-Enh

spyder-bot commented 9 years ago

From pmav99@gmail.com on 2012-03-18T15:00:28Z

I added some more tests for auto-indentation.

In regard of the wikipage title, perhaps the issues regarding the whitepage should be moved to a seperate page.

spyder-bot commented 9 years ago

From steve.f....@gmail.com on 2013-03-01T12:39:55Z

What's the status on this? I have a case where colon autocompletion is still broken.

Example: for x, y in [ [1,2], #^ Pressing enter here will insert a colon when it should not. [3,4], ]

Running 2.2.0 beta 3

spyder-bot commented 9 years ago

From ccordoba12 on 2013-03-05T13:46:45Z

Steve, this is the last thing to do before 2.2 is released. I'll fix it in beta4.

spyder-bot commented 9 years ago

From ccordoba12 on 2013-03-30T22:45:27Z

Ok guys, after neglecting this issue for a year, I just committed several fixes to improve the situation significantly for both colon and quotes auto-insertion.

I also added a new section to our specification for this feature about quotes insertion (which was missing). https://code.google.com/p/spyderlib/wiki/AutomaticColonAndQuotesInsertion Please test again to see if thing are working as expected for you.

spyder-bot commented 9 years ago

From airdrik@gmail.com 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.
Or in other words according to the Quotes Insertion section on that wiki page, A3 works, A4 doesn't work, A5 works (does nothing special), A6 doesn't work, A7 works, A8 works, A9 works (you should also include some more basic test cases, including adding a quote to a fresh line, or to a new assignment e.g. a = "hello", typing a quote when in front of the end-quote - neither of which worked when I tried them).

I also tested the Colon insertion and auto-indentation and came to the same conclusions as are listed on the wiki page.

spyder-bot commented 9 years ago

From airdrik@gmail.com on 2013-04-02T08:34:15Z

Also, quoting selected text isn't working ( issue #877 )

spyder-bot commented 9 years ago

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.

spyder-bot commented 9 years ago

From ccordoba12 on 2013-04-05T14:33:18Z

Jed, could you help me test if everything is working according to our spec?

Cc: jed.lud...@gmail.com

spyder-bot commented 9 years ago

From jed.lud...@gmail.com 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.

spyder-bot commented 9 years ago

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.

spyder-bot commented 9 years ago

From jed.lud...@gmail.com 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.

spyder-bot commented 9 years ago

From airdrik@gmail.com 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 example: a = "some string I want to *make into a multi-line string" -> a = """some string I want to make into a multi-line string"""

Which also brings up a couple more advanced indentation cases: indentation within and after triple-quote strings. Inside triple-quote strings indentation should be manual, or at least ignore any previous indentation. After triple-quote strings indentation should resume from where it was before the string.

spyder-bot commented 9 years ago

From jed.lud...@gmail.com on 2013-04-29T15:08:36Z

Labels: MS-v2.2.1

spyder-bot commented 9 years ago

From jed.lud...@gmail.com on 2013-04-29T15:10:06Z

Labels: -MS-v2.2

spyder-bot commented 9 years ago

From ccordoba12 on 2013-06-10T18:47:16Z

Labels: -MS-v2.2.1 MS-v2.3

spyder-bot commented 9 years ago

From jed.lud...@gmail.com on 2013-09-09T07:23:21Z

Cc: -jed.lud...@gmail.com

spyder-bot commented 9 years ago

From wsu...@gmail.com on 2013-11-07T16:12:26Z

Try this using 2.2.3:

class MyNewException(Exception): pass

After hitting enter, you will see this:

class MyNewException(Exception): pass:

spyder-bot commented 9 years ago

From ccordoba12 on 2013-12-11T12:18:17Z

Labels: -MS-v2.3 MS-v2.3.1

spyder-bot commented 9 years ago

From ccordoba12 on 2014-08-17T18:36:20Z

Labels: -MS-v2.3.1 MS-v2.4