#tree-sitter #vue #highlight

tree-sitter-vue-updated

vue grammar for the tree-sitter parsing library

1 unstable release

0.1.0 Sep 11, 2025

#1625 in Parser implementations

Download history 111/week @ 2025-11-13 52/week @ 2025-11-20 68/week @ 2025-11-27 452/week @ 2025-12-04 1659/week @ 2025-12-11 1023/week @ 2025-12-18 1193/week @ 2025-12-25 1322/week @ 2026-01-01 1938/week @ 2026-01-08 2457/week @ 2026-01-15 3225/week @ 2026-01-22 3163/week @ 2026-01-29 4703/week @ 2026-02-05 760/week @ 2026-02-12 50/week @ 2026-02-19 61/week @ 2026-02-26

6,204 downloads per month

MIT license

225KB
7.5K SLoC

C 7K SLoC C++ 315 SLoC // 0.0% comments JavaScript 210 SLoC Scheme 107 SLoC // 0.1% comments Rust 43 SLoC // 0.1% comments

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

Dependencies

~2.7–4MB
~78K SLoC