4 个版本
新 0.4.2 | 2024年8月22日 |
---|---|
0.4.1 | 2024年8月13日 |
0.4.0 | 2024年7月18日 |
0.3.0 | 2024年5月7日 |
127 在 文本编辑器
每月 135 次下载
480KB
17K SLoC
✨ Angular 的 Tree Sitter 语法 ✨
规范
此解析器是 steelsojka 的 tree-sitter-angular 的完整重写。此解析器扩展了 tree-sitter-html,因为新的 控制流 语法不是有效的 HTML 代码。
支持的功能
- 结构化指令
- 属性绑定
- 事件绑定
- 字符串插值
- if-语句(v17)
- for-语句(v17)
- switch-语句(v17)
- defer-语句(v17)
- ICU 消息格式
需求
- Neovim 建议使用夜间版本(因为它包括 Angular 模板的文件类型检测)
文件类型
在夜间 neovim 构建中(或发布 0.11.x),包含 Angular 模板的文件类型检测。它将基于内容检测 Angular HTML 模板,并将其文件类型设置为 htmlangular
。
如果您使用的是较旧版本,您必须自己设置文件类型。
例如,如果文件匹配模式 *.component.html
,则将其标记为 htmlangular
在 ~/.config/nvim/plugin/angular.lua
中创建一个 plugin
,如下所示
vim.filetype.add({
pattern = {
[".*%.component%.html"] = "htmlangular", -- Sets the filetype to `htmlangular` if it matches the pattern
},
})
LSP 或其他插件
您可能需要为其他插件包括此新文件类型(htmlangular
),例如 LSP 等
require('lspconfig').angularls.setup {
filetypes = { 'typescript', 'html', 'typescriptreact', 'typescript.tsx', 'htmlangular' }
}
问题
如果您遇到任何问题,请随时提交导致问题的代码问题。
依赖关系
~2.8–4MB
~74K SLoC