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
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Support unlimited sharps in raw string
Credits to @alexschord
  • Loading branch information
HKalbasi authored Feb 6, 2022
commit 95f678e7b0eed82fa31c7f631d9f6b1a24ff18f1
15 changes: 10 additions & 5 deletions ui/frontend/editor/rust_monaco_def.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ export const grammar: languages.IMonarchLanguage = {
tokenizer: {
root: [
[/r"/, { token: 'string.quote', next: '@rawstring0' }],
[/r#"/, { token: 'string.quote', next: '@rawstring1' }],
[/r##"/, { token: 'string.quote', next: '@rawstring2' }],
[/r(#+)"/, { token: 'string.quote', next: '@rawstring1.$1' }],
// identifiers and keywords
[/[a-z_$][\w$]*/, {
cases: {
Expand Down Expand Up @@ -134,9 +133,15 @@ export const grammar: languages.IMonarchLanguage = {
],

rawstring0: [[/[^"]+/, 'string'], [/"/, { token: 'string.quote', next: '@pop' }]],
rawstring1: [[/[^"#]+/, 'string'], [/"#/, { token: 'string.quote', next: '@pop' }]],
rawstring2: [[/[^"##]+/, 'string'], [/"##/, { token: 'string.quote', next: '@pop' }]],

rawstring1: [
[/"(#+)/, {
cases: {
'$1==$S2': { token: 'string.quote', next: '@pop' },
'@default': { token: 'string' },
},
}],
[/./, 'string'],
],
string: [
[/[^\\"]+/, 'string'],
[/@escapes/, 'string.escape'],
Expand Down