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

C# highlighting is not respecting the @ symbol in front of a parameter. #3764

Open
lananovikova10 opened this issue Jan 16, 2024 · 1 comment

Comments

@lananovikova10
Copy link

lananovikova10 commented Jan 16, 2024

Information:

  • Prism version: "1.27.0",
  • Plugins: none
  • Environment: [e.g. Browser, Node, Webpack]

Description
There seems to be a glitch, regarding C# syntax highlighting, not respecting @ symbol before a parameter.

To illustrate, when using the following markdown,

public TChild FirstOfTypeOrDefault(TChild @default = null);

Unexpectedly, 'default' gets highlighted in blue as if it's a keyword.

On the contrary, in this context, '@default' should be treated as a regular parameter and highlighted in black, as '@default' is not a keyword. Therefore, 'default' being highlighted in blue is incorrect.

The expected correct highlighting would treat 'default' as an identifier rather than a keyword, so it should be highlighted in black (or the color assigned for identifiers in your theme) instead of the blue color usually reserved for keywords. This is due to the @ symbol preceding it, which, in C#, effectively makes 'default' a valid identifier instead of a keyword.

Example

public TChild FirstOfTypeOrDefault(TChild @default = null);
@MrKWatkins
Copy link

MrKWatkins commented Jan 16, 2024

The same happens for contextual keywords, e.g. group:

public string SomeMethod(string group)

Group is highlighted in blue as a keyword but it should be black for a parameter name.

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

2 participants