Skip to content

Fix Monaco bugs #773

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

Merged
merged 3 commits into from
Feb 6, 2022
Merged

Fix Monaco bugs #773

merged 3 commits into from
Feb 6, 2022

Conversation

HKalbasi
Copy link
Member

fix #771
fix #770
fix #769

@@ -158,7 +158,7 @@ module.exports = function(_, argv) {
}),
new MonacoWebpackPlugin({
filename: `${filenameTemplate}.worker.js`,
languages: ['rust'],
languages: [],
Copy link
Member

Choose a reason for hiding this comment

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

Why this change?

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't need their grammar because we use our own anyway. It should save some bits.

const MODE_ID = 'my-rust';
const MODE_ID = 'rust';
Copy link
Member

Choose a reason for hiding this comment

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

Why this change?

Copy link
Member Author

Choose a reason for hiding this comment

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

Somethings (like hover snippets) can not be set to use my-rust. Not related to the issues, but still something that isn't correct.

@shepmaster shepmaster added bug The playground isn't doing what it was intended to enhancement Something new the playground could do labels Feb 6, 2022
@shepmaster
Copy link
Member

In the future, please create separate commits (or separate PRs if applicable) and use the commit message to describe what the commit is doing and why.

@shepmaster shepmaster added the CI: approved Allowed access to CI secrets label Feb 6, 2022
@shepmaster shepmaster changed the title Fix monaco bugs Fix Monaco bugs Feb 6, 2022
Comment on lines 74 to 76
[/r"/, { token: 'string.quote', next: '@rawstring0' }],
[/r#"/, { token: 'string.quote', next: '@rawstring1' }],
[/r##"/, { token: 'string.quote', next: '@rawstring2' }],
Copy link

Choose a reason for hiding this comment

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

Won't doing it this way only support raw strings with up to two #s? The ace editor supports an unlimited amount of #s, and I'd be amazed if this Monaco tokenizer engine wasn't built to offer up a way to match the starting #s to the ending #s.

Copy link

Choose a reason for hiding this comment

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

This ought to do it (see also second suggestion below):

Suggested change
[/r"/, { token: 'string.quote', next: '@rawstring0' }],
[/r#"/, { token: 'string.quote', next: '@rawstring1' }],
[/r##"/, { token: 'string.quote', next: '@rawstring2' }],
[/r"/, { token: 'string.quote', next: '@rawstring0' }],
[/r(#+)"/, { token: 'string.quote', next: '@rawstring1.$1' }],

Copy link
Member Author

Choose a reason for hiding this comment

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

I applied your suggestion, thanks!

Copy link

@ilyvion ilyvion left a comment

Choose a reason for hiding this comment

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

This should allow an unlimited amount of # usage in raw strings.

Comment on lines 74 to 76
[/r"/, { token: 'string.quote', next: '@rawstring0' }],
[/r#"/, { token: 'string.quote', next: '@rawstring1' }],
[/r##"/, { token: 'string.quote', next: '@rawstring2' }],
Copy link

Choose a reason for hiding this comment

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

This ought to do it (see also second suggestion below):

Suggested change
[/r"/, { token: 'string.quote', next: '@rawstring0' }],
[/r#"/, { token: 'string.quote', next: '@rawstring1' }],
[/r##"/, { token: 'string.quote', next: '@rawstring2' }],
[/r"/, { token: 'string.quote', next: '@rawstring0' }],
[/r(#+)"/, { token: 'string.quote', next: '@rawstring1.$1' }],

@shepmaster shepmaster added CI: approved Allowed access to CI secrets and removed CI: approved Allowed access to CI secrets labels Feb 6, 2022
@shepmaster shepmaster merged commit 11c9913 into rust-lang:master Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The playground isn't doing what it was intended to CI: approved Allowed access to CI secrets enhancement Something new the playground could do
Projects
None yet
3 participants