diff --git a/index.html b/index.html index 556cc4b3e..3c5e1e438 100644 --- a/index.html +++ b/index.html @@ -59,6 +59,10 @@

Multiple Languageclients

Json & Python Languageclients & Language Server (Web Socket)
+

Advanced Application Playground

+ Advanced Application Playground +
+

Monaco Editor React

React: Langium Statemachine Language Client & Language Server (Worker)
diff --git a/package-lock.json b/package-lock.json index 6b2683a13..94163c188 100644 --- a/package-lock.json +++ b/package-lock.json @@ -581,6 +581,15 @@ "vscode": "npm:@codingame/monaco-vscode-api@9.0.3" } }, + "node_modules/@codingame/monaco-vscode-explorer-service-override": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-explorer-service-override/-/monaco-vscode-explorer-service-override-9.0.3.tgz", + "integrity": "sha512-qdgdiBrQwo5lDNSVLp4gL8Om2H/TfjKjvFxyTy8h4AVIOiPSoetUgiAmRygKx1xcuSkIxROeLHyDw7I/iexeBQ==", + "license": "MIT", + "dependencies": { + "vscode": "npm:@codingame/monaco-vscode-api@9.0.3" + } + }, "node_modules/@codingame/monaco-vscode-extensions-service-override": { "version": "9.0.3", "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-extensions-service-override/-/monaco-vscode-extensions-service-override-9.0.3.tgz", @@ -11167,6 +11176,7 @@ "license": "MIT", "dependencies": { "@codingame/monaco-vscode-configuration-service-override": "~9.0.3", + "@codingame/monaco-vscode-explorer-service-override": "~9.0.3", "@codingame/monaco-vscode-files-service-override": "~9.0.3", "@codingame/monaco-vscode-groovy-default-extension": "~9.0.3", "@codingame/monaco-vscode-java-default-extension": "~9.0.3", @@ -11184,6 +11194,11 @@ "@codingame/monaco-vscode-theme-service-override": "~9.0.3", "@codingame/monaco-vscode-typescript-basics-default-extension": "~9.0.3", "@codingame/monaco-vscode-typescript-language-features-default-extension": "~9.0.3", + "@codingame/monaco-vscode-view-banner-service-override": "~9.0.3", + "@codingame/monaco-vscode-view-status-bar-service-override": "~9.0.3", + "@codingame/monaco-vscode-view-title-bar-service-override": "~9.0.3", + "@codingame/monaco-vscode-views-service-override": "~9.0.3", + "@codingame/monaco-vscode-workbench-service-override": "~9.0.3", "@typefox/monaco-editor-react": "~6.0.0-next.2", "express": "~4.21.0", "langium": "~3.2.0", diff --git a/packages/examples/advanced.html b/packages/examples/advanced.html new file mode 100644 index 000000000..7b544ff58 --- /dev/null +++ b/packages/examples/advanced.html @@ -0,0 +1,22 @@ + + + + + Advanced Application Playground + + + + + + + +

Advanced Application Playground

+ + + + diff --git a/packages/examples/build/downloadResources.mts b/packages/examples/build/downloadResources.mts index bf39f7cc4..dceb0171b 100644 --- a/packages/examples/build/downloadResources.mts +++ b/packages/examples/build/downloadResources.mts @@ -35,5 +35,5 @@ await downloadVsix('https://marketplace.visualstudio.com/_apis/public/gallery/pu resolve(getLocalDirectory(), '../resources/vsix/'), 'github-vscode-theme.vsix'); // not yet used -await downloadVsix('https://marketplace.visualstudio.com/_apis/public/gallery/publishers/TypeFox/vsextensions/open-collaboration-tools/0.2.3/vspackage', +await downloadVsix('https://marketplace.visualstudio.com/_apis/public/gallery/publishers/TypeFox/vsextensions/open-collaboration-tools/0.2.4/vspackage', resolve(getLocalDirectory(), '../resources/vsix/'), 'open-collaboration-tools.vsix'); diff --git a/packages/examples/package.json b/packages/examples/package.json index 0d917e7f6..0cd11028a 100644 --- a/packages/examples/package.json +++ b/packages/examples/package.json @@ -55,6 +55,7 @@ }, "dependencies": { "@codingame/monaco-vscode-configuration-service-override": "~9.0.3", + "@codingame/monaco-vscode-explorer-service-override": "~9.0.3", "@codingame/monaco-vscode-files-service-override": "~9.0.3", "@codingame/monaco-vscode-groovy-default-extension": "~9.0.3", "@codingame/monaco-vscode-keybindings-service-override": "~9.0.3", @@ -72,6 +73,11 @@ "@codingame/monaco-vscode-theme-service-override": "~9.0.3", "@codingame/monaco-vscode-typescript-basics-default-extension": "~9.0.3", "@codingame/monaco-vscode-typescript-language-features-default-extension": "~9.0.3", + "@codingame/monaco-vscode-views-service-override": "~9.0.3", + "@codingame/monaco-vscode-view-banner-service-override": "~9.0.3", + "@codingame/monaco-vscode-view-status-bar-service-override": "~9.0.3", + "@codingame/monaco-vscode-view-title-bar-service-override": "~9.0.3", + "@codingame/monaco-vscode-workbench-service-override": "~9.0.3", "@typefox/monaco-editor-react": "~6.0.0-next.2", "express": "~4.21.0", "langium": "~3.2.0", diff --git a/packages/examples/resources/advanced/hello.ts b/packages/examples/resources/advanced/hello.ts new file mode 100644 index 000000000..6a4f9f6b8 --- /dev/null +++ b/packages/examples/resources/advanced/hello.ts @@ -0,0 +1,8 @@ +import { sayFoo } from './tester.js'; + +function sayHello(): string { + console.log(sayFoo()); + return 'Hello'; +}; + +sayHello(); diff --git a/packages/examples/resources/advanced/style.css b/packages/examples/resources/advanced/style.css new file mode 100644 index 000000000..dd0c5f753 --- /dev/null +++ b/packages/examples/resources/advanced/style.css @@ -0,0 +1,59 @@ +:root { + font-family: Inter, Avenir, Helvetica, Arial, sans-serif; + font-size: 16px; + line-height: 24px; + font-weight: 400; + + font-synthesis: none; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + -webkit-text-size-adjust: 100%; + } + + body { + background-color: var(--vscode-editorWidget-background); + color: var(--vscode-editorWidget-foreground); + margin: 0; + } + + #editors { + position: relative; + min-width: 0; + height: 45vh; + border: 1px solid var(--vscode-editorWidget-border); + } + + #panel { + display: flex; + flex: 1; + border: 1px solid var(--vscode-editorWidget-border); + min-height: 0; + } + + .standalone-editor { + width: 100%; + height: 55vh; + } + + #titleBar { + position: relative; + flex: none; + } + + #banner { + flex: none; + } + + #workbench-container { + height: 90vh; + display: flex; + flex-direction: column + } + + #workbench-top { + display: flex; + gap: 20px; + flex: 2; + min-height: 0 + } diff --git a/packages/examples/resources/advanced/tester.ts b/packages/examples/resources/advanced/tester.ts new file mode 100644 index 000000000..d1535caa3 --- /dev/null +++ b/packages/examples/resources/advanced/tester.ts @@ -0,0 +1,3 @@ +export const sayFoo = () => { + return 'Foo'; +}; diff --git a/packages/examples/resources/advanced/views.html b/packages/examples/resources/advanced/views.html new file mode 100644 index 000000000..efc5d6ba7 --- /dev/null +++ b/packages/examples/resources/advanced/views.html @@ -0,0 +1,21 @@ +
+
+ +
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+ +
+
diff --git a/packages/examples/src/langium/langium-dsl/content/example.langium b/packages/examples/resources/langium/langium-dsl/example.langium similarity index 100% rename from packages/examples/src/langium/langium-dsl/content/example.langium rename to packages/examples/resources/langium/langium-dsl/example.langium diff --git a/packages/examples/src/langium/statemachine/content/example-mod.statemachine b/packages/examples/resources/langium/statemachine/example-mod.statemachine similarity index 100% rename from packages/examples/src/langium/statemachine/content/example-mod.statemachine rename to packages/examples/resources/langium/statemachine/example-mod.statemachine diff --git a/packages/examples/src/langium/statemachine/content/example.statemachine b/packages/examples/resources/langium/statemachine/example.statemachine similarity index 100% rename from packages/examples/src/langium/statemachine/content/example.statemachine rename to packages/examples/resources/langium/statemachine/example.statemachine diff --git a/packages/examples/src/python/client/bad.py b/packages/examples/resources/python/bad.py similarity index 100% rename from packages/examples/src/python/client/bad.py rename to packages/examples/resources/python/bad.py diff --git a/packages/examples/src/python/client/hello.py b/packages/examples/resources/python/hello.py similarity index 100% rename from packages/examples/src/python/client/hello.py rename to packages/examples/resources/python/hello.py diff --git a/packages/examples/src/python/client/hello2.py b/packages/examples/resources/python/hello2.py similarity index 100% rename from packages/examples/src/python/client/hello2.py rename to packages/examples/resources/python/hello2.py diff --git a/packages/examples/src/advanced/launcher.ts b/packages/examples/src/advanced/launcher.ts new file mode 100644 index 000000000..1e2ef4f75 --- /dev/null +++ b/packages/examples/src/advanced/launcher.ts @@ -0,0 +1,8 @@ +/* -------------------------------------------------------------------------------------------- + * Copyright (c) 2024 TypeFox and others. + * Licensed under the MIT License. See LICENSE in the package root for license information. + * ------------------------------------------------------------------------------------------ */ + +import { runAdvancedApplicationPlayground } from './main.js'; + +runAdvancedApplicationPlayground(); diff --git a/packages/examples/src/advanced/main.ts b/packages/examples/src/advanced/main.ts new file mode 100644 index 000000000..7c77b317d --- /dev/null +++ b/packages/examples/src/advanced/main.ts @@ -0,0 +1,237 @@ +/* -------------------------------------------------------------------------------------------- + * Copyright (c) 2024 TypeFox and others. + * Licensed under the MIT License. See LICENSE in the package root for license information. + * ------------------------------------------------------------------------------------------ */ + +import * as vscode from 'vscode'; +import { ITextFileEditorModel } from 'vscode/monaco'; +import { getService, IWorkbenchLayoutService, LogLevel } from 'vscode/services'; +import getConfigurationServiceOverride from '@codingame/monaco-vscode-configuration-service-override'; +import getKeybindingsServiceOverride from '@codingame/monaco-vscode-keybindings-service-override'; +import getLifecycleServiceOverride from '@codingame/monaco-vscode-lifecycle-service-override'; +import getLocalizationServiceOverride from '@codingame/monaco-vscode-localization-service-override'; +import { IReference, OpenEditor, Parts, onPartVisibilityChange, isPartVisibile, attachPart, getSideBarPosition, onDidChangeSideBarPosition, Position } from '@codingame/monaco-vscode-views-service-override'; +import getBannerServiceOverride from '@codingame/monaco-vscode-view-banner-service-override'; +import getStatusBarServiceOverride from '@codingame/monaco-vscode-view-status-bar-service-override'; +import getTitleBarServiceOverride from '@codingame/monaco-vscode-view-title-bar-service-override'; +import getExplorerServiceOverride from '@codingame/monaco-vscode-explorer-service-override'; +import { RegisteredFileSystemProvider, registerFileSystemOverlay, RegisteredMemoryFile } from '@codingame/monaco-vscode-files-service-override'; +// this is required syntax highlighting +import '@codingame/monaco-vscode-typescript-basics-default-extension'; +import '@codingame/monaco-vscode-typescript-language-features-default-extension'; + +import '../../resources/vsix/open-collaboration-tools.vsix'; + +import { EditorAppExtended, MonacoEditorLanguageClientWrapper, RegisterLocalProcessExtensionResult, WrapperConfig } from 'monaco-editor-wrapper'; +import { createDefaultLocaleConfiguration } from 'monaco-languageclient/vscode/services'; +import { configureMonacoWorkers } from '../common/client/utils.js'; +import helloTsCode from '../../resources/advanced/hello.ts?raw'; +import testerTsCode from '../../resources/advanced/tester.ts?raw'; +import viewsHtml from '../../resources/advanced/views.html?raw'; + +const wrapper = new MonacoEditorLanguageClientWrapper(); +const openNewEditor: OpenEditor = async (modelRef) => { + console.log('open editor'); + const container = document.createElement('div'); + container.style.position = 'fixed'; + container.style.backgroundColor = 'rgba(0, 0, 0, 0.5)'; + container.style.top = container.style.bottom = container.style.left = container.style.right = '0'; + container.style.cursor = 'pointer'; + + const editorElem = document.createElement('div'); + editorElem.style.position = 'absolute'; + editorElem.style.top = editorElem.style.bottom = editorElem.style.left = editorElem.style.right = '0'; + editorElem.style.margin = 'auto'; + editorElem.style.width = '80%'; + editorElem.style.height = '80%'; + + container.appendChild(editorElem); + try { + + wrapper.updateEditorModels({ + modelRef: modelRef as IReference + }); + + wrapper.getEditor()?.onDidBlurEditorWidget(() => { + wrapper.dispose(); + }); + container.addEventListener('mousedown', (event) => { + if (event.target !== container) return; + wrapper.dispose(); + }); + + return wrapper.getEditor(); + } catch (error) { + document.body.removeChild(container); + wrapper.dispose(); + throw error; + } +}; + +const initViews = () => { + for (const config of [ + { part: Parts.TITLEBAR_PART, element: '#titleBar' }, + { part: Parts.BANNER_PART, element: '#banner' }, + { + part: Parts.SIDEBAR_PART, get element() { + return getSideBarPosition() === Position.LEFT ? '#sidebar' : '#sidebar-right'; + }, onDidElementChange: onDidChangeSideBarPosition + }, + { + part: Parts.ACTIVITYBAR_PART, get element() { + return getSideBarPosition() === Position.LEFT ? '#activityBar' : '#activityBar-right'; + }, onDidElementChange: onDidChangeSideBarPosition + }, + { + part: Parts.AUXILIARYBAR_PART, get element() { + return getSideBarPosition() === Position.LEFT ? '#auxiliaryBar' : '#auxiliaryBar-left'; + }, onDidElementChange: onDidChangeSideBarPosition + }, + { part: Parts.EDITOR_PART, element: '#editors' }, + // { part: Parts.PANEL_PART, element: '#panel' }, + { part: Parts.STATUSBAR_PART, element: '#statusBar' } + ]) { + attachPart(config.part, document.querySelector(config.element)!); + + config.onDidElementChange?.(() => { + attachPart(config.part, document.querySelector(config.element)!); + }); + + if (!isPartVisibile(config.part)) { + document.querySelector(config.element)!.style.display = 'none'; + } + + onPartVisibilityChange(config.part, visible => { + document.querySelector(config.element)!.style.display = visible ? 'block' : 'none'; + }); + } +}; + +export const runAdvancedApplicationPlayground = async () => { + const helloTsUri = vscode.Uri.file('/workspace/hello.ts'); + const testerTsUri = vscode.Uri.file('/workspace/tester.ts'); + const htmlContainer = document.createElement('div', { is: 'app' }); + + const wrapperConfig: WrapperConfig = { + id: 'AAP', + logLevel: LogLevel.Debug, + vscodeApiConfig: { + userServices: { + ...getConfigurationServiceOverride(), + ...getKeybindingsServiceOverride(), + ...getLifecycleServiceOverride(), + ...getLocalizationServiceOverride(createDefaultLocaleConfiguration()), + ...getBannerServiceOverride(), + ...getStatusBarServiceOverride(), + ...getTitleBarServiceOverride(), + ...getExplorerServiceOverride() + }, + enableExtHostWorker: true, + viewsConfig: { + viewServiceType: 'ViewsService', + openEditorFunc: openNewEditor, + viewsInitFunc: initViews + }, + workspaceConfig: { + enableWorkspaceTrust: true, + windowIndicator: { + label: 'mlc-advanced-example', + tooltip: '', + command: '' + }, + workspaceProvider: { + trusted: true, + async open() { + window.open(window.location.href); + return true; + }, + workspace: { + workspaceUri: vscode.Uri.file('/workspace.code-workspace') + } + }, + configurationDefaults: { + 'window.title': 'mlc-advanced-example${separator}${dirty}${activeEditorShort}' + }, + defaultLayout: { + editors: [{ + uri: helloTsUri, + viewColumn: 1 + }, { + uri: testerTsUri, + viewColumn: 2 + }], + layout: { + editors: { + orientation: 0, + groups: [{ size: 1 }, { size: 1 }] + } + } + }, + productConfiguration: { + nameShort: 'mlc-advanced-example', + nameLong: 'mlc-advanced-example', + extensionsGallery: { + serviceUrl: 'https://open-vsx.org/vscode/gallery', + itemUrl: 'https://open-vsx.org/vscode/item', + resourceUrlTemplate: 'https://open-vsx.org/vscode/unpkg/{publisher}/{name}/{version}/{path}', + controlUrl: '', + nlsBaseUrl: '', + publisherUrl: '' + } + } + }, + userConfiguration: { + json: JSON.stringify({ + 'workbench.colorTheme': 'Default Dark Modern', + 'editor.wordBasedSuggestions': 'off', + 'typescript.tsserver.web.projectWideIntellisense.enabled': true, + 'typescript.tsserver.web.projectWideIntellisense.suppressSemanticErrors': false, + 'editor.guides.bracketPairsHorizontal': true, + 'oct.serverUrl': 'https://api.open-collab.tools/', + 'editor.experimental.asyncTokenization': false + }) + }, + }, + editorAppConfig: { + $type: 'extended', + extensions: [{ + config: { + name: 'mlc-advanced-example', + publisher: 'TypeFox', + version: '1.0.0', + engines: { + vscode: '*' + } + } + }], + codeResources: { + main: { + text: helloTsCode, + uri: '/workspace/hello.ts' + } + }, + monacoWorkerFactory: configureMonacoWorkers, + htmlContainer + } + }; + + htmlContainer.innerHTML = viewsHtml; + document.body.append(htmlContainer); + + await wrapper.init(wrapperConfig); + const result = (wrapper.getMonacoEditorApp() as EditorAppExtended).getExtensionRegisterResult('mlc-advanced-example') as RegisterLocalProcessExtensionResult; + result.setAsDefaultApi(); + const vscodeApi = await result.getApi(); + + await getService(IWorkbenchLayoutService); + + const fileSystemProvider = new RegisteredFileSystemProvider(false); + fileSystemProvider.registerFile(new RegisteredMemoryFile(helloTsUri, helloTsCode)); + fileSystemProvider.registerFile(new RegisteredMemoryFile(testerTsUri, testerTsCode)); + + registerFileSystemOverlay(1, fileSystemProvider); + + await vscodeApi.workspace.openTextDocument(helloTsUri); + await vscodeApi.workspace.openTextDocument(testerTsUri); + +}; diff --git a/packages/examples/src/langium/langium-dsl/config/classicConfig.ts b/packages/examples/src/langium/langium-dsl/config/classicConfig.ts index 54ef2d407..88e5414b6 100644 --- a/packages/examples/src/langium/langium-dsl/config/classicConfig.ts +++ b/packages/examples/src/langium/langium-dsl/config/classicConfig.ts @@ -4,16 +4,14 @@ * ------------------------------------------------------------------------------------------ */ import getConfigurationServiceOverride from '@codingame/monaco-vscode-configuration-service-override'; -import getEditorServiceOverride from '@codingame/monaco-vscode-editor-service-override'; import getKeybindingsServiceOverride from '@codingame/monaco-vscode-keybindings-service-override'; -import { useOpenEditorStub } from 'monaco-editor-wrapper/vscode/services'; import { LogLevel } from 'vscode/services'; import { Logger } from 'monaco-languageclient/tools'; import { WrapperConfig } from 'monaco-editor-wrapper'; import { LangiumMonarchContent } from './langium.monarch.js'; import { loadLangiumWorker } from '../wrapperLangium.js'; -import code from '../content/example.langium?raw'; import { useWorkerFactory } from 'monaco-editor-wrapper/workerFactory'; +import code from '../../../../resources/langium/langium-dsl/example.langium?raw'; export const setupLangiumClientClassic = async (): Promise => { const langiumWorker = loadLangiumWorker(); @@ -22,7 +20,6 @@ export const setupLangiumClientClassic = async (): Promise => { vscodeApiConfig: { userServices: { ...getConfigurationServiceOverride(), - ...getEditorServiceOverride(useOpenEditorStub), ...getKeybindingsServiceOverride() } }, diff --git a/packages/examples/src/langium/langium-dsl/config/extendedConfig.ts b/packages/examples/src/langium/langium-dsl/config/extendedConfig.ts index 1f3ace3c3..da237ff5f 100644 --- a/packages/examples/src/langium/langium-dsl/config/extendedConfig.ts +++ b/packages/examples/src/langium/langium-dsl/config/extendedConfig.ts @@ -3,10 +3,9 @@ * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ -import getEditorServiceOverride from '@codingame/monaco-vscode-editor-service-override'; import getKeybindingsServiceOverride from '@codingame/monaco-vscode-keybindings-service-override'; import '../../../../resources/vsix/github-vscode-theme.vsix'; -import { useOpenEditorStub } from 'monaco-editor-wrapper/vscode/services'; + import { BrowserMessageReader, BrowserMessageWriter } from 'vscode-languageclient/browser.js'; import { LogLevel } from 'vscode/services'; import { WrapperConfig } from 'monaco-editor-wrapper'; @@ -14,7 +13,7 @@ import { loadLangiumWorker } from '../wrapperLangium.js'; import { configureMonacoWorkers } from '../../../common/client/utils.js'; import langiumLanguageConfig from './langium.configuration.json?raw'; import langiumTextmateGrammar from './langium.tmLanguage.json?raw'; -import text from '../content/example.langium?raw'; +import text from '../../../../resources/langium/langium-dsl//example.langium?raw'; export const setupLangiumClientExtended = async (): Promise => { @@ -31,7 +30,6 @@ export const setupLangiumClientExtended = async (): Promise => { logLevel: LogLevel.Debug, vscodeApiConfig: { userServices: { - ...getEditorServiceOverride(useOpenEditorStub), ...getKeybindingsServiceOverride() }, userConfiguration: { @@ -55,7 +53,7 @@ export const setupLangiumClientExtended = async (): Promise => { extensions: [{ config: { name: 'langium-example', - publisher: 'monaco-editor-wrapper-examples', + publisher: 'TypeFox', version: '1.0.0', engines: { vscode: '*' diff --git a/packages/examples/src/langium/statemachine/config/wrapperStatemachineConfig.ts b/packages/examples/src/langium/statemachine/config/wrapperStatemachineConfig.ts index ec8f8d3a3..76cda3a35 100644 --- a/packages/examples/src/langium/statemachine/config/wrapperStatemachineConfig.ts +++ b/packages/examples/src/langium/statemachine/config/wrapperStatemachineConfig.ts @@ -75,7 +75,7 @@ export const createLangiumGlobalConfig = async (params: { extensions: [{ config: { name: 'statemachine-example', - publisher: 'monaco-editor-wrapper-examples', + publisher: 'TypeFox', version: '1.0.0', engines: { vscode: '*' diff --git a/packages/examples/src/langium/statemachine/main.ts b/packages/examples/src/langium/statemachine/main.ts index c261e7755..cd9378739 100644 --- a/packages/examples/src/langium/statemachine/main.ts +++ b/packages/examples/src/langium/statemachine/main.ts @@ -10,8 +10,8 @@ import { BrowserMessageReader, BrowserMessageWriter } from 'vscode-languageclien import { createLangiumGlobalConfig } from './config/wrapperStatemachineConfig.js'; import workerUrl from './worker/statemachine-server?worker&url'; import workerPortUrl from './worker/statemachine-server-port?worker&url'; -import text from './content/example.statemachine?raw'; -import textMod from './content/example-mod.statemachine?raw'; +import text from '../../../resources/langium/statemachine/example.statemachine?raw'; +import textMod from '../../../resources/langium/statemachine/example-mod.statemachine?raw'; const wrapper = new MonacoEditorLanguageClientWrapper(); const wrapper2 = new MonacoEditorLanguageClientWrapper(); diff --git a/packages/examples/src/python/client/config.ts b/packages/examples/src/python/client/config.ts index 300ff323e..1e5c4b918 100644 --- a/packages/examples/src/python/client/config.ts +++ b/packages/examples/src/python/client/config.ts @@ -4,12 +4,10 @@ * ------------------------------------------------------------------------------------------ */ import * as vscode from 'vscode'; -import getEditorServiceOverride from '@codingame/monaco-vscode-editor-service-override'; import getKeybindingsServiceOverride from '@codingame/monaco-vscode-keybindings-service-override'; import '@codingame/monaco-vscode-python-default-extension'; import { LogLevel } from 'vscode/services'; import { createUrl, WrapperConfig } from 'monaco-editor-wrapper'; -import { useOpenEditorStub } from 'monaco-editor-wrapper/vscode/services'; import { MonacoLanguageClient } from 'monaco-languageclient'; import { toSocket, WebSocketMessageReader, WebSocketMessageWriter } from 'vscode-ws-jsonrpc'; import { configureMonacoWorkers } from '../../common/client/utils.js'; @@ -66,7 +64,6 @@ export const createUserConfig = (workspaceRoot: string, code: string, codeUri: s logLevel: LogLevel.Debug, vscodeApiConfig: { userServices: { - ...getEditorServiceOverride(useOpenEditorStub), ...getKeybindingsServiceOverride() }, userConfiguration: { diff --git a/packages/examples/src/python/client/main.ts b/packages/examples/src/python/client/main.ts index b63897b71..3b6c6c6d7 100644 --- a/packages/examples/src/python/client/main.ts +++ b/packages/examples/src/python/client/main.ts @@ -9,8 +9,8 @@ import '@codingame/monaco-vscode-python-default-extension'; import { RegisteredFileSystemProvider, registerFileSystemOverlay, RegisteredMemoryFile } from '@codingame/monaco-vscode-files-service-override'; import { MonacoEditorLanguageClientWrapper } from 'monaco-editor-wrapper'; import { createUserConfig } from './config.js'; -import helloPyCode from './hello.py?raw'; -import hello2PyCode from './hello2.py?raw'; +import helloPyCode from '../../../resources/python/hello.py?raw'; +import hello2PyCode from '../../../resources/python/hello2.py?raw'; export const runPythonWrapper = async () => { const helloPyUri = vscode.Uri.file('/workspace/hello.py'); diff --git a/packages/examples/src/python/client/reactPython.tsx b/packages/examples/src/python/client/reactPython.tsx index e7279b113..27198b6d0 100644 --- a/packages/examples/src/python/client/reactPython.tsx +++ b/packages/examples/src/python/client/reactPython.tsx @@ -11,7 +11,7 @@ import type { TextChanges } from '@typefox/monaco-editor-react'; import { MonacoEditorReactComp } from '@typefox/monaco-editor-react'; import { MonacoEditorLanguageClientWrapper } from 'monaco-editor-wrapper'; import { createUserConfig } from './config.js'; -import badPyCode from './bad.py?raw'; +import badPyCode from '../../../resources/python/bad.py?raw'; export const runPythonReact = async () => { const badPyUri = vscode.Uri.file('/workspace/bad.py'); diff --git a/packages/examples/src/ts/wrapperTs.ts b/packages/examples/src/ts/wrapperTs.ts index 79d2c3161..1e8cdca56 100644 --- a/packages/examples/src/ts/wrapperTs.ts +++ b/packages/examples/src/ts/wrapperTs.ts @@ -5,7 +5,6 @@ import * as vscode from 'vscode'; import getKeybindingsServiceOverride from '@codingame/monaco-vscode-keybindings-service-override'; -import '@codingame/monaco-vscode-theme-defaults-default-extension'; import '@codingame/monaco-vscode-typescript-basics-default-extension'; import '@codingame/monaco-vscode-typescript-language-features-default-extension'; import { LogLevel } from 'vscode/services'; diff --git a/vite.config.ts b/vite.config.ts index 126cef79b..63922c309 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -15,6 +15,10 @@ export const definedViteConfig = defineConfig({ rollupOptions: { input: { index: path.resolve(__dirname, 'index.html'), + + // advanced application playground + advanced: path.resolve(__dirname, 'packages/examples/advanced.html'), + // bare monaco-languageclient bare: path.resolve(__dirname, 'packages/examples/bare.html'),