diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 7508da49..49857512 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -7,17 +7,30 @@ on: # enable users to manually trigger with workflow_dispatch workflow_dispatch: {} +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: 'pages' + cancel-in-progress: false + jobs: - publish-website: - name: Publish Website + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@dc323e67f16fb5f7663d20ff7941f27f5809e9b6 # pin@v2 - + - name: Checkout + uses: actions/checkout@v3 - uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561 # pin@v2 with: node-version: 16 - - name: Cache node modules id: cacheNodeModules uses: actions/cache@v2 @@ -25,11 +38,9 @@ jobs: path: '**/node_modules' key: ${{ runner.os }}-cacheNodeModules2-${{ hashFiles('**/package-lock.json') }} restore-keys: ${{ runner.os }}-cacheNodeModules2- - - name: execute `npm ci` (1) if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }} run: npm ci - - name: Build run: npm run build-monaco-editor @@ -45,8 +56,13 @@ jobs: working-directory: website run: yarn run build - - name: Upload website to github pages - uses: peaceiris/actions-gh-pages@bd8c6b06eba6b3d25d72b7a1767993c0aeee42e7 # pin@v3 + - name: Setup Pages + uses: actions/configure-pages@v3 + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./website/dist + # Upload entire repository + path: './website/dist' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 36b2eb14..f5a2da4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Monaco Editor Changelog +## [0.40.0] + +- Support for Glyph Margin Widgets +- Removes `getDiffLineInformationForOriginal` and `getDiffLineInformationForModified` from `IDiffEditor` +- `createTrustedTypesPolicy` is optional now +- New option `IModelDecorationOptions.shouldFillLineOnLineBreak` +- New option `EditorOptions.readOnlyMessage`` + ## [0.39.0] - New method `Environment.createTrustedTypesPolicy` to override trusted types handling. diff --git a/MAINTAINING.md b/MAINTAINING.md index 95fbfe19..deb5aee9 100644 --- a/MAINTAINING.md +++ b/MAINTAINING.md @@ -9,7 +9,7 @@ Make sure every unassigned issue is labeled properly: ## Publishing a stable build monaco-editor build - Make sure there exists a nightly build from the VS Code commit the stable build should be built from -- [Compare Last Stable With Nightly](https://microsoft.github.io/monaco-editor/playground.html?source=v0.39.0-dev.20230606#XQAAAAKzBQAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscw9ajfg2SGxNmVfIdymzfNMmpU96miXJZvs8c7gcyo98bKVzbks7HoMVAZiOQjzsGSo4vYRPplxTKh4qJ5_s9m1RB0u1a8RPwJXtmqrYtToAekuwuDQ2im8_QvtfSt1HbJIiHVd2zPiTBSeoC03JVOCBfBsHUM0AOblitxr0yoEKp5yCNj9Xx68iP2xX6l7R-oQQP0QegyE5JU_S6OAtnV--nu4J_lwqYHYrlBXuqsqRU-cKhSqrbrcWCxKMEmQyZkUHmM75vxSD8qepWmGk7BA4eU4YQI7tZ6g74Y0LXfIckS_2A-xIQYChatES1wLXoLosL4FhDqugt7bJg6Lelf09SdwM_NgJuVqmU8jOyMkHaKZ4nkZt61mFhR3Wa4KUfFUTCro6cKL3tIHInvgOfg8gpWdNOKy19pICfKSDYlWkn6rPgZxR0b-KCbY8K3_B6h8_TU8JfXlva5OmzfgvNBQcN_UE95r5zuBUua8JDaVLTOUKDRsOj5DYNx9KGGgicA2qjH3IlyyuOfgPTmNssWQv496rVgpqm4Zpt3DGSDY-1vxbGQe7m135DxLbACD70fgH8-C-ou2umXUKDrJbZJI2EFFMvzvZVBZVEp7Fa2j7161WJ_oyFj1HvHtTMvvrE_0P2g-u--1zh_9OHJ_ybwLAA) +- [Compare Last Stable With Nightly](https://microsoft.github.io/monaco-editor/playground.html?source=v0.40.0-dev.20230704#XQAAAAJWBgAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscw_SM66BuzMt6m3zM8Thvb-XSMR_Da8IdBq3FOgly-7-xuaHSi_yUg58ZO9Mr-RKT7GyHzHoU8B9N7P-uTzmCdhT2Vv-4gNRbWSMQCUPrfmzFCkSH_WR2Vc8LGx2m0uRSFiJu82B1mS0RM-eriU9PTOqAgBrlPUMTU44VrHyVOqgs5BFrUuUHwGDzUHxeNuUk-kg2u70awQLQ83wD4o2EbSefqfIWkk2Yi0mnUS903tLA4V17MD_6OHIRArunMPL6E14ZCW0_Aql21F62Fmz--i_pNbqBIpSlBbZl6LzA1HzNsoDH7i2rn1qAw55L1MjwOU4QQMCJfffmJznAbGoZWkXK91OPYlOGNHNGG-MPUFsY5JSjLfvCWOvXypW9ZVkBZMo1qUbtE135CLqbaBiw52f3eOPBTru3IL_wT__ciAFI5NDiVOeN8V9zqkzbwiFNeQyZcjxmrDLjYTPJpao0dG61Um0w4FpVud8p77bjoAdEfG8JNO97W4cawj0HvMfvcZS81P7IsijZqA7KyVsdq79iCJQuMO31aS86cM4GTNT0TvdI7p62uiEmm9X6ZjF8oSLxW87Vt0oYAZ5wBePqdN6FwNO6BWACt2Ep9i5Q6h-mOy7_JWOiPTOH0Zz3v6SaNhjxJwZAqNG3FqvRTgLg-au-pfa8PD0No3U15UyWeqrVXSthGFghLJ16ppEwFCqFfQ6Vr0leZtSZXyk41-t5ZKMG-KQjzq1XE2PnuyOz60nV4GaYvGlMHrXz-XrEqb2kwNf_pBee0) - Update [package.json](./package.json) - set `version` to next stable - set `vscodeRef` to _vscodeCommitId_ @@ -17,7 +17,7 @@ Make sure every unassigned issue is labeled properly: - Run `npm install` to update lockfile - Update [CHANGELOG.md](./CHANGELOG.md) - API Changes / Breaking Changes / New and noteworthy - - Thank you ([use this tool](https://vscode-tools.azurewebsites.net/acknowledgement/)) + - Thank you ([use this tool](https://tools.code.visualstudio.com/acknowledgement)) - Commit - [Trigger build](https://dev.azure.com/monacotools/Monaco/_build?definitionId=416) diff --git a/build/importTypescript.ts b/build/importTypescript.ts index c2e67267..14035727 100644 --- a/build/importTypescript.ts +++ b/build/importTypescript.ts @@ -37,6 +37,11 @@ export const typescriptVersion = "${typeScriptDependencyVersion}";\n` let tsServices = fs.readFileSync(path.join(TYPESCRIPT_LIB_SOURCE, 'typescript.js')).toString(); + tsServices = tsServices.replace( + 'const path = matchedStar ? subst.replace("*", matchedStar) : subst;', + 'const path = matchedStar ? subst.replace("*", matchedStar) : subst; // CodeQL [SM02383] This is a false positive, the code is from the TypeScript compiler' + ); + // The output from this build will only be accessible via ESM; rather than removing // references to require/module, define them as dummy variables that bundlers will ignore. // The TS code can figure out that it's not running under Node even with these defined. diff --git a/package-lock.json b/package-lock.json index fd3f32bc..cd4c6c87 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "monaco-editor", - "version": "0.39.0", + "version": "0.40.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "monaco-editor", - "version": "0.39.0", + "version": "0.40.0", "hasInstallScript": true, "license": "MIT", "devDependencies": { @@ -25,7 +25,7 @@ "jsdom": "^19.0.0", "jsonc-parser": "^3.0.0", "mocha": "^9.2.0", - "monaco-editor-core": "^0.39.0-dev.20230605", + "monaco-editor-core": "^0.40.0-dev.20230629", "parcel": "^2.7.0", "pin-github-action": "^1.8.0", "playwright": "^1.32.2", @@ -5326,9 +5326,9 @@ "dev": true }, "node_modules/monaco-editor-core": { - "version": "0.39.0-rc2", - "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.39.0-rc2.tgz", - "integrity": "sha512-PVOMjeVt17EvLIa27CmtVIqUz500mHPmsMJpKbVjV1fHCaRHoK38Qrk+lYWXM4MAHFOeUb1GNlj8Z1TnqlOJSw==", + "version": "0.40.0-dev.20230707", + "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.40.0-dev.20230707.tgz", + "integrity": "sha512-aKvvZjZYww+5KbyYq5L3aUjdRmVVXZrCXGO0A0GTISpx2PuqThDpEv7r4ZQkhHQxHSGCRZdLr2JAdgFLkNcmxg==", "dev": true }, "node_modules/mri": { @@ -11020,9 +11020,9 @@ } }, "monaco-editor-core": { - "version": "0.39.0-rc2", - "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.39.0-rc2.tgz", - "integrity": "sha512-PVOMjeVt17EvLIa27CmtVIqUz500mHPmsMJpKbVjV1fHCaRHoK38Qrk+lYWXM4MAHFOeUb1GNlj8Z1TnqlOJSw==", + "version": "0.40.0-dev.20230707", + "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.40.0-dev.20230707.tgz", + "integrity": "sha512-aKvvZjZYww+5KbyYq5L3aUjdRmVVXZrCXGO0A0GTISpx2PuqThDpEv7r4ZQkhHQxHSGCRZdLr2JAdgFLkNcmxg==", "dev": true }, "mri": { diff --git a/package.json b/package.json index f99c75e2..0790a0f8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "monaco-editor", - "version": "0.39.0", - "vscodeRef": "78390793536f5f43e17ff7c97b260bd2a5d1060c", + "version": "0.40.0", + "vscodeRef": "660393deaaa6d1996740ff4880f1bad43768c814", "private": true, "description": "A browser based code editor", "homepage": "https://github.com/microsoft/monaco-editor", @@ -52,7 +52,7 @@ "jsdom": "^19.0.0", "jsonc-parser": "^3.0.0", "mocha": "^9.2.0", - "monaco-editor-core": "^0.39.0-dev.20230605", + "monaco-editor-core": "^0.40.0-dev.20230629", "parcel": "^2.7.0", "pin-github-action": "^1.8.0", "playwright": "^1.32.2", diff --git a/src/basic-languages/elixir/elixir.test.ts b/src/basic-languages/elixir/elixir.test.ts index fe68c922..25c06294 100644 --- a/src/basic-languages/elixir/elixir.test.ts +++ b/src/basic-languages/elixir/elixir.test.ts @@ -303,6 +303,17 @@ testTokenization('elixir', [ ] } ], + // Sigils (multi-letter uppercase) + [ + { + line: '~DX/foo/', + tokens: [ + { startIndex: 0, type: 'sigil.delimiter.elixir' }, + { startIndex: 4, type: 'sigil.elixir' }, + { startIndex: 7, type: 'sigil.delimiter.elixir' } + ] + } + ], // Sigils (no interpolation) [ { @@ -314,6 +325,17 @@ testTokenization('elixir', [ ] } ], + // Sigils (multi-letter uppercase no interpolation) + [ + { + line: '~WW/foo#{1}/', + tokens: [ + { startIndex: 0, type: 'sigil.delimiter.elixir' }, + { startIndex: 4, type: 'sigil.elixir' }, + { startIndex: 11, type: 'sigil.delimiter.elixir' } + ] + } + ], // Sigils (modifiers) [ { @@ -325,6 +347,17 @@ testTokenization('elixir', [ ] } ], + // Sigils (multi-letter uppercase with modifiers) + [ + { + line: '~DX/custom/az09', + tokens: [ + { startIndex: 0, type: 'sigil.delimiter.elixir' }, + { startIndex: 4, type: 'sigil.elixir' }, + { startIndex: 10, type: 'sigil.delimiter.elixir' } + ] + } + ], // Module attributes [ { diff --git a/src/basic-languages/elixir/elixir.ts b/src/basic-languages/elixir/elixir.ts index 078d1030..bb98e976 100644 --- a/src/basic-languages/elixir/elixir.ts +++ b/src/basic-languages/elixir/elixir.ts @@ -333,7 +333,8 @@ export const language = { // See https://elixir-lang.org/getting-started/sigils.html // Sigils allow for typing values using their textual representation. - // All sigils start with ~ followed by a letter indicating sigil type + // All sigils start with ~ followed by a letter or + // multi-letter uppercase starting at Elixir v1.15.0, indicating sigil type // and then a delimiter pair enclosing the textual representation. // Optional modifiers are allowed after the closing delimiter. // For instance a regular expressions can be written as: @@ -353,16 +354,16 @@ export const language = { sigils: [ [/~[a-z]@sigilStartDelimiter/, { token: '@rematch', next: '@sigil.interpol' }], - [/~[A-Z]@sigilStartDelimiter/, { token: '@rematch', next: '@sigil.noInterpol' }] + [/~([A-Z]+)@sigilStartDelimiter/, { token: '@rematch', next: '@sigil.noInterpol' }] ], sigil: [ - [/~([a-zA-Z])\{/, { token: '@rematch', switchTo: '@sigilStart.$S2.$1.{.}' }], - [/~([a-zA-Z])\[/, { token: '@rematch', switchTo: '@sigilStart.$S2.$1.[.]' }], - [/~([a-zA-Z])\(/, { token: '@rematch', switchTo: '@sigilStart.$S2.$1.(.)' }], - [/~([a-zA-Z])\' }], + [/~([a-z]|[A-Z]+)\{/, { token: '@rematch', switchTo: '@sigilStart.$S2.$1.{.}' }], + [/~([a-z]|[A-Z]+)\[/, { token: '@rematch', switchTo: '@sigilStart.$S2.$1.[.]' }], + [/~([a-z]|[A-Z]+)\(/, { token: '@rematch', switchTo: '@sigilStart.$S2.$1.(.)' }], + [/~([a-z]|[A-Z]+)\' }], [ - /~([a-zA-Z])(@sigilSymmetricDelimiter)/, + /~([a-z]|[A-Z]+)(@sigilSymmetricDelimiter)/, { token: '@rematch', switchTo: '@sigilStart.$S2.$1.$2.$2' } ] ], @@ -475,7 +476,7 @@ export const language = { // Fallback to the generic sigil by default 'sigilStart.interpol': [ [ - /~([a-zA-Z])@sigilStartDelimiter/, + /~([a-z]|[A-Z]+)@sigilStartDelimiter/, { token: 'sigil.delimiter', switchTo: '@sigilContinue.$S2.$S3.$S4.$S5' @@ -498,7 +499,7 @@ export const language = { 'sigilStart.noInterpol': [ [ - /~([a-zA-Z])@sigilStartDelimiter/, + /~([a-z]|[A-Z]+)@sigilStartDelimiter/, { token: 'sigil.delimiter', switchTo: '@sigilContinue.$S2.$S3.$S4.$S5' diff --git a/src/language/typescript/lib/typescriptServices.js b/src/language/typescript/lib/typescriptServices.js index c878528b..e8d06368 100644 --- a/src/language/typescript/lib/typescriptServices.js +++ b/src/language/typescript/lib/typescriptServices.js @@ -40937,7 +40937,7 @@ ${lanes.join("\n")} trace(state.host, Diagnostics.Module_name_0_matched_pattern_1, moduleName, matchedPatternText); } const resolved = forEach(paths[matchedPatternText], (subst) => { - const path = matchedStar ? subst.replace("*", matchedStar) : subst; + const path = matchedStar ? subst.replace("*", matchedStar) : subst; // CodeQL [SM02383] This is a false positive, the code is from the TypeScript compiler const candidate = normalizePath(combinePaths(baseDirectory, path)); if (state.traceEnabled) { trace(state.host, Diagnostics.Trying_substitution_0_candidate_module_location_Colon_1, subst, path); diff --git a/test/manual/dev-setup.js b/test/manual/dev-setup.js index 9cfe13db..a2c8cc46 100644 --- a/test/manual/dev-setup.js +++ b/test/manual/dev-setup.js @@ -39,7 +39,7 @@ '
  • ' + renderLoadingOptions(true) + (isRelease ? '' : `
  • ${renderLoadingOptions(false)}`) + - '
'; + ''; // CodeQL [SM03712] This code is not deployed and serves as local test code. No risk of malicious input. document.body.appendChild(div); @@ -47,7 +47,7 @@ for (let i = 0; i < aElements.length; i++) { let aElement = aElements[i]; if (aElement.className === 'loading-opts') { - aElement.href += window.location.search; + aElement.href += window.location.search; // CodeQL [SM01507] This code is not deployed and serves as local test code. No risk of malicious input. } } })(); diff --git a/website/src/monaco-loader.ts b/website/src/monaco-loader.ts index 2c771a0c..898b08d7 100644 --- a/website/src/monaco-loader.ts +++ b/website/src/monaco-loader.ts @@ -84,7 +84,7 @@ function loadScript(path: string): Promise { script.onload = () => res(); script.async = true; script.type = "text/javascript"; - script.src = path; + script.src = path; // CodeQL [SM01507] This is safe because the runner (that allows for dynamic paths) runs in an isolated iframe. The hosting website uses a static path configuration. // CodeQL [SM03712] This is safe because the runner (that allows for dynamic paths) runs in an isolated iframe. The hosting website uses a static path configuration. document.head.appendChild(script); }); } diff --git a/website/src/runner/index.ts b/website/src/runner/index.ts index fe8af646..97776901 100644 --- a/website/src/runner/index.ts +++ b/website/src/runner/index.ts @@ -21,7 +21,7 @@ window.addEventListener("message", (event) => { const style = document.getElementById( "custom-style" ) as HTMLStyleElement; - style.innerHTML = e.css; + style.innerHTML = e.css; // CodeQL [SM03712] This is safe because the runner runs in an isolated iframe. } }); @@ -54,7 +54,7 @@ async function initialize(state: IPreviewState) { const js = massageJs(state.js); try { - eval(js); + eval(js); // CodeQL [SM01632] This is safe because the runner runs in an isolated iframe. This feature is essential to the functionality of the playground. // CodeQL [SM02688] This is safe because the runner runs in an isolated iframe. This feature is essential to the functionality of the playground. } catch (err) { const pre = document.createElement("pre"); pre.appendChild( diff --git a/website/src/website/pages/home/Home.tsx b/website/src/website/pages/home/Home.tsx index 1f3bde98..759a06b2 100644 --- a/website/src/website/pages/home/Home.tsx +++ b/website/src/website/pages/home/Home.tsx @@ -172,10 +172,9 @@ class EditorDemo extends React.Component {

IntelliSense, Validation

- Paragraph of text beneath the heading to explain - the heading. We'll add onto it with another - sentence and probably just keep going until we - run out of words. + Get completions and errors directly in the + browser for supported languages. Or write your + own completion providers in JavaScript.

@@ -184,10 +183,9 @@ class EditorDemo extends React.Component {

Basic Syntax Colorization

- Paragraph of text beneath the heading to explain - the heading. We'll add onto it with another - sentence and probably just keep going until we - run out of words. + Colorize code using our pre-built syntax + highlighting, or configure your own custom + colorization.

diff --git a/website/src/website/pages/playground/PlaygroundPageContent.tsx b/website/src/website/pages/playground/PlaygroundPageContent.tsx index cdd953cf..66b5e3f7 100644 --- a/website/src/website/pages/playground/PlaygroundPageContent.tsx +++ b/website/src/website/pages/playground/PlaygroundPageContent.tsx @@ -1,24 +1,24 @@ import { autorun } from "mobx"; import { observer } from "mobx-react"; import * as React from "react"; +import { ButtonGroup, FormCheck } from "react-bootstrap"; import { getLoadedMonaco } from "../../../monaco-loader"; -import { IPlaygroundProject, IPreviewState } from "../../../shared"; import { Page } from "../../components/Page"; import { Select } from "../../components/Select"; +import { Button, Col, Row, Stack } from "../../components/bootstrap"; import { MonacoEditor, MonacoEditorHeight, } from "../../components/monaco/MonacoEditor"; import { withLoadedMonaco } from "../../components/monaco/MonacoLoader"; +import { monacoEditorVersion } from "../../monacoEditorVersion"; import { hotComponent } from "../../utils/hotComponent"; import { IReference, ref } from "../../utils/ref"; -import { getNpmVersionsSync } from "./getNpmVersionsSync"; -import { getPlaygroundExamples, PlaygroundExample } from "./playgroundExamples"; import { PlaygroundModel } from "./PlaygroundModel"; import { Preview } from "./Preview"; import { SettingsDialog } from "./SettingsDialog"; -import { Button, Col, Row, Stack } from "../../components/bootstrap"; -import { ButtonGroup, FormCheck } from "react-bootstrap"; +import { getNpmVersionsSync } from "./getNpmVersionsSync"; +import { PlaygroundExample, getPlaygroundExamples } from "./playgroundExamples"; @hotComponent(module) @observer @@ -258,13 +258,15 @@ export class VersionSelector extends React.Component<{