Skip to content

Commit 61a6bf2

Browse files
committed
fix(engine): correct default regex flag
1 parent 5e66bf8 commit 61a6bf2

File tree

5 files changed

+79
-49
lines changed

5 files changed

+79
-49
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ packages/shiki/src/assets/*.json
1616
cache
1717
.eslintcache
1818
report-engine-js-compat.json
19+
scripts/compares

packages/core/src/engines/javascript.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class JavaScriptScanner implements PatternScanner {
2727
p
2828
// YAML specific handling; TODO: move to tm-grammars
2929
.replaceAll('[^\\s[-?:,\\[\\]{}#&*!|>\'"%@`]]', '[^\\s\\-?:,\\[\\]{}#&*!|>\'"%@`]'),
30-
{ flags: 'dg' },
30+
{ flags: 'dgm' },
3131
)
3232
cache?.set(p, regex)
3333
return regex

packages/shiki/test/engine-js/compare.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ const cases: Cases[] = [
6969
'const foo: string = "bar"',
7070
],
7171
},
72+
{
73+
name: 'jsonc',
74+
theme: () => import('../../src/assets/themes/nord'),
75+
lang: () => import('../../src/assets/langs/jsonc'),
76+
cases: [
77+
'// comment\n{"foo":"bar"}',
78+
],
79+
},
7280
]
7381

7482
describe('cases', async () => {

0 commit comments

Comments
 (0)