Skip to content

Commit 3b34422

Browse files
committed
Example tweaking
1 parent 52e36b6 commit 3b34422

File tree

9 files changed

+23
-14
lines changed

9 files changed

+23
-14
lines changed

packages/examples/eclipse.jdt.ls.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<br>
1515
<button type="button" id="button-start">Start</button>
1616
<button type="button" id="button-dispose">Dispose</button>
17+
Launch backend with: <b><code>docker compose -f ./packages/examples/resources/eclipse.jdt.ls/docker-compose.yml up -d</code></b><br>
1718
</div>
1819
<div id="monaco-editor-root" style="width:800px;height:600px;border:1px solid grey"></div>
1920
<script type="module">

packages/examples/groovy.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<br>
1515
<button type="button" id="button-start">Start</button>
1616
<button type="button" id="button-dispose">Dispose</button>
17+
Launch backend with: <b><code>docker compose -f ./packages/examples/resources/groovy/docker-compose.yml up -d</code></b><br>
1718
</div>
1819
<div id="monaco-editor-root" style="width:800px;height:600px;border:1px solid grey"></div>
1920
<script type="module">

packages/examples/src/appPlayground/reactMain.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { MonacoEditorLanguageClientWrapper, TextChanges } from 'monaco-editor-wr
99
import { MonacoEditorReactComp } from '@typefox/monaco-editor-react';
1010
import { configure } from './config.js';
1111
import { configurePostStart } from './common.js';
12+
import { disableElement } from '../common/client/utils.js';
1213

1314
export const runApplicationPlaygroundReact = async () => {
1415

@@ -43,6 +44,7 @@ export const runApplicationPlaygroundReact = async () => {
4344
} else {
4445
root.render(<App />);
4546
}
47+
disableElement('checkbox-strictmode', true);
4648
});
4749
} catch (e) {
4850
console.error(e);

packages/examples/src/clangd/client/main.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { MonacoEditorLanguageClientWrapper } from 'monaco-editor-wrapper';
1111
import { createWrapperConfig } from './config.js';
1212
import { ClangdWorkerHandler } from './workerHandler.js';
1313
import { MainRemoteMessageChannelFs } from './mainRemoteMessageChannelFs.js';
14-
import { createDefaultWorkspaceFile, disableButton } from '../../common/client/utils.js';
14+
import { createDefaultWorkspaceFile, disableElement } from '../../common/client/utils.js';
1515
import { HOME_DIR, WORKSPACE_PATH } from '../definitions.js';
1616

1717
const wrapper = new MonacoEditorLanguageClientWrapper();
@@ -58,14 +58,14 @@ export const runClangdWrapper = async () => {
5858

5959
try {
6060
document.querySelector('#button-start')?.addEventListener('click', async () => {
61-
disableButton('button-start', true);
62-
disableButton('button-start-fresh', true);
61+
disableElement('button-start', true);
62+
disableElement('button-start-fresh', true);
6363
await startWrapper();
6464
});
6565
document.querySelector('#button-start-fresh')?.addEventListener('click', async () => {
6666
initConfig.clearIndexedDb = true;
67-
disableButton('button-start', true);
68-
disableButton('button-start-fresh', true);
67+
disableElement('button-start', true);
68+
disableElement('button-start-fresh', true);
6969
await startWrapper();
7070
});
7171
} catch (e) {

packages/examples/src/common/client/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import { useWorkerFactory } from 'monaco-editor-wrapper/workerFactory';
99
import { RegisteredMemoryFile } from '@codingame/monaco-vscode-files-service-override';
1010
import { IStoredWorkspace } from '@codingame/monaco-vscode-configuration-service-override';
1111

12-
export const disableButton = (id: string, disabled: boolean) => {
13-
const button = document.getElementById(id) as HTMLButtonElement | null;
12+
export const disableElement = (id: string, disabled: boolean) => {
13+
const button = document.getElementById(id) as HTMLButtonElement | HTMLInputElement | null;
1414
if (button !== null) {
1515
button.disabled = disabled;
1616
}

packages/examples/src/langium/langium-dsl/wrapperLangium.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { MonacoEditorLanguageClientWrapper } from 'monaco-editor-wrapper';
77
import { setupLangiumClientExtended } from './config/extendedConfig.js';
88
import { setupLangiumClientClassic } from './config/classicConfig.js';
9-
import { disableButton } from '../../common/client/utils.js';
9+
import { disableElement } from '../../common/client/utils.js';
1010

1111
import workerUrl from './worker/langium-server?worker&url';
1212

@@ -32,7 +32,7 @@ export const runLangiumDslWrapper = async (extendedMode: boolean) => {
3232

3333
const startLangiumClient = async () => {
3434
if (checkStarted()) return;
35-
disableButton('button-start', true);
35+
disableElement('button-start', true);
3636

3737
const langiumWorker = loadLangiumWorker();
3838

@@ -52,7 +52,7 @@ export const runLangiumDslWrapper = async (extendedMode: boolean) => {
5252
wrapper.reportStatus();
5353
await wrapper.dispose();
5454
wrapper = undefined;
55-
disableButton('button-start', false);
55+
disableElement('button-start', false);
5656
};
5757

5858
document.querySelector('#button-start')?.addEventListener('click', startLangiumClient);

packages/examples/src/langium/statemachine/main-react.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { MonacoEditorReactComp } from '@typefox/monaco-editor-react';
99
import { createLangiumGlobalConfig } from './config/wrapperStatemachineConfig.js';
1010
import { loadStatemachineWorkerRegular } from './main.js';
1111
import text from '../../../resources/langium/statemachine/example.statemachine?raw';
12+
import { disableElement } from '../../common/client/utils.js';
1213

1314
export const runStatemachineReact = async () => {
1415
const wrapperConfig = await createLangiumGlobalConfig({
@@ -49,6 +50,7 @@ export const runStatemachineReact = async () => {
4950
} else {
5051
root.render(<App />);
5152
}
53+
disableElement('checkbox-strictmode', true);
5254
});
5355
document.querySelector('#button-dispose')?.addEventListener('click', () => {
5456
root.render([]);

packages/examples/src/multi/twoLanguageClients.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import '@codingame/monaco-vscode-json-default-extension';
1010
import '@codingame/monaco-vscode-python-default-extension';
1111
import { LogLevel } from '@codingame/monaco-vscode-api';
1212
import { CodePlusFileExt, configureAndInitVscodeApi, disposeLanguageClients, LanguageClientWrapper, MonacoEditorLanguageClientWrapper, WrapperConfig } from 'monaco-editor-wrapper';
13-
import { configureMonacoWorkers, disableButton } from '../common/client/utils.js';
13+
import { configureMonacoWorkers, disableElement } from '../common/client/utils.js';
1414
import { createJsonLanguageClientConfig, createPythonLanguageClientConfig } from './config.js';
1515

1616
export const runMultipleLanguageClientsExample = async () => {
17-
disableButton('button-flip', true);
17+
disableElement('button-flip', true);
1818

1919
const textJson = `{
2020
"$schema": "http://json.schemastore.org/coffeelint",
@@ -106,10 +106,11 @@ print("Hello Moon!")
106106
(wrapperConfig.editorAppConfig.codeResources.modified as CodePlusFileExt).fileExt = currenFileExt;
107107
}
108108

109-
disableButton('button-flip', false);
109+
disableElement('button-flip', false);
110+
disableElement('checkbox-extlc', true);
110111
});
111112
document.querySelector('#button-dispose')?.addEventListener('click', async () => {
112-
disableButton('button-flip', true);
113+
disableElement('button-flip', true);
113114

114115
wrapperConfig.vscodeApiConfig!.vscodeApiInitPerformExternally = (document.getElementById('checkbox-extlc')! as HTMLInputElement).checked;
115116
if (wrapperConfig.vscodeApiConfig!.vscodeApiInitPerformExternally === true) {

packages/examples/src/python/client/reactPython.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { MonacoEditorReactComp } from '@typefox/monaco-editor-react';
1111
import { MonacoEditorLanguageClientWrapper, TextChanges } from 'monaco-editor-wrapper';
1212
import { createWrapperConfig } from './config.js';
1313
import badPyCode from '../../../resources/python/bad.py?raw';
14+
import { disableElement } from '../../common/client/utils.js';
1415

1516
export const runPythonReact = async () => {
1617
const badPyUri = vscode.Uri.file('/workspace/bad.py');
@@ -50,6 +51,7 @@ export const runPythonReact = async () => {
5051
} else {
5152
root.render(<App />);
5253
}
54+
disableElement('checkbox-strictmode', true);
5355
});
5456
document.querySelector('#button-dispose')?.addEventListener('click', () => {
5557
root.render([]);

0 commit comments

Comments
 (0)