On Mon, Oct 4, 2010 at 2:18 AM, Edward K. Ream <[email protected]> wrote:

> Perhaps the real value of my recent scanning work is that something
> has shifted inside my bean.  I am ready to accept ctags and Ville's
> codewise tool built upon it.

I'm glad you are seeing it now :). codewise approach is simpler to
understand and extend than some monolithic system inside leo's core.

The tricky part, now, is getting a good QCompleter imlpmentation
working with key events in Leo. The existing ones in
codewisecompleter.py and ctagscompleter.py requile mouse because of
bad key handling.


>
> Last night's experience using the prototype scanner code convinced me
> that using such a scheme would be pleasant.  For some reason, that
> experience was essential.
>
> Furthermore, all the object-related code in Leo's old autocompleter is
> gone, and this should clear the way for direct support for ctags and
> codewise.
>
> I did a search here (in leo-editor) for codewise using the "Search
> this group" button:
>
> http://groups.google.com/group/leo-editor/search?group=leo-editor&q=codewise&qt_g=Search+this+group
>
> I had forgotten all about these discussions in December of last year.
> My aunt was dying about this time--perhaps this explains my total
> blank.  More likely, I simply didn't grasp the importance of the
> discussions.  Now I do.
>
> I'd like to add something to Terry's "howto":  On Windows, at least,
> instead of doing:
>
>    codewise <command> <args>
>
> it appears you must do:
>
>    python -m codewise <command> <args>
>
> However, I'll omit the "python -m" in the following discussion.
>
> Also, it's possible to run the commands directly from Leo.  Like this:
>
>    import codewise as cw
>    cw.cmd_init(args=[])
>
> The following worked for me (from the command line):
>
>    codewise setup
>    codewise init
>    codewise parse <path to Leo's trunk>
>
> However, the following (ambitious!) call failed:
>
>    codewise parse c:\python31\Lib
>
> The traceback was:
>
> c:\leo.repo\trunk>c:\Python31\python.exe -m codewise parse c:
> \python31\lib
> c:\Users\edreamleo/.codewise.db
> ctags -R --sort=no -f - c:\python31\lib
> Traceback (most recent call last):
>  File "c:\Python31\lib\runpy.py", line 128, in _run_module_as_main
>    "__main__", fname, loader, pkg_name)
>  File "c:\Python31\lib\runpy.py", line 34, in _run_code
>    exec(code, run_globals)
>  File "c:\Python31\lib\site-packages\codewise.py", line 454, in
> <module>
>    main()
>  File "c:\Python31\lib\site-packages\codewise.py", line 440, in main
>    cmd_parse(args)
>  File "c:\Python31\lib\site-packages\codewise.py", line 370, in
> cmd_parse
>    cw.parse(args)
>  File "c:\Python31\lib\site-packages\codewise.py", line 307, in parse
>    self.feed_ctags(f)
>  File "c:\Python31\lib\site-packages\codewise.py", line 250, in
> feed_ctags
>    fil = fields[1]
> IndexError: list index out of range
>
> I'm using the latest rev, rev 12.
>
> No doubt a fix will be forthcoming :-)  In any case, I am happy about
> the possibilities of this scheme.  We'll have to deal with the issues
> surrounding ctags: maybe we'll fall back on the prototype scheme if
> ctags does not exist.


I guess you should inspect why the ctags file doesn't have 4 fields
separated by tab for you ("print fields" would help there, below).

Also, a workaround:

    def feed_ctags(self,tagsfile_obj):
        for l in tagsfile_obj:
            #print l
            if not isPython3:
                l = unicode(l, 'utf8', 'replace')
            if l.startswith('!'):
                continue
            fields = l.split('\t')
            if len(fields) < 4: continue  # ADDED this
            m = fields[0]
            fil = fields[1]


-- 
Ville M. Vainio @@ Forum Nokia

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to