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 functions, variables and numbers #2088

Merged
merged 6 commits into from
Jan 7, 2025

Conversation

Morcifer
Copy link
Contributor

@Morcifer Morcifer commented Jan 4, 2025

Supports syntax highlighting for:

  • function definitions
  • function calls
  • numbers
  • variables

See issue #1950.

The change for function calls also applies to operation definitions and to attributes (see bigger example below).
The change for variables also applies to attributes and to imports.

I might be nice to make attributes and imports get their own designated rules. I can do them as part of this PR, but I think it might be best to do as a followup issue - because I believe this PR is actually already an improvement for them.

Simple example for the change (from the original issue description):

image

And a bigger example:

image

@Morcifer
Copy link
Contributor Author

Morcifer commented Jan 4, 2025

I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.

@microsoft-github-policy-service agree

@swernli
Copy link
Collaborator

swernli commented Jan 5, 2025

Thanks for the contribution, @Morcifer! One idea I had after looking at your screenshots: would it be possible to use the presence of the @ symbol to avoid highlighting attributes like @Config() and @EntryPoint() as if they were function calls?

@Morcifer
Copy link
Contributor Author

Morcifer commented Jan 6, 2025

would it be possible to use the presence of the @ symbol to avoid highlighting attributes like @Config() and @EntryPoint() as if they were function calls?

It's definitely possible (see latest commit):

image

Though it still treats the attributes inside the parentheses of the Config as variables... I think it might be simpler and probably more future-proof to just make a Config-specific rule, rather than to figure out how to disable that one.

@swernli
Copy link
Collaborator

swernli commented Jan 6, 2025

I think the items inside the parens of @Config look fine in the screenshot you posted. This is indeed a nice improvement!

Copy link
Member

@minestarks minestarks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great improvement, thank you!

@swernli swernli added this pull request to the merge queue Jan 7, 2025
Merged via the queue into microsoft:main with commit 1a930f6 Jan 7, 2025
18 checks passed
@Morcifer Morcifer deleted the syntax-highlighting branch January 16, 2025 17:29
@Morcifer Morcifer restored the syntax-highlighting branch January 16, 2025 17:29
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.

3 participants