Re: [code] New ctags module and language modules

From: Mitchell <m.att.foicica.com>
Date: Tue, 3 Mar 2015 16:11:57 -0500 (EST)

Hi Carlos,

On Tue, 3 Mar 2015, Carlos Pita wrote:

> Hi Mitchell,
>
> thank you for your answer.
>
>> I would encourage you to experiment. I don't have much to say on this matter
>> as I don't use Python much at the moment.
>
> To add more context to my question, I would like to make the python
> autocompleter just a bit smarter:
>
> 1) To scan for import aliases (say import itertools as it).
> 2) To scan for previous class declarations in order to replace self
> with a class name (or direct superclass name).
>
> These are just simple heuristics that will fail in many examples, but
> they are easy to add to the python module without bloating it.
>
> The problem I see, specially with 2, is that the class name is for a
> class defined in the current file or a superclass probably defined in
> the current project. The tags file search sequence in ctags module
> will work here but not the search sequence in the python module.
>
> I'm not sure what is the best way to go given that I can't depend on
> the ctags module being there (of course, I could just hack that for
> myself, but maybe it's useful for someone else using the python
> module).
>
> One idea is to conditionally depend on the ctags module. This will
> duplicate some code but not all.
>
> Any suggestions?

In your python module:

   local ctags = pcall(require, 'ctags')
   [...]
   if ctags then
      -- do ctags-specific stuff
   end
   [...]

Sorry if I'm missing something or stating the obvious.

Cheers,
Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Tue 03 Mar 2015 - 16:11:57 EST

This archive was generated by hypermail 2.2.0 : Wed 04 Mar 2015 - 06:46:22 EST