PySmell은 좋은 출발점처럼 보입니다.TextMate에서 파이썬 코드 완성을 구현할 수 있습니까?
필자는 PySmell의 idehelper.py
이 대다수의 복잡한 작업을 처리해야한다고 생각한다. 현재 줄을 제공하고 완료 (위로에 대해 확신이없는 비트)를 제공 한 다음 교체해야하는 경우 여야한다. 선택된 것의 선.
>>> import idehelper
>>> # The path is where my PYSMELLTAGS file is located:
>>> PYSMELLDICT = idehelper.findPYSMELLDICT("/Users/dbr/Desktop/pysmell/")
>>> options = idehelper.detectCompletionType("", "" 1, 2, "", PYSMELLDICT)
>>> completions = idehelper.findCompletions("proc", PYSMELLDICT, options)
>>> print completions
[{'dup': '1', 'menu': 'pysmell.pysmell', 'kind': 'f', 'word': 'process', 'abbr': 'process(argList, excluded, output, verbose=False)'}]
그것은 완벽하지 않을 것이다, 그러나 다만, 절대 변하지 않을해야 다음 stdlib 모듈을 완료 당신이 늘 당신이 기능을 추가 할 때마다 지속적으로 PYSMELLTAGS 파일을 재생 할 수 있도록 경우에도 그것이 (매우 유용 할 것이다)
진행 중! "출력 :"전체 문서 입력 "거의 작동하지만, 가까이 ..
나는 설정은 A의 TextMate 번들 스크립트에서 다음 python pysmells.py /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/*.py -O /Library/Python/2.5/site-packages/pysmell/PYSMELLTAGS
장소를 실행 - 나는 장소에 완성의 완전한-기본이 해당하는 키 : ALT + ESC ","범위 선택 : 텍스트 ","활성화로 삽입 source.python 수입 urll ""
#!/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 is currently in 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) # remove what user has already typed
print new_word
그런 다음 나는 새로운 파이썬 문서 입력을했다 "및 ALT + 탈출을 명중, "urllib 가져 오기"를 완료했습니다! 내가 말했듯이
, 그것은 작업의 진행, 그래서 .. 그것을 사용 아직없는 완전히의
최신 업데이트 :
orestis는 PySmell 프로젝트에이를 통합했다 암호! 더 이상의 손보는 이것은 당신이 찾고있는 정확하게하지 on github
내가 최근 GitHub의 프로젝트에의 TextMate 관련 커밋을 발견했다입니다. 나는 코드가 친숙하다고 생각했지만, 우연이라고 생각했다. : D – dbr