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

Adding keyword 'record' 'init' 'nullable' (new syntax of C# 8, 9) #2991

merged 4 commits into from Jul 11, 2021


Copy link

@kmycode kmycode commented Jul 11, 2021

New syntax keyword is added on c# 8, 9.
This pull request is adding keywords record, init and nullable.

nullable (C# 8)

record, init (C# 9)


#nullable enable

class TestClass
  public string Keyword { get; init; }

record TestModel(string Name, uint Id, int Age);

Copy link

github-actions bot commented Jul 11, 2021

JS File Size Changes (gzipped)

A total of 1 files have changed, with a combined diff of +14 B (+0.6%).

file master pull size diff % diff
components/prism-csharp.min.js 2.35 KB 2.37 KB +14 B +0.6%

Generated by 🚫 dangerJS against 8b76e8b

Copy link

@RunDevelopment RunDevelopment left a comment

Choose a reason for hiding this comment

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

Thank you for the PR @kmycode!

I left you 2 comments.

Also, you have to rebuild Prism. Just run npm ci && npm run build and commit the changes.

Also also, please add tests for the new keywords (1, 2). Adding tests is relatively easy: Just modify the text (ignore the JSON for now) and run npm run test:languages -- --update. For more information, see this page.

components/prism-csharp.js Outdated Show resolved Hide resolved
components/prism-csharp.js Outdated Show resolved Hide resolved
Copy link
Contributor Author

kmycode commented Jul 11, 2021


Thank you for your review and works. I regret I didn't read development guides.
I see that the "record" keyword is difficult to implement.

I added some test codes. Please review again.

@RunDevelopment RunDevelopment merged commit 9b56156 into PrismJS:master Jul 11, 2021
Copy link

Great work! Thank you for contributing @kmycode!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants