From 280a0bb766afd40aa5062d0f27b6aa9ed93236f6 Mon Sep 17 00:00:00 2001 From: Stefan du Fresne Date: Fri, 17 Dec 2021 14:41:55 +0000 Subject: [PATCH 1/4] scala support --- Makefile | 4 ++-- README.md | 4 ++-- package.json | 3 ++- src/extension.ts | 1 + yarn.lock | 7 +++++++ 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 9a37f7d..255ca40 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # For generating .wasm files for parsers # See https://www.npmjs.com/package/web-tree-sitter -languages = agda c clojure cpp c-sharp bash go html java javascript json markdown python ruby rust tsx typescript yaml +languages = agda c clojure cpp c-sharp bash go html java javascript json markdown python ruby rust scala tsx typescript yaml .PHONY: parsers parsers: $(addprefix parsers/tree-sitter-,$(addsuffix .wasm,$(languages))) @@ -23,4 +23,4 @@ parsers/tree-sitter-tsx.wasm: node_modules/tree-sitter-typescript/tsx/package.js parsers/tree-sitter-c-sharp.wasm: node_modules/tree-sitter-c-sharp/package.json mkdir -p $(dir $@) npx tree-sitter build-wasm $(dir $^) - mv tree-sitter-c_sharp.wasm $@ \ No newline at end of file + mv tree-sitter-c_sharp.wasm $@ diff --git a/README.md b/README.md index 01cd3a8..079be17 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ It's straightforward to add any [language with a tree-sitter grammar](https://tr 2. Add a language to the dictionary at the top of `./src/extension.ts` 3. Add a reference to `onLanguage:yourlang` to the [activationEvents section of package.json](package.json). `yourlang` must be a [VSCode language identifier](https://code.visualstudio.com/docs/languages/identifiers). 4. Add your language to the top of the [Makefile](Makefile) -5. Hit `F5` in VSCode, with this project open, to test your changes. +5. Hit `F5` in VSCode, with the Cursorless project open, to test your changes. 6. Submit a PR! ### Developing on WSL2 @@ -41,7 +41,7 @@ When working with WSL, the host vscode instance connects to a vscode server on t - Install the `pokey.command-server` extension on the host vscode - Clone the extension in the WSL side. -- If you're adding language support to `vscode-parse-tree`, you need to clone that as well, build it, and link it into the `vscode-server` extension folder: `ln -s ~/.vscode-server/extensions/vscode-parse-tree ~/git/vscode-pars-tree` for instance. +- If you're adding language support to `vscode-parse-tree`, you need to clone that as well, build it, and link it into the `vscode-server` extension folder: `ln -s ~/your/code/vscode-parse-tree ~/.vscode-server/extensions/parse-tree` for instance. - If you get errors about needing to install the `Remote-WSL` extension, you might need to manually delete the extension from the host side and try again. ## Change Log diff --git a/package.json b/package.json index 6b6942c..189994a 100644 --- a/package.json +++ b/package.json @@ -81,6 +81,7 @@ "tree-sitter-python": "^0.19.0", "tree-sitter-ruby": "^0.19.0", "tree-sitter-rust": "^0.19.0", + "tree-sitter-scala": "^0.19.0", "tree-sitter-typescript": "github:tree-sitter/tree-sitter-typescript#master", "tree-sitter-yaml": "^0.5.0", "tslint": "^6.0.0", @@ -93,4 +94,4 @@ "tar": ">=4.4.2", "web-tree-sitter": "^0.19.4" } -} \ No newline at end of file +} diff --git a/src/extension.ts b/src/extension.ts index 3950078..6d55d9a 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -28,6 +28,7 @@ const languages: { python: { module: "tree-sitter-python" }, ruby: { module: "tree-sitter-ruby" }, rust: { module: "tree-sitter-rust" }, + scala: { module: "tree-sitter-scala" }, shellscript: { module: "tree-sitter-bash" }, typescript: { module: "tree-sitter-typescript" }, typescriptreact: { module: "tree-sitter-tsx" }, diff --git a/yarn.lock b/yarn.lock index 5162573..84a74d6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2160,6 +2160,13 @@ tree-sitter-rust@^0.19.0: dependencies: nan "^2.14.0" +tree-sitter-scala@^0.19.0: + version "0.19.0" + resolved "https://registry.yarnpkg.com/tree-sitter-scala/-/tree-sitter-scala-0.19.0.tgz#c4aefcc8ba39c2f0f021beeac694709115c76b55" + integrity sha512-PALw1LDNvMv/OdrHq5DD5eR7NULa7Lh/CqKCVRtL7ohc4I3E7cO5TkPaBc49MImHbUlpBKxIbH7KDdOyWAVkkg== + dependencies: + nan "^2.14.1" + "tree-sitter-typescript@github:tree-sitter/tree-sitter-typescript#master": version "0.20.0" resolved "https://codeload.github.com/tree-sitter/tree-sitter-typescript/tar.gz/111b07762e86efab9a918b7c721f720c37e76b0a" From 2ac786e5836b12799697560a9700c174e9ef150b Mon Sep 17 00:00:00 2001 From: Stefan du Fresne Date: Fri, 17 Dec 2021 15:03:35 +0000 Subject: [PATCH 2/4] Update README.md Co-authored-by: Pokey Rule --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 079be17..365f9dc 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ It's straightforward to add any [language with a tree-sitter grammar](https://tr 2. Add a language to the dictionary at the top of `./src/extension.ts` 3. Add a reference to `onLanguage:yourlang` to the [activationEvents section of package.json](package.json). `yourlang` must be a [VSCode language identifier](https://code.visualstudio.com/docs/languages/identifiers). 4. Add your language to the top of the [Makefile](Makefile) -5. Hit `F5` in VSCode, with the Cursorless project open, to test your changes. +5. Hit `F5` in VSCode, with this project open, to test your changes. 6. Submit a PR! ### Developing on WSL2 From e1150078285aece88789f0a5718ce320fb54a2cc Mon Sep 17 00:00:00 2001 From: Stefan du Fresne Date: Mon, 20 Dec 2021 17:00:31 +0000 Subject: [PATCH 3/4] moving scala version to master --- package.json | 2 +- yarn.lock | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 189994a..97502dc 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ "tree-sitter-python": "^0.19.0", "tree-sitter-ruby": "^0.19.0", "tree-sitter-rust": "^0.19.0", - "tree-sitter-scala": "^0.19.0", + "tree-sitter-scala": "github:tree-sitter/tree-sitter-scala#master", "tree-sitter-typescript": "github:tree-sitter/tree-sitter-typescript#master", "tree-sitter-yaml": "^0.5.0", "tslint": "^6.0.0", diff --git a/yarn.lock b/yarn.lock index 84a74d6..c5bbf2c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2160,10 +2160,9 @@ tree-sitter-rust@^0.19.0: dependencies: nan "^2.14.0" -tree-sitter-scala@^0.19.0: +"tree-sitter-scala@github:tree-sitter/tree-sitter-scala#master": version "0.19.0" - resolved "https://registry.yarnpkg.com/tree-sitter-scala/-/tree-sitter-scala-0.19.0.tgz#c4aefcc8ba39c2f0f021beeac694709115c76b55" - integrity sha512-PALw1LDNvMv/OdrHq5DD5eR7NULa7Lh/CqKCVRtL7ohc4I3E7cO5TkPaBc49MImHbUlpBKxIbH7KDdOyWAVkkg== + resolved "https://codeload.github.com/tree-sitter/tree-sitter-scala/tar.gz/0a3dd53a7fc4b352a538397d054380aaa28be54c" dependencies: nan "^2.14.1" From d53fe855e95724484b17a50b66bb21f7d88a2e39 Mon Sep 17 00:00:00 2001 From: Stefan du Fresne Date: Tue, 21 Dec 2021 10:16:00 +0000 Subject: [PATCH 4/4] whoops --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 97502dc..f2cf5a9 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "onLanguage:python", "onLanguage:ruby", "onLanguage:rust", + "onLanguage:scala", "onLanguage:shellscript", "onLanguage:typescript", "onLanguage:typescriptreact",