Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 2 additions & 25 deletions tailwind_autocomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,8 @@ def __init__(self):

def on_query_completions(self, view, prefix, locations):

if view.match_selector(locations[0], "text.html string.quoted"):

# Cursor is inside a quoted attribute
# Now check if we are inside the class attribute

# max search size
LIMIT = 250

# place search cursor one word back
cursor = locations[0] - len(prefix) - 1

# dont start with negative value
start = max(0, cursor - LIMIT - len(prefix))

# get part of buffer
line = view.substr(sublime.Region(start, cursor))

# split attributes
parts = line.split('=')

# is the last typed attribute a class attribute?
if len(parts) > 1 and parts[-2].strip().endswith("class"):
return self.class_completions
else:
return []
if view.match_selector(locations[0], "text.html meta.attribute-with-value.class.html"):
return self.class_completions
elif view.match_selector(locations[0], "text.html meta.tag - text.html punctuation.definition.tag.begin"):

# Cursor is in a tag, but not inside an attribute, i.e. <div {here}>
Expand Down