From 797fdb629ea2ab7a6f7ec1177df485310933192e Mon Sep 17 00:00:00 2001 From: James Doyle Date: Sat, 7 Mar 2020 14:24:23 -0800 Subject: [PATCH] Added: support for more css scopes: postcss and scss --- TailwindCSSAutocomplete.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/TailwindCSSAutocomplete.py b/TailwindCSSAutocomplete.py index 413e50b..d3988b1 100644 --- a/TailwindCSSAutocomplete.py +++ b/TailwindCSSAutocomplete.py @@ -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 @@ -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: @@ -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')