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.