@elm-tooling/tree-sitter-elm

中文文档
5.9.4发布于 2026/07/08MITTypeScriptCommonJS构建来源已验证近 30 天下载 8635

Tree sitter definitions for elm

原始使用文档
文档目录4 节
  1. Why am I doing this?
  2. What is this tested with?
  3. Thanks
  4. Want to help?

Build Status

Elm tree sitter

Why am I doing this?

I believe that Elm would greatly benefit from better tooling, the ultimate goal is to write a language server integration. This is a possible building block for that.

What it brings to the table:

  • Very fast parsing, should enable parsing on each keystroke.
  • Resilient, even if you use wrong syntax, most of the file should still be recognized alright.
  • Should also be useful to the elm atom maintainers, as atom is using tree sitter as the new default for code highlighting (our ast might be too expressive). Highlight implementation still needs to be done if wanted.

What is this tested with?

This is tested against the tests included in the repo and:

So it should work fine for a fair amount of code. What's not tested right now is behavior in error cases.

Thanks

Very very big thanks goes out to @klazuka and the people of intellij-elm as I basically stole how they're creating their parser minus the GLSL implementation.

Want to help?

Help writing some tests or simply find valid elm files, that fail parsing. Test are located in the test folder and separated in parser tests and highlighting tests.

版本与发布记录

@elm-tooling/tree-sitter-elm 共发布 29 个版本,首次发布于 2021/02/21;过去 12 个月发布了 2 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
5.9.4latest2026/07/084 个月前
5.9.02025/11/2611 个月前
5.8.02025/03/301.6 年前
5.7.02023/12/232 年前
5.6.62023/07/303 年前
5.6.52023/07/253 年前

关于 @elm-tooling/tree-sitter-elm 的常见问题

@elm-tooling/tree-sitter-elm 是什么?

Tree sitter definitions for elm

如何安装 @elm-tooling/tree-sitter-elm?

在项目目录运行 npm install @elm-tooling/tree-sitter-elm,或使用 pnpm add / yarn add / bun add。

@elm-tooling/tree-sitter-elm 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@elm-tooling/tree-sitter-elm 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@elm-tooling/tree-sitter-elm 可以商用吗?

@elm-tooling/tree-sitter-elm 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@elm-tooling/tree-sitter-elm 的下载量有多少?

根据 npm 官方下载统计,@elm-tooling/tree-sitter-elm 在 2026/10/14 – 2026/11/12 这 30 天内被下载 8,635 次,日均约 288 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@elm-tooling/tree-sitter-elm 还在维护吗?

最新版本 5.9.4 发布于 2026/07/08(4 个月前);至今共发布 29 个版本,其中过去 12 个月发布了 2 个;首次发布于 2021/02/21。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。