Skip to content

Commit

Permalink
Update vscode-textmate and use vscode-oniguruma (#124)
Browse files Browse the repository at this point in the history
* Update vscode-textmate and use vscode-oniguruma

* Remove oniguruma dep

* Prettier

* Fix GutterCell in schema (unrelated to PR)
  • Loading branch information
andrewbranch authored Oct 11, 2020
1 parent 07bed44 commit e596b83
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 22 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@
"decompress": "^4.2.0",
"json5": "^2.1.1",
"loglevel": "^1.6.4",
"oniguruma": "^7.2.0",
"plist": "^3.0.1",
"unist-util-visit": "^1.4.1",
"vscode-textmate": "4.2.2"
"vscode-oniguruma": "^1.4.0",
"vscode-textmate": "^5.2.0"
},
"jest": {
"testMatch": [
Expand Down
18 changes: 17 additions & 1 deletion src/createGetRegistry.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
// @ts-check
const fs = require('fs');
const path = require('path');
const logger = require('loglevel');
const oniguruma = require('vscode-oniguruma');
const { getGrammarLocation, getGrammar, getAllGrammars } = require('./storeUtils');
const { readFile } = require('./utils');
const { Registry, parseRawGrammar } = require('vscode-textmate');

const wasmBin = fs.readFileSync(path.join(require.resolve('vscode-oniguruma'), '../../release/onig.wasm')).buffer;
const onigLib = oniguruma.loadWASM(wasmBin).then(() => {
return {
createOnigScanner(patterns) {
return new oniguruma.OnigScanner(patterns);
},
createOnigString(s) {
return new oniguruma.OnigString(s);
}
};
});

function createEmitter() {
/** @type {() => void} */
let subscriber;
Expand Down Expand Up @@ -75,7 +90,8 @@ function createGetRegistry() {
}
return acc;
}, []);
}
},
onigLib
});
}
const unlock = await getLock();
Expand Down
5 changes: 5 additions & 0 deletions src/graphql/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ declare namespace grvsc {
defaultThemeTokenData: GRVSCThemeTokenData;
additionalThemeTokenData: GRVSCThemeTokenData[];
}
interface GRVSCGutterCell {
className?: string;
text?: string;
}
interface GRVSCTokenizedLine {
tokens: GRVSCToken[];
gutterCells?: GRVSCGutterCell[];
text: string;
html: string;
attrs: any;
Expand Down
4 changes: 2 additions & 2 deletions src/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ type GRVSCToken {
additionalThemeTokenData: [GRVSCThemeTokenData!]!
}
type GRVSCGutterCell {
className: String!
text: String!
className: String
text: String
}
type GRVSCTokenizedLine {
tokens: [GRVSCToken!]!
Expand Down
8 changes: 6 additions & 2 deletions test/__snapshots__/index.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -20502,8 +20502,8 @@ Object {
Object {
"lang": "embedded",
"type": "html",
"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>
<span class=\\"grvsc-line\\"><span class=\\"grvsc-source\\">// Comment</span></span></code></pre>",
"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>
<span class=\\"grvsc-line\\"><span class=\\"grvsc-source\\"><span class=\\"mtk1\\">//</span><span class=\\"mtk12\\"> Comment</span></span></span></code></pre>",
},
Object {
"children": Array [],
Expand All @@ -20517,6 +20517,10 @@ Object {
background-color: #1E1E1E;
color: #D4D4D4;
}
.default-dark .mtk4 { color: #569CD6; }
.default-dark .mtk12 { color: #9CDCFE; }
.default-dark .mtk1 { color: #D4D4D4; }
.default-dark .mtk7 { color: #B5CEA8; }
.default-dark .grvsc-line-highlighted::before {
background-color: var(--grvsc-line-highlighted-background-color, rgba(255, 255, 255, 0.1));
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));
Expand Down
2 changes: 1 addition & 1 deletion test/data/embedded.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
],
"version": "https://github.com/textmate/asp.vb.net.tmbundle/commit/72d44550b3286d0382d7be0624140cf97857ff69",
"name": "ASP vb.NET",
"scopeName": "source.asp.vb.net",
"scopeName": "source.embedded",
"comment": "Modified from the original ASP bundle. Originally modified by Thomas Aylott subtleGradient.com",
"patterns": [
{
Expand Down
24 changes: 10 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9393,7 +9393,7 @@ name-all-modules-plugin@^1.0.1:
resolved "https://registry.yarnpkg.com/name-all-modules-plugin/-/name-all-modules-plugin-1.0.1.tgz#0abfb6ad835718b9fb4def0674e06657a954375c"
integrity sha1-Cr+2rYNXGLn7Te8GdOBmV6lUN1w=

nan@^2.12.1, nan@^2.14.0:
nan@^2.12.1:
version "2.14.1"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.1.tgz#d7be34dfa3105b91494c3147089315eff8874b01"
integrity sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==
Expand Down Expand Up @@ -9797,13 +9797,6 @@ onetime@^5.1.0:
dependencies:
mimic-fn "^2.1.0"

oniguruma@^7.2.0:
version "7.2.1"
resolved "https://registry.yarnpkg.com/oniguruma/-/oniguruma-7.2.1.tgz#51775834f7819b6e31aa878706aa7f65ad16b07f"
integrity sha512-WPS/e1uzhswPtJSe+Zls/kAj27+lEqZjCmRSjnYk/Z4L2Mu+lJC2JWtkZhPJe4kZeTQfz7ClcLyXlI4J68MG2w==
dependencies:
nan "^2.14.0"

open@^6.4.0:
version "6.4.0"
resolved "https://registry.yarnpkg.com/open/-/open-6.4.0.tgz#5c13e96d0dc894686164f18965ecfe889ecfc8a9"
Expand Down Expand Up @@ -13789,12 +13782,15 @@ vm-browserify@^1.0.1:
resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0"
integrity sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==

[email protected]:
version "4.2.2"
resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-4.2.2.tgz#0b4dabc69a6fba79a065cb6b615f66eac07c8f4c"
integrity sha512-1U4ih0E/KP1zNK/EbpUqyYtI7PY+Ccd2nDGTtiMR/UalLFnmaYkwoWhN1oI7B91ptBN8NdVwWuvyUnvJAulCUw==
dependencies:
oniguruma "^7.2.0"
vscode-oniguruma@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/vscode-oniguruma/-/vscode-oniguruma-1.4.0.tgz#3795fd1ef9633a4a33f208bce92c008e64a6fc8f"
integrity sha512-VvTl/jIAADEqWWpEYRsOI1sXiYOTDA8KYNgK60+Mb3T+an9zPz3Cqc6RVJeYgOx/P5G+4M4jygB3X5xLLfYD0g==

vscode-textmate@^5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-5.2.0.tgz#01f01760a391e8222fe4f33fbccbd1ad71aed74e"
integrity sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ==

w3c-hr-time@^1.0.2:
version "1.0.2"
Expand Down

0 comments on commit e596b83

Please sign in to comment.