Crates.io | tree-sitter-angular |
lib.rs | tree-sitter-angular |
version | 0.5.0 |
source | src |
created_at | 2024-05-07 14:01:54.349427 |
updated_at | 2024-09-23 07:03:49.108053 |
description | Angular grammar for tree-sitter |
homepage | |
repository | https://github.com/tree-sitter/tree-sitter-angular |
max_upload_size | |
id | 1232207 |
size | 686,484 |
This parser is a complete rewrite of steelsojka's tree-sitter-angular. This parser extends tree-sitter-html because the new Control Flow syntax is not valid HTML code.
In the nightly neovim built (or release 0.11.x), the filetype detection for Angular templates is included. It will detect Angular HTML templates, based on it's contents, and set the filetype to htmlangular
.
If you are using an older version, you must set the filetype yourself.
E.g. mark the file as htmlangular
if it matches the pattern *.component.html
:
Create a plugin
in ~/.config/nvim/plugin/angular.lua
with the following:
vim.filetype.add({
pattern = {
[".*%.component%.html"] = "htmlangular", -- Sets the filetype to `htmlangular` if it matches the pattern
},
})
You may need to include this new filetype (htmlangular
) for other plugins, like LSP for example:
require('lspconfig').angularls.setup {
filetypes = { 'typescript', 'html', 'typescriptreact', 'typescript.tsx', 'htmlangular' }
}
If you experience any issues, please feel free to open an issue with the code that's causing problems.