Skip to content
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

fix weird magic completion in notebook #1347

Merged
merged 1 commit into from Jan 30, 2012
Merged

Conversation

Carreau
Copy link
Member

@Carreau Carreau commented Jan 30, 2012

should fix #1243

handle magic as a special case, but the completer should be moved in it's
own clase for 0.13

Didn't open a PR first in case it would have introduce other bugs, but Zoltán seem to have test it long enough and didn't had problem (see #1234).

should fix ipython#1243

handle magic as a special case, but the completer should be moved in it's
own clase for 0.13
@ellisonbg
Copy link
Member

I have tested this and it seems to have fixed the issue. @Carreau do you think you will be able to refactor the completion/tooltip code into its own class anytime soon?

ellisonbg added a commit that referenced this pull request Jan 30, 2012
Fix weird magic completion in notebook.  Closes #1243.
@ellisonbg ellisonbg merged commit 2c6be75 into ipython:master Jan 30, 2012
@Carreau
Copy link
Member Author

Carreau commented Jan 31, 2012

Any time soon is really compromise. It's still on my to-do list of things I would like to improve.
We should also look at the autocomplete example of codemirror which might be a good start, and might add completion of the words of current cell even if it has not been executed in the kernel.

@v923z
Copy link
Contributor

v923z commented Jan 31, 2012

Many thanks for merging the fix!

@ellisonbg
Copy link
Member

For the record: the existing tab completion was copied over directly
from CodeMirror and made to work with our architecture - so I think we
are already following what they do pretty closely. When you get
started on this, let me know if you want to talk design.

On Tue, Jan 31, 2012 at 2:35 AM, v923z
reply@reply.github.com
wrote:

Many thanks for merging the fix!


Reply to this email directly or view it on GitHub:
#1347 (comment)

Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com

@Carreau
Copy link
Member Author

Carreau commented Feb 1, 2012

@ellisonbg, I Really needed a completion based on the current text cell instead of kernel introspection, so I quickly did this
What I can do is a PR based on that ( a little refactored because it changes code in the /codemiror/lib/ directory) and we can start to discuss on what you think of the design.

@ellisonbg
Copy link
Member

I am not quite clear on what usage case this addresses, can you say a bit more?

On Wed, Feb 1, 2012 at 7:11 AM, Bussonnier Matthias
reply@reply.github.com
wrote:

@ellisonbg, I Really needed a completion based on the current text cell instead of kernel introspection, so I quickly did this
What I can do is a PR based on that ( a little refactored because it changes code in the /codemiror/lib/ directory) and we can start to discuss on what you think  of the design.


Reply to this email directly or view it on GitHub:
#1347 (comment)

Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com

@Carreau
Copy link
Member Author

Carreau commented Feb 1, 2012

like, when writing a class in the notebook, or in a for loop, ctrl+space will propose to you any word in the curent cell that match the beginnig of the current word. eg

class Dummy(object):
    def __init__(self):
         self.myartrr1= 1
         self.myatrr2= 2
         self.myartrr3= 3

    (at)property    #no at or github want to ping property...
    def myProperty(self):
          return null

    def myfunc(self)
          return self.my<ctrl-space>  # <-- there I ask for `text-based` completion

it pops .myattr1, .myattr2 ,.myattr3 ... myProperty,myfunc

  • Whatever text of the current cell which match what you have type.
  • even if the cell has not been executed and without any request to the kernel. (so also local variable)
  • It's stil a little dumb as it proposes myProperty(self) instead of myProperty

But it should be easier to cache the introspection of the kernel and "merge" the result with this list of completion and have a mixed completer that get completion both from kernel and also from current code cell

@ellisonbg
Copy link
Member

On Wed, Feb 1, 2012 at 10:50 AM, Bussonnier Matthias
reply@reply.github.com
wrote:

like, when writing a class in the notebook, or in a for loop, ctrl+space will propose to you any word in the curent cell that match the beginnig of the current word. eg

class Dummy(object):
   def __init__(self):
        self.myartrr1= 1
        self.myatrr2= 2
        self.myartrr3= 3

   (at)property    #no at or github want to ping property...
   def myProperty(self):
         return null

   def myfunc(self)
         return self.my<ctrl-space>  # <-- there I ask for `text-based` completion

it pops .myattr1, .myattr2 ,.myattr3 ... myProperty,myfunc

OK I think this functionality would be useful.

 * Whatever text of the current cell which match what you have type.
 * even if the cell has not been executed and without any request to the kernel. (so also local variable)
 * It's stil a little dumb as it proposes myProperty(self) instead of myProperty

But I do think we should clean up the tab completion/tooltip code
before adding this in. That part of the CodeCell is really messy and
difficult to deal with.

But it should be easier to cache the introspection of the kernel and "merge" the result with this list of completion and have a mixed completer that get completion both from kernel and also from current code cell

I agree this would be nice, but if we want to go this way, then it is
extra important that we clean up the existing code first.


Reply to this email directly or view it on GitHub:
#1347 (comment)

Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com

@Carreau
Copy link
Member Author

Carreau commented Feb 1, 2012

Agreed, this was just a quick need so I've done it on the fly, nothing serious.

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Fix weird magic completion in notebook.  Closes ipython#1243.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

magic commands without % are not completed properly in htmlnotebook
3 participants