Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
rope-get-calltip?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  15 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Leo  
View profile  
 More options Feb 5 2012, 1:44 am
From: Leo <sdl....@gmail.com>
Date: Sun, 05 Feb 2012 14:44:10 +0800
Local: Sun, Feb 5 2012 1:44 am
Subject: rope-get-calltip?
Hello,

I want to use something like rope-get-calltip which returns the calltip
as a string so that I can hook it up in eldoc to automatically show
calltips.

It would be nice if it also returns the index of the current arg. For
example, if foo has signature foo(x, y, z), when I am typing foo(1, |)
where | indicates where cursor is, the index is 1 (counting from 0).

Could this be implemented upstream? Thanks.

Leo


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jasper St. Pierre  
View profile  
 More options Feb 5 2012, 3:40 am
From: "Jasper St. Pierre" <jstpie...@mecheye.net>
Date: Sun, 5 Feb 2012 03:40:47 -0500
Local: Sun, Feb 5 2012 3:40 am
Subject: Re: rope-get-calltip?
Sure. Write a patch and I'm sure agr will take it.

On Sun, Feb 5, 2012 at 1:44 AM, Leo <sdl....@gmail.com> wrote:
> Hello,

> I want to use something like rope-get-calltip which returns the calltip
> as a string so that I can hook it up in eldoc to automatically show
> calltips.

> It would be nice if it also returns the index of the current arg. For
> example, if foo has signature foo(x, y, z), when I am typing foo(1, |)
> where | indicates where cursor is, the index is 1 (counting from 0).

> Could this be implemented upstream? Thanks.

> Leo

--
  Jasper

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ali Gholami Rudi  
View profile  
 More options Feb 5 2012, 11:02 am
From: Ali Gholami Rudi <aligr...@gmail.com>
Date: Sun, 05 Feb 2012 19:32:02 +0330
Local: Sun, Feb 5 2012 11:02 am
Subject: Re: rope-get-calltip?
Hi,

> On Sun, Feb 5, 2012 at 1:44 AM, Leo <sdl....@gmail.com> wrote:
> > I want to use something like rope-get-calltip which returns the calltip
> > as a string so that I can hook it up in eldoc to automatically show
> > calltips.

> > It would be nice if it also returns the index of the current arg. For
> > example, if foo has signature foo(x, y, z), when I am typing foo(1, |)
> > where | indicates where cursor is, the index is 1 (counting from 0).

> > Could this be implemented upstream? Thanks.

Another solution is to write a lisp function that uses
rope-get-calltip; this doesn't require changing ropemode.
But I'm not sure which of them are cleaner.  Please
report any success.

"Jasper St. Pierre" <jstpie...@mecheye.net> wrote:

> Sure. Write a patch and I'm sure agr will take it.

Certainly, any patch is welcome.  By the way, Anton maintains
ropemacs too, so he takes the patches.

Thanks,
Ali


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Leo  
View profile  
 More options Feb 5 2012, 12:56 pm
From: Leo <sdl....@gmail.com>
Date: Mon, 06 Feb 2012 01:56:31 +0800
Local: Sun, Feb 5 2012 12:56 pm
Subject: Re: rope-get-calltip?
On 2012-02-06 00:02 +0800, Ali Gholami Rudi wrote:

> Another solution is to write a lisp function that uses
> rope-get-calltip; this doesn't require changing ropemode.
> But I'm not sure which of them are cleaner.  Please
> report any success.

I was using one:

(defun rope-get-calltip ()
  (let ((message-log-max nil))
    (rope-show-calltip ropemacs-separate-doc-buffer)
    (let ((msg (current-message)))
      (message nil)
      (unless (equal msg "No docs available!")
        msg))))

But this feels backwards. I think if rope-get-calltip is defined then
rope-show-calltip will be straightforward to define in elisp. Just like
rope-show-doc can be easily re-implemented in elisp using rope-get-doc.

BTW, rope-show-calltip fails on the following example code:

os.path.join\
  ('a', 'b')

> "Jasper St. Pierre" <jstpie...@mecheye.net> wrote:
>> Sure. Write a patch and I'm sure agr will take it.

> Certainly, any patch is welcome.  By the way, Anton maintains
> ropemacs too, so he takes the patches.

Leo

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ali Gholami Rudi  
View profile  
 More options Feb 5 2012, 1:31 pm
From: Ali Gholami Rudi <aligr...@gmail.com>
Date: Sun, 05 Feb 2012 22:01:52 +0330
Local: Sun, Feb 5 2012 1:31 pm
Subject: Re: rope-get-calltip?
Hi,

And it works with eldoc?

> But this feels backwards. I think if rope-get-calltip is defined then
> rope-show-calltip will be straightforward to define in elisp. Just like
> rope-show-doc can be easily re-implemented in elisp using rope-get-doc.

Changing ropemacs is a bit harder as you may need to change
ropemode and possibly ropevim (but the latter is very unlikely).
But I may be wrong.  Do you have a patch?

> BTW, rope-show-calltip fails on the following example code:

> os.path.join\
>   ('a', 'b')

You can change show_calltip() in ropemode/interface.py for
handling that; just skip any whitespace and newlines
following backslashes.  But personally I think this is not
PEP8 compatible and safe to ignore.

Thanks,
Ali


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Leo  
View profile  
 More options Feb 7 2012, 2:45 am
From: Leo <sdl....@gmail.com>
Date: Tue, 07 Feb 2012 15:45:46 +0800
Local: Tues, Feb 7 2012 2:45 am
Subject: Re: rope-get-calltip?
On 2012-02-06 02:31 +0800, Ali Gholami Rudi wrote:

>> (defun rope-get-calltip ()
>>   (let ((message-log-max nil))
>>     (rope-show-calltip ropemacs-separate-doc-buffer)
>>     (let ((msg (current-message)))
>>       (message nil)
>>       (unless (equal msg "No docs available!")
>>         msg))))

> And it works with eldoc?

Yes, by setting eldoc-documentation-function locally in python mode.

>> But this feels backwards. I think if rope-get-calltip is defined then
>> rope-show-calltip will be straightforward to define in elisp. Just like
>> rope-show-doc can be easily re-implemented in elisp using rope-get-doc.

> Changing ropemacs is a bit harder as you may need to change
> ropemode and possibly ropevim (but the latter is very unlikely).
> But I may be wrong.  Do you have a patch?

The following patch works for me. Comments?

diff -r 9bf46eecc9b7 ropemode/interface.py
--- a/ropemode/interface.py     Mon Feb 06 12:39:36 2012 +0100
+++ b/ropemode/interface.py     Tue Feb 07 15:43:02 2012 +0800
@@ -182,8 +182,8 @@
         self._check_project()
         self._base_show_doc(prefix, codeassist.get_doc)

-    @decorators.local_command('a c', 'P')
-    def show_calltip(self, prefix):
+    @decorators.local_command()
+    def get_calltip(self):
         self._check_project()
         def _get_doc(project, text, offset, *args, **kwds):
             try:
@@ -191,7 +191,11 @@
             except ValueError:
                 return None
             return codeassist.get_calltip(project, text, offset, *args, **kwds)
-        self._base_show_doc(prefix, _get_doc)
+        return self._base_get_doc(_get_doc)
+
+    @decorators.local_command('a c', 'P')
+    def show_calltip(self, prefix):
+        self._base_show_doc(prefix, lambda *args, **kwds: self.get_calltip())

     def _base_show_doc(self, prefix, get_doc):
         docs = self._base_get_doc(get_doc)

Leo


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ali Gholami Rudi  
View profile  
 More options Feb 7 2012, 12:02 pm
From: Ali Gholami Rudi <aligr...@gmail.com>
Date: Tue, 07 Feb 2012 20:32:55 +0330
Local: Tues, Feb 7 2012 12:02 pm
Subject: Re: rope-get-calltip?
Hi Leo,

This is OK.  But I suggest applying this (untested) clean up before
your patch (_base_show_doc() no longer calls _base_get_doc()):

--- a/ropemode/interface.py     2012-02-07 20:29:20.181617836 +0330
+++ b/ropemode/interface.py     2012-02-07 20:30:26.111711102 +0330
@@ -180,7 +180,7 @@
     @decorators.local_command('a d', 'P', 'C-c d')
     def show_doc(self, prefix):
         self._check_project()
-        self._base_show_doc(prefix, codeassist.get_doc)
+        self._base_show_doc(prefix, self._base_get_doc(codeassist.get_doc))

     @decorators.local_command('a c', 'P')
     def show_calltip(self, prefix):
@@ -191,10 +191,9 @@
             except ValueError:
                 return None
             return codeassist.get_calltip(project, text, offset, *args, **kwds)
-        self._base_show_doc(prefix, _get_doc)
+        self._base_show_doc(prefix, self._base_get_doc(_get_doc))

-    def _base_show_doc(self, prefix, get_doc):
-        docs = self._base_get_doc(get_doc)
+    def _base_show_doc(self, prefix, docs):
         if docs:
             self.env.show_doc(docs, prefix)
         else:

Then the lambda in your patch would be unnecessary.

Thanks,
Ali


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Leo  
View profile  
 More options Feb 7 2012, 9:53 pm
From: Leo <sdl....@gmail.com>
Date: Wed, 08 Feb 2012 10:53:13 +0800
Local: Tues, Feb 7 2012 9:53 pm
Subject: Re: rope-get-calltip?
On 2012-02-08 01:02 +0800, Ali Gholami Rudi wrote:

Indeed. Thanks for the cleanup. I have re-worked the patch to be on top
of yours. How to get these two patches installed upstream? Thanks. - Leo

diff -r 5174afc04c11 ropemode/interface.py
--- a/ropemode/interface.py     Wed Feb 08 10:37:57 2012 +0800
+++ b/ropemode/interface.py     Wed Feb 08 10:49:41 2012 +0800
@@ -182,8 +182,8 @@
         self._check_project()
         self._base_show_doc(prefix, self._base_get_doc(codeassist.get_doc))

-    @decorators.local_command('a c', 'P')
-    def show_calltip(self, prefix):
+    @decorators.local_command()
+    def get_calltip(self):
         self._check_project()
         def _get_doc(project, text, offset, *args, **kwds):
             try:
@@ -191,7 +191,11 @@
             except ValueError:
                 return None
             return codeassist.get_calltip(project, text, offset, *args, **kwds)
-        self._base_show_doc(prefix, self._base_get_doc(_get_doc))
+        return self._base_get_doc(_get_doc)
+
+    @decorators.local_command('a c', 'P')
+    def show_calltip(self, prefix):
+        self._base_show_doc(prefix, self.get_calltip())

     def _base_show_doc(self, prefix, docs):
         if docs:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Leo  
View profile  
 More options Feb 7 2012, 9:55 pm
From: Leo <sdl....@gmail.com>
Date: Wed, 08 Feb 2012 10:55:55 +0800
Local: Tues, Feb 7 2012 9:55 pm
Subject: Re: rope-get-calltip?
On 2012-02-08 10:53 +0800, Leo wrote:

> Indeed. Thanks for the cleanup. I have re-worked the patch to be on top
> of yours. How to get these two patches installed upstream? Thanks.

I forgot to mention that I have tested these patches and they worked.

Leo


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ali Gholami Rudi  
View profile  
 More options Feb 7 2012, 10:22 pm
From: Ali Gholami Rudi <aligr...@gmail.com>
Date: Wed, 08 Feb 2012 06:52:02 +0330
Local: Tues, Feb 7 2012 10:22 pm
Subject: Re: rope-get-calltip?
Hi Leo,

Leo <sdl....@gmail.com> wrote:
> On 2012-02-08 10:53 +0800, Leo wrote:
> > Indeed. Thanks for the cleanup. I have re-worked the patch to be on top
> > of yours. How to get these two patches installed upstream? Thanks.

> I forgot to mention that I have tested these patches and they worked.

ACK.

Please resubmit both patches and CC Anton.

Thanks,
Ali


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Leo  
View profile  
 More options Feb 7 2012, 11:20 pm
From: Leo <sdl....@gmail.com>
Date: Wed, 08 Feb 2012 12:20:44 +0800
Local: Tues, Feb 7 2012 11:20 pm
Subject: Re: rope-get-calltip?

On 2012-02-08 11:22 +0800, Ali Gholami Rudi wrote:

>> I forgot to mention that I have tested these patches and they worked.

> ACK.

> Please resubmit both patches and CC Anton.

> Thanks,
> Ali

Hello Anton,

Could you kindly install the following patch sets? Thanks a lot.

Leo

  patch.diff
2K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Leo  
View profile  
 More options Feb 11 2012, 1:31 am
From: Leo <sdl....@gmail.com>
Date: Sat, 11 Feb 2012 14:31:41 +0800
Local: Sat, Feb 11 2012 1:31 am
Subject: Re: rope-get-calltip?
On 2012-02-08 12:20 +0800, Leo wrote:

> Could you kindly install the following patch sets? Thanks a lot.

Ping?

Leo


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
general  
View profile  
 More options Feb 11 2012, 5:49 pm
From: general <gene...@angri.ru>
Date: Sat, 11 Feb 2012 23:49:47 +0100
Local: Sat, Feb 11 2012 5:49 pm
Subject: Re: rope-get-calltip?
Hi Leo,

could you please send a pull request with the changes in question?

Thank you.

--
Anton

2012/2/11 Leo <sdl....@gmail.com>:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Leo  
View profile  
 More options Feb 11 2012, 10:43 pm
From: Leo <sdl....@gmail.com>
Date: Sun, 12 Feb 2012 11:43:19 +0800
Local: Sat, Feb 11 2012 10:43 pm
Subject: Re: rope-get-calltip?
On 2012-02-12 06:49 +0800, general wrote:

> could you please send a pull request with the changes in question?

Done.  - Leo

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
an...@angri.ch  
View profile  
 More options Feb 12 2012, 5:28 pm
From: an...@angri.ch
Date: Sun, 12 Feb 2012 23:28:49 +0100
Local: Sun, Feb 12 2012 5:28 pm
Subject: Re: rope-get-calltip?
Pulled. Thanks.

--
Anton

2012/2/12 Leo <sdl....@gmail.com>:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »