|
3 | 3 | from shutil import copyfile |
4 | 4 | from threading import Timer |
5 | 5 |
|
6 | | -PLUGIN_VERSION = "0.13.11" |
| 6 | +PLUGIN_VERSION = "0.13.12" |
7 | 7 |
|
8 | 8 | PACKAGE_PATH = os.path.abspath(os.path.dirname(__file__)) |
9 | 9 | PACKAGE_NAME = os.path.basename(PACKAGE_PATH) |
@@ -723,20 +723,20 @@ def trim_Region(view, region): |
723 | 723 |
|
724 | 724 | @staticmethod |
725 | 725 | def selection_in_js_scope(view, point = -1, except_for = ""): |
726 | | - selections = view.sel() |
| 726 | + try : |
727 | 727 |
|
728 | | - if not selections: |
729 | | - return False |
| 728 | + sel_begin = view.sel()[0].begin() if point == -1 else point |
730 | 729 |
|
731 | | - sel_begin = selections[0].begin() if point == -1 else point |
| 730 | + return view.match_selector( |
| 731 | + sel_begin, |
| 732 | + 'source.js ' + except_for |
| 733 | + ) or view.match_selector( |
| 734 | + sel_begin, |
| 735 | + 'source.js.embedded.html ' + except_for |
| 736 | + ) |
732 | 737 |
|
733 | | - return view.match_selector( |
734 | | - sel_begin, |
735 | | - 'source.js ' + except_for |
736 | | - ) or view.match_selector( |
737 | | - sel_begin, |
738 | | - 'source.js.embedded.html ' + except_for |
739 | | - ) |
| 738 | + except IndexError as e: |
| 739 | + return False |
740 | 740 |
|
741 | 741 | @staticmethod |
742 | 742 | def replace_with_tab(view, region, pre="", after="", add_to_each_line_before="", add_to_each_line_after="") : |
@@ -1660,7 +1660,7 @@ def run(self, **kwargs): |
1660 | 1660 | if not self.command: |
1661 | 1661 | self.command = kwargs.get("command") |
1662 | 1662 | else: |
1663 | | - self.command += kwargs.get("command") |
| 1663 | + self.command += [kwargs.get("command")] |
1664 | 1664 |
|
1665 | 1665 | self.prepare_command(**kwargs) |
1666 | 1666 |
|
@@ -1689,7 +1689,7 @@ def run(self, **kwargs): |
1689 | 1689 | if not self.command: |
1690 | 1690 | self.command = kwargs.get("command") |
1691 | 1691 | else: |
1692 | | - self.command += kwargs.get("command") |
| 1692 | + self.command += [kwargs.get("command")] |
1693 | 1693 |
|
1694 | 1694 | self.prepare_command(**kwargs) |
1695 | 1695 |
|
@@ -4094,7 +4094,7 @@ class on_hover_descriptionEventListener(sublime_plugin.EventListener): |
4094 | 4094 | def on_hover(self, view, point, hover_zone) : |
4095 | 4095 | if not view.match_selector( |
4096 | 4096 | point, |
4097 | | - 'source.js - comment' |
| 4097 | + 'source.js - string - constant - comment' |
4098 | 4098 | ): |
4099 | 4099 | return |
4100 | 4100 |
|
@@ -4255,6 +4255,7 @@ def on_hover_description_async(view, point, hover_zone, popup_position, show_hin |
4255 | 4255 |
|
4256 | 4256 | if result[0] and result[1].get("type") and result[1]["type"] != "(unknown)": |
4257 | 4257 |
|
| 4258 | + print(result[1]) |
4258 | 4259 | results_found = 1 |
4259 | 4260 |
|
4260 | 4261 | description = dict() |
@@ -5584,7 +5585,7 @@ def on_modified_async_with_thread(self, recheck=True): |
5584 | 5585 |
|
5585 | 5586 | repetitions[variableName] = [variableRegion] |
5586 | 5587 |
|
5587 | | - items = Util.nested_lookup("type", ["MemberExpression", "CallExpression", "BinaryExpression", "ExpressionStatement", "Property", "ArrayExpression", "ObjectPattern", "AssignmentExpression", "IfStatement", "ForStatement", "WhileStatement", "ForInStatement", "ForOfStatement", "LogicalExpression", "UpdateExpression", "ArrowFunctionExpression", "ConditionalExpression"], body) |
| 5588 | + items = Util.nested_lookup("type", ["VariableDeclarator", "MemberExpression", "CallExpression", "BinaryExpression", "ExpressionStatement", "Property", "ArrayExpression", "ObjectPattern", "AssignmentExpression", "IfStatement", "ForStatement", "WhileStatement", "ForInStatement", "ForOfStatement", "LogicalExpression", "UpdateExpression", "ArrowFunctionExpression", "ConditionalExpression"], body) |
5588 | 5589 | for item in items: |
5589 | 5590 |
|
5590 | 5591 | if "object" in item : |
@@ -5635,6 +5636,9 @@ def on_modified_async_with_thread(self, recheck=True): |
5635 | 5636 | elif "value" in item and isinstance(item["value"],dict) and "name" in item["value"] and item["value"]["type"] == "Identifier": |
5636 | 5637 | item = item["value"] |
5637 | 5638 |
|
| 5639 | + elif "init" in item and isinstance(item["init"],dict) and "name" in item["init"] and item["init"]["type"] == "Identifier": |
| 5640 | + item = item["init"] |
| 5641 | + |
5638 | 5642 | elif "body" in item and isinstance(item["body"],dict) and "name" in item["body"] and item["body"]["type"] == "Identifier": |
5639 | 5643 | item = item["body"] |
5640 | 5644 |
|
|
0 commit comments