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

Syntax highlighting is not complete #17

Closed
yusufyildirim opened this issue Nov 20, 2020 · 4 comments
Closed

Syntax highlighting is not complete #17

yusufyildirim opened this issue Nov 20, 2020 · 4 comments

Comments

@yusufyildirim
Copy link

Hey ✋

First of all, thank you everyone for your effort. Things have started to come together recently and I wanted to test how well this extension works. Looks like syntax highlighting is not complete. TextMate grammar file needs some more regexps/scopes to be able to deliver much "complete" highlighting experience. I'd like to contribute to this and I've even started 😄. I wonder If anyone working on this? If not, I'm gonna continue.

Also, semantic highlighting would be awesome! I'd like to contribute to that too but I haven't dig into the rescript-editor-support yet. I believe that is where the tokenization, type on hover process etc. occurs. Looks like we need that info to make semantic highlighting possible.

P.S: I have no experience in VSCode extension development, language servers etc. Just trying to help and learn new things.

@chenglou
Copy link
Member

chenglou commented Dec 5, 2020

Hello! Thanks for looking at this. Regarding highlighting, currently we'd rather take a correct but minimal approach because the result is highly theme-dependent. There's a huge point of diminishing return where highlighting certain things bloats up the grammar a lot and also causes incorrect coloring in some themes. A bit hard to describe but we can provide the specifics depending on the use-case.

We won't be doing semantic highlighting for now, as it's highly async and can't replace the regular highlighting experience. So we'd end up with 2 systems that highlight differently, with a brief flash in-between...

Thanks for the help! I'll close this for now and you can feel free to open feature-specific issues =)

@chenglou chenglou closed this as completed Dec 5, 2020
@dchambers
Copy link

@chenglou, this is what I'm seeing on the default Dark+ theme:

image

where the function name, the function parameters, the function return type, and all of the delimiter characters are white. Do you know if this is the expected result, or is there anything I can do to improve the highlighting further?

@chenglou
Copy link
Member

chenglou commented Feb 7, 2021

Hey @dchambers. Hope you've seen my post at #8 (comment)

It's good that you're using the default at least. But yeah it really doesn't highlight things well. No punctuation, no operator, no bracket/braces highlighting even though we've assigned proper scopes to all of these. As a compromise (without messing with what I wrote in that issue), I've made the operators highlight for the default dark+ for now. Might explore further, but yeah, the default themes aren't that great (compared to, say, Sublime Text).

@dchambers
Copy link

Hi @chenglou, thanks so much for responding. The post you linked was very educational and helps me to understand what's actually going on here, and I fully support the approach you're taking. All of that said, thank you kindly for also making a small tweak to the extent that you were able to without compromising on the simplicity of the grammar that you have to maintain 👍.

Personally, I'm not too bothered about highly colourful IDEs (though they can be very beautiful), but I only thought to investigate what could be done as I noticed that it was taking me longer to mentally parse code I'd previously written. One upside though is that it's caused me to try even harder to further simplify the code I write so it stays readable.

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

3 participants