Orestis has integrated this into the PySmell project's code! Any further fiddling will happen on github Then I made a new python document, typed "import urll" and hit alt+escape, and it completed it to "import urllib"!Īs I said, it's entirely a work-in-progress, so don't use it yet. New_word = new_word.replace(CUR_WORD, "", 1) # remove what user has already typed Options = tectCompletionType(cur_file, orig_source, line_no, cur_col, "", PYSMELLDICT)Ĭompletions = idehelper.findCompletions(CUR_WORD, PYSMELLDICT, options) ![]() PYSMELLDICT = idehelper.findPYSMELLDICT("/Library/Python/2.5/site-packages/pysmell/blah") # PYSMELLS is currently in site-packages/pysmell/ Line_no = int(os.environ.get("TM_LINE_NUMBER"))Ĭur_col = int(os.environ.get("TM_LINE_INDEX")) Place the following in a TextMate bundle script, set "input: entire document", "output: insert as text", "activation: key equivalent: alt+esc", "scope selector: source.python" #!/usr/bin/env pythonĬUR_WORD = os.environ.get("TM_CURRENT_WORD") I ran python pysmells.py /System/Library/Frameworks/amework/Versions/2.5/lib/python2.5/*.py -O /Library/Python/2.5/site-packages/pysmell/PYSMELLTAGS Progressing! I have the utter-basics of completion in place – barely works, but it's close. It'll never be perfect, but it would be extremely useful (even if just for completing the stdlib modules, which should never change, so you wont have to constantly regenerate the PYSMELLTAGS file whenever you add a function) > completions = idehelper.findCompletions("proc", PYSMELLDICT, options) > options = tectCompletionType("", "" 1, 2, "", PYSMELLDICT) > PYSMELLDICT = idehelper.findPYSMELLDICT("/Users/dbr/Desktop/pysmell/") > # The path is where my PYSMELLTAGS file is located: I think it should be possible, PySmell's idehelper.py does a majority of the complex stuff, it should just be a case of giving it the current line, offering up the completions (the bit I am not sure about) and then replacing the line with the selected one. PySmell seems like a good starting point.
0 Comments
Leave a Reply. |