Patch to support "extended completion"
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:
"Jasper St. Pierre" <jstpie... @mecheye.net>
Date: Tue, 27 Apr 2010 21:57:10 -0400
Local: Tues, Apr 27 2010 9:57 pm
Subject: Patch to support "extended completion"
I am currently in the process of making a ropemacs auto-complete backend.
Here is the patch to support that:
diff -r 364ab6aeb8e9 ropemode/interface.py
--- a/ropemode/interface.py Tue Apr 27 19:53:45 2010 +0400
+++ b/ropemode/interface.py Tue Apr 27 21:55:06 2010 -0400
@@ -272,6 +272,10 @@
def completions(self):
return _CodeAssist(self, self.env).completions()
+ @decorators.local_command()
+ def extended_completions(self):
+ return _CodeAssist(self, self.env).extended_completions()
+
def _check_autoimport(self):
self._check_project()
if self.autoimport is None:
@@ -590,6 +594,12 @@
return [self.env._completion_text(proposal)[prefix:]
for proposal in proposals]
+ def extended_completions(self):
+ proposals = self._calculate_proposals()
+ prefix = self.offset - self.starting_offset
+ return [[proposal.name[prefix:], proposal.get_doc(),
+ proposal.type] for proposal in proposals]
+
def _apply_assist(self, assist):
if ' : ' in assist:
name, module = assist.rsplit(' : ', 1)
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Ali Gholami Rudi <aligr... @gmail.com>
Date: Thu, 29 Apr 2010 08:14:57 +0430
Local: Wed, Apr 28 2010 11:44 pm
Subject: Re: Patch to support "extended completion"
Hi Jasper,
"Jasper St. Pierre" <jstpie... @mecheye.net> wrote:
> I am currently in the process of making a ropemacs auto-complete backend.
> Here is the patch to support that:
> diff -r 364ab6aeb8e9 ropemode/interface.py
> --- a/ropemode/interface.py Tue Apr 27 19:53:45 2010 +0400
> +++ b/ropemode/interface.py Tue Apr 27 21:55:06 2010 -0400
> @@ -272,6 +272,10 @@
> def completions(self):
> return _CodeAssist(self, self.env).completions()
> + @decorators.local_command()
> + def extended_completions(self):
> + return _CodeAssist(self, self.env).extended_completions()
> +
> def _check_autoimport(self):
> self._check_project()
> if self.autoimport is None:
> @@ -590,6 +594,12 @@
> return [self.env._completion_text(proposal)[prefix:]
> for proposal in proposals]
> + def extended_completions(self):
> + proposals = self._calculate_proposals()
> + prefix = self.offset - self.starting_offset
> + return [[proposal.name[prefix:], proposal.get_doc(),
> + proposal.type] for proposal in proposals]
> +
> def _apply_assist(self, assist):
> if ' : ' in assist:
> name, module = assist.rsplit(' : ', 1)
It looks good. I think the main difference with ropevim's
extended_completions is that, ropevim handles the completions
on python-side while you want to do that on emacs-side so
your patch seems a lot simpler.
Thanks,
Ali
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Darren Hoo <darren.... @gmail.com>
Date: Thu, 29 Apr 2010 15:19:56 +0800
Local: Thurs, Apr 29 2010 3:19 am
Subject: Re: Patch to support "extended completion"
Hi,
On Wed, Apr 28, 2010 at 9:57 AM, Jasper St. Pierre
<jstpie
... @mecheye.net> wrote:
> I am currently in the process of making a ropemacs auto-complete backend.
> Here is the patch to support that:
> diff -r 364ab6aeb8e9 ropemode/interface.py
> --- a/ropemode/interface.py Tue Apr 27 19:53:45 2010 +0400
> +++ b/ropemode/interface.py Tue Apr 27 21:55:06 2010 -0400
> @@ -272,6 +272,10 @@
> def completions(self):
> return _CodeAssist(self, self.env).completions()
> + @decorators.local_command()
> + def extended_completions(self):
> + return _CodeAssist(self, self.env).extended_completions()
> +
> def _check_autoimport(self):
> self._check_project()
> if self.autoimport is None:
> @@ -590,6 +594,12 @@
> return [self.env._completion_text(proposal)[prefix:]
> for proposal in proposals]
> + def extended_completions(self):
> + proposals = self._calculate_proposals()
> + prefix = self.offset - self.starting_offset
> + return [[proposal.name[prefix:], proposal.get_doc(),
> + proposal.type] for proposal in proposals]
> +
> def _apply_assist(self, assist):
> if ' : ' in assist:
> name, module = assist.rsplit(' : ', 1)
this patch works for me.
People who use company-mode can use this patch to make
of this extended complete, the info will show in the echo area
--- company-ropemacs.new.el 2010-04-29 14:55:24.766121479 +0800
+++ company-ropemacs.el 2010-04-29 14:56:15.000000000 +0800
@@ -63,6 +63,9 @@
(company-ropemacs--grab-symbol)))
('candidates (mapcar (lambda (element) (concat arg element))
(rope-completions)))
+ ('meta (let* ((completions (rope-extended-completions))
+ (match (assoc arg completions)))
+ (concat (propertize arg 'face 'font-lock-doc-face) ": " (caddr match))))
('doc-buffer (company-ropemacs-doc-buffer arg))
('location (company-ropemacs-location arg))))
there's one nuisance here, that is if the completion is an instance
for example if it is a string , it will return the documentation of
string class ,I think this is too much verbose, return something like
"type String" will be enough IMHO. so I have not added doc in
the above patch, add it if that's ok for you. also you can press
F1 on the selected completion candidate to get docuementation of
it in company-mode.
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
"Jasper St. Pierre" <jstpie... @mecheye.net>
Date: Thu, 29 Apr 2010 04:03:59 -0400
Local: Thurs, Apr 29 2010 4:03 am
Subject: Re: Patch to support "extended completion"
It's currently in here:
http://github.com/magcius/auto-complete/
Which I will try to get upstream as soon as the patch is integrated.
<http://github.com/magcius/auto-complete/ >
On Thu, Apr 29, 2010 at 3:19 AM, Darren Hoo <darren.
... @gmail.com> wrote:
> Hi,
> On Wed, Apr 28, 2010 at 9:57 AM, Jasper St. Pierre
> <jstpie... @mecheye.net> wrote:
> > I am currently in the process of making a ropemacs auto-complete backend.
> > Here is the patch to support that:
> > diff -r 364ab6aeb8e9 ropemode/interface.py
> > --- a/ropemode/interface.py Tue Apr 27 19:53:45 2010 +0400
> > +++ b/ropemode/interface.py Tue Apr 27 21:55:06 2010 -0400
> > @@ -272,6 +272,10 @@
> > def completions(self):
> > return _CodeAssist(self, self.env).completions()
> > + @decorators.local_command()
> > + def extended_completions(self):
> > + return _CodeAssist(self, self.env).extended_completions()
> > +
> > def _check_autoimport(self):
> > self._check_project()
> > if self.autoimport is None:
> > @@ -590,6 +594,12 @@
> > return [self.env._completion_text(proposal)[prefix:]
> > for proposal in proposals]
> > + def extended_completions(self):
> > + proposals = self._calculate_proposals()
> > + prefix = self.offset - self.starting_offset
> > + return [[proposal.name[prefix:], proposal.get_doc(),
> > + proposal.type] for proposal in proposals]
> > +
> > def _apply_assist(self, assist):
> > if ' : ' in assist:
> > name, module = assist.rsplit(' : ', 1)
> this patch works for me.
> People who use company-mode can use this patch to make
> of this extended complete, the info will show in the echo area
> --- company-ropemacs.new.el 2010-04-29 14:55:24.766121479 +0800
> +++ company-ropemacs.el 2010-04-29 14:56:15.000000000 +0800
> @@ -63,6 +63,9 @@
> (company-ropemacs--grab-symbol)))
> ('candidates (mapcar (lambda (element) (concat arg element))
> (rope-completions)))
> + ('meta (let* ((completions (rope-extended-completions))
> + (match (assoc arg completions)))
> + (concat (propertize arg 'face 'font-lock-doc-face) ": " (caddr
> match))))
> ('doc-buffer (company-ropemacs-doc-buffer arg))
> ('location (company-ropemacs-location arg))))
> there's one nuisance here, that is if the completion is an instance
> for example if it is a string , it will return the documentation of
> string class ,I think this is too much verbose, return something like
> "type String" will be enough IMHO. so I have not added doc in
> the above patch, add it if that's ok for you. also you can press
> F1 on the selected completion candidate to get docuementation of
> it in company-mode.
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Ali Gholami Rudi <aligr... @gmail.com>
Date: Thu, 29 Apr 2010 16:23:07 +0430
Local: Thurs, Apr 29 2010 7:53 am
Subject: Re: Patch to support "extended completion"
Hi,
"Jasper St. Pierre" <jstpie... @mecheye.net> wrote:
> diff -r 364ab6aeb8e9 ropemode/interface.py
> --- a/ropemode/interface.py Tue Apr 27 19:53:45 2010 +0400
> +++ b/ropemode/interface.py Tue Apr 27 21:55:06 2010 -0400
> @@ -272,6 +272,10 @@
> def completions(self):
> return _CodeAssist(self, self.env).completions()
> + @decorators.local_command()
> + def extended_completions(self):
> + return _CodeAssist(self, self.env).extended_completions()
> +
> def _check_autoimport(self):
> self._check_project()
> if self.autoimport is None:
> @@ -590,6 +594,12 @@
> return [self.env._completion_text(proposal)[prefix:]
> for proposal in proposals]
> + def extended_completions(self):
> + proposals = self._calculate_proposals()
> + prefix = self.offset - self.starting_offset
> + return [[proposal.name[prefix:], proposal.get_doc(),
> + proposal.type] for proposal in proposals]
> +
> def _apply_assist(self, assist):
> if ' : ' in assist:
> name, module = assist.rsplit(' : ', 1)
angri, would you have a look at this?
Thanks,
Ali
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
general <gene... @angri.ru>
Date: Fri, 30 Apr 2010 22:03:25 +0400
Local: Fri, Apr 30 2010 2:03 pm
Subject: Re: Patch to support "extended completion"
Applied.
Thanks!
--
angri
2010/4/29 Ali Gholami Rudi <aligr... @gmail.com>:
> Hi,
> "Jasper St. Pierre" <jstpie... @mecheye.net> wrote:
>> diff -r 364ab6aeb8e9 ropemode/interface.py
>> --- a/ropemode/interface.py Tue Apr 27 19:53:45 2010 +0400
>> +++ b/ropemode/interface.py Tue Apr 27 21:55:06 2010 -0400
>> @@ -272,6 +272,10 @@
>> def completions(self):
>> return _CodeAssist(self, self.env).completions()
>> + @decorators.local_command()
>> + def extended_completions(self):
>> + return _CodeAssist(self, self.env).extended_completions()
>> +
>> def _check_autoimport(self):
>> self._check_project()
>> if self.autoimport is None:
>> @@ -590,6 +594,12 @@
>> return [self.env._completion_text(proposal)[prefix:]
>> for proposal in proposals]
>> + def extended_completions(self):
>> + proposals = self._calculate_proposals()
>> + prefix = self.offset - self.starting_offset
>> + return [[proposal.name[prefix:], proposal.get_doc(),
>> + proposal.type] for proposal in proposals]
>> +
>> def _apply_assist(self, assist):
>> if ' : ' in assist:
>> name, module = assist.rsplit(' : ', 1)
> angri, would you have a look at this?
> Thanks,
> Ali
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
"Jasper St. Pierre" <jstpie... @mecheye.net>
Date: Sat, 1 May 2010 03:02:02 -0400
Local: Sat, May 1 2010 3:02 am
Subject: Re: Patch to support "extended completion"
And it would help if I actually put the correct address in here.
On Sat, May 1, 2010 at 3:01 AM, Jasper St. Pierre <jstpie... @mecheye.net>wrote:
> Just a note, after using this a bit, it seems that emacs really slows to a
> crawl. Not sure if this is rope or auto-complete though.
You must
Sign in before you can post messages.
You do not have the permission required to post.