mirror of
https://github.com/zhigang1992/AutoFileName.git
synced 2026-01-12 22:45:57 +08:00
important bug fix
now path must be preceded by / or \\. Folder names are followed by / even on windows.
This commit is contained in:
@@ -2,11 +2,17 @@ import sublime, sublime_plugin, os, re
|
||||
|
||||
class FileNameComplete(sublime_plugin.EventListener):
|
||||
|
||||
def prev_has(self, view, string):
|
||||
sel = view.sel()[0].a
|
||||
print string, view.substr(sel-2)
|
||||
return string in view.substr(sublime.Region(sel-1, sel))
|
||||
|
||||
def on_query_completions(self, view, prefix, locations):
|
||||
completions = []
|
||||
sel = view.sel()[0].a
|
||||
|
||||
if '\\' or '/' in view.substr(sublime.Region(sel-2,sel)):
|
||||
if self.prev_has(view, '/') or self.prev_has(view, '\\\\'):
|
||||
print "yes"
|
||||
if "string" in view.scope_name(sel):
|
||||
pass
|
||||
elif "css" in view.scope_name(sel):
|
||||
@@ -29,7 +35,7 @@ class FileNameComplete(sublime_plugin.EventListener):
|
||||
dir_files = os.listdir(this_dir)
|
||||
for d in dir_files:
|
||||
if not '.' in d:
|
||||
d += os.path.sep
|
||||
d += '/'
|
||||
completions.append(d.decode('utf-8'))
|
||||
return [(x, x) for x in list(set(completions))]
|
||||
except OSError:
|
||||
|
||||
Reference in New Issue
Block a user