Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added: support for more css scopes: postcss and scss #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
7 changes: 5 additions & 2 deletions TailwindCSSAutocomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def get_config_items(self, config):
# we override this if we are inside an @apply
def on_text_command(self, view, command_name, args):
cursor = view.sel()[0].begin()
isCss = view.match_selector(cursor, 'source.css meta.property-list.css')
isCss = self.check_css_scope(view, cursor)

if isCss == False:
return None
Expand Down Expand Up @@ -132,7 +132,7 @@ def on_query_completions(self, view, prefix, locations):
if items is None:
return []

isCss = view.match_selector(locations[0], 'source.css meta.property-list.css')
isCss = self.check_css_scope(view, locations[0])
isHtml = view.match_selector(locations[0], 'text.html string.quoted') or view.match_selector(locations[0], 'string.quoted.jsx')

if isCss == False and isHtml == False:
Expand Down Expand Up @@ -210,3 +210,6 @@ def find_node_module(self, dir, name):
if module is not None:
break
return module

def check_css_scope(self, view, matcher):
return view.match_selector(matcher, 'source.css meta.property-list.css') or view.match_selector(matcher, 'source.postcss') or view.match_selector(matcher, 'source.scss')