From 4886e1da087e36c3c8211208e8000199762e5749 Mon Sep 17 00:00:00 2001 From: Henning Dieterichs Date: Fri, 31 Mar 2023 12:29:44 +0200 Subject: [PATCH 01/13] Fixes webcomponent sample for local development --- .../creating-the-editor/web-component/sample.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/website/src/website/data/playground-samples/creating-the-editor/web-component/sample.js b/website/src/website/data/playground-samples/creating-the-editor/web-component/sample.js index 07dc477f..9f178b30 100644 --- a/website/src/website/data/playground-samples/creating-the-editor/web-component/sample.js +++ b/website/src/website/data/playground-samples/creating-the-editor/web-component/sample.js @@ -11,10 +11,12 @@ customElements.define( const shadowRoot = this.attachShadow({ mode: "open" }); // Copy over editor styles - const style = document.querySelector( - "link[rel='stylesheet'][data-name='vs/editor/editor.main']" + const styles = document.querySelectorAll( + "link[rel='stylesheet'][data-name^='vs/']" ); - shadowRoot.appendChild(style.cloneNode(true)); + for (const style of styles) { + shadowRoot.appendChild(style.cloneNode(true)); + } const template = /** @type HTMLTemplateElement */ ( document.getElementById("editor-template") From 6c77360f6b8dd9ee7ea07b67f9a6a9c540100ed9 Mon Sep 17 00:00:00 2001 From: Henning Dieterichs Date: Tue, 4 Apr 2023 11:00:31 +0200 Subject: [PATCH 02/13] Sets tsc target to fix playground compile issues --- website/scripts/check-playground-samples-js.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/website/scripts/check-playground-samples-js.ts b/website/scripts/check-playground-samples-js.ts index dffcc62e..b0fa28c4 100644 --- a/website/scripts/check-playground-samples-js.ts +++ b/website/scripts/check-playground-samples-js.ts @@ -14,6 +14,8 @@ import { exit } from "process"; "yarn", [ "tsc", + "--target", + "es6", "--noEmit", "--allowJs", "--checkJs", From 29bf7f9a9192158d0258cee2c2e12d9e9d8b0adf Mon Sep 17 00:00:00 2001 From: Henning Dieterichs Date: Wed, 5 Apr 2023 12:22:20 +0200 Subject: [PATCH 03/13] Implements option to disable auto-reload --- .../pages/playground/PlaygroundModel.ts | 19 ++++++++++++++- .../playground/PlaygroundPageContent.tsx | 24 ++++++++++++++++--- .../website/pages/playground/SettingsModel.ts | 10 ++++++++ 3 files changed, 49 insertions(+), 4 deletions(-) diff --git a/website/src/website/pages/playground/PlaygroundModel.ts b/website/src/website/pages/playground/PlaygroundModel.ts index 15ae15f8..5f8bdc15 100644 --- a/website/src/website/pages/playground/PlaygroundModel.ts +++ b/website/src/website/pages/playground/PlaygroundModel.ts @@ -56,7 +56,7 @@ export class PlaygroundModel { public readonly serializer = new StateUrlSerializer(this); - reload(): void { + public reload(): void { this.reloadKey++; } @@ -127,12 +127,29 @@ export class PlaygroundModel { private readonly debouncer = new Debouncer(250); + @observable + public isDirty = false; + constructor() { + let lastState = this.state; + this.dispose.track({ dispose: reaction( () => ({ state: this.state }), ({ state }) => { + if (!this.settings.autoReload) { + if ( + JSON.stringify(state.monacoSetup) === + JSON.stringify(lastState.monacoSetup) && + state.key === lastState.key + ) { + this.isDirty = true; + return; + } + } this.debouncer.run(() => { + this.isDirty = false; + lastState = state; for (const handler of this._previewHandlers) { handler.handlePreview(state); } diff --git a/website/src/website/pages/playground/PlaygroundPageContent.tsx b/website/src/website/pages/playground/PlaygroundPageContent.tsx index 7968b323..20eca186 100644 --- a/website/src/website/pages/playground/PlaygroundPageContent.tsx +++ b/website/src/website/pages/playground/PlaygroundPageContent.tsx @@ -18,7 +18,7 @@ import { PlaygroundModel } from "./PlaygroundModel"; import { Preview } from "./Preview"; import { SettingsDialog } from "./SettingsDialog"; import { Button, Col, Row, Stack } from "../../components/bootstrap"; -import { ButtonGroup } from "react-bootstrap"; +import { ButtonGroup, FormCheck } from "react-bootstrap"; @hotComponent(module) @observer @@ -114,11 +114,29 @@ export class PlaygroundPageContent extends React.Component< titleBarItems={
+ {model.settings.previewFullScreen || ( + + (model.settings.autoReload = + e.target.checked) + } + /> + )}
+ } + > + + + -
- - - -
+
+ + + +
-
- - - -
- - +
+ + + +
+ + + )} Date: Wed, 5 Apr 2023 17:50:32 +0200 Subject: [PATCH 05/13] 0.37.1 --- CHANGELOG.md | 4 ++++ package.json | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57537405..b4a60415 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Monaco Editor Changelog +## [0.37.1] + +- Fixes Inline Completions feature + ## [0.37.0] - New `registerLinkOpener` API diff --git a/package.json b/package.json index 2696fdf5..68fb1602 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "monaco-editor", - "version": "0.37.0", - "vscodeRef": "9eba21c20f8720575cbc6c531d60c042c554d465", + "version": "0.37.1", + "vscodeRef": "8f74fbfd1f2d8f6268a42df131726b218aafe511", "private": true, "description": "A browser based code editor", "homepage": "https://github.com/microsoft/monaco-editor", From e3b1a47554b8ec6282f02d0d537cf7e1777e8983 Mon Sep 17 00:00:00 2001 From: Henning Dieterichs Date: Thu, 6 Apr 2023 16:30:30 +0200 Subject: [PATCH 06/13] Playground improvements --- .../website/pages/playground/PlaygroundModel.ts | 2 +- .../pages/playground/PlaygroundPageContent.tsx | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/website/src/website/pages/playground/PlaygroundModel.ts b/website/src/website/pages/playground/PlaygroundModel.ts index d94a9988..7cb6cbf0 100644 --- a/website/src/website/pages/playground/PlaygroundModel.ts +++ b/website/src/website/pages/playground/PlaygroundModel.ts @@ -140,7 +140,7 @@ export class PlaygroundModel { } } - private readonly debouncer = new Debouncer(250); + private readonly debouncer = new Debouncer(700); @observable public isDirty = false; diff --git a/website/src/website/pages/playground/PlaygroundPageContent.tsx b/website/src/website/pages/playground/PlaygroundPageContent.tsx index e93c0d4a..3c1039d5 100644 --- a/website/src/website/pages/playground/PlaygroundPageContent.tsx +++ b/website/src/website/pages/playground/PlaygroundPageContent.tsx @@ -133,10 +133,16 @@ export class PlaygroundPageContent extends React.Component< checked={ model.settings.autoReload } - onChange={(e) => - (model.settings.autoReload = - e.target.checked) - } + onChange={(e) => { + model.settings.autoReload = + e.target.checked; + if ( + e.target.checked && + model.isDirty + ) { + model.reload(); + } + }} /> )}