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

CM KCL: highlight property names, labeled args and annotations #5305

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mattmundell
Copy link
Contributor

What

In codemirror-lang-kcl, highlight property names in object definitions and labeled arguments in function calls.

Why

Hopefully makes the code easier to read.

In dark mode there's a lot of similar highlighting now. See below. I think that should be treated as a follow on issue, but I'm happy to adjust anything here. (Dark is highlighting fn names in fn calls and variable references whereas Light leaves them bare. Also Light is using the same color for variable names in variable definitions as it uses for properties and labels, whereas Dark is using a dedicated color for variable names in variable definitions.)

shot-li

shot

Copy link

qa-wolf bot commented Feb 7, 2025

QA Wolf here! As you write new code it's important that your test coverage is keeping up.
Click here to request test coverage for this PR!

Copy link

vercel bot commented Feb 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
modeling-app ✅ Ready (Inspect) Visit Preview Feb 14, 2025 7:06am

@jtran
Copy link
Collaborator

jtran commented Feb 13, 2025

Now that #5374 is merged, can you update to include annotations also? Usually, splitting changes that do separate things into separate PRs is good. But for the highlighting, we have screenshot tests that create a PNG snapshot. So it would be nice to do all that at once.

It is a bit strange that our light and dark mode highlighting doesn't match. But I wouldn't worry about fixing that here.

@mattmundell
Copy link
Contributor Author

Annotations in 98942a9.

I used CodeMirror's "annotation" highlight for the name, see the yellow in dark below.

For annotation property names I used the same highlight as for object properties and arg labels.

Note that unlabeled args are highlighted like annotations, as expected. See line 17 in dark below.

shot
shot-dark

It is a bit strange that our light and dark mode highlighting doesn't match.

Dark uses @codemirror/theme-one-dark, while light uses CodeMirror's base theme. Maybe CM needs a theme-one-light.

@mattmundell mattmundell changed the title CM KCL: highlight property names and labeled args CM KCL: highlight property names, labeled args and annotations Feb 14, 2025
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

Successfully merging this pull request may close these issues.

2 participants