Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rollup/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ export default (args: Record<string, string>): rollup.RollupOptions => {
VSCODE_VERSION: JSON.stringify(vscodeVersion),
VSCODE_REF: JSON.stringify(vscodeRef),
VSCODE_COMMIT: JSON.stringify(vscodeCommit),
BUILD_ID: JSON.stringify(`${vscodeRef}-${crypto.randomUUID()}`),
'globalThis.require': 'undefined',
preventAssignment: true
}),
Expand Down
10 changes: 6 additions & 4 deletions src/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,17 @@ import getBaseServiceOverride from './service-override/base'

declare global {
interface Window {
monacoVscodeApiInitialized?: boolean
monacoVscodeApiBuildId?: string
}
}

if (window.monacoVscodeApiInitialized ?? false) {
throw new Error('Another version of monaco-vscode-api has already been loaded.')
if (window.monacoVscodeApiBuildId != null && window.monacoVscodeApiBuildId !== BUILD_ID) {
throw new Error(
`Another version of monaco-vscode-api has already been loaded. Trying to load ${BUILD_ID}, ${window.monacoVscodeApiBuildId} is already loaded`
)
}

window.monacoVscodeApiInitialized = true
window.monacoVscodeApiBuildId = BUILD_ID

export async function initialize(
overrides: IEditorOverrideServices,
Expand Down
1 change: 1 addition & 0 deletions src/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
declare const VSCODE_VERSION: string
declare const VSCODE_REF: string
declare const VSCODE_COMMIT: string
declare const BUILD_ID: string

declare module 'vs/platform/accessibilitySignal/browser/media/*.mp3' {
const assets: Record<string, string>
Expand Down