Code Monkey home page Code Monkey logo

Comments (17)

Widowan avatar Widowan commented on May 28, 2024 1

That marks it solved I guess, thanks for your work, feel free to close it if you don't need this issue.

from nvim-ts-rainbow.

p00f avatar p00f commented on May 28, 2024

Is the ((())) syntax valid? Do you see errors in the playground (nvim-treesitter-playground)? Does it also happen when you write normal stuff like foo(bar(lorem(ipsum)))

from nvim-ts-rainbow.

Widowan avatar Widowan commented on May 28, 2024

Bash: {{{}}} is a valid expression, no errors in playground, broken highlight. echo {{{}}} is a valid expression too, once again no errors and this time brackets are completely white.
((())) is not valid, there is an error, highlight broken
${arr[]} I find this example interesting - it is valid syntax and will fail only in runtime, no errors, broken highlight (first square bracket is highlighted, second is not). If you nest this expression (array[array[array[array[]]]]), highlight will break completely
image
if [[ ... ]] expressions are broken too:
image

Rust: valid except square brackets, without compiles and runs (it doesn't affect what showed on screenshots tho)
image

YAML: All three (((())), [[[]]], {{{}}}) are valid syntax, plain white

Lua: ((())) is not a valid syntax, however no errors from playground, normal chains (foo(bar(baz()))) work fine; [[[]]] isn't valid either, playground throws an error. {{{}}} is valid.

Python: everything works

from nvim-ts-rainbow.

p00f avatar p00f commented on May 28, 2024

👍

from nvim-ts-rainbow.

Widowan avatar Widowan commented on May 28, 2024

Small update - Bash's if [[ ]] (empty expression) is not valid syntax, although playground gives no errors; if it's not empty - it works.

from nvim-ts-rainbow.

Widowan avatar Widowan commented on May 28, 2024

image
It also seems like it doesn't work inside Lua blocks inside Vim files

from nvim-ts-rainbow.

p00f avatar p00f commented on May 28, 2024

Noted, thanks

from nvim-ts-rainbow.

optimizasean avatar optimizasean commented on May 28, 2024

I also am having no luck on any file types of getting it to work either.

from nvim-ts-rainbow.

p00f avatar p00f commented on May 28, 2024

${arr[]} I find this example interesting - it is valid syntax and will fail only in runtime, no errors, broken highlight (first square bracket is highlighted, second is not). If you nest this expression (array[array[array[array[]]]]), highlight will break completely

@Widowan Are you sure ${arr[]} is valid syntax? Because it's not actually indexing argv when you don't specify the index. When I put in an index there (${argv[1]}) it works.

array[array[array[array[]]]] and array[array[array[array[1]]]] give me a top-level error in the playground so I don't think I can do anything here.

Regarding the other ones, are nested empty brackets real use cases 😅 ?

For example

Rust: (although notice that deepest pair of round brackets are blue instead of purple)

But it totally works when you actually use the brackets.
image

from nvim-ts-rainbow.

p00f avatar p00f commented on May 28, 2024

@optimizasean can you share your config?

from nvim-ts-rainbow.

Widowan avatar Widowan commented on May 28, 2024

In case of ${arr[]} example wrong highlight may or may not be relevant to overlap (Please do note that I do not know anything about treesitter or plugin and this is pure speculation)
image

Here is, however, working example with no runtime errors and no parsing errors:
image
image

Other languages work good enough, although I am really curious about why those little things are happening with no treesitter parsing errors

from nvim-ts-rainbow.

p00f avatar p00f commented on May 28, 2024

image

image

Parsing here is totally wrong, it thinks of arr1[0 and arr[arr1[0] as one unit 😕

from nvim-ts-rainbow.

p00f avatar p00f commented on May 28, 2024

(this explains the wrong colour, both the cyan brackets in my screenshot are inside equally many nodes because the closing bracket is left out)

from nvim-ts-rainbow.

p00f avatar p00f commented on May 28, 2024

https://github.com/tree-sitter/tree-sitter-bash has open issues like this

from nvim-ts-rainbow.

p00f avatar p00f commented on May 28, 2024

In conclusion:

  1. Nested empty expressions are not really used, also if I wanted to make that work then #33 would be more prominent because I only count specific nodes to change color for all the languages in https://github.com/p00f/nvim-ts-rainbow/blob/master/lua/rainbow/levels.lua
  2. Bash - buggy parser
  3. Lua blocks in vimscript: I'll try to fix this

from nvim-ts-rainbow.

p00f avatar p00f commented on May 28, 2024

Nice, I created #72 for the lua-blocks-in-vimscript bug

from nvim-ts-rainbow.

optimizasean avatar optimizasean commented on May 28, 2024

Mentioning this issue here for some people that might see this and stumble into a fix: Issue 71 Configurations unclear - documentation improvements for the new nvim-mers

Also, @p00f my configuration is the same as in the linked issue above #71 (more complicated now that I got rainbow working).

Files must have a recognizeable extension for treesitter to know how to parse them, it must have support for that language, and you must have that language installed and configured (maintained v.s. all in linked issue - can also manually activate and install through TSInstall and TSEnable if I remember right). Then if you open that file with nvim, treesitter builds the tree properly and it should work.

^Notes of why it won't work if you just start a new nvim window = language cannot be recognized. That is a treesitter problem, not necessarily bug here. Also bash is weird but it works now...I think? Not the most advanced bash programmer here so maybe there is a case it doesn't work but I can verify that C# was *definitely working!

from nvim-ts-rainbow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.