mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 16:15:41 +01:00
Merge branch 'main' into mn/fix/expose-all-module-resolutions
This commit is contained in:
commit
f7512b812b
21 changed files with 240 additions and 141 deletions
29
.github/workflows/info-needed-closer.yml
vendored
29
.github/workflows/info-needed-closer.yml
vendored
|
|
@ -1,29 +0,0 @@
|
||||||
name: Info Needed Closer
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: 20 12 * * * # 5:20am Redmond
|
|
||||||
repository_dispatch:
|
|
||||||
types: [trigger-needs-more-info]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
main:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout Actions
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
repository: 'microsoft/vscode-github-triage-actions'
|
|
||||||
path: ./actions
|
|
||||||
ref: stable
|
|
||||||
- name: Install Actions
|
|
||||||
run: npm install --production --prefix ./actions
|
|
||||||
- name: Run Info Needed Closer
|
|
||||||
uses: ./actions/needs-more-info-closer
|
|
||||||
with:
|
|
||||||
label: info-needed
|
|
||||||
closeDays: 7
|
|
||||||
additionalTeam: 'spahnke|rcjsuen'
|
|
||||||
closeComment: "This issue has been closed automatically because it needs more information and has not had recent activity. See also our [issue reporting](https://aka.ms/vscodeissuereporting) guidelines.\n\nHappy Coding!"
|
|
||||||
pingDays: 120
|
|
||||||
pingComment: "Hey @${assignee}, this issue might need further attention.\n\n@${author}, you can help us out by closing this issue if the problem no longer exists, or adding more information."
|
|
||||||
27
.github/workflows/locker.yml
vendored
27
.github/workflows/locker.yml
vendored
|
|
@ -1,27 +0,0 @@
|
||||||
name: Locker
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: 21 23 * * * # 5:20pm Redmond
|
|
||||||
repository_dispatch:
|
|
||||||
types: [trigger-locker]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
main:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout Actions
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
repository: 'microsoft/vscode-github-triage-actions'
|
|
||||||
path: ./actions
|
|
||||||
ref: stable
|
|
||||||
- name: Install Actions
|
|
||||||
run: npm install --production --prefix ./actions
|
|
||||||
- name: Run Locker
|
|
||||||
uses: ./actions/locker
|
|
||||||
with:
|
|
||||||
daysSinceClose: 45
|
|
||||||
appInsightsKey: ${{secrets.TRIAGE_ACTIONS_APP_INSIGHTS}}
|
|
||||||
daysSinceUpdate: 3
|
|
||||||
ignoredLabel: '*out-of-scope'
|
|
||||||
2
.nvmrc
2
.nvmrc
|
|
@ -1 +1 @@
|
||||||
18.17
|
20.14.0
|
||||||
|
|
|
||||||
16
CHANGELOG.md
16
CHANGELOG.md
|
|
@ -1,5 +1,21 @@
|
||||||
# Monaco Editor Changelog
|
# Monaco Editor Changelog
|
||||||
|
|
||||||
|
## [0.52.0]
|
||||||
|
|
||||||
|
- Comment added inside of `IModelContentChangedEvent`
|
||||||
|
|
||||||
|
## [0.51.0]
|
||||||
|
|
||||||
|
- New fields `IEditorOptions.placeholder` and `IEditorOptions.compactMode`
|
||||||
|
- New fields `IGotoLocationOptions.multipleTests` and `IGotoLocationOptions.alternativeTestsCommand`
|
||||||
|
- New field `IInlineEditOptions.backgroundColoring`
|
||||||
|
- New experimental field `IEditorOptions.experimental.useTrueInlineView`
|
||||||
|
- New options `CommentThreadRevealOptions` for comments
|
||||||
|
|
||||||
|
Contributions to `monaco-editor`:
|
||||||
|
|
||||||
|
- [@ScottCarda-MS (Scott Carda)](https://github.com/ScottCarda-MS): Update Q# Keywords [PR #4586](https://github.com/microsoft/monaco-editor/pull/4586)
|
||||||
|
|
||||||
## [0.50.0]
|
## [0.50.0]
|
||||||
|
|
||||||
- New field `IEditorMinimapOptions.sectionHeaderLetterSpacing`
|
- New field `IEditorMinimapOptions.sectionHeaderLetterSpacing`
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,9 @@ Make sure every unassigned issue is labeled properly:
|
||||||
- API Changes / Breaking Changes / New and noteworthy (use the diff from the compare step)
|
- API Changes / Breaking Changes / New and noteworthy (use the diff from the compare step)
|
||||||
- Add thank you mentions ([use this tool](https://tools.code.visualstudio.com/acknowledgement) and select only the monaco-editor)
|
- Add thank you mentions ([use this tool](https://tools.code.visualstudio.com/acknowledgement) and select only the monaco-editor)
|
||||||
- Commit & Create PR
|
- Commit & Create PR
|
||||||
- [Trigger build](https://dev.azure.com/monacotools/Monaco/_build?definitionId=416) once merged
|
- [Trigger build](https://dev.azure.com/monacotools/Monaco/_build?definitionId=416) once merged. Tick the following checkboxes:
|
||||||
|
- Publish Monaco Editor Core
|
||||||
|
- Publish Monaco Editor
|
||||||
|
|
||||||
#### Publish new webpack plugin
|
#### Publish new webpack plugin
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
import path = require('path');
|
import path = require('path');
|
||||||
import fs = require('fs');
|
import fs = require('fs');
|
||||||
import { REPO_ROOT, readFiles, writeFiles, IFile } from '../build/utils';
|
import { REPO_ROOT, readFiles, writeFiles, IFile, readFile } from '../build/utils';
|
||||||
import { removeDir } from '../build/fs';
|
import { removeDir } from '../build/fs';
|
||||||
import ts = require('typescript');
|
import ts = require('typescript');
|
||||||
import { generateMetadata } from './releaseMetadata';
|
import { generateMetadata } from './releaseMetadata';
|
||||||
|
|
@ -66,9 +66,10 @@ generateMetadata();
|
||||||
* Release to `dev` or `min`.
|
* Release to `dev` or `min`.
|
||||||
*/
|
*/
|
||||||
function AMD_releaseOne(type: 'dev' | 'min') {
|
function AMD_releaseOne(type: 'dev' | 'min') {
|
||||||
const coreFiles = readFiles(`node_modules/monaco-editor-core/${type}/**/*`, {
|
let coreFiles = readFiles(`node_modules/monaco-editor-core/${type}/**/*`, {
|
||||||
base: `node_modules/monaco-editor-core/${type}`
|
base: `node_modules/monaco-editor-core/${type}`
|
||||||
});
|
});
|
||||||
|
coreFiles = fixNlsFiles(coreFiles);
|
||||||
AMD_addPluginContribs(type, coreFiles);
|
AMD_addPluginContribs(type, coreFiles);
|
||||||
writeFiles(coreFiles, `out/monaco-editor/${type}`);
|
writeFiles(coreFiles, `out/monaco-editor/${type}`);
|
||||||
|
|
||||||
|
|
@ -79,6 +80,33 @@ function AMD_releaseOne(type: 'dev' | 'min') {
|
||||||
writeFiles(pluginFiles, `out/monaco-editor/${type}`);
|
writeFiles(pluginFiles, `out/monaco-editor/${type}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fixNlsFiles(files: IFile[]): IFile[] {
|
||||||
|
return files.map((f) => {
|
||||||
|
if (!f.path.match(/nls\.messages\.[a-z\-]+\.js/)) {
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
const dirName = path.dirname(f.path);
|
||||||
|
const fileName = path.basename(f.path);
|
||||||
|
|
||||||
|
const newPath = path.join(dirName, 'vs', fileName);
|
||||||
|
let contentStr = f.contents.toString('utf-8');
|
||||||
|
|
||||||
|
contentStr = `
|
||||||
|
define([], function () {
|
||||||
|
${contentStr}
|
||||||
|
});
|
||||||
|
`;
|
||||||
|
|
||||||
|
const newContents = Buffer.from(contentStr, 'utf-8');
|
||||||
|
|
||||||
|
return {
|
||||||
|
path: newPath,
|
||||||
|
contents: newContents
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit editor.main.js:
|
* Edit editor.main.js:
|
||||||
* - rename the AMD module 'vs/editor/editor.main' to 'vs/editor/edcore.main'
|
* - rename the AMD module 'vs/editor/editor.main' to 'vs/editor/edcore.main'
|
||||||
|
|
@ -96,6 +124,15 @@ function AMD_addPluginContribs(type: 'dev' | 'min', files: IFile[]) {
|
||||||
// Rename the AMD module 'vs/editor/editor.main' to 'vs/editor/edcore.main'
|
// Rename the AMD module 'vs/editor/editor.main' to 'vs/editor/edcore.main'
|
||||||
contents = contents.replace(/"vs\/editor\/editor\.main\"/, '"vs/editor/edcore.main"');
|
contents = contents.replace(/"vs\/editor\/editor\.main\"/, '"vs/editor/edcore.main"');
|
||||||
|
|
||||||
|
// This ensures that old nls-plugin configurations are still respected by the new localization solution.
|
||||||
|
const contentPrefixSource = readFile('src/nls-fix.js')
|
||||||
|
.contents.toString('utf-8')
|
||||||
|
.replace(/\r\n|\n/g, ' ');
|
||||||
|
|
||||||
|
// TODO: Instead of adding this source to the header to maintain the source map indices, it should rewrite the sourcemap!
|
||||||
|
const searchValue = 'https://github.com/microsoft/vscode/blob/main/LICENSE.txt';
|
||||||
|
contents = contents.replace(searchValue, searchValue + ' */ ' + contentPrefixSource + ' /*');
|
||||||
|
|
||||||
const pluginFiles = readFiles(`out/languages/bundled/amd-${type}/**/monaco.contribution.js`, {
|
const pluginFiles = readFiles(`out/languages/bundled/amd-${type}/**/monaco.contribution.js`, {
|
||||||
base: `out/languages/bundled/amd-${type}`
|
base: `out/languages/bundled/amd-${type}`
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -268,8 +268,11 @@ export function readFiles(
|
||||||
});
|
});
|
||||||
|
|
||||||
const base = options.base;
|
const base = options.base;
|
||||||
|
return files.map((file) => readFile(file, base));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function readFile(file: string, base: string = '') {
|
||||||
const baseLength = base === '' ? 0 : base.endsWith('/') ? base.length : base.length + 1;
|
const baseLength = base === '' ? 0 : base.endsWith('/') ? base.length : base.length + 1;
|
||||||
return files.map((file) => {
|
|
||||||
const fullPath = path.join(REPO_ROOT, file);
|
const fullPath = path.join(REPO_ROOT, file);
|
||||||
const contents = fs.readFileSync(fullPath);
|
const contents = fs.readFileSync(fullPath);
|
||||||
const relativePath = file.substring(baseLength);
|
const relativePath = file.substring(baseLength);
|
||||||
|
|
@ -277,7 +280,6 @@ export function readFiles(
|
||||||
path: relativePath,
|
path: relativePath,
|
||||||
contents
|
contents
|
||||||
};
|
};
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function writeFiles(files: IFile[], dest: string) {
|
export function writeFiles(files: IFile[], dest: string) {
|
||||||
|
|
|
||||||
18
package-lock.json
generated
18
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "monaco-editor",
|
"name": "monaco-editor",
|
||||||
"version": "0.50.0",
|
"version": "0.52.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "monaco-editor",
|
"name": "monaco-editor",
|
||||||
"version": "0.50.0",
|
"version": "0.52.0",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
"jsdom": "^19.0.0",
|
"jsdom": "^19.0.0",
|
||||||
"jsonc-parser": "^3.0.0",
|
"jsonc-parser": "^3.0.0",
|
||||||
"mocha": "^9.2.0",
|
"mocha": "^9.2.0",
|
||||||
"monaco-editor-core": "0.50.0-rc",
|
"monaco-editor-core": "0.52.0-rc2",
|
||||||
"parcel": "^2.7.0",
|
"parcel": "^2.7.0",
|
||||||
"pin-github-action": "^1.8.0",
|
"pin-github-action": "^1.8.0",
|
||||||
"playwright": "^1.32.2",
|
"playwright": "^1.32.2",
|
||||||
|
|
@ -5394,9 +5394,9 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/monaco-editor-core": {
|
"node_modules/monaco-editor-core": {
|
||||||
"version": "0.50.0-rc",
|
"version": "0.52.0-rc2",
|
||||||
"resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.50.0-rc.tgz",
|
"resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.52.0-rc2.tgz",
|
||||||
"integrity": "sha512-DM/rRS4/dxWvHnszmSA81hpAhy8k5k1zE/aYc+lvH+4SxEJNsdHhindo8xM7VavawujvGhs+X3SPbi3ytl3rJQ==",
|
"integrity": "sha512-buoH7pURwcTnmnO+aQ69jlbJ1Nop7w3sQm1pmBJ6pr/M9/WhAD2GsgL/bOf7kK+Vzd9FlzitlThImezQ28s9+g==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/mri": {
|
"node_modules/mri": {
|
||||||
|
|
@ -11150,9 +11150,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"monaco-editor-core": {
|
"monaco-editor-core": {
|
||||||
"version": "0.50.0-rc",
|
"version": "0.52.0-rc2",
|
||||||
"resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.50.0-rc.tgz",
|
"resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.52.0-rc2.tgz",
|
||||||
"integrity": "sha512-DM/rRS4/dxWvHnszmSA81hpAhy8k5k1zE/aYc+lvH+4SxEJNsdHhindo8xM7VavawujvGhs+X3SPbi3ytl3rJQ==",
|
"integrity": "sha512-buoH7pURwcTnmnO+aQ69jlbJ1Nop7w3sQm1pmBJ6pr/M9/WhAD2GsgL/bOf7kK+Vzd9FlzitlThImezQ28s9+g==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"mri": {
|
"mri": {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "monaco-editor",
|
"name": "monaco-editor",
|
||||||
"version": "0.50.0",
|
"version": "0.52.0",
|
||||||
"vscodeRef": "5437499feb04f7a586f677b155b039bc2b3669eb",
|
"vscodeRef": "493330cdc6475247184ea459c66776c3da12cd2d",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "A browser based code editor",
|
"description": "A browser based code editor",
|
||||||
"homepage": "https://github.com/microsoft/monaco-editor",
|
"homepage": "https://github.com/microsoft/monaco-editor",
|
||||||
|
|
@ -52,7 +52,7 @@
|
||||||
"jsdom": "^19.0.0",
|
"jsdom": "^19.0.0",
|
||||||
"jsonc-parser": "^3.0.0",
|
"jsonc-parser": "^3.0.0",
|
||||||
"mocha": "^9.2.0",
|
"mocha": "^9.2.0",
|
||||||
"monaco-editor-core": "0.50.0-rc",
|
"monaco-editor-core": "0.52.0-rc2",
|
||||||
"parcel": "^2.7.0",
|
"parcel": "^2.7.0",
|
||||||
"pin-github-action": "^1.8.0",
|
"pin-github-action": "^1.8.0",
|
||||||
"playwright": "^1.32.2",
|
"playwright": "^1.32.2",
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
var require = { paths: { vs: '../node_modules/monaco-editor/min/vs' } };
|
var require = { paths: { vs: '../node_modules/monaco-editor/min/vs' } };
|
||||||
</script>
|
</script>
|
||||||
<script src="../node_modules/monaco-editor/min/vs/loader.js"></script>
|
<script src="../node_modules/monaco-editor/min/vs/loader.js"></script>
|
||||||
<script src="../node_modules/monaco-editor/min/vs/editor/editor.main.nls.js"></script>
|
|
||||||
<script src="../node_modules/monaco-editor/min/vs/editor/editor.main.js"></script>
|
<script src="../node_modules/monaco-editor/min/vs/editor/editor.main.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
import { testTokenization } from '../test/testRunner';
|
import { testTokenization } from '../test/testRunner';
|
||||||
|
|
||||||
testTokenization('qsharp', [
|
testTokenization('qsharp', [
|
||||||
// Generated from sample: https://github.com/microsoft/Quantum/blob/main/samples/azure-quantum/parallel-qrng/ParallelQrng.ipynb
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
line: 'open Microsoft.Quantum.Arrays;',
|
line: 'open Microsoft.Quantum.Arrays;',
|
||||||
|
|
@ -21,19 +20,6 @@ testTokenization('qsharp', [
|
||||||
{ startIndex: 29, type: 'delimiter.qsharp' }
|
{ startIndex: 29, type: 'delimiter.qsharp' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
line: 'open Microsoft.Quantum.Measurement;',
|
|
||||||
tokens: [
|
|
||||||
{ startIndex: 0, type: 'keyword.open.qsharp' },
|
|
||||||
{ startIndex: 4, type: 'white.qsharp' },
|
|
||||||
{ startIndex: 5, type: 'namespace.qsharp' },
|
|
||||||
{ startIndex: 14, type: 'delimiter.qsharp' },
|
|
||||||
{ startIndex: 15, type: 'namespace.qsharp' },
|
|
||||||
{ startIndex: 22, type: 'delimiter.qsharp' },
|
|
||||||
{ startIndex: 23, type: 'namespace.qsharp' },
|
|
||||||
{ startIndex: 34, type: 'delimiter.qsharp' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
line: '',
|
line: '',
|
||||||
tokens: []
|
tokens: []
|
||||||
|
|
@ -67,20 +53,6 @@ testTokenization('qsharp', [
|
||||||
{ startIndex: 1, type: 'comment.qsharp' }
|
{ startIndex: 1, type: 'comment.qsharp' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
line: ' // superposition state, such that when we measure,',
|
|
||||||
tokens: [
|
|
||||||
{ startIndex: 0, type: 'white.qsharp' },
|
|
||||||
{ startIndex: 1, type: 'comment.qsharp' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
line: ' // all bitstrings occur with equal probability.',
|
|
||||||
tokens: [
|
|
||||||
{ startIndex: 0, type: 'white.qsharp' },
|
|
||||||
{ startIndex: 1, type: 'comment.qsharp' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
line: ' use register = Qubit[nQubits] {',
|
line: ' use register = Qubit[nQubits] {',
|
||||||
tokens: [
|
tokens: [
|
||||||
|
|
@ -99,13 +71,6 @@ testTokenization('qsharp', [
|
||||||
{ startIndex: 31, type: 'delimiter.curly.qsharp' }
|
{ startIndex: 31, type: 'delimiter.curly.qsharp' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
line: ' // Set qubits in superposition.',
|
|
||||||
tokens: [
|
|
||||||
{ startIndex: 0, type: 'white.qsharp' },
|
|
||||||
{ startIndex: 2, type: 'comment.qsharp' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
line: ' ApplyToEachA(H, register);',
|
line: ' ApplyToEachA(H, register);',
|
||||||
tokens: [
|
tokens: [
|
||||||
|
|
@ -120,17 +85,6 @@ testTokenization('qsharp', [
|
||||||
{ startIndex: 27, type: 'delimiter.qsharp' }
|
{ startIndex: 27, type: 'delimiter.qsharp' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
line: '',
|
|
||||||
tokens: []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
line: ' // Measure all qubits and return.',
|
|
||||||
tokens: [
|
|
||||||
{ startIndex: 0, type: 'white.qsharp' },
|
|
||||||
{ startIndex: 2, type: 'comment.qsharp' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
line: ' return ForEach(MResetZ, register);',
|
line: ' return ForEach(MResetZ, register);',
|
||||||
tokens: [
|
tokens: [
|
||||||
|
|
@ -157,6 +111,76 @@ testTokenization('qsharp', [
|
||||||
{
|
{
|
||||||
line: '}',
|
line: '}',
|
||||||
tokens: [{ startIndex: 0, type: 'delimiter.curly.qsharp' }]
|
tokens: [{ startIndex: 0, type: 'delimiter.curly.qsharp' }]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
line: 'struct Foo { First : Int, Second : Int }',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'keyword.qsharp' },
|
||||||
|
{ startIndex: 6, type: 'white.qsharp' },
|
||||||
|
{ startIndex: 7, type: 'identifier.qsharp' },
|
||||||
|
{ startIndex: 10, type: 'white.qsharp' },
|
||||||
|
{ startIndex: 11, type: 'delimiter.curly.qsharp' },
|
||||||
|
{ startIndex: 12, type: 'white.qsharp' },
|
||||||
|
{ startIndex: 13, type: 'identifier.qsharp' },
|
||||||
|
{ startIndex: 18, type: 'white.qsharp' },
|
||||||
|
{ startIndex: 19, type: 'operator.qsharp' },
|
||||||
|
{ startIndex: 20, type: 'white.qsharp' },
|
||||||
|
{ startIndex: 21, type: 'type.qsharp' },
|
||||||
|
{ startIndex: 24, type: 'delimiter.qsharp' },
|
||||||
|
{ startIndex: 25, type: 'white.qsharp' },
|
||||||
|
{ startIndex: 26, type: 'identifier.qsharp' },
|
||||||
|
{ startIndex: 32, type: 'white.qsharp' },
|
||||||
|
{ startIndex: 33, type: 'operator.qsharp' },
|
||||||
|
{ startIndex: 34, type: 'white.qsharp' },
|
||||||
|
{ startIndex: 35, type: 'type.qsharp' },
|
||||||
|
{ startIndex: 38, type: 'white.qsharp' },
|
||||||
|
{ startIndex: 39, type: 'delimiter.curly.qsharp' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
line: 'Foo.First',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'identifier.qsharp' },
|
||||||
|
{ startIndex: 3, type: 'operator.qsharp' },
|
||||||
|
{ startIndex: 4, type: 'identifier.qsharp' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
line: 'import Microsoft.Quantum.Math, Microsoft.Quantum.Diagnostics.*;',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'keyword.import.qsharp' },
|
||||||
|
{ startIndex: 6, type: 'white.qsharp' },
|
||||||
|
{ startIndex: 7, type: 'namespace.qsharp' },
|
||||||
|
{ startIndex: 16, type: 'delimiter.qsharp' },
|
||||||
|
{ startIndex: 17, type: 'namespace.qsharp' },
|
||||||
|
{ startIndex: 24, type: 'delimiter.qsharp' },
|
||||||
|
{ startIndex: 25, type: 'identifier.qsharp' },
|
||||||
|
{ startIndex: 29, type: 'delimiter.qsharp' },
|
||||||
|
{ startIndex: 30, type: 'white.qsharp' },
|
||||||
|
{ startIndex: 31, type: 'namespace.qsharp' },
|
||||||
|
{ startIndex: 40, type: 'delimiter.qsharp' },
|
||||||
|
{ startIndex: 41, type: 'namespace.qsharp' },
|
||||||
|
{ startIndex: 48, type: 'delimiter.qsharp' },
|
||||||
|
{ startIndex: 49, type: 'namespace.qsharp' },
|
||||||
|
{ startIndex: 60, type: 'delimiter.qsharp' },
|
||||||
|
{ startIndex: 61, type: 'wildcard.qsharp' },
|
||||||
|
{ startIndex: 62, type: 'delimiter.qsharp' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
line: 'export A, B, C;',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'keyword.qsharp' },
|
||||||
|
{ startIndex: 6, type: 'white.qsharp' },
|
||||||
|
{ startIndex: 7, type: 'identifier.qsharp' },
|
||||||
|
{ startIndex: 8, type: 'delimiter.qsharp' },
|
||||||
|
{ startIndex: 9, type: 'white.qsharp' },
|
||||||
|
{ startIndex: 10, type: 'identifier.qsharp' },
|
||||||
|
{ startIndex: 11, type: 'delimiter.qsharp' },
|
||||||
|
{ startIndex: 12, type: 'white.qsharp' },
|
||||||
|
{ startIndex: 13, type: 'identifier.qsharp' },
|
||||||
|
{ startIndex: 14, type: 'delimiter.qsharp' }
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -33,12 +33,15 @@ export const language = <languages.IMonarchLanguage>{
|
||||||
keywords: [
|
keywords: [
|
||||||
'namespace',
|
'namespace',
|
||||||
'open',
|
'open',
|
||||||
|
'import',
|
||||||
|
'export',
|
||||||
'as',
|
'as',
|
||||||
'operation',
|
'operation',
|
||||||
'function',
|
'function',
|
||||||
'body',
|
'body',
|
||||||
'adjoint',
|
'adjoint',
|
||||||
'newtype',
|
'newtype',
|
||||||
|
'struct',
|
||||||
'controlled',
|
'controlled',
|
||||||
'if',
|
'if',
|
||||||
'elif',
|
'elif',
|
||||||
|
|
@ -141,7 +144,6 @@ export const language = <languages.IMonarchLanguage>{
|
||||||
'stackalloc',
|
'stackalloc',
|
||||||
'static',
|
'static',
|
||||||
'string',
|
'string',
|
||||||
'struct',
|
|
||||||
'switch',
|
'switch',
|
||||||
'this',
|
'this',
|
||||||
'throw',
|
'throw',
|
||||||
|
|
@ -202,6 +204,7 @@ export const language = <languages.IMonarchLanguage>{
|
||||||
'^=',
|
'^=',
|
||||||
':',
|
':',
|
||||||
'::',
|
'::',
|
||||||
|
'.',
|
||||||
'..',
|
'..',
|
||||||
'==',
|
'==',
|
||||||
'...',
|
'...',
|
||||||
|
|
@ -241,6 +244,8 @@ export const language = <languages.IMonarchLanguage>{
|
||||||
|
|
||||||
namespaceFollows: ['namespace', 'open'],
|
namespaceFollows: ['namespace', 'open'],
|
||||||
|
|
||||||
|
importsFollows: ['import'],
|
||||||
|
|
||||||
symbols: /[=><!~?:&|+\-*\/\^%@._]+/,
|
symbols: /[=><!~?:&|+\-*\/\^%@._]+/,
|
||||||
|
|
||||||
escapes: /\\[\s\S]/,
|
escapes: /\\[\s\S]/,
|
||||||
|
|
@ -257,6 +262,10 @@ export const language = <languages.IMonarchLanguage>{
|
||||||
token: 'keyword.$0',
|
token: 'keyword.$0',
|
||||||
next: '@namespace'
|
next: '@namespace'
|
||||||
},
|
},
|
||||||
|
'@importsFollows': {
|
||||||
|
token: 'keyword.$0',
|
||||||
|
next: '@imports'
|
||||||
|
},
|
||||||
'@typeKeywords': 'type',
|
'@typeKeywords': 'type',
|
||||||
'@keywords': 'keyword',
|
'@keywords': 'keyword',
|
||||||
'@constants': 'constant',
|
'@constants': 'constant',
|
||||||
|
|
@ -282,7 +291,7 @@ export const language = <languages.IMonarchLanguage>{
|
||||||
[/[;,.]/, 'delimiter'],
|
[/[;,.]/, 'delimiter'],
|
||||||
|
|
||||||
// strings
|
// strings
|
||||||
//[/"([^"\\]|\\.)*$/, 'string.invalid' ], // non-teminated string
|
//[/"([^"\\]|\\.)*$/, 'string.invalid' ], // non-terminated string
|
||||||
[/"/, { token: 'string.quote', bracket: '@open', next: '@string' }]
|
[/"/, { token: 'string.quote', bracket: '@open', next: '@string' }]
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
@ -295,7 +304,16 @@ export const language = <languages.IMonarchLanguage>{
|
||||||
namespace: [
|
namespace: [
|
||||||
{ include: '@whitespace' },
|
{ include: '@whitespace' },
|
||||||
[/[A-Za-z]\w*/, 'namespace'],
|
[/[A-Za-z]\w*/, 'namespace'],
|
||||||
[/[\.=]/, 'delimiter'],
|
[/[\.]/, 'delimiter'],
|
||||||
|
['', '', '@pop']
|
||||||
|
],
|
||||||
|
|
||||||
|
imports: [
|
||||||
|
{ include: '@whitespace' },
|
||||||
|
[/[A-Za-z]\w*(?=\.)/, 'namespace'],
|
||||||
|
[/[A-Za-z]\w*/, 'identifier'],
|
||||||
|
[/\*/, 'wildcard'],
|
||||||
|
[/[\.,]/, 'delimiter'],
|
||||||
['', '', '@pop']
|
['', '', '@pop']
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
|
||||||
39
src/nls-fix.js
Normal file
39
src/nls-fix.js
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
/* This fix ensures that old nls-plugin configurations are still respected by the new localization solution. */
|
||||||
|
/* We should try to avoid this file and find a different solution. */
|
||||||
|
/* Warning: This file still has to work when replacing "\n" with " "! */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {typeof define}
|
||||||
|
*/
|
||||||
|
const globalDefine = globalThis.define;
|
||||||
|
globalDefine('vs/nls.messages-loader', [], function (...args) {
|
||||||
|
return {
|
||||||
|
load: (name, req, load, config) => {
|
||||||
|
const requestedLanguage = config['vs/nls']?.availableLanguages?.['*'];
|
||||||
|
if (!requestedLanguage || requestedLanguage === 'en') {
|
||||||
|
load({});
|
||||||
|
} else {
|
||||||
|
req([`vs/nls.messages.${requestedLanguage}`], () => {
|
||||||
|
load({});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
globalDefine(
|
||||||
|
'vs/nls.messages',
|
||||||
|
['require', 'exports', 'vs/nls.messages-loader!'],
|
||||||
|
function (require, exports) {
|
||||||
|
Object.assign(exports, {
|
||||||
|
getNLSMessages: () => globalThis._VSCODE_NLS_MESSAGES,
|
||||||
|
getNLSLanguage: () => globalThis._VSCODE_NLS_LANGUAGE
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
define = function (...args) {
|
||||||
|
if (args.length > 0 && args[0] === 'vs/nls.messages') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return globalDefine(...args);
|
||||||
|
};
|
||||||
|
define.amd = true;
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
<script src="../../../out/monaco-editor/dev/vs/loader.js"></script>
|
<script src="../../../out/monaco-editor/dev/vs/loader.js"></script>
|
||||||
<script>
|
<script>
|
||||||
require.config({
|
require.config({
|
||||||
|
baseUrl: new URL('..', document.baseURI).toString(),
|
||||||
paths: {
|
paths: {
|
||||||
vs: '../../../out/monaco-editor/dev/vs'
|
vs: '../../../out/monaco-editor/dev/vs'
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -186,16 +186,22 @@ suite(`Smoke Test '${testInfo.packager}' on '${testInfo.browser}'`, () => {
|
||||||
await page.waitForSelector(`text=addEventListener`);
|
await page.waitForSelector(`text=addEventListener`);
|
||||||
|
|
||||||
// find the TypeScript worker
|
// find the TypeScript worker
|
||||||
const tsWorker = page.workers().find((worker) => {
|
|
||||||
const url = worker.url();
|
function findAsync(arr, fn) {
|
||||||
return /ts\.worker(\.[a-f0-9]+)?\.js$/.test(url) || /workerMain.js#typescript$/.test(url);
|
return Promise.all(arr.map(fn)).then((results) => {
|
||||||
|
return arr.find((_, i) => results[i]);
|
||||||
});
|
});
|
||||||
if (!tsWorker) {
|
|
||||||
assert.fail('Could not find TypeScript worker');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check that the TypeScript worker exposes `ts` as a global
|
// check that the TypeScript worker exposes `ts` as a global
|
||||||
assert.strictEqual(await tsWorker.evaluate(`typeof ts`), 'object');
|
const tsWorker = await findAsync(
|
||||||
|
page.workers(),
|
||||||
|
async (page) => await page.evaluate(`typeof ts !== 'undefined'`)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!tsWorker) {
|
||||||
|
assert.fail('Could not find TypeScript worker');
|
||||||
|
}
|
||||||
|
|
||||||
// check that the TypeScript worker exposes the full `ts` as a global
|
// check that the TypeScript worker exposes the full `ts` as a global
|
||||||
assert.strictEqual(await tsWorker.evaluate(`typeof ts.optionDeclarations`), 'object');
|
assert.strictEqual(await tsWorker.evaluate(`typeof ts.optionDeclarations`), 'object');
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,9 @@ global.window = {
|
||||||
matches: false,
|
matches: false,
|
||||||
addEventListener: function () {}
|
addEventListener: function () {}
|
||||||
};
|
};
|
||||||
}
|
},
|
||||||
|
setInterval: function () {},
|
||||||
|
setTimeout: function () {}
|
||||||
};
|
};
|
||||||
|
|
||||||
requirejs(
|
requirejs(
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,9 @@ define('vs/nls', [], {
|
||||||
localize: function () {
|
localize: function () {
|
||||||
return 'NO_LOCALIZATION_FOR_YOU';
|
return 'NO_LOCALIZATION_FOR_YOU';
|
||||||
},
|
},
|
||||||
|
localize2: function (key, message) {
|
||||||
|
return { value: 'NO_LOCALIZATION_FOR_YOU', original: message };
|
||||||
|
},
|
||||||
load: function (name, req, load) {
|
load: function (name, req, load) {
|
||||||
load({});
|
load({});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,10 @@ async function _loadMonaco(setup: IMonacoSetup): Promise<typeof monaco> {
|
||||||
return new Promise((res) => {
|
return new Promise((res) => {
|
||||||
// First load editor.main. If it inlines the plugins, we don't want to try to load them from the server.
|
// First load editor.main. If it inlines the plugins, we don't want to try to load them from the server.
|
||||||
req(["vs/editor/editor.main"], () => {
|
req(["vs/editor/editor.main"], () => {
|
||||||
|
if ((setup as any).onlyCore) {
|
||||||
|
res(monaco);
|
||||||
|
return;
|
||||||
|
}
|
||||||
req(
|
req(
|
||||||
[
|
[
|
||||||
"vs/basic-languages/monaco.contribution",
|
"vs/basic-languages/monaco.contribution",
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,10 @@ export class ControlledMonacoEditor extends React.Component<{
|
||||||
|
|
||||||
private lastSubscription: monaco.IDisposable | undefined;
|
private lastSubscription: monaco.IDisposable | undefined;
|
||||||
|
|
||||||
|
componentDidMount(): void {
|
||||||
|
this.componentDidUpdate({ value: "" });
|
||||||
|
}
|
||||||
|
|
||||||
componentDidUpdate(lastProps: this["props"]) {
|
componentDidUpdate(lastProps: this["props"]) {
|
||||||
const newOnDidValueChange = this.props.onDidValueChange;
|
const newOnDidValueChange = this.props.onDidValueChange;
|
||||||
if (newOnDidValueChange !== lastProps.onDidValueChange) {
|
if (newOnDidValueChange !== lastProps.onDidValueChange) {
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
paths: { vs: "node_modules/monaco-editor/min/vs" },
|
paths: { vs: "node_modules/monaco-editor/min/vs" },
|
||||||
};
|
};
|
||||||
require("script-loader!../../node_modules/monaco-editor/min/vs/loader");
|
require("script-loader!../../node_modules/monaco-editor/min/vs/loader");
|
||||||
require("script-loader!../../node_modules/monaco-editor/min/vs/editor/editor.main.nls.js");
|
|
||||||
require("script-loader!../../node_modules/monaco-editor/min/vs/editor/editor.main.js");
|
require("script-loader!../../node_modules/monaco-editor/min/vs/editor/editor.main.js");
|
||||||
import { loadMonaco } from "../monaco-loader";
|
import { loadMonaco } from "../monaco-loader";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5338,7 +5338,6 @@ return {
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<script src="./node_modules/monaco-editor/dev/vs/loader.js"></script>
|
<script src="./node_modules/monaco-editor/dev/vs/loader.js"></script>
|
||||||
<script src="./node_modules/monaco-editor/dev/vs/editor/editor.main.nls.js"></script>
|
|
||||||
<script src="./node_modules/monaco-editor/dev/vs/editor/editor.main.js"></script>
|
<script src="./node_modules/monaco-editor/dev/vs/editor/editor.main.js"></script>
|
||||||
|
|
||||||
<script data-inline="yes-please" src="./monarch/monarch.js"></script>
|
<script data-inline="yes-please" src="./monarch/monarch.js"></script>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue