Skip to content

Commit e596b83

Browse files
authored
Update vscode-textmate and use vscode-oniguruma (#124)
* Update vscode-textmate and use vscode-oniguruma * Remove oniguruma dep * Prettier * Fix GutterCell in schema (unrelated to PR)
1 parent 07bed44 commit e596b83

File tree

7 files changed

+43
-22
lines changed

7 files changed

+43
-22
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@
6363
"decompress": "^4.2.0",
6464
"json5": "^2.1.1",
6565
"loglevel": "^1.6.4",
66-
"oniguruma": "^7.2.0",
6766
"plist": "^3.0.1",
6867
"unist-util-visit": "^1.4.1",
69-
"vscode-textmate": "4.2.2"
68+
"vscode-oniguruma": "^1.4.0",
69+
"vscode-textmate": "^5.2.0"
7070
},
7171
"jest": {
7272
"testMatch": [

src/createGetRegistry.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
11
// @ts-check
2+
const fs = require('fs');
3+
const path = require('path');
24
const logger = require('loglevel');
5+
const oniguruma = require('vscode-oniguruma');
36
const { getGrammarLocation, getGrammar, getAllGrammars } = require('./storeUtils');
47
const { readFile } = require('./utils');
58
const { Registry, parseRawGrammar } = require('vscode-textmate');
69

10+
const wasmBin = fs.readFileSync(path.join(require.resolve('vscode-oniguruma'), '../../release/onig.wasm')).buffer;
11+
const onigLib = oniguruma.loadWASM(wasmBin).then(() => {
12+
return {
13+
createOnigScanner(patterns) {
14+
return new oniguruma.OnigScanner(patterns);
15+
},
16+
createOnigString(s) {
17+
return new oniguruma.OnigString(s);
18+
}
19+
};
20+
});
21+
722
function createEmitter() {
823
/** @type {() => void} */
924
let subscriber;
@@ -75,7 +90,8 @@ function createGetRegistry() {
7590
}
7691
return acc;
7792
}, []);
78-
}
93+
},
94+
onigLib
7995
});
8096
}
8197
const unlock = await getLock();

src/graphql/schema.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,13 @@ declare namespace grvsc {
1919
defaultThemeTokenData: GRVSCThemeTokenData;
2020
additionalThemeTokenData: GRVSCThemeTokenData[];
2121
}
22+
interface GRVSCGutterCell {
23+
className?: string;
24+
text?: string;
25+
}
2226
interface GRVSCTokenizedLine {
2327
tokens: GRVSCToken[];
28+
gutterCells?: GRVSCGutterCell[];
2429
text: string;
2530
html: string;
2631
attrs: any;

src/graphql/schema.graphql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ type GRVSCToken {
1818
additionalThemeTokenData: [GRVSCThemeTokenData!]!
1919
}
2020
type GRVSCGutterCell {
21-
className: String!
22-
text: String!
21+
className: String
22+
text: String
2323
}
2424
type GRVSCTokenizedLine {
2525
tokens: [GRVSCToken!]!

test/__snapshots__/index.js.snap

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20502,8 +20502,8 @@ Object {
2050220502
Object {
2050320503
"lang": "embedded",
2050420504
"type": "html",
20505-
"value": "<pre class=\\"grvsc-container default-dark\\" data-language=\\"embedded\\" data-index=\\"0\\"><code class=\\"grvsc-code\\"><span class=\\"grvsc-line\\"><span class=\\"grvsc-source\\">const x = 3;</span></span>
20506-
<span class=\\"grvsc-line\\"><span class=\\"grvsc-source\\">// Comment</span></span></code></pre>",
20505+
"value": "<pre class=\\"grvsc-container default-dark\\" data-language=\\"embedded\\" data-index=\\"0\\"><code class=\\"grvsc-code\\"><span class=\\"grvsc-line\\"><span class=\\"grvsc-source\\"><span class=\\"mtk4\\">const </span><span class=\\"mtk12\\">x</span><span class=\\"mtk1\\"> = </span><span class=\\"mtk7\\">3</span><span class=\\"mtk1\\">;</span></span></span>
20506+
<span class=\\"grvsc-line\\"><span class=\\"grvsc-source\\"><span class=\\"mtk1\\">//</span><span class=\\"mtk12\\"> Comment</span></span></span></code></pre>",
2050720507
},
2050820508
Object {
2050920509
"children": Array [],
@@ -20517,6 +20517,10 @@ Object {
2051720517
background-color: #1E1E1E;
2051820518
color: #D4D4D4;
2051920519
}
20520+
.default-dark .mtk4 { color: #569CD6; }
20521+
.default-dark .mtk12 { color: #9CDCFE; }
20522+
.default-dark .mtk1 { color: #D4D4D4; }
20523+
.default-dark .mtk7 { color: #B5CEA8; }
2052020524
.default-dark .grvsc-line-highlighted::before {
2052120525
background-color: var(--grvsc-line-highlighted-background-color, rgba(255, 255, 255, 0.1));
2052220526
box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, rgba(255, 255, 255, 0.5));

test/data/embedded.tmLanguage.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
],
77
"version": "https://github.com/textmate/asp.vb.net.tmbundle/commit/72d44550b3286d0382d7be0624140cf97857ff69",
88
"name": "ASP vb.NET",
9-
"scopeName": "source.asp.vb.net",
9+
"scopeName": "source.embedded",
1010
"comment": "Modified from the original ASP bundle. Originally modified by Thomas Aylott subtleGradient.com",
1111
"patterns": [
1212
{

yarn.lock

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9393,7 +9393,7 @@ name-all-modules-plugin@^1.0.1:
93939393
resolved "https://registry.yarnpkg.com/name-all-modules-plugin/-/name-all-modules-plugin-1.0.1.tgz#0abfb6ad835718b9fb4def0674e06657a954375c"
93949394
integrity sha1-Cr+2rYNXGLn7Te8GdOBmV6lUN1w=
93959395

9396-
nan@^2.12.1, nan@^2.14.0:
9396+
nan@^2.12.1:
93979397
version "2.14.1"
93989398
resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.1.tgz#d7be34dfa3105b91494c3147089315eff8874b01"
93999399
integrity sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==
@@ -9797,13 +9797,6 @@ onetime@^5.1.0:
97979797
dependencies:
97989798
mimic-fn "^2.1.0"
97999799

9800-
oniguruma@^7.2.0:
9801-
version "7.2.1"
9802-
resolved "https://registry.yarnpkg.com/oniguruma/-/oniguruma-7.2.1.tgz#51775834f7819b6e31aa878706aa7f65ad16b07f"
9803-
integrity sha512-WPS/e1uzhswPtJSe+Zls/kAj27+lEqZjCmRSjnYk/Z4L2Mu+lJC2JWtkZhPJe4kZeTQfz7ClcLyXlI4J68MG2w==
9804-
dependencies:
9805-
nan "^2.14.0"
9806-
98079800
open@^6.4.0:
98089801
version "6.4.0"
98099802
resolved "https://registry.yarnpkg.com/open/-/open-6.4.0.tgz#5c13e96d0dc894686164f18965ecfe889ecfc8a9"
@@ -13789,12 +13782,15 @@ vm-browserify@^1.0.1:
1378913782
resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0"
1379013783
integrity sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==
1379113784

13792-
13793-
version "4.2.2"
13794-
resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-4.2.2.tgz#0b4dabc69a6fba79a065cb6b615f66eac07c8f4c"
13795-
integrity sha512-1U4ih0E/KP1zNK/EbpUqyYtI7PY+Ccd2nDGTtiMR/UalLFnmaYkwoWhN1oI7B91ptBN8NdVwWuvyUnvJAulCUw==
13796-
dependencies:
13797-
oniguruma "^7.2.0"
13785+
vscode-oniguruma@^1.4.0:
13786+
version "1.4.0"
13787+
resolved "https://registry.yarnpkg.com/vscode-oniguruma/-/vscode-oniguruma-1.4.0.tgz#3795fd1ef9633a4a33f208bce92c008e64a6fc8f"
13788+
integrity sha512-VvTl/jIAADEqWWpEYRsOI1sXiYOTDA8KYNgK60+Mb3T+an9zPz3Cqc6RVJeYgOx/P5G+4M4jygB3X5xLLfYD0g==
13789+
13790+
vscode-textmate@^5.2.0:
13791+
version "5.2.0"
13792+
resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-5.2.0.tgz#01f01760a391e8222fe4f33fbccbd1ad71aed74e"
13793+
integrity sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ==
1379813794

1379913795
w3c-hr-time@^1.0.2:
1380013796
version "1.0.2"

0 commit comments

Comments
 (0)