Skip to content

Commit 787c216

Browse files
More syntax highlighting fix (#60)
* string escape newline with backslash * fix multiple divisions in the same line matched as regex * fixed some issues that failed test cases * Revert lockfile changes * Prefer modern corepack config over yarnpath * Update gitignore * Deduplicate dependencies * Use corepack in workflow --------- Co-authored-by: Richard Dominick <[email protected]>
1 parent e87a9f4 commit 787c216

File tree

7 files changed

+47
-40
lines changed

7 files changed

+47
-40
lines changed

.github/workflows/check.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ jobs:
88
steps:
99
- name: Checkout repository
1010
uses: actions/checkout@v4
11+
- name: Enable corepack for Yarn
12+
run: corepack enable
1113
- name: Setup NodeJS
1214
uses: actions/setup-node@v4
1315
with:
@@ -25,6 +27,8 @@ jobs:
2527
steps:
2628
- name: Checkout repository
2729
uses: actions/checkout@v4
30+
- name: Enable corepack for Yarn
31+
run: corepack enable
2832
- name: Setup NodeJS
2933
uses: actions/setup-node@v4
3034
with:

.github/workflows/publish.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ jobs:
3535
- name: Checkout repository
3636
uses: actions/checkout@v4
3737

38+
- name: Enable corepack for Yarn
39+
run: corepack enable
40+
3841
- name: Setup NodeJS
3942
uses: actions/setup-node@v4
4043
with:

.gitignore

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33

44
# Yarn Berry
55
.pnp.*
6-
.yarn/*
7-
!.yarn/patches
8-
!.yarn/plugins
9-
!.yarn/releases
10-
!.yarn/sdks
11-
!.yarn/versions
6+
.yarn/install-state.gz
127

138
# Intermediate files
149
syntaxes/source.tmLanguage.json
@@ -23,5 +18,5 @@ yarn-error.log
2318
# Misc
2419
.DS_Store
2520

26-
# No longer needed
21+
# Dependencies
2722
node_modules/

.yarnrc.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,5 +167,5 @@
167167
"showdown": "^2.1.0",
168168
"vscode-languageclient": "^9.0.1"
169169
},
170-
"packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
170+
"packageManager": "yarn@4.6.0"
171171
}

syntaxes/source.tmLanguage.yaml

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,18 +164,46 @@ repository:
164164
regex-literal:
165165
patterns:
166166
- name: invalid.illegal.string.regexp
167-
match: \/.+\/(?<!\/\/)(?!\/)\w*
167+
begin: '(?<=[=(:!,+-]|^|return)\s*(/)(?![/*+{}?])'
168+
end: "(/)[igm]*"
169+
beginCaptures:
170+
"0": { name: invalid.illegal.string.regexp }
171+
endCaptures:
172+
"0": { name: invalid.illegal.string.regexp }
173+
patterns:
174+
- name: constant.character.escape
175+
match: \\.
168176

169177
string:
170178
patterns:
171179
- name: string.quoted.double
172-
match: '".*"'
173-
captures:
174-
"0": { patterns: [{ include: "#string-character-escape" }] }
180+
begin: '"'
181+
beginCaptures:
182+
"0": { name: punctuation.definition.string.begin }
183+
end: '"'
184+
endCaptures:
185+
"0": { name: punctuation.definition.string.end }
186+
patterns:
187+
- include: "#string-character-escape"
188+
- match: '\\\n'
189+
name: constant.character.escape.newline
190+
- match: "\\\\(n|r|t|b|f|v|\\\\|\"|'|0|x[0-9A-Fa-f]{2}|u\\{[0-9A-Fa-f]+\\}|u[0-9A-Fa-f]{4})"
191+
name: constant.character.escape
192+
- match: '\\.'
193+
name: invalid.illegal.invalid-escape
175194
- name: string.quoted.single
176-
match: "'.*'"
177-
captures:
178-
"0": { patterns: [{ include: "#string-character-escape" }] }
195+
begin: "'"
196+
beginCaptures:
197+
"0": { name: punctuation.definition.string.begin }
198+
end: "'"
199+
endCaptures:
200+
"0": { name: punctuation.definition.string.end }
201+
patterns:
202+
- include: "#string-character-escape"
203+
- match: '\\\n'
204+
name: constant.character.escape.newline
205+
- match: '\\.'
206+
name: constant.character.escape
179207
- name: string.quoted.other
180208
begin: "`"
181209
end: "`"
@@ -204,7 +232,6 @@ repository:
204232
patterns:
205233
- include: "#comment"
206234
- include: "#block"
207-
- name: meta.arrow
208235

209236
function-call:
210237
patterns:

yarn.lock

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -981,19 +981,7 @@ __metadata:
981981
languageName: node
982982
linkType: hard
983983

984-
"debug@npm:4":
985-
version: 4.3.7
986-
resolution: "debug@npm:4.3.7"
987-
dependencies:
988-
ms: "npm:^2.1.3"
989-
peerDependenciesMeta:
990-
supports-color:
991-
optional: true
992-
checksum: 10c0/1471db19c3b06d485a622d62f65947a19a23fbd0dd73f7fd3eafb697eec5360cde447fb075919987899b1a2096e85d35d4eb5a4de09a57600ac9cf7e6c8e768b
993-
languageName: node
994-
linkType: hard
995-
996-
"debug@npm:^4.3.4, debug@npm:^4.4.0":
984+
"debug@npm:4, debug@npm:^4.3.4, debug@npm:^4.4.0":
997985
version: 4.4.0
998986
resolution: "debug@npm:4.4.0"
999987
dependencies:
@@ -2836,16 +2824,7 @@ __metadata:
28362824
languageName: node
28372825
linkType: hard
28382826

2839-
"semver@npm:^7.3.5":
2840-
version: 7.6.3
2841-
resolution: "semver@npm:7.6.3"
2842-
bin:
2843-
semver: bin/semver.js
2844-
checksum: 10c0/88f33e148b210c153873cb08cfe1e281d518aaa9a666d4d148add6560db5cd3c582f3a08ccb91f38d5f379ead256da9931234ed122057f40bb5766e65e58adaf
2845-
languageName: node
2846-
linkType: hard
2847-
2848-
"semver@npm:^7.3.7, semver@npm:^7.5.2, semver@npm:^7.5.4":
2827+
"semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.5.2, semver@npm:^7.5.4":
28492828
version: 7.7.1
28502829
resolution: "semver@npm:7.7.1"
28512830
bin:

0 commit comments

Comments
 (0)