diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-02-05 20:29:50 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-02-05 20:29:50 +0000 |
commit | 2471b6bc3a318d7303d0556c85940090b6cf6d7a (patch) | |
tree | 07df61a25b0735d96f78bbd754bc7c16b9361926 /editors/code/src/highlighting.ts | |
parent | 8d0f7da2f5f2ae1dc5711005f08fde0007da165b (diff) | |
parent | 49a681404860e98855d8698e94dc1208e07daff4 (diff) |
Merge #3015
3015: vscode: yet another refactor commit r=matklad a=Veetaha
It compiles, it runs in dev extension host, It bundles, it runs when bundled and installed.
Removed 5 lines of code as you like less code, especially TypeScript code)
Co-authored-by: Veetaha <[email protected]>
Diffstat (limited to 'editors/code/src/highlighting.ts')
-rw-r--r-- | editors/code/src/highlighting.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/editors/code/src/highlighting.ts b/editors/code/src/highlighting.ts index 66216e0fc..e90fb8acc 100644 --- a/editors/code/src/highlighting.ts +++ b/editors/code/src/highlighting.ts | |||
@@ -69,7 +69,7 @@ interface Decoration { | |||
69 | 69 | ||
70 | // Based on this HSL-based color generator: https://gist.github.com/bendc/76c48ce53299e6078a76 | 70 | // Based on this HSL-based color generator: https://gist.github.com/bendc/76c48ce53299e6078a76 |
71 | function fancify(seed: string, shade: 'light' | 'dark') { | 71 | function fancify(seed: string, shade: 'light' | 'dark') { |
72 | const random = randomU32Numbers(hashString(seed)) | 72 | const random = randomU32Numbers(hashString(seed)); |
73 | const randomInt = (min: number, max: number) => { | 73 | const randomInt = (min: number, max: number) => { |
74 | return Math.abs(random()) % (max - min + 1) + min; | 74 | return Math.abs(random()) % (max - min + 1) + min; |
75 | }; | 75 | }; |
@@ -253,14 +253,14 @@ function randomU32Numbers(seed: number) { | |||
253 | random ^= random >> 17; | 253 | random ^= random >> 17; |
254 | random ^= random << 5; | 254 | random ^= random << 5; |
255 | random |= 0; | 255 | random |= 0; |
256 | return random | 256 | return random; |
257 | } | 257 | }; |
258 | } | 258 | } |
259 | 259 | ||
260 | function hashString(str: string): number { | 260 | function hashString(str: string): number { |
261 | let res = 0; | 261 | let res = 0; |
262 | for (let i = 0; i < str.length; ++i) { | 262 | for (let i = 0; i < str.length; ++i) { |
263 | const c = str.codePointAt(i)!!; | 263 | const c = str.codePointAt(i)!; |
264 | res = (res * 31 + c) & ~0; | 264 | res = (res * 31 + c) & ~0; |
265 | } | 265 | } |
266 | return res; | 266 | return res; |