diff --git a/bench.esy.lock/index.json b/bench.esy.lock/index.json index 76a0947a85..9a5837d180 100644 --- a/bench.esy.lock/index.json +++ b/bench.esy.lock/index.json @@ -1,5 +1,5 @@ { - "checksum": "c37b1858514aac1c3a2f01daacf39d52", + "checksum": "903fd03f9db0da7ef98b560eeeab931e", "root": "Oni2@link-dev:./package.json", "node": { "yarn-pkg-config@github:esy-ocaml/yarn-pkg-config#db3a0b63883606dd57c54a7158d560d6cba8cd79@d41d8cd9": { @@ -278,25 +278,25 @@ ], "devDependencies": [ "ocaml@4.10.0@d41d8cd9" ] }, - "reason-tree-sitter@1.0.1001@d41d8cd9": { - "id": "reason-tree-sitter@1.0.1001@d41d8cd9", + "reason-tree-sitter@github:CrossR/reason-tree-sitter#b2913d3@d41d8cd9": { + "id": + "reason-tree-sitter@github:CrossR/reason-tree-sitter#b2913d3@d41d8cd9", "name": "reason-tree-sitter", - "version": "1.0.1001", + "version": "github:CrossR/reason-tree-sitter#b2913d3", "source": { "type": "install", - "source": [ - "archive:https://registry.npmjs.org/reason-tree-sitter/-/reason-tree-sitter-1.0.1001.tgz#sha1:bd642ac513d19dc1151ab78d983cab779677cb31" - ] + "source": [ "github:CrossR/reason-tree-sitter#b2913d3" ] }, "overrides": [], "dependencies": [ "reperf@1.5.0@d41d8cd9", "refmterr@3.3.2@d41d8cd9", - "ocaml@4.10.0@d41d8cd9", "esy-tree-sitter@1.4.1@d41d8cd9", + "ocaml@4.10.0@d41d8cd9", + "esy-tree-sitter@github:CrossR/esy-tree-sitter#fdcf8f7@d41d8cd9", "editor-core-types@github:onivim/editor-core-types#6a8afaf@d41d8cd9", "@opam/dune-configurator@opam:2.5.1@aeb9d8d5", "@opam/dune@opam:2.5.0@e0bac278", "@esy-ocaml/reason@3.6.0@d41d8cd9" ], - "devDependencies": [] + "devDependencies": [ "ocaml@4.10.0@d41d8cd9" ] }, "reason-native-crash-utils@github:onivim/reason-native-crash-utils#38c8f00@d41d8cd9": { "id": @@ -672,15 +672,13 @@ ], "devDependencies": [] }, - "esy-tree-sitter@1.4.1@d41d8cd9": { - "id": "esy-tree-sitter@1.4.1@d41d8cd9", + "esy-tree-sitter@github:CrossR/esy-tree-sitter#fdcf8f7@d41d8cd9": { + "id": "esy-tree-sitter@github:CrossR/esy-tree-sitter#fdcf8f7@d41d8cd9", "name": "esy-tree-sitter", - "version": "1.4.1", + "version": "github:CrossR/esy-tree-sitter#fdcf8f7", "source": { "type": "install", - "source": [ - "archive:https://registry.npmjs.org/esy-tree-sitter/-/esy-tree-sitter-1.4.1.tgz#sha1:67731d4e01fb391ebd1988a4781d41e1532ac6b6" - ] + "source": [ "github:CrossR/esy-tree-sitter#fdcf8f7" ] }, "overrides": [], "dependencies": [], @@ -1031,7 +1029,7 @@ "rench@github:bryphe/rench#a976fe5@d41d8cd9", "refmterr@3.3.2@d41d8cd9", "reasonFuzz@github:CrossR/reasonFuzz#1ad6f5d@d41d8cd9", - "reason-tree-sitter@1.0.1001@d41d8cd9", + "reason-tree-sitter@github:CrossR/reason-tree-sitter#b2913d3@d41d8cd9", "reason-native-crash-utils@github:onivim/reason-native-crash-utils#38c8f00@d41d8cd9", "ocaml@4.10.0@d41d8cd9", "libvim@8.10869.55@d41d8cd9", "isolinear@github:revery-ui/isolinear#8cad3b0@d41d8cd9", @@ -1732,8 +1730,8 @@ "@opam/base-bytes@opam:base@19d0c2ff" ] }, - "@opam/stdlib-shims@opam:0.1.0@d957c903": { - "id": "@opam/stdlib-shims@opam:0.1.0@d957c903", + "@opam/stdlib-shims@opam:0.1.0@8c116481": { + "id": "@opam/stdlib-shims@opam:0.1.0@8c116481", "name": "@opam/stdlib-shims", "version": "opam:0.1.0", "source": { @@ -2510,7 +2508,7 @@ "dependencies": [ "ocaml@4.10.0@d41d8cd9", "@opam/yojson@github:onivim/yojson:yojson.opam#f480aef@d41d8cd9", - "@opam/stdlib-shims@opam:0.1.0@d957c903", + "@opam/stdlib-shims@opam:0.1.0@8c116481", "@opam/ppx_yojson_conv_lib@opam:v0.14.0@116b53d6", "@opam/ocamlfind@opam:1.8.1@ff07b0f9", "@opam/menhir@opam:20200624@8629ff13", @@ -2520,7 +2518,7 @@ "devDependencies": [ "ocaml@4.10.0@d41d8cd9", "@opam/yojson@github:onivim/yojson:yojson.opam#f480aef@d41d8cd9", - "@opam/stdlib-shims@opam:0.1.0@d957c903", + "@opam/stdlib-shims@opam:0.1.0@8c116481", "@opam/ppx_yojson_conv_lib@opam:v0.14.0@116b53d6", "@opam/ocamlfind@opam:1.8.1@ff07b0f9", "@opam/menhir@opam:20200624@8629ff13", @@ -3178,7 +3176,7 @@ "overrides": [], "dependencies": [ "ocaml@4.10.0@d41d8cd9", "@opam/topkg@opam:1.0.2@3c5942ad", - "@opam/stdlib-shims@opam:0.1.0@d957c903", + "@opam/stdlib-shims@opam:0.1.0@8c116481", "@opam/seq@opam:base@d8d7de1d", "@opam/ocamlfind@opam:1.8.1@ff07b0f9", "@opam/ocamlbuild@opam:0.14.0@6ac75d03", @@ -3186,7 +3184,7 @@ "@esy-ocaml/substs@0.0.1@d41d8cd9" ], "devDependencies": [ - "ocaml@4.10.0@d41d8cd9", "@opam/stdlib-shims@opam:0.1.0@d957c903", + "ocaml@4.10.0@d41d8cd9", "@opam/stdlib-shims@opam:0.1.0@8c116481", "@opam/seq@opam:base@d8d7de1d" ] }, diff --git a/bench.esy.lock/opam/stdlib-shims.0.1.0/opam b/bench.esy.lock/opam/stdlib-shims.0.1.0/opam index 5839c43cad..0d1079d893 100644 --- a/bench.esy.lock/opam/stdlib-shims.0.1.0/opam +++ b/bench.esy.lock/opam/stdlib-shims.0.1.0/opam @@ -8,8 +8,9 @@ bug-reports: "https://github.com/ocaml/stdlib-shims/issues" tags: ["stdlib" "compatibility" "org:ocaml"] license: ["typeof OCaml system"] depends: [ + "ocaml" {>="4.02.3"} "dune" - "ocaml" {>= "4.02.3"} + ("dune" {>= "2.7.0"} | "dune" & "ocaml" {<"4.12.0~~"}) ] build: [ "dune" "build" "-p" name "-j" jobs ] synopsis: "Backport some of the new stdlib features to older compiler" diff --git a/esy.lock/index.json b/esy.lock/index.json index a82191154b..34d4f682e8 100644 --- a/esy.lock/index.json +++ b/esy.lock/index.json @@ -1,5 +1,5 @@ { - "checksum": "c37b1858514aac1c3a2f01daacf39d52", + "checksum": "903fd03f9db0da7ef98b560eeeab931e", "root": "Oni2@link-dev:./package.json", "node": { "yarn-pkg-config@github:esy-ocaml/yarn-pkg-config#db3a0b63883606dd57c54a7158d560d6cba8cd79@d41d8cd9": { @@ -278,25 +278,25 @@ ], "devDependencies": [ "ocaml@4.10.0@d41d8cd9" ] }, - "reason-tree-sitter@1.0.1001@d41d8cd9": { - "id": "reason-tree-sitter@1.0.1001@d41d8cd9", + "reason-tree-sitter@github:CrossR/reason-tree-sitter#b2913d3@d41d8cd9": { + "id": + "reason-tree-sitter@github:CrossR/reason-tree-sitter#b2913d3@d41d8cd9", "name": "reason-tree-sitter", - "version": "1.0.1001", + "version": "github:CrossR/reason-tree-sitter#b2913d3", "source": { "type": "install", - "source": [ - "archive:https://registry.npmjs.org/reason-tree-sitter/-/reason-tree-sitter-1.0.1001.tgz#sha1:bd642ac513d19dc1151ab78d983cab779677cb31" - ] + "source": [ "github:CrossR/reason-tree-sitter#b2913d3" ] }, "overrides": [], "dependencies": [ "reperf@1.5.0@d41d8cd9", "refmterr@3.3.2@d41d8cd9", - "ocaml@4.10.0@d41d8cd9", "esy-tree-sitter@1.4.1@d41d8cd9", + "ocaml@4.10.0@d41d8cd9", + "esy-tree-sitter@github:CrossR/esy-tree-sitter#fdcf8f7@d41d8cd9", "editor-core-types@github:onivim/editor-core-types#6a8afaf@d41d8cd9", "@opam/dune-configurator@opam:2.5.1@aeb9d8d5", "@opam/dune@opam:2.5.0@e0bac278", "@esy-ocaml/reason@3.6.0@d41d8cd9" ], - "devDependencies": [] + "devDependencies": [ "ocaml@4.10.0@d41d8cd9" ] }, "reason-native-crash-utils@github:onivim/reason-native-crash-utils#38c8f00@d41d8cd9": { "id": @@ -672,15 +672,13 @@ ], "devDependencies": [] }, - "esy-tree-sitter@1.4.1@d41d8cd9": { - "id": "esy-tree-sitter@1.4.1@d41d8cd9", + "esy-tree-sitter@github:CrossR/esy-tree-sitter#fdcf8f7@d41d8cd9": { + "id": "esy-tree-sitter@github:CrossR/esy-tree-sitter#fdcf8f7@d41d8cd9", "name": "esy-tree-sitter", - "version": "1.4.1", + "version": "github:CrossR/esy-tree-sitter#fdcf8f7", "source": { "type": "install", - "source": [ - "archive:https://registry.npmjs.org/esy-tree-sitter/-/esy-tree-sitter-1.4.1.tgz#sha1:67731d4e01fb391ebd1988a4781d41e1532ac6b6" - ] + "source": [ "github:CrossR/esy-tree-sitter#fdcf8f7" ] }, "overrides": [], "dependencies": [], @@ -1030,7 +1028,7 @@ "rench@github:bryphe/rench#a976fe5@d41d8cd9", "refmterr@3.3.2@d41d8cd9", "reasonFuzz@github:CrossR/reasonFuzz#1ad6f5d@d41d8cd9", - "reason-tree-sitter@1.0.1001@d41d8cd9", + "reason-tree-sitter@github:CrossR/reason-tree-sitter#b2913d3@d41d8cd9", "reason-native-crash-utils@github:onivim/reason-native-crash-utils#38c8f00@d41d8cd9", "ocaml@4.10.0@d41d8cd9", "libvim@8.10869.55@d41d8cd9", "isolinear@github:revery-ui/isolinear#8cad3b0@d41d8cd9", @@ -1731,8 +1729,8 @@ "@opam/base-bytes@opam:base@19d0c2ff" ] }, - "@opam/stdlib-shims@opam:0.1.0@d957c903": { - "id": "@opam/stdlib-shims@opam:0.1.0@d957c903", + "@opam/stdlib-shims@opam:0.1.0@8c116481": { + "id": "@opam/stdlib-shims@opam:0.1.0@8c116481", "name": "@opam/stdlib-shims", "version": "opam:0.1.0", "source": { @@ -2509,7 +2507,7 @@ "dependencies": [ "ocaml@4.10.0@d41d8cd9", "@opam/yojson@github:onivim/yojson:yojson.opam#f480aef@d41d8cd9", - "@opam/stdlib-shims@opam:0.1.0@d957c903", + "@opam/stdlib-shims@opam:0.1.0@8c116481", "@opam/ppx_yojson_conv_lib@opam:v0.14.0@116b53d6", "@opam/ocamlfind@opam:1.8.1@ff07b0f9", "@opam/menhir@opam:20200624@8629ff13", @@ -2519,7 +2517,7 @@ "devDependencies": [ "ocaml@4.10.0@d41d8cd9", "@opam/yojson@github:onivim/yojson:yojson.opam#f480aef@d41d8cd9", - "@opam/stdlib-shims@opam:0.1.0@d957c903", + "@opam/stdlib-shims@opam:0.1.0@8c116481", "@opam/ppx_yojson_conv_lib@opam:v0.14.0@116b53d6", "@opam/ocamlfind@opam:1.8.1@ff07b0f9", "@opam/menhir@opam:20200624@8629ff13", @@ -3177,7 +3175,7 @@ "overrides": [], "dependencies": [ "ocaml@4.10.0@d41d8cd9", "@opam/topkg@opam:1.0.2@3c5942ad", - "@opam/stdlib-shims@opam:0.1.0@d957c903", + "@opam/stdlib-shims@opam:0.1.0@8c116481", "@opam/seq@opam:base@d8d7de1d", "@opam/ocamlfind@opam:1.8.1@ff07b0f9", "@opam/ocamlbuild@opam:0.14.0@6ac75d03", @@ -3185,7 +3183,7 @@ "@esy-ocaml/substs@0.0.1@d41d8cd9" ], "devDependencies": [ - "ocaml@4.10.0@d41d8cd9", "@opam/stdlib-shims@opam:0.1.0@d957c903", + "ocaml@4.10.0@d41d8cd9", "@opam/stdlib-shims@opam:0.1.0@8c116481", "@opam/seq@opam:base@d8d7de1d" ] }, diff --git a/esy.lock/opam/stdlib-shims.0.1.0/opam b/esy.lock/opam/stdlib-shims.0.1.0/opam index 5839c43cad..0d1079d893 100644 --- a/esy.lock/opam/stdlib-shims.0.1.0/opam +++ b/esy.lock/opam/stdlib-shims.0.1.0/opam @@ -8,8 +8,9 @@ bug-reports: "https://github.com/ocaml/stdlib-shims/issues" tags: ["stdlib" "compatibility" "org:ocaml"] license: ["typeof OCaml system"] depends: [ + "ocaml" {>="4.02.3"} "dune" - "ocaml" {>= "4.02.3"} + ("dune" {>= "2.7.0"} | "dune" & "ocaml" {<"4.12.0~~"}) ] build: [ "dune" "build" "-p" name "-j" jobs ] synopsis: "Backport some of the new stdlib features to older compiler" diff --git a/extensions/javascript/package.json b/extensions/javascript/package.json index 6909de1400..e39ef18a4b 100644 --- a/extensions/javascript/package.json +++ b/extensions/javascript/package.json @@ -71,6 +71,7 @@ "language": "javascript", "scopeName": "source.js", "path": "./syntaxes/JavaScript.tmLanguage.json", + "treeSitterPath": "./syntaxes/tree-sitter-javascript.json", "embeddedLanguages": { "meta.tag.js": "jsx-tags", "meta.tag.without-attributes.js": "jsx-tags", diff --git a/extensions/javascript/syntaxes/tree-sitter-javascript.json b/extensions/javascript/syntaxes/tree-sitter-javascript.json new file mode 100644 index 0000000000..e89f8a7c79 --- /dev/null +++ b/extensions/javascript/syntaxes/tree-sitter-javascript.json @@ -0,0 +1,269 @@ +{ + "name": "JavaScript", + "scopeName": "source.js", + "type": "tree-sitter", + "parser": "tree-sitter-javascript", + "fileTypes": [ + "js", + "jsx" + ], + "injectionRegex": "^js$|^JS$|javascript|JavaScript", + "firstLineRegex": [ + "^#!.*\\b(node)\\r?\\n", + "vim\\b.*\\bset\\b.*\\b(filetype|ft|syntax)=(js|javascript)" + ], + "folds": [ + { + "type": "comment" + }, + { + "type": [ + "jsx_element", + "template_string" + ], + "start": { + "index": 0 + }, + "end": { + "index": -1 + } + }, + { + "type": "jsx_self_closing_element", + "start": { + "index": 1 + }, + "end": { + "index": -2 + } + }, + { + "start": { + "index": 0, + "type": "{" + }, + "end": { + "index": -1, + "type": "}" + } + }, + { + "start": { + "index": 0, + "type": "[" + }, + "end": { + "index": -1, + "type": "]" + } + }, + { + "start": { + "index": 0, + "type": "(" + }, + "end": { + "index": -1, + "type": ")" + } + }, + { + "type": [ + "switch_case", + "switch_default" + ], + "start": { + "index": 0 + }, + "end": { + "type": "break_statement", + "index": -1 + } + }, + { + "type": [ + "switch_case", + "switch_default" + ], + "start": { + "index": 0 + } + } + ], + "comments": { + "start": "// " + }, + "scopes": { + "program": "source.js", + "property_identifier": [ + { + "match": "^[$A-Z_]+$", + "scopes": "constant.other.property.js" + }, + "variable.other.object.property" + ], + "member_expression > property_identifier": "variable.other.object.property.unquoted", + "formal_parameters > identifier": "variable.parameter.function", + "formal_parameters > rest_parameter > identifier": "variable.parameter.rest.function", + "shorthand_property_identifier": [ + { + "match": "^[$A-Z_]{2,}$", + "scopes": "constant.other" + } + ], + "class > identifier, new_expression > identifier": "meta.class", + "jsx_opening_element > identifier, jsx_closing_element > identifier, jsx_self_closing_element > identifier": [ + { + "match": "^[A-Z]", + "scopes": "meta.class.component.jsx" + } + ], + "call_expression > identifier": [ + { + "match": "^require$", + "scopes": "support.function" + }, + "entity.name.function" + ], + "arrow_function > identifier:nth-child(0)": "variable.parameter.function", + "function > identifier": "entity.name.function", + "function_declaration > identifier": "entity.name.function", + "generator_function > identifier": "entity.name.function", + "call_expression > super": "support.function.super", + "method_definition > property_identifier": "entity.name.function", + "call_expression > member_expression > property_identifier": "entity.name.function", + "identifier": [ + { + "match": "^(global|module|exports|__filename|__dirname)$", + "scopes": "support.variable" + }, + { + "match": "^(window|event|document|performance|screen|navigator|console)$", + "scopes": "support.variable.dom" + }, + { + "exact": "require", + "scopes": "support.function" + }, + { + "match": "^[$A-Z_]{2,}$", + "scopes": "constant.other" + }, + { + "match": "^[A-Z]", + "scopes": "meta.class" + } + ], + "number": "constant.numeric", + "string": "string.quoted", + "regex": "string.regexp", + "escape_sequence": "constant.character.escape", + "template_string": "string.quoted.template", + "undefined": "constant.language", + "null": "constant.language.null", + "true": "constant.language.boolean.true", + "false": "constant.language.boolean.false", + "comment": [ + { + "match": "^//", + "scopes": "comment.line" + }, + "comment.block" + ], + "hash_bang_line": "comment.block", + "jsx_expression > \"{\", jsx_expression > \"}\", template_substitution > \"${\", template_substitution > \"}\"": "punctuation.section.embedded", + "template_substitution": "embedded.source", + "\"(\"": "punctuation.definition.parameters.begin.bracket.round", + "\")\"": "punctuation.definition.parameters.end.bracket.round", + "\"{\"": "punctuation.definition.function.body.begin.bracket.curly", + "\"}\"": "punctuation.definition.function.body.end.bracket.curly", + "\";\"": "punctuation.terminator.statement.semicolon", + "\"[\"": "punctuation.definition.array.begin.bracket.square", + "\"]\"": "punctuation.definition.array.end.bracket.square", + "\"var\"": "storage.type", + "\"let\"": "storage.type", + "\"class\"": "storage.type", + "\"extends\"": "storage.modifier", + "\"const\"": "storage.modifier", + "\"static\"": "storage.modifier", + "\"function\"": "storage.type.function", + "\"=>\"": "storage.type.function.arrow", + "\"=\"": "keyword.operator.js", + "\"+=\"": "keyword.operator.js", + "\"-=\"": "keyword.operator.js", + "\"*=\"": "keyword.operator.js", + "\"/=\"": "keyword.operator.js", + "\"%=\"": "keyword.operator.js", + "\"<<=\"": "keyword.operator.js", + "\">>=\"": "keyword.operator.js", + "\">>>=\"": "keyword.operator.js", + "\"&=\"": "keyword.operator.js", + "\"^=\"": "keyword.operator.js", + "\"|=\"": "keyword.operator.js", + "\"!\"": "keyword.operator.js", + "\"+\"": "keyword.operator.js", + "\"-\"": "keyword.operator.js", + "\"*\"": "keyword.operator.js", + "\"/\"": "keyword.operator.js", + "\"%\"": "keyword.operator.js", + "\"==\"": "keyword.operator.js", + "\"===\"": "keyword.operator.js", + "\"!=\"": "keyword.operator.js", + "\"!==\"": "keyword.operator.js", + "\">=\"": "keyword.operator.js", + "\"<=\"": "keyword.operator.js", + "\">\"": "keyword.operator.js", + "\"<\"": "keyword.operator.js", + "\":\"": "keyword.operator.js", + "\"?\"": "keyword.operator.js", + "\"&&\"": "keyword.operator.js", + "\"||\"": "keyword.operator.js", + "\"&\"": "keyword.operator.js", + "\"~\"": "keyword.operator.js", + "\"^\"": "keyword.operator.js", + "\">>\"": "keyword.operator.js", + "\">>>\"": "keyword.operator.js", + "\"<<\"": "keyword.operator.js", + "\"|\"": "keyword.operator.js", + "\"++\"": "keyword.operator.js", + "\"--\"": "keyword.operator.js", + "\"...\"": "keyword.operator.spread.js", + "\"in\"": "keyword.operator.in", + "\"instanceof\"": "keyword.operator.instanceof", + "\"of\"": "keyword.operator.of", + "\"new\"": "keyword.operator.new", + "\"typeof\"": "keyword.operator.typeof", + "\"get\"": "keyword.operator.setter", + "\"set\"": "keyword.operator.setter", + "\".\"": "meta.delimiter.period", + "\",\"": "meta.delimiter.comma", + "\"as\"": "keyword.control", + "\"if\"": "keyword.control", + "\"do\"": "keyword.control", + "\"else\"": "keyword.control", + "\"while\"": "keyword.control", + "\"for\"": "keyword.control", + "\"return\"": "keyword.control", + "\"break\"": "keyword.control", + "\"continue\"": "keyword.control", + "\"throw\"": "keyword.control", + "\"try\"": "keyword.control", + "\"catch\"": "keyword.control", + "\"finally\"": "keyword.control", + "\"switch\"": "keyword.control", + "\"case\"": "keyword.control", + "\"default\"": "keyword.control", + "\"export\"": "keyword.control", + "\"import\"": "keyword.control", + "\"from\"": "keyword.control", + "\"yield\"": "keyword.control", + "\"async\"": "keyword.control", + "\"await\"": "keyword.control", + "\"debugger\"": "keyword.control", + "\"delete\"": "keyword.control", + "jsx_attribute > property_identifier": "entity.other.attribute-name", + "jsx_opening_element > identifier": "entity.name.tag", + "jsx_closing_element > identifier": "entity.name.tag", + "jsx_self_closing_element > identifier": "entity.name.tag" + } +} \ No newline at end of file diff --git a/extensions/python/package.json b/extensions/python/package.json index 53ca25bd88..b4d41b837b 100644 --- a/extensions/python/package.json +++ b/extensions/python/package.json @@ -18,7 +18,8 @@ "grammars": [{ "language": "python", "scopeName": "source.python", - "path": "./syntaxes/MagicPython.tmLanguage.json" + "path": "./syntaxes/MagicPython.tmLanguage.json", + "treeSitterPath": "./syntaxes/tree-sitter-python.json" },{ "scopeName": "source.regexp.python", "path": "./syntaxes/MagicRegExp.tmLanguage.json" diff --git a/extensions/python/syntaxes/tree-sitter-python.json b/extensions/python/syntaxes/tree-sitter-python.json new file mode 100644 index 0000000000..5b8473b340 --- /dev/null +++ b/extensions/python/syntaxes/tree-sitter-python.json @@ -0,0 +1,192 @@ +{ + "name": "Python", + "scopeName": "source.python", + "type": "tree-sitter", + "parser": "tree-sitter-python", + "firstLineRegex": [ + "^#![ \\t]*/.*\\bpython[\\d\\.]*\\b", + "vim\\b.*\\bset\\b.*\\b(filetype|ft|syntax)=python" + ], + "fileTypes": [ + "py", + "pyi", + "pyw", + "gyp", + "gypi", + "SConstruct", + "Sconstruct", + "sconstruct", + "SConscript", + "wsgi" + ], + "folds": [ + { + "type": [ + "if_statement" + ], + "start": { + "type": ":" + }, + "end": { + "type": [ + "elif_clause", + "else_clause" + ] + } + }, + { + "type": [ + "if_statement", + "elif_clause", + "else_clause", + "for_statement", + "try_statement", + "with_statement", + "while_statement", + "class_definition", + "function_definition", + "async_function_definition" + ], + "start": { + "type": ":" + } + }, + { + "start": { + "type": "(", + "index": 0 + }, + "end": { + "type": ")", + "index": -1 + } + }, + { + "start": { + "type": "[", + "index": 0 + }, + "end": { + "type": "]", + "index": -1 + } + }, + { + "start": { + "type": "{", + "index": 0 + }, + "end": { + "type": "}", + "index": -1 + } + } + ], + "comments": { + "start": "# " + }, + "scopes": { + "module": "source.python", + "comment": "comment.line", + "string": "string.quoted", + "escape_sequence": "constant.character.escape", + "interpolation": "meta.embedded", + "interpolation > \"{\"": "punctuation.section.embedded", + "interpolation > \"}\"": "punctuation.section.embedded", + "class_definition > identifier": "entity.name.type.class", + "function_definition > identifier": "entity.name.function", + "call > identifier:nth-child(0)": [ + { + "match": "^(abs|all|any|ascii|bin|bool|breakpoint|bytearray|bytes|callable|chr|classmethod|compile|complex|delattr|dict|dir|divmod|enumerate|eval|exec|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|isinstance|issubclass|iter|len|list|locals|map|max|memoryview|min|next|object|oct|open|ord|pow|print|property|range|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|vars|zip|__import__)$", + "scopes": "support.function" + }, + "entity.name.function" + ], + "call > attribute > identifier:nth-child(2)": "entity.name.function", + "identifier": { + "match": "^(BaseException|Exception|TypeError|StopAsyncIteration|StopIteration|ImportError|ModuleNotFoundError|OSError|ConnectionError|BrokenPipeError|ConnectionAbortedError|ConnectionRefusedError|ConnectionResetError|BlockingIOError|ChildProcessError|FileExistsError|FileNotFoundError|IsADirectoryError|NotADirectoryError|InterruptedError|PermissionError|ProcessLookupError|TimeoutError|EOFError|RuntimeError|RecursionError|NotImplementedError|NameError|UnboundLocalError|AttributeError|SyntaxError|IndentationError|TabError|LookupError|IndexError|KeyError|ValueError|UnicodeError|UnicodeEncodeError|UnicodeDecodeError|UnicodeTranslateError|AssertionError|ArithmeticError|FloatingPointError|OverflowError|ZeroDivisionError|SystemError|ReferenceError|BufferError|MemoryError|Warning|UserWarning|DeprecationWarning|PendingDeprecationWarning|SyntaxWarning|RuntimeWarning|FutureWarning|ImportWarning|UnicodeWarning|BytesWarning|ResourceWarning|GeneratorExit|SystemExit|KeyboardInterrupt)$", + "scopes": "support.type.exception" + }, + "attribute > identifier:nth-child(2)": "variable.other.object.property", + "decorator": "entity.name.function.decorator", + "none": "constant.language", + "true": "constant.language", + "false": "constant.language", + "integer": "constant.numeric", + "float": "constant.numeric", + "type > identifier": "support.storage.type", + "class_definition > argument_list > attribute": "entity.other.inherited-class", + "class_definition > argument_list > identifier": "entity.other.inherited-class", + "class_definition > argument_list > keyword_argument > attribute": "entity.other.inherited-class", + "class_definition > argument_list > keyword_argument > identifier:nth-child(2)": "entity.other.inherited-class", + "\"class\"": "storage.type.class", + "\"def\"": "storage.type.function", + "\"lambda\"": "storage.type.function", + "\"global\"": "storage.modifier.global", + "\"nonlocal\"": "storage.modifier.nonlocal", + "parameters > identifier": "variable.parameter.function", + "parameters > list_splat > identifier": "variable.parameter.function", + "parameters > dictionary_splat > identifier": "variable.parameter.function", + "default_parameter > identifier:nth-child(0)": "variable.parameter.function", + "keyword_argument > identifier:nth-child(0)": "variable.parameter.function", + "\"if\"": "keyword.control", + "\"else\"": "keyword.control", + "\"elif\"": "keyword.control", + "\"while\"": "keyword.control", + "\"for\"": "keyword.control", + "\"return\"": "keyword.control", + "\"break\"": "keyword.control", + "\"continue\"": "keyword.control", + "\"pass\"": "keyword.control", + "\"raise\"": "keyword.control", + "\"yield\"": "keyword.control", + "\"await\"": "keyword.control", + "\"async\"": "keyword.control", + "\"try\"": "keyword.control", + "\"except\"": "keyword.control", + "\"with\"": "keyword.control", + "\"as\"": "keyword.control", + "\"finally\"": "keyword.control", + "\"import\"": "keyword.control", + "\"from\"": "keyword.control", + "\"print\"": "keyword.other", + "\"assert\"": "keyword.other", + "\"exec\"": "keyword.other", + "\"del\"": "keyword.other", + "\"+\"": "keyword.operator", + "\"-\"": "keyword.operator", + "\"*\"": "keyword.operator", + "\"/\"": "keyword.operator", + "\"%\"": "keyword.operator", + "\"**\"": "keyword.operator", + "\"//\"": "keyword.operator", + "\"==\"": "keyword.operator", + "\"!=\"": "keyword.operator", + "\"<>\"": "keyword.operator", + "\">\"": "keyword.operator", + "\"<\"": "keyword.operator", + "\">=\"": "keyword.operator", + "\"<=\"": "keyword.operator", + "\"=\"": "keyword.operator", + "\"+=\"": "keyword.operator", + "\"-=\"": "keyword.operator", + "\"*=\"": "keyword.operator", + "\"/=\"": "keyword.operator", + "\"%=\"": "keyword.operator", + "\"**=\"": "keyword.operator", + "\"//=\"": "keyword.operator", + "\"&\"": "keyword.operator", + "\"|\"": "keyword.operator", + "\"^\"": "keyword.operator", + "\"~\"": "keyword.operator", + "\"<<\"": "keyword.operator", + "\">>\"": "keyword.operator", + "binary_operator > \"@\"": "keyword.operator", + "binary_operator > \"@=\"": "keyword.operator", + "\"in\"": "keyword.operator.logical.python", + "\"and\"": "keyword.operator.logical.python", + "\"or\"": "keyword.operator.logical.python", + "\"not\"": "keyword.operator.logical.python", + "\"is\"": "keyword.operator.logical.python" + } +} \ No newline at end of file diff --git a/extensions/typescript-basics/package.json b/extensions/typescript-basics/package.json index 80c1f491ce..653d0ac32a 100644 --- a/extensions/typescript-basics/package.json +++ b/extensions/typescript-basics/package.json @@ -54,6 +54,7 @@ "language": "typescript", "scopeName": "source.ts", "path": "./syntaxes/TypeScript.tmLanguage.json", + "treeSitterPath": "./syntaxes/tree-sitter-typescript.json", "tokenTypes": { "entity.name.type.instance.jsdoc": "other", "entity.name.function.tagged-template": "other", @@ -64,6 +65,7 @@ { "language": "typescriptreact", "scopeName": "source.tsx", + "treeSitterPath": "./syntaxes/tree-sitter-tsx.json", "path": "./syntaxes/TypeScriptReact.tmLanguage.json", "embeddedLanguages": { "meta.tag.tsx": "jsx-tags", diff --git a/extensions/typescript-basics/syntaxes/tree-sitter-tsx.json b/extensions/typescript-basics/syntaxes/tree-sitter-tsx.json new file mode 100644 index 0000000000..bfb4356316 --- /dev/null +++ b/extensions/typescript-basics/syntaxes/tree-sitter-tsx.json @@ -0,0 +1,254 @@ +{ + "name": "TypeScriptReact", + "scopeName": "source.tsx", + "type": "tree-sitter", + "parser": "tree-sitter-typescript/tsx", + "fileTypes": [ + "tsx" + ], + "comments": { + "start": "// " + }, + "folds": [ + { + "type": "comment" + }, + { + "type": [ + "jsx_element", + "template_string" + ], + "start": { + "index": 0 + }, + "end": { + "index": -1 + } + }, + { + "type": "jsx_self_closing_element", + "start": { + "index": 1 + }, + "end": { + "index": -2 + } + }, + { + "type": [ + "object_type", + "type_arguments", + "type_parameters" + ], + "start": { + "index": 0 + }, + "end": { + "index": -1 + } + }, + { + "start": { + "index": 0, + "type": "{" + }, + "end": { + "index": -1, + "type": "}" + } + }, + { + "start": { + "index": 0, + "type": "[" + }, + "end": { + "index": -1, + "type": "]" + } + }, + { + "start": { + "index": 0, + "type": "(" + }, + "end": { + "index": -1, + "type": ")" + } + } + ], + "scopes": { + "program": "source.ts", + "property_identifier": [ + { + "match": "^[$A-Z_]+$", + "scopes": "constant.other.property.js" + }, + "variable.other.object.property" + ], + "shorthand_property_identifier": [ + { + "match": "^[$A-Z_]{2,}$", + "scopes": "constant.other" + } + ], + "class > identifier, new_expression > call_expression > identifier": "support.type", + "jsx_opening_element > identifier, jsx_closing_element > identifier, jsx_self_closing_element > identifier, call_expression > identifier": [ + { + "match": "^[A-Z]", + "scopes": "support.type" + } + ], + "function > identifier": "entity.name.function", + "generator_function > identifier": "entity.name.function", + "call_expression > identifier": [ + { + "match": "^require$", + "scopes": "support.function" + }, + "entity.name.function" + ], + "call_expression > super": "support.function.super", + "method_definition > property_identifier": "entity.name.function", + "call_expression > member_expression > property_identifier": "entity.name.function", + "identifier": [ + { + "match": "^(global|module|exports|__filename|__dirname|window|document)$", + "scopes": "support.variable" + }, + { + "exact": "require", + "scopes": "support.function" + }, + { + "match": "^[$A-Z_]{2,}$", + "scopes": "constant.other" + }, + { + "match": "^[A-Z]", + "scopes": "support.type" + } + ], + "number": "constant.numeric", + "string": "string.quoted", + "regex": "string.regexp", + "escape_sequence": "constant.character.escape", + "template_string": "string.quoted.template", + "undefined": "constant.language", + "null": "constant.language.null", + "true": "constant.language.boolean.true", + "false": "constant.language.boolean.false", + "comment": "comment.block", + "hash_bang_line": "comment.block", + "jsx_expression > \"{\", jsx_expression > \"}\", template_substitution > \"${\", template_substitution > \"}\"": "punctuation.section.embedded", + "template_substitution": "embedded.source", + "\"(\"": "punctuation.definition.parameters.begin.bracket.round", + "\")\"": "punctuation.definition.parameters.end.bracket.round", + "\"{\"": "punctuation.definition.function.body.begin.bracket.curly", + "\"}\"": "punctuation.definition.function.body.end.bracket.curly", + "\";\"": "punctuation.terminator.statement.semicolon", + "\"[\"": "punctuation.definition.array.begin.bracket.square", + "\"]\"": "punctuation.definition.array.end.bracket.square", + "\"var\"": "storage.type", + "\"let\"": "storage.type", + "\"class\"": "storage.type", + "\"extends\"": "storage.modifier", + "\"const\"": "storage.modifier", + "\"static\"": "storage.modifier", + "\"function\"": "storage.type.function", + "\"=>\"": "storage.type.function.arrow", + "\"=\"": "keyword.operator.js", + "\"+=\"": "keyword.operator.js", + "\"-=\"": "keyword.operator.js", + "\"*=\"": "keyword.operator.js", + "\"/=\"": "keyword.operator.js", + "\"%=\"": "keyword.operator.js", + "\"<<=\"": "keyword.operator.js", + "\">>=\"": "keyword.operator.js", + "\">>>=\"": "keyword.operator.js", + "\"&=\"": "keyword.operator.js", + "\"^=\"": "keyword.operator.js", + "\"|=\"": "keyword.operator.js", + "\"!\"": "keyword.operator.js", + "\"+\"": "keyword.operator.js", + "\"-\"": "keyword.operator.js", + "\"*\"": "keyword.operator.js", + "\"/\"": "keyword.operator.js", + "\"%\"": "keyword.operator.js", + "\"==\"": "keyword.operator.js", + "\"===\"": "keyword.operator.js", + "\"!=\"": "keyword.operator.js", + "\"!==\"": "keyword.operator.js", + "\">=\"": "keyword.operator.js", + "\"<=\"": "keyword.operator.js", + "\">\"": "keyword.operator.js", + "\"<\"": "keyword.operator.js", + "\":\"": "keyword.operator.js", + "\"?\"": "keyword.operator.js", + "\"&&\"": "keyword.operator.js", + "\"||\"": "keyword.operator.js", + "\"&\"": "keyword.operator.js", + "\"~\"": "keyword.operator.js", + "\"^\"": "keyword.operator.js", + "\">>\"": "keyword.operator.js", + "\">>>\"": "keyword.operator.js", + "\"<<\"": "keyword.operator.js", + "\"|\"": "keyword.operator.js", + "\"++\"": "keyword.operator.js", + "\"--\"": "keyword.operator.js", + "\"...\"": "keyword.operator.js", + "\"in\"": "keyword.control", + "\"instanceof\"": "keyword.control", + "\"of\"": "keyword.control", + "\"new\"": "keyword.control", + "\"typeof\"": "keyword.control", + "\"get\"": "keyword.operator.setter", + "\"set\"": "keyword.operator.setter", + "\".\"": "meta.delimiter.period", + "\",\"": "meta.delimiter.comma", + "\"as\"": "keyword.control", + "\"if\"": "keyword.control", + "\"do\"": "keyword.control", + "\"else\"": "keyword.control", + "\"while\"": "keyword.control", + "\"for\"": "keyword.control", + "\"return\"": "keyword.control", + "\"break\"": "keyword.control", + "\"continue\"": "keyword.control", + "\"throw\"": "keyword.control", + "\"try\"": "keyword.control", + "\"catch\"": "keyword.control", + "\"finally\"": "keyword.control", + "\"switch\"": "keyword.control", + "\"case\"": "keyword.control", + "\"default\"": "keyword.control", + "\"export\"": "keyword.control", + "\"import\"": "keyword.control", + "\"from\"": "keyword.control", + "\"yield\"": "keyword.control", + "\"async\"": "keyword.control", + "\"await\"": "keyword.control", + "\"debugger\"": "keyword.control", + "\"delete\"": "keyword.control", + "jsx_attribute > property_identifier": "entity.other.attribute-name", + "jsx_opening_element > identifier": "entity.name.tag", + "jsx_closing_element > identifier": "entity.name.tag", + "jsx_self_closing_element > identifier": "entity.name.tag", + "class > identifier": "support.storage.type", + "type_identifier": "support.storage.type", + "predefined_type": "support.storage.type", + "method_signature > property_identifier, function_signature > identifier": "entity.name.function", + "\"implements\"": "keyword.modifier", + "\"namespace\"": "keyword.modifier", + "\"enum\"": "keyword.modifier", + "\"interface\"": "keyword.modifier", + "\"module\"": "keyword.modifier", + "\"declare\"": "keyword.modifier", + "\"public\"": "keyword.modifier", + "\"private\"": "keyword.modifier", + "\"protected\"": "keyword.modifier", + "readonly": "keyword.modifier", + "\"type\"": "keyword.modifier" + } +} \ No newline at end of file diff --git a/extensions/typescript-basics/syntaxes/tree-sitter-typescript.json b/extensions/typescript-basics/syntaxes/tree-sitter-typescript.json new file mode 100644 index 0000000000..6d44d39068 --- /dev/null +++ b/extensions/typescript-basics/syntaxes/tree-sitter-typescript.json @@ -0,0 +1,223 @@ +{ + "name": "TypeScript", + "scopeName": "source.ts", + "type": "tree-sitter", + "parser": "tree-sitter-typescript/typescript", + "fileTypes": [ + "ts" + ], + "comments": { + "start": "// " + }, + "folds": [ + { + "type": "comment" + }, + { + "type": [ + "object_type", + "type_arguments", + "type_parameters" + ], + "start": { + "index": 0 + }, + "end": { + "index": -1 + } + }, + { + "start": { + "index": 0, + "type": "{" + }, + "end": { + "index": -1, + "type": "}" + } + }, + { + "start": { + "index": 0, + "type": "[" + }, + "end": { + "index": -1, + "type": "]" + } + }, + { + "start": { + "index": 0, + "type": "(" + }, + "end": { + "index": -1, + "type": ")" + } + } + ], + "scopes": { + "program": "source.ts", + "property_identifier": [ + { + "match": "^[$A-Z_]+$", + "scopes": "constant.other.property.js" + }, + "variable.other.object.property" + ], + "shorthand_property_identifier": [ + { + "match": "^[$A-Z_]{2,}$", + "scopes": "constant.other" + } + ], + "class > identifier, new_expression > call_expression > identifier": "support.type", + "call_expression > identifier": [ + { + "match": "^require$", + "scopes": "support.function" + }, + "entity.name.function" + ], + "function > identifier": "entity.name.function", + "generator_function > identifier": "entity.name.function", + "call_expression > super": "support.function.super", + "method_definition > property_identifier": "entity.name.function", + "call_expression > member_expression > property_identifier": "entity.name.function", + "identifier": [ + { + "match": "^(global|module|exports|__filename|__dirname|window|document)$", + "scopes": "support.variable" + }, + { + "exact": "require", + "scopes": "support.function" + }, + { + "match": "^[$A-Z_]{2,}$", + "scopes": "constant.other" + }, + { + "match": "^[A-Z]", + "scopes": "support.type" + } + ], + "number": "constant.numeric", + "string": "string.quoted", + "regex": "string.regexp", + "escape_sequence": "constant.character.escape", + "template_string": "string.quoted.template", + "undefined": "constant.language", + "null": "constant.language.null", + "true": "constant.language.boolean.true", + "false": "constant.language.boolean.false", + "comment": "comment.block", + "hash_bang_line": "comment.block", + "template_substitution > \"${\", template_substitution > \"}\"": "punctuation.section.embedded", + "template_substitution": "embedded.source", + "\"(\"": "punctuation.definition.parameters.begin.bracket.round", + "\")\"": "punctuation.definition.parameters.end.bracket.round", + "\"{\"": "punctuation.definition.function.body.begin.bracket.curly", + "\"}\"": "punctuation.definition.function.body.end.bracket.curly", + "\";\"": "punctuation.terminator.statement.semicolon", + "\"[\"": "punctuation.definition.array.begin.bracket.square", + "\"]\"": "punctuation.definition.array.end.bracket.square", + "\"var\"": "storage.type", + "\"let\"": "storage.type", + "\"class\"": "storage.type", + "\"extends\"": "storage.modifier", + "\"const\"": "storage.modifier", + "\"static\"": "storage.modifier", + "\"function\"": "storage.type.function", + "\"=>\"": "storage.type.function.arrow", + "\"=\"": "keyword.operator.js", + "\"+=\"": "keyword.operator.js", + "\"-=\"": "keyword.operator.js", + "\"*=\"": "keyword.operator.js", + "\"/=\"": "keyword.operator.js", + "\"%=\"": "keyword.operator.js", + "\"<<=\"": "keyword.operator.js", + "\">>=\"": "keyword.operator.js", + "\">>>=\"": "keyword.operator.js", + "\"&=\"": "keyword.operator.js", + "\"^=\"": "keyword.operator.js", + "\"|=\"": "keyword.operator.js", + "\"!\"": "keyword.operator.js", + "\"+\"": "keyword.operator.js", + "\"-\"": "keyword.operator.js", + "\"*\"": "keyword.operator.js", + "\"/\"": "keyword.operator.js", + "\"%\"": "keyword.operator.js", + "\"==\"": "keyword.operator.js", + "\"===\"": "keyword.operator.js", + "\"!=\"": "keyword.operator.js", + "\"!==\"": "keyword.operator.js", + "\">=\"": "keyword.operator.js", + "\"<=\"": "keyword.operator.js", + "\">\"": "keyword.operator.js", + "\"<\"": "keyword.operator.js", + "\":\"": "keyword.operator.js", + "\"?\"": "keyword.operator.js", + "\"&&\"": "keyword.operator.js", + "\"||\"": "keyword.operator.js", + "\"&\"": "keyword.operator.js", + "\"~\"": "keyword.operator.js", + "\"^\"": "keyword.operator.js", + "\">>\"": "keyword.operator.js", + "\">>>\"": "keyword.operator.js", + "\"<<\"": "keyword.operator.js", + "\"|\"": "keyword.operator.js", + "\"++\"": "keyword.operator.js", + "\"--\"": "keyword.operator.js", + "\"...\"": "keyword.operator.js", + "\"in\"": "keyword.control", + "\"instanceof\"": "keyword.control", + "\"of\"": "keyword.control", + "\"new\"": "keyword.control", + "\"typeof\"": "keyword.control", + "\"get\"": "keyword.operator.setter", + "\"set\"": "keyword.operator.setter", + "\".\"": "meta.delimiter.period", + "\",\"": "meta.delimiter.comma", + "\"as\"": "keyword.control", + "\"if\"": "keyword.control", + "\"do\"": "keyword.control", + "\"else\"": "keyword.control", + "\"while\"": "keyword.control", + "\"for\"": "keyword.control", + "\"return\"": "keyword.control", + "\"break\"": "keyword.control", + "\"continue\"": "keyword.control", + "\"throw\"": "keyword.control", + "\"try\"": "keyword.control", + "\"catch\"": "keyword.control", + "\"finally\"": "keyword.control", + "\"switch\"": "keyword.control", + "\"case\"": "keyword.control", + "\"default\"": "keyword.control", + "\"export\"": "keyword.control", + "\"import\"": "keyword.control", + "\"from\"": "keyword.control", + "\"yield\"": "keyword.control", + "\"async\"": "keyword.control", + "\"await\"": "keyword.control", + "\"debugger\"": "keyword.control", + "\"delete\"": "keyword.control", + "class > identifier": "support.storage.type", + "type_identifier": "support.storage.type", + "predefined_type": "support.storage.type", + "method_signature > property_identifier, function_signature > identifier": "entity.name.function", + "\"implements\"": "keyword.modifier", + "\"namespace\"": "keyword.modifier", + "\"enum\"": "keyword.modifier", + "\"interface\"": "keyword.modifier", + "\"module\"": "keyword.modifier", + "\"declare\"": "keyword.modifier", + "\"public\"": "keyword.modifier", + "\"private\"": "keyword.modifier", + "\"protected\"": "keyword.modifier", + "readonly": "keyword.modifier", + "\"type\"": "keyword.modifier" + } +} \ No newline at end of file diff --git a/integrationtest.esy.lock/index.json b/integrationtest.esy.lock/index.json index 0e6d64fc93..eb87f303af 100644 --- a/integrationtest.esy.lock/index.json +++ b/integrationtest.esy.lock/index.json @@ -1,5 +1,5 @@ { - "checksum": "c37b1858514aac1c3a2f01daacf39d52", + "checksum": "903fd03f9db0da7ef98b560eeeab931e", "root": "Oni2@link-dev:./package.json", "node": { "yarn-pkg-config@github:esy-ocaml/yarn-pkg-config#db3a0b63883606dd57c54a7158d560d6cba8cd79@d41d8cd9": { @@ -278,25 +278,25 @@ ], "devDependencies": [ "ocaml@4.10.0@d41d8cd9" ] }, - "reason-tree-sitter@1.0.1001@d41d8cd9": { - "id": "reason-tree-sitter@1.0.1001@d41d8cd9", + "reason-tree-sitter@github:CrossR/reason-tree-sitter#b2913d3@d41d8cd9": { + "id": + "reason-tree-sitter@github:CrossR/reason-tree-sitter#b2913d3@d41d8cd9", "name": "reason-tree-sitter", - "version": "1.0.1001", + "version": "github:CrossR/reason-tree-sitter#b2913d3", "source": { "type": "install", - "source": [ - "archive:https://registry.npmjs.org/reason-tree-sitter/-/reason-tree-sitter-1.0.1001.tgz#sha1:bd642ac513d19dc1151ab78d983cab779677cb31" - ] + "source": [ "github:CrossR/reason-tree-sitter#b2913d3" ] }, "overrides": [], "dependencies": [ "reperf@1.5.0@d41d8cd9", "refmterr@3.3.2@d41d8cd9", - "ocaml@4.10.0@d41d8cd9", "esy-tree-sitter@1.4.1@d41d8cd9", + "ocaml@4.10.0@d41d8cd9", + "esy-tree-sitter@github:CrossR/esy-tree-sitter#fdcf8f7@d41d8cd9", "editor-core-types@github:onivim/editor-core-types#6a8afaf@d41d8cd9", "@opam/dune-configurator@opam:2.5.1@aeb9d8d5", "@opam/dune@opam:2.5.0@e0bac278", "@esy-ocaml/reason@3.6.0@d41d8cd9" ], - "devDependencies": [] + "devDependencies": [ "ocaml@4.10.0@d41d8cd9" ] }, "reason-native-crash-utils@github:onivim/reason-native-crash-utils#38c8f00@d41d8cd9": { "id": @@ -672,15 +672,13 @@ ], "devDependencies": [] }, - "esy-tree-sitter@1.4.1@d41d8cd9": { - "id": "esy-tree-sitter@1.4.1@d41d8cd9", + "esy-tree-sitter@github:CrossR/esy-tree-sitter#fdcf8f7@d41d8cd9": { + "id": "esy-tree-sitter@github:CrossR/esy-tree-sitter#fdcf8f7@d41d8cd9", "name": "esy-tree-sitter", - "version": "1.4.1", + "version": "github:CrossR/esy-tree-sitter#fdcf8f7", "source": { "type": "install", - "source": [ - "archive:https://registry.npmjs.org/esy-tree-sitter/-/esy-tree-sitter-1.4.1.tgz#sha1:67731d4e01fb391ebd1988a4781d41e1532ac6b6" - ] + "source": [ "github:CrossR/esy-tree-sitter#fdcf8f7" ] }, "overrides": [], "dependencies": [], @@ -1030,7 +1028,7 @@ "rench@github:bryphe/rench#a976fe5@d41d8cd9", "refmterr@3.3.2@d41d8cd9", "reasonFuzz@github:CrossR/reasonFuzz#1ad6f5d@d41d8cd9", - "reason-tree-sitter@1.0.1001@d41d8cd9", + "reason-tree-sitter@github:CrossR/reason-tree-sitter#b2913d3@d41d8cd9", "reason-native-crash-utils@github:onivim/reason-native-crash-utils#38c8f00@d41d8cd9", "ocaml@4.10.0@d41d8cd9", "libvim@8.10869.55@d41d8cd9", "isolinear@github:revery-ui/isolinear#8cad3b0@d41d8cd9", @@ -1731,8 +1729,8 @@ "@opam/base-bytes@opam:base@19d0c2ff" ] }, - "@opam/stdlib-shims@opam:0.1.0@d957c903": { - "id": "@opam/stdlib-shims@opam:0.1.0@d957c903", + "@opam/stdlib-shims@opam:0.1.0@8c116481": { + "id": "@opam/stdlib-shims@opam:0.1.0@8c116481", "name": "@opam/stdlib-shims", "version": "opam:0.1.0", "source": { @@ -2510,7 +2508,7 @@ "dependencies": [ "ocaml@4.10.0@d41d8cd9", "@opam/yojson@github:onivim/yojson:yojson.opam#f480aef@d41d8cd9", - "@opam/stdlib-shims@opam:0.1.0@d957c903", + "@opam/stdlib-shims@opam:0.1.0@8c116481", "@opam/ppx_yojson_conv_lib@opam:v0.14.0@116b53d6", "@opam/ocamlfind@opam:1.8.1@ff07b0f9", "@opam/menhir@opam:20200624@8629ff13", @@ -2520,7 +2518,7 @@ "devDependencies": [ "ocaml@4.10.0@d41d8cd9", "@opam/yojson@github:onivim/yojson:yojson.opam#f480aef@d41d8cd9", - "@opam/stdlib-shims@opam:0.1.0@d957c903", + "@opam/stdlib-shims@opam:0.1.0@8c116481", "@opam/ppx_yojson_conv_lib@opam:v0.14.0@116b53d6", "@opam/ocamlfind@opam:1.8.1@ff07b0f9", "@opam/menhir@opam:20200624@8629ff13", @@ -3178,7 +3176,7 @@ "overrides": [], "dependencies": [ "ocaml@4.10.0@d41d8cd9", "@opam/topkg@opam:1.0.2@3c5942ad", - "@opam/stdlib-shims@opam:0.1.0@d957c903", + "@opam/stdlib-shims@opam:0.1.0@8c116481", "@opam/seq@opam:base@d8d7de1d", "@opam/ocamlfind@opam:1.8.1@ff07b0f9", "@opam/ocamlbuild@opam:0.14.0@6ac75d03", @@ -3186,7 +3184,7 @@ "@esy-ocaml/substs@0.0.1@d41d8cd9" ], "devDependencies": [ - "ocaml@4.10.0@d41d8cd9", "@opam/stdlib-shims@opam:0.1.0@d957c903", + "ocaml@4.10.0@d41d8cd9", "@opam/stdlib-shims@opam:0.1.0@8c116481", "@opam/seq@opam:base@d8d7de1d" ] }, diff --git a/integrationtest.esy.lock/opam/stdlib-shims.0.1.0/opam b/integrationtest.esy.lock/opam/stdlib-shims.0.1.0/opam index 5839c43cad..0d1079d893 100644 --- a/integrationtest.esy.lock/opam/stdlib-shims.0.1.0/opam +++ b/integrationtest.esy.lock/opam/stdlib-shims.0.1.0/opam @@ -8,8 +8,9 @@ bug-reports: "https://github.com/ocaml/stdlib-shims/issues" tags: ["stdlib" "compatibility" "org:ocaml"] license: ["typeof OCaml system"] depends: [ + "ocaml" {>="4.02.3"} "dune" - "ocaml" {>= "4.02.3"} + ("dune" {>= "2.7.0"} | "dune" & "ocaml" {<"4.12.0~~"}) ] build: [ "dune" "build" "-p" name "-j" jobs ] synopsis: "Backport some of the new stdlib features to older compiler" diff --git a/package.json b/package.json index 8a66c1ae1f..cf4764eefc 100644 --- a/package.json +++ b/package.json @@ -244,7 +244,7 @@ "libvim": "8.10869.55", "ocaml": "~4.7.0", "reason-native-crash-utils": "onivim/reason-native-crash-utils#38c8f00", - "reason-tree-sitter": "^1.0.1001", + "reason-tree-sitter": "*", "reasonFuzz": "*", "refmterr": "*", "rench": "1.7.1", @@ -264,6 +264,7 @@ "@opam/fs": "bryphe/reason-native:fs.opam#fd0225c", "@opam/fp": "bryphe/reason-native:fp.opam#fd0225c", "@opam/dir": "bryphe/reason-native:dir.opam#fd0225", + "reason-tree-sitter": "CrossR/reason-tree-sitter#b2913d3", "@opam/conf-pkg-config": "1.2" }, "devDependencies": { diff --git a/src/Syntax/NativeSyntaxHighlights.re b/src/Syntax/NativeSyntaxHighlights.re index 8be176ac6f..687303a879 100644 --- a/src/Syntax/NativeSyntaxHighlights.re +++ b/src/Syntax/NativeSyntaxHighlights.re @@ -33,18 +33,6 @@ type t = }) : t; -let _hasTreeSitterScope = (useTreeSitter, scope: string) => - if (!useTreeSitter) { - false; - } else { - switch (scope) { - | "source.json" => true - /* | "source.c" => true - | "source.cpp" => true */ - | _ => false - }; - }; - let anyPendingWork = hl => { let Highlighter({highlighter: (module SyntaxHighlighter), state}) = hl; @@ -82,13 +70,17 @@ let create = lines: array(string), ) => { let maybeScopeConverter = getTreesitterScope(scope); + let maybeParser = TreeSitterSyntaxHighlights.getParserFromScope(scope); - let allowTreeSitter = _hasTreeSitterScope(useTreeSitter, scope); - - switch (maybeScopeConverter) { - | Some(scopeConverter) when allowTreeSitter => + switch (maybeScopeConverter, maybeParser) { + | (Some(scopeConverter), Some(parser)) when useTreeSitter => let ts = - TreeSitterSyntaxHighlights.create(~theme, ~scopeConverter, lines); + TreeSitterSyntaxHighlights.create( + ~theme, + ~scopeConverter, + ~parser, + lines, + ); Highlighter({ highlighter: (module TreeSitterSyntaxHighlights), state: ts, diff --git a/src/Syntax/TreeSitterSyntaxHighlights.re b/src/Syntax/TreeSitterSyntaxHighlights.re index 18f734bcfd..01c4c7ec20 100644 --- a/src/Syntax/TreeSitterSyntaxHighlights.re +++ b/src/Syntax/TreeSitterSyntaxHighlights.re @@ -33,8 +33,19 @@ let scopesToStrings = (scopes: list(TreeSitter.Syntax.scope)) => { ); }; -let create = (~theme, ~scopeConverter, lines: array(string)) => { - let parser = Parser.json(); +let getParserFromScope = language => + switch (language) { + | "source.json" => Some(Parser.json()) + | "source.c" => Some(Parser.c()) + | "source.cpp" => Some(Parser.cpp()) + | "source.python" => Some(Parser.python()) + | "source.js" => Some(Parser.javascript()) + | "source.ts" => Some(Parser.typescript()) + | "source.tsx" => Some(Parser.tsx()) + | _ => None + }; + +let create = (~theme, ~scopeConverter, ~parser, lines: array(string)) => { let (tree, baseline) = ArrayParser.parse(parser, None, lines); let job = diff --git a/test.esy.lock/index.json b/test.esy.lock/index.json index ae5ac86e66..eda7f7bb2d 100644 --- a/test.esy.lock/index.json +++ b/test.esy.lock/index.json @@ -1,5 +1,5 @@ { - "checksum": "12c31a587ab48699b6391c7359717dae", + "checksum": "71e21ba97bda7c0ba44f55ff38915790", "root": "Oni2@link-dev:./package.json", "node": { "yarn-pkg-config@github:esy-ocaml/yarn-pkg-config#db3a0b63883606dd57c54a7158d560d6cba8cd79@d41d8cd9": { @@ -278,25 +278,25 @@ ], "devDependencies": [ "ocaml@4.10.0@d41d8cd9" ] }, - "reason-tree-sitter@1.0.1001@d41d8cd9": { - "id": "reason-tree-sitter@1.0.1001@d41d8cd9", + "reason-tree-sitter@github:CrossR/reason-tree-sitter#b2913d3@d41d8cd9": { + "id": + "reason-tree-sitter@github:CrossR/reason-tree-sitter#b2913d3@d41d8cd9", "name": "reason-tree-sitter", - "version": "1.0.1001", + "version": "github:CrossR/reason-tree-sitter#b2913d3", "source": { "type": "install", - "source": [ - "archive:https://registry.npmjs.org/reason-tree-sitter/-/reason-tree-sitter-1.0.1001.tgz#sha1:bd642ac513d19dc1151ab78d983cab779677cb31" - ] + "source": [ "github:CrossR/reason-tree-sitter#b2913d3" ] }, "overrides": [], "dependencies": [ "reperf@1.5.0@d41d8cd9", "refmterr@3.3.2@d41d8cd9", - "ocaml@4.10.0@d41d8cd9", "esy-tree-sitter@1.4.1@d41d8cd9", + "ocaml@4.10.0@d41d8cd9", + "esy-tree-sitter@github:CrossR/esy-tree-sitter#fdcf8f7@d41d8cd9", "editor-core-types@github:onivim/editor-core-types#6a8afaf@d41d8cd9", "@opam/dune-configurator@opam:2.5.1@aeb9d8d5", "@opam/dune@opam:2.5.0@e0bac278", "@esy-ocaml/reason@3.6.0@d41d8cd9" ], - "devDependencies": [] + "devDependencies": [ "ocaml@4.10.0@d41d8cd9" ] }, "reason-native-crash-utils@github:onivim/reason-native-crash-utils#38c8f00@d41d8cd9": { "id": @@ -672,15 +672,13 @@ ], "devDependencies": [] }, - "esy-tree-sitter@1.4.1@d41d8cd9": { - "id": "esy-tree-sitter@1.4.1@d41d8cd9", + "esy-tree-sitter@github:CrossR/esy-tree-sitter#fdcf8f7@d41d8cd9": { + "id": "esy-tree-sitter@github:CrossR/esy-tree-sitter#fdcf8f7@d41d8cd9", "name": "esy-tree-sitter", - "version": "1.4.1", + "version": "github:CrossR/esy-tree-sitter#fdcf8f7", "source": { "type": "install", - "source": [ - "archive:https://registry.npmjs.org/esy-tree-sitter/-/esy-tree-sitter-1.4.1.tgz#sha1:67731d4e01fb391ebd1988a4781d41e1532ac6b6" - ] + "source": [ "github:CrossR/esy-tree-sitter#fdcf8f7" ] }, "overrides": [], "dependencies": [], @@ -1030,7 +1028,7 @@ "rench@github:bryphe/rench#a976fe5@d41d8cd9", "refmterr@3.3.2@d41d8cd9", "reasonFuzz@github:CrossR/reasonFuzz#1ad6f5d@d41d8cd9", - "reason-tree-sitter@1.0.1001@d41d8cd9", + "reason-tree-sitter@github:CrossR/reason-tree-sitter#b2913d3@d41d8cd9", "reason-native-crash-utils@github:onivim/reason-native-crash-utils#38c8f00@d41d8cd9", "ocaml@4.10.0@d41d8cd9", "libvim@8.10869.55@d41d8cd9", "isolinear@github:revery-ui/isolinear#8cad3b0@d41d8cd9", @@ -1731,8 +1729,8 @@ "@opam/base-bytes@opam:base@19d0c2ff" ] }, - "@opam/stdlib-shims@opam:0.1.0@d957c903": { - "id": "@opam/stdlib-shims@opam:0.1.0@d957c903", + "@opam/stdlib-shims@opam:0.1.0@8c116481": { + "id": "@opam/stdlib-shims@opam:0.1.0@8c116481", "name": "@opam/stdlib-shims", "version": "opam:0.1.0", "source": { @@ -2509,7 +2507,7 @@ "dependencies": [ "ocaml@4.10.0@d41d8cd9", "@opam/yojson@github:onivim/yojson:yojson.opam#f480aef@d41d8cd9", - "@opam/stdlib-shims@opam:0.1.0@d957c903", + "@opam/stdlib-shims@opam:0.1.0@8c116481", "@opam/ppx_yojson_conv_lib@opam:v0.14.0@116b53d6", "@opam/ocamlfind@opam:1.8.1@ff07b0f9", "@opam/menhir@opam:20200624@8629ff13", @@ -2519,7 +2517,7 @@ "devDependencies": [ "ocaml@4.10.0@d41d8cd9", "@opam/yojson@github:onivim/yojson:yojson.opam#f480aef@d41d8cd9", - "@opam/stdlib-shims@opam:0.1.0@d957c903", + "@opam/stdlib-shims@opam:0.1.0@8c116481", "@opam/ppx_yojson_conv_lib@opam:v0.14.0@116b53d6", "@opam/ocamlfind@opam:1.8.1@ff07b0f9", "@opam/menhir@opam:20200624@8629ff13", @@ -3177,7 +3175,7 @@ "overrides": [], "dependencies": [ "ocaml@4.10.0@d41d8cd9", "@opam/topkg@opam:1.0.2@3c5942ad", - "@opam/stdlib-shims@opam:0.1.0@d957c903", + "@opam/stdlib-shims@opam:0.1.0@8c116481", "@opam/seq@opam:base@d8d7de1d", "@opam/ocamlfind@opam:1.8.1@ff07b0f9", "@opam/ocamlbuild@opam:0.14.0@6ac75d03", @@ -3185,7 +3183,7 @@ "@esy-ocaml/substs@0.0.1@d41d8cd9" ], "devDependencies": [ - "ocaml@4.10.0@d41d8cd9", "@opam/stdlib-shims@opam:0.1.0@d957c903", + "ocaml@4.10.0@d41d8cd9", "@opam/stdlib-shims@opam:0.1.0@8c116481", "@opam/seq@opam:base@d8d7de1d" ] }, diff --git a/test.esy.lock/opam/stdlib-shims.0.1.0/opam b/test.esy.lock/opam/stdlib-shims.0.1.0/opam index 5839c43cad..0d1079d893 100644 --- a/test.esy.lock/opam/stdlib-shims.0.1.0/opam +++ b/test.esy.lock/opam/stdlib-shims.0.1.0/opam @@ -8,8 +8,9 @@ bug-reports: "https://github.com/ocaml/stdlib-shims/issues" tags: ["stdlib" "compatibility" "org:ocaml"] license: ["typeof OCaml system"] depends: [ + "ocaml" {>="4.02.3"} "dune" - "ocaml" {>= "4.02.3"} + ("dune" {>= "2.7.0"} | "dune" & "ocaml" {<"4.12.0~~"}) ] build: [ "dune" "build" "-p" name "-j" jobs ] synopsis: "Backport some of the new stdlib features to older compiler"