From 326ef9c8979b1d115bc9b0c0080161012cf3c448 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mangeonjean?= Date: Wed, 15 Mar 2023 19:13:11 +0100 Subject: [PATCH] feat: add audio cue in demo --- demo/package-lock.json | 2 ++ demo/package.json | 2 +- demo/src/main.ts | 3 ++- demo/src/setup.ts | 10 ++++------ demo/vite.config.ts | 6 ++++-- demo/vite.github-page.config.ts | 6 ++++++ 6 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 demo/vite.github-page.config.ts diff --git a/demo/package-lock.json b/demo/package-lock.json index 1955cf46..bd313a14 100644 --- a/demo/package-lock.json +++ b/demo/package-lock.json @@ -32,6 +32,7 @@ "@codingame/tsconfig": "^1.1.1", "@octokit/rest": "^19.0.7", "@rollup/plugin-dynamic-import-vars": "^2.0.3", + "@rollup/plugin-inject": "^5.0.3", "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-replace": "^5.0.2", "@rollup/plugin-typescript": "^11.0.0", @@ -50,6 +51,7 @@ "recast": "^0.22.0", "rollup": "^3.18.0", "rollup-plugin-dts": "^5.2.0", + "rollup-plugin-external-assets": "^3.0.1", "rollup-plugin-styles": "^4.0.0", "semver": "^7.3.8", "ts-node": "^10.9.1", diff --git a/demo/package.json b/demo/package.json index a1c95a30..0364e08d 100644 --- a/demo/package.json +++ b/demo/package.json @@ -9,7 +9,7 @@ "start": "vite --config vite.config.ts", "start:debug": "vite --config vite.config.ts --debug --force", "build": "vite --config vite.config.ts build", - "build:github": "vite --config vite.config.ts build --base=/monaco-vscode-api && touch dist/.nojekyll" + "build:github": "vite --config vite.github-page.config.ts build && touch dist/.nojekyll" }, "devDependencies": { "@types/throttle-debounce": "~5.0.0", diff --git a/demo/src/main.ts b/demo/src/main.ts index 72d2f290..453f8d14 100644 --- a/demo/src/main.ts +++ b/demo/src/main.ts @@ -87,7 +87,8 @@ const settingsModel = monaco.editor.createModel( "editor.foldingHighlight": false, "editor.semanticHighlighting.enabled": true, "editor.bracketPairColorization.enabled": false, - "editor.fontSize": 12 + "editor.fontSize": 12, + "audioCues.lineHasError": "on" }`, 'json', monaco.Uri.file('/settings.json')) createConfiguredEditor(document.getElementById('settings-editor')!, { model: settingsModel diff --git a/demo/src/setup.ts b/demo/src/setup.ts index abd60910..962001ef 100644 --- a/demo/src/setup.ts +++ b/demo/src/setup.ts @@ -6,7 +6,6 @@ import 'monaco-editor/esm/vs/editor/standalone/browser/quickAccess/standaloneGot import 'monaco-editor/esm/vs/editor/standalone/browser/quickAccess/standaloneGotoSymbolQuickAccess' import 'monaco-editor/esm/vs/editor/standalone/browser/quickAccess/standaloneCommandsQuickAccess' import 'monaco-editor/esm/vs/editor/standalone/browser/referenceSearch/standaloneReferenceSearch' -import onigFile from 'vscode-oniguruma/release/onig.wasm?url' import { StandaloneServices } from 'vscode/services' import getModelEditorServiceOverride from 'vscode/service-override/modelEditor' import getNotificationServiceOverride from 'vscode/service-override/notifications' @@ -18,6 +17,7 @@ import getThemeServiceOverride, { setDefaultThemes, IThemeExtensionPoint } from import geTokenClassificationServiceOverride from 'vscode/service-override/tokenClassification' import getLanguageConfigurationServiceOverride, { setLanguageConfiguration } from 'vscode/service-override/languageConfiguration' import getLanguagesServiceOverride, { setLanguages } from 'vscode/service-override/languages' +import getAudioCueServiceOverride from 'vscode/service-override/audioCue' import EditorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker' import JsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker' import themes from './resources/themes/themes.json' @@ -53,14 +53,12 @@ StandaloneServices.initialize({ ...getDialogsServiceOverride(), ...getConfigurationServiceOverride(), ...getKeybindingsServiceOverride(), - ...getTextmateServiceOverride(async () => { - const response = await fetch(onigFile) - return await response.arrayBuffer() - }), + ...getTextmateServiceOverride(), ...getThemeServiceOverride(), ...geTokenClassificationServiceOverride(), ...getLanguageConfigurationServiceOverride(), - ...getLanguagesServiceOverride() + ...getLanguagesServiceOverride(), + ...getAudioCueServiceOverride() }) const loader: Partial Promise>> = { diff --git a/demo/vite.config.ts b/demo/vite.config.ts index b4148262..ccc9d86f 100644 --- a/demo/vite.config.ts +++ b/demo/vite.config.ts @@ -2,8 +2,10 @@ import { defineConfig } from 'vite' export default defineConfig({ server: { + origin: 'http://localhost:5173', fs: { - allow: ['../'] // allow to load codicon.tss from monaco-editor in the parent folder + allow: ['../'] // allow to load codicon.ttf from monaco-editor in the parent folder } - } + }, + assetsInclude: ['**/*.wasm'] }) diff --git a/demo/vite.github-page.config.ts b/demo/vite.github-page.config.ts new file mode 100644 index 00000000..c6a9ffe8 --- /dev/null +++ b/demo/vite.github-page.config.ts @@ -0,0 +1,6 @@ +import { defineConfig } from 'vite' + +export default defineConfig({ + base: 'https://codingame.github.io/monaco-vscode-api', + assetsInclude: ['**/*.wasm'] +})