Vue grammar for tree-sitter
  • JavaScript 41.2%
  • C++ 18.7%
  • Rust 17.5%
  • Tree-sitter Query 14.3%
  • Vue 4.5%
  • Other 3.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Balazs Horvath e2421e39f7 Remove dead tree-sitter gitlink
The submodule entry remained after .gitmodules was deleted, breaking
libgit2-based fetches (cargo update failed with: no URL configured for
submodule 'tree-sitter'). The Rust build uses the git.sly.so tree-sitter
dependency directly, so the local copy is untracked tooling only.
2026-08-03 11:56:43 +02:00
bindings Rewrite Rust bindings for multicrate tree-sitter API 2026-08-03 11:55:40 +02:00
corpus feat: add ts js highlight 2022-09-24 11:46:28 +08:00
docs chore(release): 0.2.1 2021-03-21 20:22:59 +08:00
queries feat: add ts js highlight 2022-09-24 11:46:28 +08:00
scripts chore: upgrade to tree-sitter@0.16.7 2020-10-02 16:57:11 +08:00
src feat: add ts js highlight 2022-09-24 11:46:28 +08:00
test feat: add ts js highlight 2022-09-24 11:46:28 +08:00
.editorconfig feat: initial implementation 2019-10-04 19:40:39 +08:00
.gitattributes feat: initial implementation 2019-10-04 19:40:39 +08:00
.gitignore Remove dead tree-sitter gitlink 2026-08-03 11:56:43 +02:00
.npmignore feat: initial implementation 2019-10-04 19:40:39 +08:00
.travis.yml feat: initial implementation 2019-10-04 19:40:39 +08:00
binding.gyp feat: upgrade to tree-sitter@0.19.3 2021-03-14 19:07:22 +08:00
Cargo.toml Rewrite Rust bindings for multicrate tree-sitter API 2026-08-03 11:55:40 +02:00
CHANGELOG.md chore(release): 0.2.1 2021-03-21 20:22:59 +08:00
grammar.js feat: add ts js highlight 2022-09-24 11:46:28 +08:00
LICENSE feat: initial implementation 2019-10-04 19:40:39 +08:00
package.json feat: add vue highlight supply 2022-09-23 15:03:00 +08:00
README.md feat: initial implementation 2019-10-04 19:40:39 +08:00
ThirdPartyNoticeText.txt feat: initial implementation 2019-10-04 19:40:39 +08:00
yarn.lock build(deps): bump y18n from 4.0.0 to 4.0.1 (#9) 2021-04-04 11:51:48 +08:00

tree-sitter-vue

npm build

Vue (Vue v2.6.0 Template Syntax) grammar for tree-sitter

Note: This grammar is not responsible for parsing embedded languages, see Multi-language Documents for more info.

Changelog

Install

npm install tree-sitter-vue tree-sitter

Usage

const Parser = require("tree-sitter");
const Vue = require("tree-sitter-vue");

const parser = new Parser();
parser.setLanguage(Vue);

const sourceCode = `
<template>
  Hello, <a :[key]="url">{{ name }}</a>!
</template>
`;

const tree = parser.parse(sourceCode);
console.log(tree.rootNode.toString());
// (component
//   (template_element
//     (start_tag
//       (tag_name))
//       (text)
//       (element
//         (start_tag
//           (tag_name)
//           (directive_attribute
//             (directive_name)
//             (directive_dynamic_argument
//               (directive_dynamic_argument_value))
//             (quoted_attribute_value
//               (attribute_value))))
//         (interpolation
//           (raw_text))
//         (end_tag
//           (tag_name)))
//       (text)
//     (end_tag
//       (tag_name))))

License

MIT © Ika