Skip to content

Commit

Permalink
Revert "build: Upgrade shiki (#446)" (#449)
Browse files Browse the repository at this point in the history
This reverts commit 579ea31.
  • Loading branch information
max-sixty authored Mar 1, 2024
1 parent 3cc4fb1 commit 92851ca
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 18 deletions.
38 changes: 28 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,6 @@
"dependencies": {
"@types/vscode": "^1.87.0",
"prql-js": "^0.11.3",
"shiki": "^1.1.7"
"shiki": "^0.14.7"
}
}
10 changes: 5 additions & 5 deletions src/views/sqlPreview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
WebviewPanelOnDidChangeViewStateEvent,
Uri,
} from 'vscode';

import * as shiki from 'shiki';

import { readFileSync } from 'node:fs';
Expand Down Expand Up @@ -510,7 +511,7 @@ export class SqlPreview {

// create html to display for the generated sql
const highlighter = await this.getHighlighter();
const sqlHtml = highlighter.codeToHtml(sqlCode, { lang: 'sql', theme: this.themeName});
const sqlHtml = highlighter.codeToHtml(sqlCode, { lang: 'sql' });

return { status: 'ok', sqlHtml: sqlHtml, sql: sqlCode };
}
Expand All @@ -525,8 +526,7 @@ export class SqlPreview {
return Promise.resolve(this._highlighter);
}
return (this._highlighter = await shiki.getHighlighter({
themes: [this.themeName],
langs: ['sql'],
theme: this.themeName,
}));
}

Expand All @@ -540,7 +540,7 @@ export class SqlPreview {
.getConfiguration('workbench')
.get<string>('colorTheme', 'dark-plus'); // default to dark plus

if (colorTheme in shiki.bundledThemes) {
if (shiki.BUNDLED_THEMES.includes(colorTheme as shiki.Theme)) {
return colorTheme;
}

Expand All @@ -549,7 +549,7 @@ export class SqlPreview {
.toLowerCase()
.replace('theme', '')
.replace(/\s+/g, '-');
if (colorTheme in shiki.bundledThemes) {
if (shiki.BUNDLED_THEMES.includes(colorTheme as shiki.Theme)) {
return colorTheme;
}

Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "ES2021",
"lib": ["ES2021", "DOM"],
"target": "es2020",
"lib": ["es2020"],
"outDir": "out",
"sourceMap": true,
"strict": true,
Expand Down

0 comments on commit 92851ca

Please sign in to comment.