p00f / nvim-ts-rainbow

Rainbow parentheses for neovim using tree-sitter. Use https://sr.ht/~p00f/nvim-ts-rainbow instead
Apache License 2.0
869 stars 67 forks source link

Add EJS? #139

Closed rodhash closed 2 years ago

rodhash commented 2 years ago

Hello,

Is it possible to add EJS chars for HTML lang? Like "<%" and "<%=" for opening and "%>" for closing. I tried myself but no luck there.

Thanks

rodhash commented 2 years ago

One more thing that would be nice is to not match ">" in the middle of the line.

Currently my "=>" for the callback fn became half highlighted:

image

Or perhaps would be ok to apply the highlight when it's actually closing with %> as I have inside my <li> tag.

p00f commented 2 years ago

Can you paste an example

rodhash commented 2 years ago

Sorry delay..

Sure, in this example I'm updating the title:

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title><%= pageTitle %></title>
    <link rel="stylesheet" href="/css/main.css">
    <link rel="stylesheet" href="/css/forms.css">
    <link rel="stylesheet" href="/css/product.css">
</head>

Here, it's a full file (404.ejs) with 3 different includes:

<%- include('./includes/head.ejs') %>

</head>
<%- include('./includes/navigation.ejs') %>

<body>
    <h1>Page Not Found!</h1>

<%- include('./includes/end.ejs') %>

Here, we have two variables kindofday and el and a array method being used forEach:

<body>
    <h1><%= kindOfDay %> </h1>

    <ul>
        <% itemList.forEach( el => { %>
            <li><%= el %> </li>
        <% }) %>
    </ul>
</body>
p00f commented 2 years ago

tree-sitter doesn't recognise them: image

p00f commented 2 years ago

nvim-treesitter needs to add the embedded_template language (no checkmark): https://github.com/nvim-treesitter/nvim-treesitter#supported-languages