diff --git a/cfml_plugin.py b/cfml_plugin.py index 24e987e..bb94bd7 100644 --- a/cfml_plugin.py +++ b/cfml_plugin.py @@ -80,6 +80,8 @@ class CustomHtmlTagCompletions(html_completions.HtmlTagCompletions): """ There is no text.html scope in bodies, so this allows the HTML completions to still function there + + uses Default Packages HtmlTagCompletions code """ def on_query_completions(self, view, prefix, locations): @@ -91,9 +93,28 @@ def on_query_completions(self, view, prefix, locations): if not view.match_selector(locations[0], selector): return None - # check if we are inside a tag - is_inside_tag = view.match_selector( - locations[0], "meta.tag - punctuation.definition.tag.begin" - ) + pt = locations[0] - len(prefix) - 1 + ch = view.substr(pt) + + if ch == '&': + return self.entity_completions + + if ch == '<': + # If the caret is within tag, complete only tag names. + # see: https://github.com/sublimehq/sublime_text/issues/3508 + if view.match_selector(locations[0], "meta.tag"): + return self.tag_name_completions + return self.tag_completions + + # Note: Exclude opening punctuation to enable abbreviations + # if the caret is located directly in front of a html tag. + if view.match_selector(locations[0], "meta.function.body.tag.cfml meta.tag - meta.string - punctuation.definition.tag.begin"): + if ch in ' \f\n\t': + return self.attribute_completions(view, locations[0], prefix) + return None + + if view.match_selector(locations[0], "meta.function.body.tag.cfml - meta.tag, meta.function.body.tag.cfml punctuation.definition.tag.begin"): + # Expand tag and attribute abbreviations + return self.expand_tag_attributes(view, locations) or self.tag_abbreviations - return self.get_completions(view, prefix, locations, is_inside_tag) + return None diff --git a/src/plugins_/applicationcfc/json/methods_docs.json b/src/plugins_/applicationcfc/json/methods_docs.json index 1ff6259..bf0f6a6 100644 --- a/src/plugins_/applicationcfc/json/methods_docs.json +++ b/src/plugins_/applicationcfc/json/methods_docs.json @@ -64,24 +64,24 @@ ] }, "onerror": { - "header": "onError()", - "body": "This method is triggered when a uncaught exception occurs in this application context. As arguments you get the exception (cfcatch block) and the eventName.", + "header": "onError()", + "body": "This method is triggered when a uncaught exception occurs in this application context. As arguments you get the exception (cfcatch block) and the eventName.", "links": [ { "href": "http://docs.lucee.org/guides/cookbooks/application-context-basic.html", "text": "docs.lucee.org/guides/cookbooks/application-context-basic.html"}, { "href": "https://helpx.adobe.com/coldfusion/cfml-reference/application-cfc-reference/onerror.html", "text": "helpx.adobe.com onerror.html"} ] }, "onabort": { - "header": "onAbort()", - "body": "This method is triggered when a request is ended with help of the tag >.", + "header": "onAbort()", + "body": "This method is triggered when a request is ended with help of the tag .", "links": [ { "href": "http://docs.lucee.org/guides/cookbooks/application-context-basic.html", "text": "docs.lucee.org/guides/cookbooks/application-context-basic.html"}, { "href": "https://helpx.adobe.com/coldfusion/cfml-reference/application-cfc-reference/onabort.html", "text": "helpx.adobe.com onabort.html"} ] }, "ondebug": { - "header": "onDebug()", - "body": "This method is triggered when debugging is enabled for this requestt.", + "header": "onDebug()", + "body": "This method is triggered when debugging is enabled for this request.", "links": [ { "href": "http://docs.lucee.org/guides/cookbooks/application-context-basic.html", "text": "docs.lucee.org/guides/cookbooks/application-context-basic.html"}, { "href": "https://helpx.adobe.com/coldfusion/cfml-reference/application-cfc-reference/ondebug.html", "text": "helpx.adobe.com ondebug.html"}