Comments (17)
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.
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.
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
if [[ ... ]]
expressions are broken too:
Rust: valid except square brackets, without compiles and runs (it doesn't affect what showed on screenshots tho)
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.
👍
from nvim-ts-rainbow.
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.
It also seems like it doesn't work inside Lua blocks inside Vim files
from nvim-ts-rainbow.
Noted, thanks
from nvim-ts-rainbow.
I also am having no luck on any file types of getting it to work either.
from nvim-ts-rainbow.
${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.
from nvim-ts-rainbow.
@optimizasean can you share your config?
from nvim-ts-rainbow.
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)
Here is, however, working example with no runtime errors and no parsing errors:
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.
Parsing here is totally wrong, it thinks of arr1[0
and arr[arr1[0]
as one unit 😕
from nvim-ts-rainbow.
(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.
https://github.com/tree-sitter/tree-sitter-bash has open issues like this
from nvim-ts-rainbow.
In conclusion:
- 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
- Bash - buggy parser
- Lua blocks in vimscript: I'll try to fix this
from nvim-ts-rainbow.
Nice, I created #72 for the lua-blocks-in-vimscript bug
from nvim-ts-rainbow.
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)
- tsx html element change color too HOT 1
- Can't get the plugin to work HOT 13
- Not sure whether it is a bug or expected behavour, but loading this extension plugin before any colorscheme throws error
- Tsx colors are the other way around HOT 5
- TSX colors still appear broken HOT 10
- JSX is not highlighted in files with `jsx` extension HOT 2
- Highlight `do` and `and` keywords for elixir HOT 3
- My rainbow doesn't work HOT 2
- Question: how to get vertical lines? HOT 1
- Update readme to mention how to install HOT 1
- Treesitter hl map has been removed in neovim nightly HOT 4
- Add support for Makefiles HOT 8
- Add EJS? HOT 5
- Colorized bracket inside python f-strings HOT 1
- Only work when execute :e to reload current file or :TSEnable rainbow HOT 10
- Autoformatting breaks highlights HOT 2
- Rainbow doesn't work in header file c HOT 6
- Lines with inline comments get wrong color HOT 1
- Rainbow Matching Pairs for JavaScript's styled-components Library HOT 5
- Colors of tags in tsx file are messed up after inserting new tag HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nvim-ts-rainbow.