def _async_eval_at_trg(self, buf, trg, ctlr, styleClassifier): if _xpcom_: trg = UnwrapObject(trg) ctlr = UnwrapObject(ctlr) # Handle ambiguous property-names here DEBUG = DebugStatus # DEBUG = True if DEBUG: print("Less: _async_eval_at_trg: trg: %s(%r)" % (trg, trg)) if trg.id != (self.lang, TRG_FORM_CPLN, "tag-or-property-names"): CSSLangIntel._async_eval_at_trg( self, buf, trg, ctlr, styleClassifier) return if DEBUG: print("\n----- async_eval_at_trg(trg=%r) -----"\ % (trg)) # Setup the AccessorCache extra = trg.extra ac = None # print "Extra: %r" % (extra) if isinstance(extra, dict): extra = extra.get("extra", None) if isinstance(extra, dict): ac = extra.get("ac", None) if ac and DEBUG: print(" _async_eval_at_trg:: Trigger had existing AC") ac.dump() if ac is None: if DEBUG: print(" _async_eval_at_trg:: Created new trigger!") ac = AccessorCache(buf.accessor, trg.pos, fetchsize=20) ctlr.start(buf, trg) pos = trg.pos try: cplns1 = [("property", v + ": ") for v in self.CSS_PROPERTY_NAMES] cplns2 = [("element", v) for v in self.CSS_HTML_TAG_NAMES] cplns = sorted(cplns1 + cplns2, key=_OrdPunctLastOnSecondItem) # Note: we add the colon as well - see bug 89913. ctlr.set_cplns(cplns) # print " _async_eval_at_trg:: cplns:", cplns ctlr.done("success") trg.retriggerOnCompletion = True except IndexError: # Tried to go out of range of buffer, nothing appropriate found if DEBUG: print(" _async_eval_at_trg:: ** Out of range error **") ctlr.done("success")
def _async_eval_at_trg(self, buf, trg, ctlr, styleClassifier): if _xpcom_: trg = UnwrapObject(trg) ctlr = UnwrapObject(ctlr) # Handle ambiguous property-names here DEBUG = DebugStatus # DEBUG = True if DEBUG: print "Less: _async_eval_at_trg: trg: %s(%r)" % (trg, trg) if trg.id != (self.lang, TRG_FORM_CPLN, "tag-or-property-names"): CSSLangIntel._async_eval_at_trg( self, buf, trg, ctlr, styleClassifier) return if DEBUG: print "\n----- async_eval_at_trg(trg=%r) -----"\ % (trg) # Setup the AccessorCache extra = trg.extra ac = None # print "Extra: %r" % (extra) if isinstance(extra, dict): extra = extra.get("extra", None) if isinstance(extra, dict): ac = extra.get("ac", None) if ac and DEBUG: print " _async_eval_at_trg:: Trigger had existing AC" ac.dump() if ac is None: if DEBUG: print " _async_eval_at_trg:: Created new trigger!" ac = AccessorCache(buf.accessor, trg.pos, fetchsize=20) ctlr.start(buf, trg) pos = trg.pos try: cplns1 = [("property", v + ": ") for v in self.CSS_PROPERTY_NAMES] cplns2 = [("element", v) for v in self.CSS_HTML_TAG_NAMES] cplns = sorted(cplns1 + cplns2, key=_OrdPunctLastOnSecondItem) # Note: we add the colon as well - see bug 89913. ctlr.set_cplns(cplns) # print " _async_eval_at_trg:: cplns:", cplns ctlr.done("success") trg.retriggerOnCompletion = True except IndexError: # Tried to go out of range of buffer, nothing appropriate found if DEBUG: print " _async_eval_at_trg:: ** Out of range error **" ctlr.done("success")
def _async_eval_at_trg(self, buf, trg, ctlr, styleClassifier): if _xpcom_: trg = UnwrapObject(trg) ctlr = UnwrapObject(ctlr) # Handle ambiguous property-names here DEBUG = DebugStatus #DEBUG = True if DEBUG: print "Less: _async_eval_at_trg: trg: %s(%r)" % (trg, trg) if trg.id == (self.lang, TRG_FORM_CPLN, "variable"): # Autocomplete Less variables from the current file and/or scope(s). cplns = [] if self.lang in buf.blob_from_lang: blob = buf.blob_from_lang[self.lang] linenum = buf.accessor.line_from_pos(trg.pos) scoperef = buf.scoperef_from_blob_and_line(blob, linenum) while scoperef: elem = scoperef[0] for lname in scoperef[1]: elem = elem.names[lname] for child in elem: if child.tag == "variable": cplns.append(("variable", child.get("name"))) if scoperef[1]: scoperef = (scoperef[0], scoperef[1][:-1]) else: scoperef = None ctlr.set_cplns(sorted(cplns)) ctlr.done("success") return elif trg.id != (self.lang, TRG_FORM_CPLN, "tag-or-property-names"): CSSLangIntel._async_eval_at_trg(self, buf, trg, ctlr, styleClassifier) return if DEBUG: print "\n----- async_eval_at_trg(trg=%r) -----"\ % (trg) # Setup the AccessorCache extra = trg.extra ac = None #print "Extra: %r" % (extra) if isinstance(extra, dict): extra = extra.get("extra", None) if isinstance(extra, dict): ac = extra.get("ac", None) if ac and DEBUG: print " _async_eval_at_trg:: Trigger had existing AC" ac.dump() if ac is None: if DEBUG: print " _async_eval_at_trg:: Created new trigger!" ac = AccessorCache(buf.accessor, trg.pos, fetchsize=20) ctlr.start(buf, trg) pos = trg.pos try: cplns1 = [ ("property", v + ": ") for v in self.CSS_PROPERTY_NAMES ] cplns2 = [ ("element", v) for v in self.CSS_HTML_TAG_NAMES ] cplns = sorted(cplns1 + cplns2, key=_OrdPunctLastOnSecondItem) # Note: we add the colon as well - see bug 89913. ctlr.set_cplns(cplns) #print " _async_eval_at_trg:: cplns:", cplns ctlr.done("success") trg.retriggerOnCompletion = True except IndexError: # Tried to go out of range of buffer, nothing appropriate found if DEBUG: print " _async_eval_at_trg:: ** Out of range error **" ctlr.done("success")
def _async_eval_at_trg(self, buf, trg, ctlr, styleClassifier): if _xpcom_: trg = UnwrapObject(trg) ctlr = UnwrapObject(ctlr) # Handle ambiguous property-names here DEBUG = DebugStatus #DEBUG = True if DEBUG: print("Less: _async_eval_at_trg: trg: %s(%r)" % (trg, trg)) if trg.id == (self.lang, TRG_FORM_CPLN, "variable"): # Autocomplete Less variables from the current file and/or scope(s). cplns = [] if self.lang in buf.blob_from_lang: blob = buf.blob_from_lang[self.lang] linenum = buf.accessor.line_from_pos(trg.pos) scoperef = buf.scoperef_from_blob_and_line(blob, linenum) while scoperef: elem = scoperef[0] for lname in scoperef[1]: elem = elem.names[lname] for child in elem: if child.tag == "variable": cplns.append(("variable", child.get("name"))) if scoperef[1]: scoperef = (scoperef[0], scoperef[1][:-1]) else: scoperef = None ctlr.set_cplns(sorted(cplns)) ctlr.done("success") return elif trg.id != (self.lang, TRG_FORM_CPLN, "tag-or-property-names"): CSSLangIntel._async_eval_at_trg(self, buf, trg, ctlr, styleClassifier) return if DEBUG: print("\n----- async_eval_at_trg(trg=%r) -----"\ % (trg)) # Setup the AccessorCache extra = trg.extra ac = None #print "Extra: %r" % (extra) if isinstance(extra, dict): extra = extra.get("extra", None) if isinstance(extra, dict): ac = extra.get("ac", None) if ac and DEBUG: print(" _async_eval_at_trg:: Trigger had existing AC") ac.dump() if ac is None: if DEBUG: print(" _async_eval_at_trg:: Created new trigger!") ac = AccessorCache(buf.accessor, trg.pos, fetchsize=20) ctlr.start(buf, trg) pos = trg.pos try: cplns1 = [("property", v + ": ") for v in self.CSS_PROPERTY_NAMES] cplns2 = [("element", v) for v in self.CSS_HTML_TAG_NAMES] cplns = sorted(cplns1 + cplns2, key=_OrdPunctLastOnSecondItem) # Note: we add the colon as well - see bug 89913. ctlr.set_cplns(cplns) #print " _async_eval_at_trg:: cplns:", cplns ctlr.done("success") trg.retriggerOnCompletion = True except IndexError: # Tried to go out of range of buffer, nothing appropriate found if DEBUG: print(" _async_eval_at_trg:: ** Out of range error **") ctlr.done("success")