From ca344182e6c296bba402b30dff297c00eee639bb Mon Sep 17 00:00:00 2001 From: shawa Date: Fri, 25 Nov 2022 17:55:40 +0000 Subject: [PATCH 1/2] Add Elixir support This PR (attempts) to add support for Elixir by adding the dependency on the official Elixir tree-sitter grammar. I've been unable to build this on any machine for some reason, it looks like Emscripten is failing on the linker step. I'd appreciate any insight and testing! The output is below; yarn was failing to even run `yarn add -D` due to the preinstall step: ``` $ make web-tree-sitter /Users/shawa/Projects/cursorless/vscode-parse-tree/.make-work/tree-sitter /Users/shawa/Projects/cursorless/vscode-parse-tree/.make-work/tree-sitter Unable to find image 'emscripten/emsdk:2.0.24' locally 2.0.24: Pulling from emscripten/emsdk 345e3491a907: Pull complete 57671312ef6f: Pull complete 5e9250ddb7d0: Pull complete 859aa499d6fa: Pull complete 04e009ac95c8: Pull complete 5bfdbd9279e5: Pull complete ac435eb7f4a4: Pull complete Digest: sha256:81ec54b7a096d28f24d906955dbf98ff336cca47658d980c243baa36f6484f9f Status: Downloaded newer image for emscripten/emsdk:2.0.24 cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/pic/libGL.a... (this will be cached in "/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libGL.a" for subsequent builds) cache:INFO: - ok cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/pic/libal.a... (this will be cached in "/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libal.a" for subsequent builds) cache:INFO: - ok cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/pic/libhtml5.a... (this will be cached in "/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libhtml5.a" for subsequent builds) cache:INFO: - ok cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/pic/libc.a... (this will be cached in "/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libc.a" for subsequent builds) cache:INFO: - ok cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/pic/libcompiler_rt.a... (this will be cached in "/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libcompiler_rt.a" for subsequent builds) cache:INFO: - ok cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/pic/libc++-noexcept.a... (this will be cached in "/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libc++-noexcept.a" for subsequent builds) cache:INFO: - ok cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/pic/libc++abi-noexcept.a... (this will be cached in "/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libc++abi-noexcept.a" for subsequent builds) cache:INFO: - ok cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/pic/libdlmalloc.a... (this will be cached in "/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libdlmalloc.a" for subsequent builds) cache:INFO: - ok cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/pic/libc_rt_wasm.a... (this will be cached in "/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libc_rt_wasm.a" for subsequent builds) cache:INFO: - ok cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/pic/libsockets.a... (this will be cached in "/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libsockets.a" for subsequent builds) cache:INFO: - ok emcc: error: undefined exported symbol: "___cxa_atexit" [-Wundefined] [-Werror] make: *** [vendor/web-tree-sitter/0.20.4/README.md] Error 1 error Command failed with exit code 2. ``` --- Makefile | 2 +- package.json | 2 ++ src/extension.ts | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index aaa903c..32829d7 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 bash c c-sharp clojure cpp css elm go haskell html java javascript json kotlin latex markdown php python query ruby rust scala scss sparql talon tsx typescript yaml +LANGUAGES = agda bash c c-sharp clojure cpp css elm elixir go haskell html java javascript json kotlin latex markdown php python query ruby rust scala scss sparql talon tsx typescript yaml # NOTE: Update the version number in the filepath for web-tree-sitter in package.json, diff --git a/package.json b/package.json index 8c09f9b..f286d13 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "onLanguage:css", "onLanguage:csharp", "onLanguage:elm", + "onLanguage:elixir", "onLanguage:go", "onLanguage:haskell", "onLanguage:html", @@ -93,6 +94,7 @@ "tree-sitter-cpp": "^0.19.0", "@elm-tooling/tree-sitter-elm": "github:elm-tooling/tree-sitter-elm#0aecfbf69f0c9bcdfada0f6f2c5398235c23949f", "tree-sitter-go": "^0.19.0", + "tree-sitter-elixir": "github:elixir-lang/tree-sitter-elixir#b20eaa75565243c50be5e35e253d8beb58f45d56", "tree-sitter-haskell": "github:tree-sitter/tree-sitter-haskell#d6ccd2d9c40bdec29fee0027ef04fe5ff1ae4ceb", "tree-sitter-html": "^0.19.0", "tree-sitter-java": "github:tree-sitter/tree-sitter-java#ac14b4b1884102839455d32543ab6d53ae089ab7", diff --git a/src/extension.ts b/src/extension.ts index 3a00268..213143f 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -19,6 +19,7 @@ const languages: { csharp: { module: "tree-sitter-c-sharp" }, css: { module: "tree-sitter-css" }, elm: { module: "tree-sitter-elm" }, + elixir: { module: "tree-sitter-elixir" }, go: { module: "tree-sitter-go" }, haskell: { module: "tree-sitter-haskell" }, html: { module: "tree-sitter-html" }, From 55b3e5abce1d2ba05eb28d278e32c55428ac1835 Mon Sep 17 00:00:00 2001 From: Pokey Rule <755842+pokey@users.noreply.github.com> Date: Tue, 29 Nov 2022 22:25:23 -0800 Subject: [PATCH 2/2] Update yarn.lock --- yarn.lock | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/yarn.lock b/yarn.lock index b13c1b6..bd9f61e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2444,6 +2444,12 @@ tree-sitter-css@^0.19.0: dependencies: nan "^2.14.1" +"tree-sitter-elixir@github:elixir-lang/tree-sitter-elixir#b20eaa75565243c50be5e35e253d8beb58f45d56": + version "0.19.0" + resolved "https://codeload.github.com/elixir-lang/tree-sitter-elixir/tar.gz/b20eaa75565243c50be5e35e253d8beb58f45d56" + dependencies: + nan "^2.15.0" + tree-sitter-go@^0.19.0: version "0.19.1" resolved "https://registry.yarnpkg.com/tree-sitter-go/-/tree-sitter-go-0.19.1.tgz#f23c84bff882eafa296ce2d307366e76f1f83e2d"