{"id":28411,"library":"tree-sitter-elixir","title":"tree-sitter-elixir","description":"Elixir grammar for tree-sitter, providing parsing, syntax highlighting, and code navigation for Elixir files. Current version 0.3.5, requires Python >=3.9. Released irregularly, tied to tree-sitter updates.","status":"active","version":"0.3.5","language":"python","source_language":"en","source_url":"https://github.com/elixir-lang/tree-sitter-elixir","tags":["tree-sitter","elixir","parser","syntax-highlighting"],"install":[{"cmd":"pip install tree-sitter-elixir","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Core library for parser generation and execution.","package":"tree-sitter","optional":false}],"imports":[{"note":"The correct symbol is a function 'language()', not a class. Importing 'Language' gives the tree-sitter built-in class, not this grammar.","wrong":"from tree_sitter_elixir import Language","symbol":"Language","correct":"from tree_sitter_elixir import language"}],"quickstart":{"code":"from tree_sitter import Language, Parser\n\n# Load the Elixir language as a shared object\nELIXIR_LANGUAGE = Language('tree_sitter_elixir', 'elixir')\n\n# Create a parser and set the language\nparser = Parser()\nparser.set_language(ELIXIR_LANGUAGE)\n\n# Parse some Elixir code\ntree = parser.parse(b\"\"\"\ndefmodule MyModule do\n  def hello do\n    :world\n  end\nend\n\"\"\")\n\nprint(tree.root_node.sexp())","lang":"python","description":"Basic usage: load the Elixir language, parse a source string, and print the syntax tree."},"warnings":[{"fix":"Ensure tree-sitter is installed at version 0.21 or later: pip install 'tree-sitter>=0.21'","message":"Version 0.3.0 changed the Rust crate dependency to tree-sitter-language instead of tree-sitter. Python package may require tree-sitter >=0.21.","severity":"breaking","affected_versions":">=0.3.0"},{"fix":"Update custom queries to use #any-of? instead of #match? when matching multiple values.","message":"The built-in queries in 0.3.4 replaced #match? predicates with #any-of?. Custom queries using #match? may need updating.","severity":"deprecated","affected_versions":">=0.3.4"},{"fix":"Use 'from tree_sitter_elixir import language' (lowercase) and call language() to get the language object.","message":"The language() function from tree_sitter_elixir is misspelled as 'language' (lowercase 'l') while the official tree-sitter Python binding uses 'Language' (uppercase). This causes confusion.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Run: pip install tree-sitter-elixir","cause":"Package not installed.","error":"ModuleNotFoundError: No module named 'tree_sitter_elixir'"},{"fix":"Upgrade tree-sitter: pip install --upgrade tree-sitter","cause":"Outdated tree-sitter version (<0.20).","error":"AttributeError: module 'tree_sitter' has no attribute 'Language'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}