|
5 | 5 | {"include": "#comments"}, |
6 | 6 | {"include": "#imports"}, |
7 | 7 | {"include": "#strings"}, |
| 8 | + {"include": "#hover_function_parameters"}, |
8 | 9 | {"include": "#constants"}, |
| 10 | + {"include": "#keywords"}, |
9 | 11 | {"include": "#functions"}, |
| 12 | + {"include": "#long_functions"}, |
| 13 | + {"include": "#user_defined_functions"}, |
10 | 14 | {"include": "#types"}, |
11 | | - {"include": "#keywords"}, |
12 | 15 | {"include": "#variables"}, |
13 | 16 | {"include": "#operators"}, |
14 | 17 | {"include": "#parameters"} |
|
913 | 916 | }, |
914 | 917 | "functions": { |
915 | 918 | "patterns": [ |
916 | | - {"include": "#keywords"}, |
917 | 919 | { |
918 | 920 | "match": "^\\s*\\b(indicator|library|strategy)(?=\\s*\\()", |
919 | 921 | "name": "storage.type.class.ps" |
|
947 | 949 | } |
948 | 950 | }, |
949 | 951 | { |
950 | | - "match": "(?<![\\.]\\s*)\\b(array|matrix)\\b(\\.)\\b(new)\\b\\s*(<)\\s*([a-zA-Z_][a-zA-Z0-9_\\.]*)\\s*(>)(?=\\s*\\()", |
| 952 | + "match": "(?<![\\.]\\s*)\\b(array|matrix)\\b(\\.)\\b(new)\\b\\s*(<)\\s*([a-zA-Z_][a-zA-Z0-9_\\.]*)\\b\\s*(>)(?=\\s*\\()", |
951 | 953 | "captures": { |
952 | 954 | "1": { |
953 | 955 | "name": "support.function.ps" |
|
1116 | 1118 | } |
1117 | 1119 | }, |
1118 | 1120 | { |
1119 | | - "match": "(?<![\\.]\\s*)\\b(map)\\b(\\.)\\b(new)\\b\\s*(<)\\s*\\b(int|float|bool|string|color)\\b\\s*(\\,)\\s*\\b([a-zA-Z_][\\w\\.]*)\\b\\s*(>)(?=\\s*\\()", |
| 1121 | + "match": "(?<![\\.]\\s*)\\b(map)\\b(\\.)\\b(new)\\b\\s*(<)\\s*\\b([a-zA-Z_]+)\\b\\s*(\\,)\\s*\\b([a-zA-Z_][\\w\\.]*)\\b\\s*(>)(?=\\s*\\()", |
1120 | 1122 | "captures": { |
1121 | 1123 | "1": { |
1122 | 1124 | "name": "support.function.ps" |
|
1357 | 1359 | {"include": "#map_methods"}, |
1358 | 1360 | {"include": "#matrix_methods"}, |
1359 | 1361 | {"include": "#table_methods"}, |
1360 | | - {"include": "#long_functions"}, |
1361 | 1362 | { |
1362 | 1363 | "match": "(?<![\\.]\\s*)\\b(fill)(?=\\s*\\((?!\\s*[\"'\\)]))", |
1363 | 1364 | "name": "support.function.property.ps" |
1364 | | - }, |
| 1365 | + } |
| 1366 | + ] |
| 1367 | + }, |
| 1368 | + "user_defined_functions": { |
| 1369 | + "patterns": [ |
1365 | 1370 | { |
1366 | 1371 | "match": "(?:([\\w\\.]*))(\\.)\\b(new)\\b(?=\\s*\\()", |
1367 | 1372 | "captures": { |
|
1449 | 1454 | "name": "entity.name.function.ps" |
1450 | 1455 | }, |
1451 | 1456 | { |
1452 | | - "match": "(\\()(\\))\\s*(=>)", |
| 1457 | + "match": "(\\()\\s*(\\))\\s*(=>)", |
1453 | 1458 | "captures": { |
1454 | 1459 | "1":{"name":"meta.brace.round.ps"}, |
1455 | 1460 | "2":{"name":"meta.brace.round.ps"}, |
|
1685 | 1690 | } |
1686 | 1691 | }, |
1687 | 1692 | { |
1688 | | - "match": "(?<=^(?:\\s*export\\s*)?(?:\\s*method\\s*)?\\b\\w+\\s*\\()\\b((?:\\s*\\b[\\w][^\\(\\)]*\\s*\\,)*\\s*(?:\\b[\\w\\.]+(?:(?:\\s*\\<\\s*[\\w\\.]+\\s*\\>\\s*)|\\s*\\[\\s*\\]\\s*)?\\s+\\b\\w+\\s*(?:\\=\\s*[^\\(\\)\\s]*)?)(?:\\s*\\,\\s*\\b[\\w][^\\(\\)]*)*)(?=\\,\\s*(?://.*)?$)", |
| 1693 | + "match": "(?<=^\\s*export\\s+(?:method\\s+)?\\b\\w+\\s*\\()\\b([\\w][^\\(\\)]*)(?=\\s*\\,\\s*(?://.*)?$)", |
| 1694 | + "captures": { |
| 1695 | + "1":{ |
| 1696 | + "patterns": [ |
| 1697 | + {"include": "#strings"}, |
| 1698 | + {"include": "#collection_new"}, |
| 1699 | + {"include": "#array_new"}, |
| 1700 | + {"include": "#constants"}, |
| 1701 | + {"include": "#support_type"}, |
| 1702 | + {"include": "#built_in_constants"}, |
| 1703 | + {"include": "#user_define_types"}, |
| 1704 | + { |
| 1705 | + "match": "\\b([a-zA-Z_]\\w*)\\b", |
| 1706 | + "name":"variable.parameter.ps" |
| 1707 | + }, |
| 1708 | + { |
| 1709 | + "include": "#operators" |
| 1710 | + } |
| 1711 | + ] |
| 1712 | + } |
| 1713 | + } |
| 1714 | + }, |
| 1715 | + { |
| 1716 | + "match": "(?<=^\\s*(?:export\\s+)?method\\s+\\b\\w+\\s*\\()\\b([\\w][^\\(\\)]*)(?=\\s*\\,\\s*(?://.*)?$)", |
| 1717 | + "captures": { |
| 1718 | + "1":{ |
| 1719 | + "patterns": [ |
| 1720 | + {"include": "#strings"}, |
| 1721 | + {"include": "#collection_new"}, |
| 1722 | + {"include": "#array_new"}, |
| 1723 | + {"include": "#constants"}, |
| 1724 | + {"include": "#support_type"}, |
| 1725 | + {"include": "#built_in_constants"}, |
| 1726 | + {"include": "#user_define_types"}, |
| 1727 | + { |
| 1728 | + "match": "\\b([a-zA-Z_]\\w*)\\b", |
| 1729 | + "name":"variable.parameter.ps" |
| 1730 | + }, |
| 1731 | + { |
| 1732 | + "include": "#operators" |
| 1733 | + } |
| 1734 | + ] |
| 1735 | + } |
| 1736 | + } |
| 1737 | + }, |
| 1738 | + { |
| 1739 | + "match": "(?<=^\\s*(?:export\\s+)?(?:method\\s+)?\\b\\w+\\s*\\()((?:\\s*(?:\\b[\\w\\.]+\\s*(?:(?:\\<\\s*(?:(?:[\\w\\.]+)|(?:[\\w]+\\s*\\,\\s*[\\w\\.]+))\\s*\\>)|(?:\\[\\s*\\]))?\\s+)?\\b\\w+\\s*(?:\\=\\s*[\\w\\.\\#]+)?\\s*\\,)*(?:\\s*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*(?:(?:[\\w\\.]+)|(?:[\\w]+\\s*\\,\\s*[\\w\\.]+))\\s*\\>)|(?:\\[\\s*\\]))?\\s+)?\\b\\w+\\s*(?:\\=\\s*[\\w\\.\\#]+)?\\s*)*)(?=\\s*\\,\\s*(?://.*)?$)", |
1712 | 1763 | "captures": { |
1713 | 1764 | "1":{ |
1714 | 1765 | "patterns": [ |
|
1755 | 1806 | } |
1756 | 1807 | ] |
1757 | 1808 | }, |
| 1809 | + "hover_function_parameters":{ |
| 1810 | + "patterns": [ |
| 1811 | + { |
| 1812 | + "match": "(?<=^(?:(?:[a-zA-Z_]\\w*)|(?:\\b[\\w\\.]*\\.(?:(?:[a-zA-Z_]\\w*)|(?:new\\s*<\\s*[a-zA-Z_][^\\(\\)]*\\b\\s*>))))\\s*\\(\\s*)([^\\(\\)]*)\\)\\s*(→)(.+)", |
| 1813 | + "captures": { |
| 1814 | + "1":{ |
| 1815 | + "patterns": [ |
| 1816 | + { |
| 1817 | + "match": "\\b([a-zA-Z_]\\w*)\\b", |
| 1818 | + "name": "variable.parameter.ps" |
| 1819 | + }, |
| 1820 | + { |
| 1821 | + "include": "#operators" |
| 1822 | + } |
| 1823 | + ] |
| 1824 | + }, |
| 1825 | + "2":{"name":"storage.type.function.arrow.ps"}, |
| 1826 | + "3":{ |
| 1827 | + "patterns": [ |
| 1828 | + {"include": "#operators"}, |
| 1829 | + { |
| 1830 | + "match": "\\b(void|input|map|keyType|valueType|value_type)\\b", |
| 1831 | + "name": "support.type.primitive.ps" |
| 1832 | + }, |
| 1833 | + { |
| 1834 | + "match": "\\b([a-zA-Z_]+)\\b", |
| 1835 | + "name": "support.type.primitive.ps" |
| 1836 | + } |
| 1837 | + ] |
| 1838 | + } |
| 1839 | + } |
| 1840 | + } |
| 1841 | + ] |
| 1842 | + }, |
1758 | 1843 | "user_define_types":{ |
1759 | 1844 | "patterns": [ |
1760 | 1845 | { |
|
2827 | 2912 | "patterns":[ |
2828 | 2913 | {"include": "#primitive_type"}, |
2829 | 2914 | { |
2830 | | - "match": "\\b(box|color|label|line|linefill|table)\\b(?!\\s*[\\=\\(])", |
| 2915 | + "match": "\\b(box|color|label|line|linefill|table)\\b(?!\\s*[\\=\\(\\,])", |
2831 | 2916 | "name": "support.type.primitive.ps" |
2832 | 2917 | } |
2833 | 2918 | ] |
2834 | 2919 | }, |
2835 | 2920 | "primitive_type":{ |
2836 | 2921 | "patterns":[ |
2837 | 2922 | { |
2838 | | - "match": "\\b(bool|float|int|string|simple|series|array|map|matrix|chart.point)\\b", |
| 2923 | + "match": "\\b(bool|float|int|string|simple|series|array|map|matrix|chart.point)\\b(?!\\s*\\=\\()", |
2839 | 2924 | "name": "support.type.primitive.ps" |
2840 | 2925 | } |
2841 | 2926 | ] |
|
2877 | 2962 | "built_in_constants":{ |
2878 | 2963 | "patterns": [ |
2879 | 2964 | { |
2880 | | - "match": "(?<![\\.]\\s*)\\b(hour|minute|month|second|time|volume|year)\\b(?!\\s*[\\.\\(\\=])", |
| 2965 | + "match": "(?<![\\.]\\s*)\\b(hour|minute|month|second|time|volume|year)\\b(?=(?!\\s*(?:[\\.\\(\\=]|(?:\\:\\=)))|(?:\\s*\\=\\=))", |
2881 | 2966 | "name": "support.constant.ps" |
2882 | 2967 | }, |
2883 | 2968 | { |
2884 | | - "match": "(?<![\\.]\\s*)\\b(bar_index|close|dayofmonth|dayofweek|high|hl2|hlc3|hlcc4|last_bar_index|last_bar_time|low|na|ohlc4|open|time_close|time_tradingday|timenow|weekofyear)\\b(?!\\s*[\\.\\(])", |
| 2969 | + "match": "(?<![\\.]\\s*)\\b(bar_index|close|dayofmonth|dayofweek|high|hl2|hlc3|hlcc4|last_bar_index|last_bar_time|low|na|ohlc4|open|time_close|time_tradingday|timenow|weekofyear)\\b(?=(?!\\s*(?:[\\.\\(\\=]|(?:\\:\\=)))|(?:\\s*\\=\\=))", |
2885 | 2970 | "name": "support.constant.ps" |
2886 | 2971 | }, |
2887 | 2972 | {"include": "#strategy_openclose_trade"} |
|
0 commit comments