Closed hamidreza4dev closed 1 year ago
Changing the file extension to html and changing it again to ejs solves the problem. Do you have any opinion at all?
local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
parser_config.embedded_template = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-embedded-template",
files = {"src/parser.c"},
requires_generate_from_grammar = false,
},
}
local ft_to_parser = require"nvim-treesitter.parsers".filetype_to_parsername
ft_to_parser.ejs = "embedded_template"
vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, {
pattern = "*.ejs",
command = "set filetype=ejs"
})
This works for me without having to install any other plugins. I think issue is that ejs is not a recognized file type so needs to be mapped to the embedded_template file type.
local parser_config = require "nvim-treesitter.parsers".get_parser_configs() parser_config.embedded_template = { install_info = { url = "https://github.com/tree-sitter/tree-sitter-embedded-template", files = {"src/parser.c"}, requires_generate_from_grammar = false, }, } local ft_to_parser = require"nvim-treesitter.parsers".filetype_to_parsername ft_to_parser.ejs = "embedded_template" vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { pattern = "*.ejs", command = "set filetype=ejs" })
This works for me without having to install any other plugins. I think issue is that ejs is not a recognized file type so needs to be mapped to the embedded_template file type.
This code worked and syntax highlighting was fixed. Do you have an idea to get auto-completion using cmp-nvim ?
I'm no expert but you can see my personal configs here https://github.com/p-m-p/nvim-config/blob/main/plugin/cmp.lua
Hi, I installed the plugin but I can't have syntax highlighting. I also typed these commands: :TSInstall ejs :TSBufEnable hightlight
My config repo : https://github.com/hamidreza4dev/dotfiles