diff --git a/sample_files/compare.expected b/sample_files/compare.expected
index f0477f768e..97bd0d0af9 100644
--- a/sample_files/compare.expected
+++ b/sample_files/compare.expected
@@ -64,6 +64,9 @@ sample_files/elisp_1.el sample_files/elisp_2.el
sample_files/elisp_contiguous_1.el sample_files/elisp_contiguous_2.el
4a5a33873a4f84ee055d95e1448fba35 -
+sample_files/elixir_1.ex sample_files/elixir_2.ex
+85494310196ac5065b3b4ce1d4b350fd -
+
sample_files/elm_1.elm sample_files/elm_2.elm
ccc1f4bb568cd72781dbcd623b612c43 -
diff --git a/sample_files/elixir_1.ex b/sample_files/elixir_1.ex
new file mode 100644
index 0000000000..7fec6c3a0e
--- /dev/null
+++ b/sample_files/elixir_1.ex
@@ -0,0 +1,13 @@
+defmodule ExampleComponent do
+ defp greet do
+ "Hello world"
+ end
+
+ def greet_component(assigns) do
+ ~H"""
+
+ <%= greet() %>
+
+ """
+ end
+end
diff --git a/sample_files/elixir_2.ex b/sample_files/elixir_2.ex
new file mode 100644
index 0000000000..76154238a4
--- /dev/null
+++ b/sample_files/elixir_2.ex
@@ -0,0 +1,13 @@
+defmodule ExampleComponent do
+ defp greet_str do
+ "Hello world!"
+ end
+
+ def greet_component(assigns) do
+ ~H"""
+
+ <%= greet_str() %>
+
+ """
+ end
+end
diff --git a/src/parse/tree_sitter_parser.rs b/src/parse/tree_sitter_parser.rs
index fa88c30339..5f28dcffa5 100644
--- a/src/parse/tree_sitter_parser.rs
+++ b/src/parse/tree_sitter_parser.rs
@@ -358,7 +358,7 @@ pub(crate) fn from_language(language: guess::Language) -> TreeSitterConfig {
let language = unsafe { tree_sitter_elixir() };
TreeSitterConfig {
language,
- atom_nodes: vec!["string", "heredoc"].into_iter().collect(),
+ atom_nodes: vec!["string", "sigil", "heredoc"].into_iter().collect(),
delimiter_tokens: vec![("(", ")"), ("{", "}"), ("do", "end")]
.into_iter()
.collect(),
diff --git a/vendored_parsers/tree-sitter-elixir/.editorconfig b/vendored_parsers/tree-sitter-elixir/.editorconfig
new file mode 100644
index 0000000000..d3a8b5b697
--- /dev/null
+++ b/vendored_parsers/tree-sitter-elixir/.editorconfig
@@ -0,0 +1,39 @@
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.{json,toml,yml,gyp}]
+indent_style = space
+indent_size = 2
+
+[*.js]
+indent_style = space
+indent_size = 2
+
+[*.rs]
+indent_style = space
+indent_size = 4
+
+[*.{c,cc,h}]
+indent_style = space
+indent_size = 4
+
+[*.{py,pyi}]
+indent_style = space
+indent_size = 4
+
+[*.swift]
+indent_style = space
+indent_size = 4
+
+[*.go]
+indent_style = tab
+indent_size = 8
+
+[Makefile]
+indent_style = tab
+indent_size = 8
diff --git a/vendored_parsers/tree-sitter-elixir/.github/workflows/generate.yml b/vendored_parsers/tree-sitter-elixir/.github/workflows/generate.yml
index 4764cb9a05..959a832c28 100644
--- a/vendored_parsers/tree-sitter-elixir/.github/workflows/generate.yml
+++ b/vendored_parsers/tree-sitter-elixir/.github/workflows/generate.yml
@@ -8,6 +8,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
+ # Workaround for https://github.com/nodejs/node-gyp/issues/2219#issuecomment-1359162118
+ - uses: actions/setup-python@v5
+ with:
+ python-version: "3.10"
- name: Install Node
uses: actions/setup-node@v2
with:
@@ -24,7 +28,7 @@ jobs:
- name: Generate parser
run: |
npx tree-sitter generate
- npx tree-sitter build-wasm
+ npx tree-sitter build --wasm -o tree-sitter-elixir.wasm
- name: Update parser files
uses: stefanzweifel/git-auto-commit-action@v4
with:
diff --git a/vendored_parsers/tree-sitter-elixir/.github/workflows/test.yml b/vendored_parsers/tree-sitter-elixir/.github/workflows/test.yml
index d83e49750b..79e8fa1391 100644
--- a/vendored_parsers/tree-sitter-elixir/.github/workflows/test.yml
+++ b/vendored_parsers/tree-sitter-elixir/.github/workflows/test.yml
@@ -11,6 +11,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
+ # Workaround for https://github.com/nodejs/node-gyp/issues/2219#issuecomment-1359162118
+ - uses: actions/setup-python@v5
+ with:
+ python-version: "3.10"
- name: Install Node
uses: actions/setup-node@v2
with:
diff --git a/vendored_parsers/tree-sitter-elixir/CHANGELOG.md b/vendored_parsers/tree-sitter-elixir/CHANGELOG.md
index 5f005ba25b..beeee55d42 100644
--- a/vendored_parsers/tree-sitter-elixir/CHANGELOG.md
+++ b/vendored_parsers/tree-sitter-elixir/CHANGELOG.md
@@ -4,6 +4,41 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
+## [Unreleased](https://github.com/elixir-lang/tree-sitter-elixir/tree/main)
+
+### Added
+
+* Support for ~LVN sigils (LiveView Native templates) in the built-in injections ([#75](https://github.com/elixir-lang/tree-sitter-elixir/pull/75))
+
+## [v0.3.1](https://github.com/elixir-lang/tree-sitter-elixir/tree/v0.3.1) (2024-09-28)
+
+### Changed
+
+* Changed highlight queries to distinguish field access from calls ([#73](https://github.com/elixir-lang/tree-sitter-elixir/pull/73))
+
+## [v0.3.0](https://github.com/elixir-lang/tree-sitter-elixir/tree/v0.3.0) (2024-09-05)
+
+### Changed
+
+* The Rust crate to depend on tree-sitter-language rather than tree-sitter ([#70](https://github.com/elixir-lang/tree-sitter-elixir/pull/70))
+
+## [v0.2.0](https://github.com/elixir-lang/tree-sitter-elixir/tree/v0.2.0) (2024-04-08)
+
+### Changed
+
+* Required tree-sitter version to 0.21+ ([#66](https://github.com/elixir-lang/tree-sitter-elixir/pull/66))
+
+## [v0.1.1](https://github.com/elixir-lang/tree-sitter-elixir/tree/v0.1.1) (2023-12-04)
+
+### Changed
+
+* Rewritten the custom scanner code in C ([#56](https://github.com/elixir-lang/tree-sitter-elixir/pull/56))
+
+### Fixed
+
+* Parsing empty interpolation ([#55](https://github.com/elixir-lang/tree-sitter-elixir/pull/55))
+* Fixed the repository URL in the Rust crate ([#57](https://github.com/elixir-lang/tree-sitter-elixir/pull/57))
+
## [v0.1.0](https://github.com/elixir-lang/tree-sitter-elixir/tree/v0.1.0) (2023-03-14)
Initial release.
diff --git a/vendored_parsers/tree-sitter-elixir/Cargo.toml b/vendored_parsers/tree-sitter-elixir/Cargo.toml
index 1638bf0153..352acf0044 100644
--- a/vendored_parsers/tree-sitter-elixir/Cargo.toml
+++ b/vendored_parsers/tree-sitter-elixir/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "tree-sitter-elixir"
description = "Elixir grammar for the tree-sitter parsing library"
-version = "0.1.0"
+version = "0.3.1"
keywords = ["incremental", "parsing", "elixir"]
categories = ["parsing", "text-editors"]
repository = "https://github.com/elixir-lang/tree-sitter-elixir"
@@ -20,7 +20,10 @@ include = [
path = "bindings/rust/lib.rs"
[dependencies]
-tree-sitter = ">= 0.19, < 0.21"
+tree-sitter-language = "0.1.0"
+
+[dev-dependencies]
+tree-sitter = "0.23.0"
[build-dependencies]
cc = "1.0"
diff --git a/vendored_parsers/tree-sitter-elixir/Makefile b/vendored_parsers/tree-sitter-elixir/Makefile
index 850068702b..bb0ab7ae65 100644
--- a/vendored_parsers/tree-sitter-elixir/Makefile
+++ b/vendored_parsers/tree-sitter-elixir/Makefile
@@ -1,4 +1,4 @@
-VERSION := 0.19.1
+VERSION := 0.3.1
# Repository
SRC_DIR := src
@@ -29,7 +29,7 @@ PCLIBDIR ?= $(LIBDIR)/pkgconfig
CPPSRC := $(wildcard $(SRC_DIR)/*.cc)
ifeq (, $(CPPSRC))
- ADDITIONALLIBS :=
+ ADDITIONALLIBS :=
else
ADDITIONALLIBS := -lc++
endif
diff --git a/vendored_parsers/tree-sitter-elixir/binding.gyp b/vendored_parsers/tree-sitter-elixir/binding.gyp
index a78b7a6710..000f958da8 100644
--- a/vendored_parsers/tree-sitter-elixir/binding.gyp
+++ b/vendored_parsers/tree-sitter-elixir/binding.gyp
@@ -2,18 +2,20 @@
"targets": [
{
"target_name": "tree_sitter_elixir_binding",
+ "dependencies": [
+ "
-#include "nan.h"
+#include
-using namespace v8;
+typedef struct TSLanguage TSLanguage;
-extern "C" TSLanguage * tree_sitter_elixir();
+extern "C" TSLanguage *tree_sitter_elixir();
-namespace {
+// "tree-sitter", "language" hashed with BLAKE2
+const napi_type_tag LANGUAGE_TYPE_TAG = {
+ 0x8AF2E5212AD58ABF, 0xD5006CAD83ABBA16
+};
-NAN_METHOD(New) {}
-
-void Init(Local