is illusory exercise python code-completion textmate?
seems good starting point.
i cruise should possible, pysmell's idehelper.py does decrease challenging stuff, should only box giving tide line, charity adult completions (the bit i am certain about) following replacing line comparison one.
>>> import idehelper
>>> # route where pysmelltags record located:
>>> pysmelldict = idehelper.findpysmelldict("/users/dbr/desktop/pysmell/")
>>> options = idehelper.detectcompletiontype("", "" 1, 2, "", pysmelldict)
>>> completions = idehelper.findcompletions("proc", pysmelldict, options)
>>> imitation completions
[{'dup': '1', 'menu': 'pysmell.pysmell', 'kind': 'f', 'word': 'process', 'abbr': 'process(arglist, excluded, output, verbose=false)'}]
it'll never perfect, nonetheless severely useful (even only completing stdlib modules, should never change, can't have constantly reconstruct pysmelltags record whenever supplement function)
progressing! i have utter-basics execution place - hardly works, nonetheless it's close..
i ran python pysmells.py /system/library/frameworks/python.framework/versions/2.5/lib/python2.5/*.py -o /library/python/2.5/site-packages/pysmell/pysmelltags
place following textmate gold script, set "input: whole document", "output: insert text", "activation: pivotal equivalent: alt+esc", "scope selector: source.python"
#!/usr/bin/env python
import os
import sys
from pysmell import idehelper
cur_word = os.environ.get("tm_current_word")
cur_file = os.environ.get("tm_filepath")
orig_source = sys.stdin.read()
line_no = int(os.environ.get("tm_line_number"))
cur_col = int(os.environ.get("tm_line_index"))
# pysmells now site-packages/pysmell/
pysmelldict = idehelper.findpysmelldict("/library/python/2.5/site-packages/pysmell/blah")
options = idehelper.detectcompletiontype(cur_file, orig_source, line_no, cur_col, "", pysmelldict)
completions = idehelper.findcompletions(cur_word, pysmelldict, options)
if len(completions) > 0:
new_word = completions[0]['word']
new_word = new_word.replace(cur_word, "", 1) # mislay user already typed
imitation new_word
then i finished new python document, typed "import urll" strike alt+escape, finished "import urllib"!
as i said, it's wholly work-in-progress, don't yet..
last update:
orestis integrated pysmell project's code! any offer fiddling occur
Comments
Post a Comment