Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No JSX support #99

Open
2 tasks done
patchworkCode opened this issue Feb 28, 2022 · 9 comments
Open
2 tasks done

No JSX support #99

patchworkCode opened this issue Feb 28, 2022 · 9 comments

Comments

@patchworkCode
Copy link

Environment:

  • OS
  • Vim (:version)
  • Terminal

If you have a trouble with coloration and are using Vim/Neovim with terminal:

  • Does your Vim support full colors? (:set termguicolors)
  • Does your terminal support full colors? (e.g. Terminal.app doesn't support it)

Other colorschemes I have tried support JSX, but it seems iceberg doesn't..

image

@fragov
Copy link

fragov commented Apr 22, 2022

I have same issue.

@fragov
Copy link

fragov commented Apr 23, 2022

Theme on image is not iceberg, but here we can see how TS defines JSX tags.
image

TSConstructor and TSVariable both set to icebergNormalFg, so all tags in JSX are white.
When I comment those two lines in iceberg.vim, JSX tags get green color:

hi! link TSConstructor icebergNormalFg
hi! link TSVariable icebergNormalFg

Properties in JSX tags (TSProperty) are set to TSField, TSField again to icebergNormalFg, which again makes them all white:

hi! link TSField icebergNormalFg
hi! link TSProperty TSField

@fragov
Copy link

fragov commented Apr 23, 2022

@cocopon will you have time to bring TreeSitter highlighting to working condition?

@cocopon
Copy link
Owner

cocopon commented Apr 24, 2022

Okay, I'm looking into the issue... First, what is the file type of the buffer? It seems that the file extension of the file is js, not jsx.

I have tried a small code with the name foobar.jsx (:echo &ft returns javascript.jsx) and it seems to work fine:

image

:TSHighlightCapturesUnderCursor:
image

@fragov
Copy link

fragov commented Apr 24, 2022

You are using just HTML tags, which are parsed better:
Capto_Capture 2022-04-24_02-48-06_PM

JSX tags have additional highlights groups (I tried both tsx and jsx files):
Capto_Capture 2022-04-24_02-49-21_PM

BTW: on this and also on your's screenshot you may see another problem. I believe NormalFloat highlights is set wrong, so we have that black box around the floating window. If you select this box (I just select it with my mouse), you will see borders.

When you compare how typescript code is looking on screenshots from colorswat.ch, you also see some differences. On those old screenshots, I see that functions have orange and some other parts also have different colors. But with Treesitter there is really a lot of white color. :)

@cocopon
Copy link
Owner

cocopon commented Apr 26, 2022

You are using just HTML tags, which are parsed better:

The original issue by @patchworkCode contains HTML tags. Your issue seems a bit different.


hi! link TSConstructor icebergNormalFg
hi! link TSVariable icebergNormalFg

These links are intentional. One of the concept of Iceberg is: don't get fancy, focusing few important things. I think that the white color is good for user-defined tags because this is a kind of variable.


Anyway it's good to add highlighting for tag attributes, so added it in 5ac9da6:

image

@patchworkCode
Copy link
Author

I'm not sure whether things have been updated as I use another theme now, however my image is an example of JavaScript react which when I was iceberg before would be rendered as plaintext.

@fragov
Copy link

fragov commented Apr 27, 2022

@patchworkCode have you Treesitter installed and tsserver for it?

@ecklf
Copy link

ecklf commented Jul 17, 2022

These links are intentional. One of the concept of Iceberg is: don't get fancy, focusing few important things. I think that the white color is good for user-defined tags because this is a kind of variable.

I am slightly bothered about the difference I experience between editors. Not trying to change your conscious decision here, I'd just love to see consistency 👍.

Here are some screenshots when using the filetype typescriptreact:

VSCode:
Screen Shot 2022-07-17 at 08 18 19

Neovim (treesitter + tsserver) - Highlight enabled:
Screen Shot 2022-07-17 at 08 15 35

Neovim (treesitter + tsserver) - Highlight disabled:
Screen Shot 2022-07-17 at 08 15 26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants