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 for @doc, @moduledoc and @typedoc can be a bit distracting #91

Closed
doughsay opened this issue Jan 7, 2025 · 5 comments

Comments

@doughsay
Copy link

doughsay commented Jan 7, 2025

With the recent addition of Markdown syntax highlighting for @doc, @moduledoc and @typedoc (#90) it makes scanning code a bit harder, because large documentation blocks have the same default text color and syntax highlighting colors as the actual code.

Comparing it to how other languages do documentation highlighting (for example TSDoc in TypeScript files), we see that they at least use the default comment color as the default text color, making it easier to identify blocks of documentation vs blocks of code.

Expected behavior

I'd love it if we could keep the markdown highlighting / language awareness, but change the default text color to match comments. I know this might not be possible, or might be hard, but that (I think) would be the ideal solution.

Example screenshots

With Markdown syntax highlighting, it's harder to quickly scan the code and distinguish documentation blocks from code blocks:

Screenshot from 2025-01-07 13-50-40

Without Markdown highlighting (this is ElixirLS's vscode extension, so the colors are different):

Screenshot from 2025-01-07 12-01-57

Example of TypeScript, showing the default color being the comment color:

Screenshot from 2025-01-07 13-46-53

@lucavenir
Copy link

lucavenir commented Jan 7, 2025

My two cents: I think I prefer the comment color better. Furthermore, the typescript example is even more noisy imho, I don't feel like that's a "middle ground".

To me it's hard to distinguish between examples, docs and actual code; I think this will be especially true if you're even a tiny bit neurodivergent (e.g. dysgraphia/dyslexia).

Maybe a third way would be to toggle this setting in lexical's settings?

@objectuser
Copy link

So far, when editing a file with a comment containing markdown, I don't find it useful to have the markdown contents highlighted there. For me, the purpose is to get useful when using the module/function (through the hover popup). It's more noisy than useful when editing the file itself.

@Blond11516
Copy link
Collaborator

Blond11516 commented Jan 10, 2025

Thanks to you three for your input!

I agree the current solution isn't ideal. Making it configurable sadly isn't easy to I think do because grammars are statically defined in JSON files, so they can't be affected by settings.

I'll have to research if

  1. It's possible to define or "load" a grammar in code, which would allow user configuration
  2. There's a way to change the default text color for the embedded markdown. Off the top of my head I'm not sure it is possible but I'll try to find similar situations in other languages and see how they handle this.

I might not have a lot of time to work on this soon though, so I might end up reverting the change since I agree the current highlighting is very distracting.

@Terbium-135
Copy link
Contributor

Terbium-135 commented Jan 10, 2025

I'd say revert the change for now until we find a better solution (if any at all) so people have the developer experience they are used to

@Blond11516
Copy link
Collaborator

I've reverted the markdown syntax highlighting and published a new version.

I'll close this issue. @Terbium-135 feel free to open a new issue or PR if you want to revisit this, I'll be happy to review it, but I personally won't be spending too much time researching this in the foreseeable future.

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

5 participants