Iâve revised and re-posted my Python Completions file below.
- It lists Python functions and methods (after a dot)
- It will include the usual/file completions, but only for terms of more the 3 characters - I find this very useful ; they are marked as âDefaultâ in the completions list
- If working with the ST-API it will also include these methods (after a dot)
- If you want to only display ST-API completions, you can type âyour_obj.stâ then press Ctrl-Space to display the list. You may have to press Escape to first dismiss the currently displayed completions.
Personally, I increased the auto-complete delay so that the list doesnât appear too quickly.
I should update my Gist for this when I get round to it
[code]import sublime, sublime_plugin
py_funcs =
(âimport()\t__import__ fnâ,
âimport(${1:name}${2:, globals, locals, fromlist, level]})$0â),
(âabs()\tabs fnâ, âabs(${1:number})$0â),
(âall()\tall fnâ, âall(${1:iterable})$0â),
(âany()\tany fnâ, âany(${1:iterable})$0â),
(âbin()\tbin fnâ, âbin(${1:integer})$0â),
(âbool()\tbool fnâ, âbool(${1:[value]})$0â),
(âbytearray()\tbytearray fnâ,
âbytearray(${1:${2:source}${3:, encoding]}${4:, errors]}})$0â),
(âcallable()\tcallable fnâ, âcallable(${1:object})$0â),
(âchr()\tchr fnâ, âchr(${1:integer})$0â),
(âclassmethod()\tclassmethod fnâ, âclassmethod(${1:function})$0â),
(âcmp()\tcmp fnâ, âcmp(${1:x}, ${2:y})$0â),
(âcompile()\tcompile fnâ,
âcompile(${1:source}, ${2:filename}, ${3:mode}${4:, flags]}${5:, dont_inherit]})$0â),
(âcomplex()\tcomplex fnâ, âcomplex(${1:real}${2:, imag]})$0â),
(âdelattr()\tdelattr fnâ, âdelattr(${1:object}, ${2:name})$0â),
(âdict()\tdict fn/ctorâ, âdict(${1:arg})$0â),
(âdir()\tdir fnâ, âdir(${1:[object]})$0â),
(âdivmod()\tdivmod fnâ, âdivmod(${1:a}, ${2:b})$0â),
(âenumerate()\tenumerate fnâ, âenumerate(${1:sequence}${2:, start]})$0â),
(âeval()\teval fnâ, âeval(${1:expression}${2:, globals]}${3:, locals]})$0â),
(âexecfile()\texecfile fnâ, âexecfile(${1:filename}${2:, globals]}${3:, locals]})$0â),
(âfile()\tfile fnâ, âfile(${1:filename}${2:, mode]}${3:, bufsize]})$0â),
(âfilter()\tfilter fnâ, âfilter(${1:function}, ${2:iterable})$0â),
(âfloat()\tfloat fn/ctorâ, âfloat(${1:[x]})$0â),
(âformat()\tformat fnâ, âformat(${1:value}${2:, format_spec]})$0â),
(âfrozenset()\tfrozenset fn/ctorâ, âfrozenset(${1:[iterable]})$0â),
(âgetattr()\tgetattr fnâ, âgetattr(${1:object}, ${2:name}${3:, default]})$0â),
(âglobals()\tglobals fnâ, âglobals()$0â),
(âhasattr()\thasattr fnâ, âhasattr(${1:object}, ${2:name})$0â),
(âhash()\thash fnâ, âhash(${1:object})$0â),
(âhelp()\thelp fnâ, âhelp(${1:[object]})$0â),
(âhex()\thex fnâ, âhex(${1:x})$0â),
(âid()\tid fnâ, âid(${1:object})$0â),
(âinput()\tinput fnâ, âinput(${1:[prompt]})$0â),
(âint()\tint fn/ctorâ, âint(${1:x}${2:, base]})$0â),
(âisinstance()\tisinstance fnâ, âisinstance(${1:object}, ${2:classinfo})$0â),
(âissubclass()\tissubclass fnâ, âissubclass(${1:class}, ${2:classinfo})$0â),
(âiter()\titer fnâ, âiter(${1:o}${2:, sentinel]})$0â),
(âlen()\tlen fnâ, âlen(${1:object})$0â),
(âlist()\tlist fn/ctorâ, âlist(${1:[iterable]})$0â),
(âlocals()\tlocals fnâ, âlocals()$0â),
(âlong()\tlong fn/ctorâ, âlong(${1:x}${2:, base]})$0â),
(âmap()\tmap fnâ, âmap(${1:function}${2:, iterables]})$0â),
(âmax()\tmax fnâ, âmax(${1:iterable}${2:, args]}${3:, key]})$0â),
(âmemoryview()\tmemoryview fnâ, âmemoryview(${1:object})$0â),
(âmin()\tmin fnâ, âmin(${1:iterable}${2:, args]}${3:, key]})$0â),
(ânext()\tnext fnâ, ânext(${1:iterator}${2:, default]})$0â),
(âobject()\tobject fnâ, âobject()$0â),
(âoct()\toct fnâ, âoct(${1:integer})$0â),
(âopen()\topen fnâ, âopen(${1:filename}${2:, mode]}${3:, bufsize]})$0â),
(âord()\tord fnâ, âord(${1:char})$0â),
(âpow()\tpow fnâ, âpow(${1:x}, ${2:y}${3:, modulo]})$0â),
(âprint()\tprint fnâ,
âprint(${1:[object, âŚ], sep=â â], end=â\nâ], file=sys.stdout]})$0â),
(âproperty()\tproperty fnâ, âproperty(${1:[fget[, fset[, fdel[, doc]]]]})$0â),
(ârange()\trange fnâ, ârange(${1:[start, ]}${2:stop}${3:, step]})$0â),
(âraw_input()\traw_input fnâ, âraw_input(${1:[prompt]})$0â),
(âreduce()\treduce fnâ, âreduce(${1:function}, ${2:iterable}${3:, initializer]})$0â),
(âreload()\treload fnâ, âreload(${1:module})$0â),
(ârepr()\trepr fnâ, ârepr(${1:object})$0â),
(âreversed()\treversed fnâ, âreversed(${1:seq})$0â),
(âround()\tround fnâ, âround(${1:float}${2:, digits]})$0â),
(âset()\tset fn/ctorâ, âset(${1:[iterable]})$0â),
(âsetattr()\tsetattr fnâ, âsetattr(${1:object}, ${2:name}, ${3:value})$0â),
(âslice()\tslice fnâ, âslice(${1:[start, ]}${2:stop}${3:, step]})$0â),
(âsorted()\tsorted fnâ,
âsorted(${1:iterable}${2:${3:, cmp]}${4:, key]}${5:, reverse]}})$0â),
(âstaticmethod()\tstaticmethod fnâ, âstaticmethod(${1:function})$0â),
(âstr()\tString fnâ, âstr(${1:object})$0â),
(âsum()\tsum fnâ, âsum(${1:iterable}${2:, start]})$0â),
(âsuper()\tsuper fnâ, âsuper(${1:type}${2:, object/type]})$0â),
(âtuple()\ttuple fn/ctorâ, âtuple(${1:[iterable]})$0â),
(âtype()\ttype fnâ, âtype(${1:object})$0â),
(âtype()\ttype ctorâ, âtype(${1:name}, ${2:bases}, ${3:dict})$0â),
(âunichr()\tunichr fnâ, âunichr(${1:[integer]})$0â),
(âunicode()\tunicode fnâ, âunicode(${1:[object, ]}${2:encoding}${3:, errors]})$0â),
(âvars()\tvars fnâ, âvars(${1:[object]})$0â),
(âxrange()\txrange fnâ, âxrange(${1:[start, ]}${2:stop}${3:, step]})$0â),
(âzip()\tzip fnâ, âzip(${1:iterable})$0â)
]
py_members = # methods and attributes
(âadd()\tsetâ, âadd(${1:elem})$0â),
(âappend()\tMutableâ, âappend(${1:x})$0â),
(âas_integer_ratio()\tfloatâ, âas_integer_ratio()$0â),
(âbit_length() 3.1\tint/longâ, âbit_length()$0â),
(âcapitalize()\tstringâ, âcapitalize()$0â),
(âcenter()\tstringâ, âcenter(${1:width}${2:, fillchar]})$0â),
(âclear()\tset/dictâ, âclear()$0â),
(âclose()\tfileâ, âclose()$0â),
(âclosed\tfileâ, âclosed$0â),
(âconjugate()\tcomplexâ, âconjugate()$0â),
(âcopy()\tSet/dictâ, âcopy()$0â),
(âcount()\tSequenceâ, âcount(${1:value})$0â),
(âcount()\tstringâ, âcount(${1:substr}${2:, start]}${3:, end]})$0â),
(âdecode()\tstringâ, âdecode(${1:[encoding]}${2:, errors]})$0â),
(âdifference()\tSetâ, âdifference(${1:other,âŚ})$0â),
(âdifference_update()\tsetâ, âdifference_update(${1:other,âŚ})$0â),
(âdiscard()\tsetâ, âdiscard(${1:elem})$0â),
(âencode()\tstringâ, âencode(${1:[encoding]}${2:, errors]})$0â),
(âencoding\tfileâ, âencoding$0â),
(âendswith()\tstringâ, âendswith(${1:suffix}${2:, start]}${3:, end]})$0â),
(âerrors\tfileâ, âerrors$0â),
(âexpandtabs()\tstringâ, âexpandtabs(${1:[tabsize]})$0â),
(âextend()\tMutableâ, âextend(${1:x})$0â),
(âfileno()\tfileâ, âfileno()$0â),
(âfind()\tstringâ, âfind(${1:substr}${2:, start]}${3:, end]})$0â),
(âflush()\tfileâ, âflush()$0â),
(âformat()\tstringâ, âformat(${1:args}, ${2:**kwargs})$0"),
(âformat\tmemoryviewâ, âformat$0â),
(âfromhex()\tfloatâ, âfromhex(${1:string})$0â),
(âfromkeys()\tDictâ, âfromkeys(${1:seq}${2:, value]})$0â),
(âget()\tdictâ, âget(${1:key}${2:, default]})$0â),
(âhas_key()\tdictâ, âhas_key(${1:key})$0â),
(âhex()\tfloatâ, âhex()$0â),
(âindex()\tSequenceâ, âindex(${1:value}${2:, start]}${3:, end]})$0â),
(âinsert()\tMutableâ, âinsert(${1:i}, ${2:x})$0â),
(âintersection()\tSetâ, âintersection(${1:other,âŚ})$0â),
(âintersection_update()\tsetâ, âintersection_update(${1:other,âŚ})$0â),
(âis_integer()\tfloatâ, âis_integer()$0â),
(âisalnum()\tstringâ, âisalnum()$0â),
(âisalpha()\tstringâ, âisalpha()$0â),
(âisatty()\tfileâ, âisatty()$0â),
(âisdecimal()\tunicodeâ, âisdecimal()$0â),
(âisdigit()\tstringâ, âisdigit()$0â),
(âisdisjoint()\tSetâ, âisdisjoint(${1:other})$0â),
(âislower()\tstringâ, âislower()$0â),
(âisnumeric()\tunicodeâ, âisnumeric()$0â),
(âisspace()\tstringâ, âisspace()$0â),
(âissubset()\tSetâ, âissubset(${1:other})$0â),
(âissuperset()\tSetâ, âissuperset(${1:other})$0â),
(âistitle()\tstringâ, âistitle()$0â),
(âisupper()\tstringâ, âisupper()$0â),
(âitems()\tdictâ, âitems()$0â),
(âitemsize\tmemoryviewâ, âitemsize$0â),
(âiteritems()\tdictâ, âiteritems()$0â),
(âiterkeys()\tdictâ, âiterkeys()$0â),
(âitervalues()\tdictâ, âitervalues()$0â),
(âjoin()\tstringâ, âjoin(${1:iterable})$0â),
(âkeys()\tdictâ, âkeys()$0â),
(âljust()\tstringâ, âljust(${1:width}${2:, fillchar]})$0â),
(âlower()\tstringâ, âlower()$0â),
(âlstrip()\tstringâ, âlstrip(${1:[chars]})$0â),
(âmode\tfileâ, âmode$0â),
(âname\tfileâ, âname$0â),
(ândim\tmemoryviewâ, ândim$0â),
(ânewlines\tfileâ, ânewlines$0â),
(ânext()\tfileâ, ânext()$0â),
(âpartition()\tstringâ, âpartition(${1:sep})$0â),
(âpop()\tdictâ, âpop(${:key}${2:, default]})$0â),
(âpop()\tMutableâ, "pop(${1:})$0â),
(âpop()\tsetâ, âpop()$0â),
(âpopitem()\tdictâ, âpopitem()$0â),
(âread()\tfileâ, âread(${1:[size=]})$0â),
(âreadline()\tfileâ, âreadline(${1:[size=]})$0â),
(âreadlines()\tfileâ, âreadlines(${1:[sizehint]})$0â),
(âreadonly\tmemoryviewâ, âreadonly$0â),
(âremove()\tMutableâ, âremove(${1:x})$0â),
(âremove()\tsetâ, âremove(${1:elem})$0â),
(âreplace()\tstringâ, âreplace(${1:old}, ${2:new}${3:, count]})$0â),
(âreverse()\tMutableâ, âreverse()$0â),
(ârfind()\tstringâ, ârfind(${1:substr}${2:, start]}${3:, end]})$0â),
(ârindex()\tstringâ, ârindex(${1:substr}${2:, start]}${3:, end]})$0â),
(ârjust()\tstringâ, ârjust(${1:width}${2:, fillchar]})$0â),
(ârpartition()\tstringâ, ârpartition(${1:sep})$0â),
(ârsplit()\tstringâ, ârsplit(${1:[sep]}${2:, maxsplit]})$0â),
(ârstrip()\tstringâ, ârstrip(${1:[chars]})$0â),
(âseek()\tfileâ, âseek(${1:offset}${2:, whence]})$0â),
(âsetdefault()\tdictâ, âsetdefault(${:key}${2:, default]})$0â),
(âshape\tmemoryviewâ, âshape$0â),
(âsoftspace\tfileâ, âsoftspace$0â),
(âsort()\tMutableâ, âsort(${1:[cmp]}${2:, key]}${3:, reverse]})$0â),
(âsplit()\tstringâ, âsplit(${1:[sep]}${2:, maxsplit]})$0â),
(âsplitlines()\tstringâ, âsplitlines(${1:[keepends]})$0â),
(âstartswith()\tstringâ, âstartswith(${1:prefix}${2:, start]}${3:, end]})$0â),
(âstrides\tmemoryviewâ, âstrides$0â),
(âstrip()\tstringâ, âstrip(${1:[chars]})$0â),
(âswapcase()\tstringâ, âswapcase()$0â),
(âsymmetric_difference()\tSetâ, âsymmetric_difference(${1:other})$0â),
(âsymmetric_difference_update()\tsetâ, âsymmetric_difference_update(${1:other})$0â),
(âtell()\tfileâ, âtell()$0â),
(âtitle()\tstringâ, âtitle()$0â),
(âtobytes()\tmemoryviewâ, âtobytes()$0â),
(âtolist()\tmemoryviewâ, âtolist()$0â),
(âtranslate()\tstringâ, âtranslate(${1:table}${2:, deletechars]})$0â),
(âtruncate()\tfileâ, âtruncate(${1:[size=]})$0â),
(âunion()\tSetâ, âunion(${1:other,âŚ})$0â),
(âupdate()\tdict/setâ, âupdate(${1:other,âŚ})$0â),
(âupper()\tstringâ, âupper()$0â),
(âvalues()\tdictâ, âvalues()$0â),
(âviewitems()\tdictâ, âviewitems()$0â),
(âviewkeys()\tdictâ, âviewkeys()$0â),
(âviewvalues()\tdictâ, âviewvalues()$0â),
(âwrite()\tfileâ, âwrite(${1:str})$0â),
(âwritelines()\tfileâ, âwritelines(${1:sequence})$0â),
(âzfill()\tstringâ, âzfill(${1:width})$0â)
]
subl_methods =
(âactive_group()\tST Windowâ, âactive_group()$0â),
(âactive_view()\tST Windowâ, âactive_view()$0â),
(âactive_view_in_group()\tST Windowâ, âactive_view_in_group(${1:group})$0â),
(âactive_window()\tsublimeâ, âactive_window()$0â),
(âadd()\tST RegionSetâ, âadd(${1:region})$0â),
(âadd_all()\tST RegionSetâ, âadd_all(${1:region_set})$0â),
(âadd_on_change()\tST Settingsâ, âadd_on_change(${1:key}, ${2:on_change})$0â),
(âadd_regions()\tST Viewâ,
âadd_regions(${1:key}${2:, regions]}, ${3:scope}${4:, icon]}${5:, flags]})$0â),
(âarch()\tsublimeâ, âarch()$0â),
(âbegin()\tST Regionâ, âbegin()$0â),
(âbegin_edit()\tST Viewâ, âbegin_edit(${1:[command]}${2:, args]})$0â),
(âbuffer_id()\tST Viewâ, âbuffer_id()$0â),
(âclear_on_change()\tST Settingsâ, âclear_on_change(${1:key})$0â),
(âcommand_history()\tST Viewâ, âcommand_history(${1:[index]}${2:, modifying_only]})$0â),
(âcontains()\tST Region/Setâ, âcontains(${1:region/pt})$0â),
(âcover()\tST Regionâ, âcover(${1:region})$0â),
(âem_width()\tST Viewâ, âem_width()$0â),
(âempty()\tST Regionâ, âempty()$0â),
(âencoding()\tST Viewâ, âencoding()$0â),
(âend()\tST Regionâ, âend()$0â),
(âend_edit()\tST Viewâ, âend_edit(${1:edit})$0â),
(âerase()\tST Settingsâ, âerase(${1:name})$0â),
(âerase()\tST Viewâ, âerase(${1:edit}, ${2:region})$0â),
(âerase_regions()\tST Viewâ, âerase_regions(${1:key})$0â),
(âerase_status()\tST Viewâ, âerase_status(${1:key})$0â),
(âerror_message()\tsublimeâ, âerror_message(${1:string})$0â),
(âextract_completions()\tST Viewâ, âextract_completions(${1:prefix})$0â),
(âextract_scope()\tST Viewâ, âextract_scope(${1:point})$0â),
(âfile_name()\tST Viewâ, âfile_name()$0â),
(âfind()\tST Viewâ, âfind(${1:pattern}, ${2:fromPosition}${3:, flags]})$0â),
(âfind_all()\tST Viewâ,
âfind_all(${1:pattern}${2:, flags]}${3:, format]}${4:, extractions]})$0â),
(âfocus_group()\tST Windowâ, âfocus_group(${1:group})$0â),
(âfocus_view()\tST Windowâ, âfocus_view(${1:view})$0â),
(âfold()\tST Viewâ, âfold(${1:region(s)})$0â),
(âfolders()\tST Windowâ, âfolders()$0â),
(âfull_line()\tST Viewâ, âfull_line(${1:region/pt})$0â),
(âfind_by_selector()\tST Viewâ, âfind_by_selector(${1:selector})$0â),
(âget()\tST Settingsâ, âget(${1:name}${2:, default]})$0â),
(âget_clipboard()\tsublimeâ, âget_clipboard()$0â),
(âget_output_panel()\tST Windowâ, âget_output_panel(${1:name})$0â),
(âget_regions()\tST Viewâ, âget_regions(${1:key})$0â),
(âget_status()\tST Viewâ, âget_status(${1:key})$0â),
(âget_view_index()\tST Windowâ, âget_view_index(${1:view})$0â),
(âhas()\tST Settingsâ, âhas(${1:name})$0â),
(âid()\tST View/Windowâ, âid()$0â),
(âinsert()\tST Viewâ, âinsert(${1:edit}, ${2:point}, ${3:string})$0â),
(âinstalled_packages_path()\tsublimeâ, âinstalled_packages_path()$0â),
(âintersection()\tST Regionâ, âintersection(${1:region})$0â),
(âintersects()\tST Regionâ, âintersects(${1:region})$0â),
(âis_dirty()\tST Viewâ, âis_dirty()$0â),
(âis_loading()\tST Viewâ, âis_loading()$0â),
(âis_read_only()\tST Viewâ, âis_read_only()$0â),
(âis_scratch()\tST Viewâ, âis_scratch()$0â),
(âlayout_extent()\tST Viewâ, âlayout_extent()$0â),
(âlayout_to_text()\tST Viewâ, âlayout_to_text(${1:vector})$0â),
(âline()\tST Viewâ, âline(${1:region/pt})$0â),
(âline_endings()\tST Viewâ, âline_endings()$0â),
(âline_height()\tST Viewâ, âline_height()$0â),
(âlines()\tST Viewâ, âlines(${1:region})$0â),
(âload_settings()\tsublimeâ, âload_settings(${1:base_name})$0â),
(âlog_commands()\tsublimeâ, âlog_commands(${1:flag})$0â),
(âlog_input()\tsublimeâ, âlog_input(${1:flag})$0â),
(âmatch_selector()\tST Viewâ, âmatch_selector(${1:pt}, ${2:scope_string})$0â),
(âmessage_dialog()\tsublimeâ, âmessage_dialog(${1:string})$0â),
(âname()\tST Viewâ, âname()$0â),
(ânew_file()\tST Windowâ, ânew_file()$0â),
(ânum_groups()\tST Windowâ, ânum_groups()$0â),
(âok_cancel_dialog()\tsublimeâ, âok_cancel_dialog(${1:string}${2:, ok_button]})$0â),
(âopen_file()\tST Windowâ, âopen_file(${1:file_name}${2:, flags]})$0â),
(âpackages_path()\tsublimeâ, âpackages_path()$0â),
(âplatform()\tsublimeâ, âplatform()$0â),
(âRegion()\tsublimeâ, âRegion(${1:a}, ${2:b})$0â),
(âreplace()\tST Viewâ, âreplace(${1:edit}, ${2:region}, ${3:string})$0â),
(ârowcol()\tST Viewâ, ârowcol(${1:point})$0â),
(ârun_command()\tsublime/View/Windowâ, ârun_command(${1:string}${2:, args]})$0â),
(âsave_settings()\tsublimeâ, âsave_settings(${1:base_name})$0â),
(âscope_name()\tST Viewâ, âscope_name(${1:point})$0â),
(âscore_selector()\tST View/Windowâ, âscore_selector(${1:scope/pt}, ${2:selector})$0â),
(âsel()\tST Viewâ, âsel()$0â),
(âset()\tST Settingsâ, âset(${1:name}, ${2:value})$0â),
(âset_clipboard()\tsublimeâ, âset_clipboard(${1:string})$0â),
(âset_encoding()\tST Viewâ, âset_encoding(${1:encoding})$0â),
(âset_line_endings()\tST Viewâ, âset_line_endings(${1:line_endings})$0â),
(âset_name()\tST Viewâ, âset_name(${1:name})$0â),
(âset_read_only()\tST Viewâ, âset_read_only(${1:value})$0â),
(âset_scratch()\tST Viewâ, âset_scratch(${1:value})$0â),
(âset_status()\tST Viewâ, âset_status(${1:key}, ${2:value})$0â),
(âset_syntax_file()\tST Viewâ, âset_syntax_file(${1:syntax_file})$0â),
(âset_timeout()\tsublimeâ, âset_timeout(${1:callback}, ${2:delay})$0â),
(âset_view_index()\tST Windowâ, âset_view_index(${1:view}, ${2:group}, ${3:index})$0â),
(âsettings()\tST Viewâ, âsettings()$0â),
(âset_viewport_position()\tST Viewâ, âset_viewport_position(${1:vector}${2:, animate]})$0â),
(âshow()\tST Viewâ, âshow(${1:region/pt}${2:, show_surrounds]})$0â),
(âshow_at_center()\tST Viewâ, âshow_at_center(${1:region/pt})$0â),
(âshow_input_panel()\tST Windowâ,
âshow_input_panel(${1:caption}, ${2:initial_text}, ${3:on_done}, ${4:on_change}, ${5:on_cancel})$0â),
(âshow_quick_panel()\tST Windowâ,
âshow_quick_panel(${1:items}, ${2:on_done}${3:, flags]})$0â),
(âsize()\tST Region/Viewâ, âsize()$0â),
(âsplit_by_newlines()\tST Viewâ, âsplit_by_newlines(${1:region})$0â),
(âstatus_message()\tsublimeâ, âstatus_message(${1:string})$0â),
(âsubstr()\tST Viewâ, âsubstr(${1:region/pt})$0â),
(âsubtract()\tST RegionSetâ, âsubtract(${1:region})$0â),
(âtext_point()\tST Viewâ, âtext_point(${1:row}, ${2:col})$0â),
(âtext_to_layout()\tST Viewâ, âtext_to_layout(${1:point})$0â),
(âunfold()\tST Viewâ, âunfold(${1:region(s)})$0â),
(âversion()\tsublimeâ, âversion()$0â),
(âviewport_extent()\tST Viewâ, âviewport_extent()$0â),
(âviewport_position()\tST Viewâ, âviewport_position()$0â),
(âviews()\tST Windowâ, âviews()$0â),
(âviews_in_group()\tST Windowâ, âviews_in_group(${1:group})$0â),
(âvisible_region()\tST Viewâ, âvisible_region()$0â),
(âwindow()\tST Viewâ, âwindow()$0â),
(âwindows()\tsublimeâ, âwindows()$0â),
(âword()\tST Viewâ, âword(${1:region/pt})$0â)
]
sublime_methods_all = list(py_members)
sublime_methods_all.extend(subl_methods)
class PythonCompletions(sublime_plugin.EventListener):
def on_query_completions(self, view, prefix, locations):
global py_funcs, py_members, subl_methods, subl_methods_all
if not view.match_selector(locations[0], âsource.python -string -comment -constantâ):
return ]
completions = ]
pt = locations[0] - len(prefix) - 1
ch = view.substr(sublime.Region(pt, pt + 1)) # the character before the trigger
is_dot = (ch == â.â)
if is_dot: completions = py_members
if not is_dot: completions = py_funcs
if view.find("(?:from|import)\s+sublime", 0) is not None and is_dot:
if prefix.upper() == âSTâ: # just show Sublime methods
edit = view.begin_edit()
view.erase(edit, sublime.Region(locations[0], locations[0]-len(prefix)))
view.end_edit(edit)
return (subl_methods, sublime.INHIBIT_WORD_COMPLETIONS |
sublime.INHIBIT_EXPLICIT_COMPLETIONS)
else:
completions = sublime_methods_all # include Python methods/attributes
compl_default = [view.extract_completions(prefix)]
compl_default = (item + â\tDefaultâ, item) for sublist in compl_default
for item in sublist if len(item) > 3] # flatten
compl_default = list(set(compl_default)) # make unique
compl_full = list(completions)
compl_full.extend(compl_default)
compl_full.sort()
return (compl_full, sublime.INHIBIT_WORD_COMPLETIONS |
sublime.INHIBIT_EXPLICIT_COMPLETIONS)[/code][/size][/size][/size]*