HiPhish / nvim-ts-rainbow2

Rainbow delimiters for Neovim through Tree-sitter
https://gitlab.com/HiPhish/nvim-ts-rainbow2
Apache License 2.0
338 stars 35 forks source link

TSX - No handler for jsx-extended-rainbow-mode #1

Closed ada-x64 closed 1 year ago

ada-x64 commented 1 year ago

Describe the bug

When opening .tsx files, I get the following error:

E5108: [...] Vim(append):Error executing lua callback: /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:495: No handler for jsx-extended-rainbow-mode

Steps to reproduce

  1. Install nvim-ts-rainbow2 (I used packer)
  2. Use the config below
  3. Open a .tsx file, e.g. the example below

Config:

require 'nvim-treesitter.configs'.setup({
    highlight = {
        enable = true,
    },
    rainbow = {
        enable = true,
        query = {
            'rainbow-parens',
            'rainbow-tags',
        },
        extended_mode = true,
    }
})

Example code (default index.tsx from create-react-app):

import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';

const root = ReactDOM.createRoot(
  document.getElementById('root') as HTMLElement
);
root.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();

Expected behavior

Don't throw an error on TSX files and highlight properly.

Screenshots

Proper highlight (using nvim-ts-rainbow): image

Error message (moving through tabs, most of it is irrelevant stack trace): image

Improper highlighting: image

HiPhish commented 1 year ago

This fork is still going through a major refactoring. There won't be an extended mode anymore, instead you will be able to specify which query to use. I will also drop support for languages I don't know (tsx among them) because the queries will be rewritten from the ground up. Configuration will be different from the original plugin (hence why I call it rainbow 2).

I will have to rely on contributors to fill in the missing languages. So far I have been able to support 23 languages myself. Once the disclaimer in the README is gone this fork will be ready for use.

HiPhish commented 1 year ago

I am closing this issue since it is no longer applicable. Extended mode has been removed and support for tsx files needs to be added by someone who knows TSX properly