mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 16:15:41 +01:00
Merge remote-tracking branch 'origin/master' into PAPERPANKS-master
This commit is contained in:
commit
290dd05367
19 changed files with 6177 additions and 1266 deletions
|
|
@ -1,10 +1,13 @@
|
||||||
# Monaco Editor Change log
|
# Monaco Editor Change log
|
||||||
|
|
||||||
|
## [0.10.1] (16.10.2017)
|
||||||
|
- Fixes [issue #601](https://github.com/Microsoft/monaco-editor/issues/601): window.opener should be set to null to protect against malicious code
|
||||||
|
|
||||||
## [0.10.0] (17.08.2017)
|
## [0.10.0] (17.08.2017)
|
||||||
|
|
||||||
### Breaking changes
|
### Breaking changes
|
||||||
* Removed `CodeAction`.
|
* Removed `CodeAction`.
|
||||||
* Method `provideCodeActions` in `CodeActionProvider` now returns `Command[] | Thenable<Command[]` instead of `CodeAction[] | Thenable<CodeAction[]>`, which is already removed.
|
* Method `provideCodeActions` in `CodeActionProvider` now returns `Command[] | Thenable<Command[]>` instead of `CodeAction[] | Thenable<CodeAction[]>`, which is already removed.
|
||||||
|
|
||||||
### API changes
|
### API changes
|
||||||
* added `monaco.editor.getModelMarkers`. Get markers for owner and/or resource.
|
* added `monaco.editor.getModelMarkers`. Get markers for owner and/or resource.
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2017 Microsoft Corporation
|
Copyright (c) 2018 Microsoft Corporation
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ In IE, the editor must be completely surrounded in the body element, otherwise t
|
||||||
## Installing
|
## Installing
|
||||||
|
|
||||||
```
|
```
|
||||||
npm install monaco-editor
|
$ npm install monaco-editor
|
||||||
```
|
```
|
||||||
|
|
||||||
You will get:
|
You will get:
|
||||||
|
|
|
||||||
298
gulpfile.js
298
gulpfile.js
|
|
@ -1,21 +1,23 @@
|
||||||
|
|
||||||
var gulp = require('gulp');
|
const gulp = require('gulp');
|
||||||
var metadata = require('./metadata');
|
const metadata = require('./metadata');
|
||||||
var es = require('event-stream');
|
const es = require('event-stream');
|
||||||
var path = require('path');
|
const path = require('path');
|
||||||
var fs = require('fs');
|
const fs = require('fs');
|
||||||
var rimraf = require('rimraf');
|
const rimraf = require('rimraf');
|
||||||
var cp = require('child_process');
|
const cp = require('child_process');
|
||||||
var httpServer = require('http-server');
|
const httpServer = require('http-server');
|
||||||
var typedoc = require("gulp-typedoc");
|
const typedoc = require("gulp-typedoc");
|
||||||
var CleanCSS = require('clean-css');
|
const CleanCSS = require('clean-css');
|
||||||
var uncss = require('uncss');
|
const uncss = require('uncss');
|
||||||
|
const File = require('vinyl');
|
||||||
|
const ts = require('typescript');
|
||||||
|
|
||||||
var WEBSITE_GENERATED_PATH = path.join(__dirname, 'website/playground/new-samples');
|
const WEBSITE_GENERATED_PATH = path.join(__dirname, 'website/playground/new-samples');
|
||||||
var MONACO_EDITOR_VERSION = (function() {
|
const MONACO_EDITOR_VERSION = (function() {
|
||||||
var packageJsonPath = path.join(__dirname, 'package.json');
|
const packageJsonPath = path.join(__dirname, 'package.json');
|
||||||
var packageJson = JSON.parse(fs.readFileSync(packageJsonPath).toString());
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath).toString());
|
||||||
var version = packageJson.version;
|
const version = packageJson.version;
|
||||||
if (!/\d+\.\d+\.\d+/.test(version)) {
|
if (!/\d+\.\d+\.\d+/.test(version)) {
|
||||||
console.log('unrecognized package.json version: ' + version);
|
console.log('unrecognized package.json version: ' + version);
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
|
|
@ -33,6 +35,9 @@ gulp.task('release', ['clean-release'], function() {
|
||||||
// min folder
|
// min folder
|
||||||
releaseOne('min'),
|
releaseOne('min'),
|
||||||
|
|
||||||
|
// esm folder
|
||||||
|
ESM_release(),
|
||||||
|
|
||||||
// package.json
|
// package.json
|
||||||
gulp.src('package.json')
|
gulp.src('package.json')
|
||||||
.pipe(es.through(function(data) {
|
.pipe(es.through(function(data) {
|
||||||
|
|
@ -62,31 +67,51 @@ gulp.task('release', ['clean-release'], function() {
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Release to `dev` or `min`.
|
||||||
|
*/
|
||||||
function releaseOne(type) {
|
function releaseOne(type) {
|
||||||
return es.merge(
|
return es.merge(
|
||||||
gulp.src('node_modules/monaco-editor-core/' + type + '/**/*')
|
gulp.src('node_modules/monaco-editor-core/' + type + '/**/*')
|
||||||
.pipe(addPluginContribs())
|
.pipe(addPluginContribs(type))
|
||||||
.pipe(gulp.dest('release/' + type)),
|
.pipe(gulp.dest('release/' + type)),
|
||||||
pluginStreams('release/' + type + '/')
|
pluginStreams(type, 'release/' + type + '/')
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function pluginStreams(destinationPath) {
|
/**
|
||||||
|
* Release plugins to `dev` or `min`.
|
||||||
|
*/
|
||||||
|
function pluginStreams(type, destinationPath) {
|
||||||
return es.merge(
|
return es.merge(
|
||||||
metadata.METADATA.PLUGINS.map(function(plugin) {
|
metadata.METADATA.PLUGINS.map(function(plugin) {
|
||||||
return pluginStream(plugin, destinationPath);
|
return pluginStream(plugin, type, destinationPath);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function pluginStream(plugin, destinationPath) {
|
/**
|
||||||
var contribPath = path.join(plugin.paths.npm, plugin.contrib.substr(plugin.modulePrefix.length)) + '.js';
|
* Release a plugin to `dev` or `min`.
|
||||||
|
*/
|
||||||
|
function pluginStream(plugin, type, destinationPath) {
|
||||||
|
var pluginPath = plugin.paths[`npm/${type}`]; // npm/dev or npm/min
|
||||||
|
var contribPath = path.join(pluginPath, plugin.contrib.substr(plugin.modulePrefix.length)) + '.js';
|
||||||
return (
|
return (
|
||||||
gulp.src([
|
gulp.src([
|
||||||
plugin.paths.npm + '/**/*',
|
pluginPath + '/**/*',
|
||||||
'!' + contribPath,
|
'!' + contribPath
|
||||||
'!' + plugin.paths.npm + '/**/monaco.d.ts'
|
|
||||||
])
|
])
|
||||||
|
.pipe(es.through(function(data) {
|
||||||
|
if (!/_\.contribution/.test(data.path)) {
|
||||||
|
this.emit('data', data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let contents = data.contents.toString();
|
||||||
|
contents = contents.replace('define(["require", "exports"],', 'define(["require", "exports", "vs/editor/editor.api"],');
|
||||||
|
data.contents = new Buffer(contents);
|
||||||
|
this.emit('data', data);
|
||||||
|
}))
|
||||||
.pipe(gulp.dest(destinationPath + plugin.modulePrefix))
|
.pipe(gulp.dest(destinationPath + plugin.modulePrefix))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -94,10 +119,10 @@ function pluginStream(plugin, destinationPath) {
|
||||||
/**
|
/**
|
||||||
* 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'
|
||||||
* - append contribs from plugins
|
* - append monaco.contribution modules from plugins
|
||||||
* - append new AMD module 'vs/editor/editor.main' that stiches things together
|
* - append new AMD module 'vs/editor/editor.main' that stiches things together
|
||||||
*/
|
*/
|
||||||
function addPluginContribs() {
|
function addPluginContribs(type) {
|
||||||
return es.through(function(data) {
|
return es.through(function(data) {
|
||||||
if (!/editor\.main\.js$/.test(data.path)) {
|
if (!/editor\.main\.js$/.test(data.path)) {
|
||||||
this.emit('data', data);
|
this.emit('data', data);
|
||||||
|
|
@ -113,22 +138,53 @@ function addPluginContribs() {
|
||||||
|
|
||||||
metadata.METADATA.PLUGINS.forEach(function(plugin) {
|
metadata.METADATA.PLUGINS.forEach(function(plugin) {
|
||||||
allPluginsModuleIds.push(plugin.contrib);
|
allPluginsModuleIds.push(plugin.contrib);
|
||||||
var contribPath = path.join(__dirname, plugin.paths.npm, plugin.contrib.substr(plugin.modulePrefix.length)) + '.js';
|
var pluginPath = plugin.paths[`npm/${type}`]; // npm/dev or npm/min
|
||||||
|
var contribPath = path.join(__dirname, pluginPath, plugin.contrib.substr(plugin.modulePrefix.length)) + '.js';
|
||||||
var contribContents = fs.readFileSync(contribPath).toString();
|
var contribContents = fs.readFileSync(contribPath).toString();
|
||||||
|
|
||||||
|
// Check for the anonymous define call case 1
|
||||||
|
// transform define(function() {...}) to define("moduleId",["require"],function() {...})
|
||||||
|
var anonymousContribDefineCase1 = contribContents.indexOf('define(function');
|
||||||
|
if (anonymousContribDefineCase1 >= 0) {
|
||||||
|
contribContents = (
|
||||||
|
contribContents.substring(0, anonymousContribDefineCase1)
|
||||||
|
+ `define("${plugin.contrib}",["require"],function`
|
||||||
|
+ contribContents.substring(anonymousContribDefineCase1 + 'define(function'.length)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for the anonymous define call case 2
|
||||||
|
// transform define([ to define("moduleId",[
|
||||||
|
var anonymousContribDefineCase2 = contribContents.indexOf('define([');
|
||||||
|
if (anonymousContribDefineCase2 >= 0) {
|
||||||
|
contribContents = (
|
||||||
|
contribContents.substring(0, anonymousContribDefineCase2)
|
||||||
|
+ `define("${plugin.contrib}",[`
|
||||||
|
+ contribContents.substring(anonymousContribDefineCase2 + 'define(['.length)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
var contribDefineIndex = contribContents.indexOf('define("' + plugin.contrib);
|
var contribDefineIndex = contribContents.indexOf('define("' + plugin.contrib);
|
||||||
if (contribDefineIndex === -1) {
|
if (contribDefineIndex === -1) {
|
||||||
console.error('(1) CANNOT DETERMINE AMD define location for contribution', plugin);
|
contribDefineIndex = contribContents.indexOf('define(\'' + plugin.contrib);
|
||||||
process.exit(-1);
|
if (contribDefineIndex === -1) {
|
||||||
|
console.error('(1) CANNOT DETERMINE AMD define location for contribution', pluginPath);
|
||||||
|
process.exit(-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var depsEndIndex = contribContents.indexOf(']', contribDefineIndex);
|
var depsEndIndex = contribContents.indexOf(']', contribDefineIndex);
|
||||||
if (contribDefineIndex === -1) {
|
if (contribDefineIndex === -1) {
|
||||||
console.error('(2) CANNOT DETERMINE AMD define location for contribution', plugin);
|
console.error('(2) CANNOT DETERMINE AMD define location for contribution', pluginPath);
|
||||||
process.exit(-1);
|
process.exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
contribContents = contribContents.substring(0, depsEndIndex) + ',"vs/editor/edcore.main"' + contribContents.substring(depsEndIndex);
|
contribContents = contribContents.substring(0, depsEndIndex) + ',"vs/editor/editor.api"' + contribContents.substring(depsEndIndex);
|
||||||
|
|
||||||
|
contribContents = contribContents.replace(
|
||||||
|
'define("vs/basic-languages/_.contribution",["require","exports"],',
|
||||||
|
'define("vs/basic-languages/_.contribution",["require","exports","vs/editor/editor.api"],',
|
||||||
|
);
|
||||||
|
|
||||||
extraContent.push(contribContents);
|
extraContent.push(contribContents);
|
||||||
});
|
});
|
||||||
|
|
@ -145,6 +201,181 @@ function addPluginContribs() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ESM_release() {
|
||||||
|
return es.merge(
|
||||||
|
gulp.src('node_modules/monaco-editor-core/esm/**/*')
|
||||||
|
.pipe(ESM_addImportSuffix())
|
||||||
|
.pipe(ESM_addPluginContribs('release/esm'))
|
||||||
|
.pipe(gulp.dest('release/esm')),
|
||||||
|
ESM_pluginStreams('release/esm/')
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Release plugins to `esm`.
|
||||||
|
*/
|
||||||
|
function ESM_pluginStreams(destinationPath) {
|
||||||
|
return es.merge(
|
||||||
|
metadata.METADATA.PLUGINS.map(function(plugin) {
|
||||||
|
return ESM_pluginStream(plugin, destinationPath);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Release a plugin to `esm`.
|
||||||
|
* Adds a dependency to 'vs/editor/editor.api' in contrib files in order for `monaco` to be defined.
|
||||||
|
* Rewrites imports for 'monaco-editor-core/**'
|
||||||
|
*/
|
||||||
|
function ESM_pluginStream(plugin, destinationPath) {
|
||||||
|
const DESTINATION = path.join(__dirname, destinationPath);
|
||||||
|
let pluginPath = plugin.paths[`esm`];
|
||||||
|
return (
|
||||||
|
gulp.src([
|
||||||
|
pluginPath + '/**/*'
|
||||||
|
])
|
||||||
|
.pipe(es.through(function(data) {
|
||||||
|
if (!/\.js$/.test(data.path)) {
|
||||||
|
this.emit('data', data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let contents = data.contents.toString();
|
||||||
|
|
||||||
|
const info = ts.preProcessFile(contents);
|
||||||
|
for (let i = info.importedFiles.length - 1; i >= 0; i--) {
|
||||||
|
const importText = info.importedFiles[i].fileName;
|
||||||
|
const pos = info.importedFiles[i].pos;
|
||||||
|
const end = info.importedFiles[i].end;
|
||||||
|
|
||||||
|
if (!/(^\.\/)|(^\.\.\/)/.test(importText)) {
|
||||||
|
// non-relative import
|
||||||
|
if (!/^monaco-editor-core/.test(importText)) {
|
||||||
|
console.error(`Non-relative import for unknown module: ${importText} in ${data.path}`);
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
const myFileDestPath = path.join(DESTINATION, plugin.modulePrefix, data.relative);
|
||||||
|
const importFilePath = path.join(DESTINATION, importText.substr('monaco-editor-core/esm/'.length));
|
||||||
|
let relativePath = path.relative(path.dirname(myFileDestPath), importFilePath);
|
||||||
|
if (!/(^\.\/)|(^\.\.\/)/.test(relativePath)) {
|
||||||
|
relativePath = './' + relativePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
contents = (
|
||||||
|
contents.substring(0, pos + 1)
|
||||||
|
+ relativePath
|
||||||
|
+ contents.substring(end + 1)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data.contents = new Buffer(contents);
|
||||||
|
this.emit('data', data);
|
||||||
|
}))
|
||||||
|
.pipe(es.through(function(data) {
|
||||||
|
if (!/monaco\.contribution\.js$/.test(data.path)) {
|
||||||
|
this.emit('data', data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const myFileDestPath = path.join(DESTINATION, plugin.modulePrefix, data.relative);
|
||||||
|
const apiFilePath = path.join(DESTINATION, 'vs/editor/editor.api');
|
||||||
|
let relativePath = path.relative(path.dirname(myFileDestPath), apiFilePath);
|
||||||
|
if (!/(^\.\/)|(^\.\.\/)/.test(relativePath)) {
|
||||||
|
relativePath = './' + relativePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
let contents = data.contents.toString();
|
||||||
|
contents = (
|
||||||
|
`import '${relativePath}';\n` +
|
||||||
|
contents
|
||||||
|
);
|
||||||
|
|
||||||
|
data.contents = new Buffer(contents);
|
||||||
|
|
||||||
|
this.emit('data', data);
|
||||||
|
}))
|
||||||
|
.pipe(ESM_addImportSuffix())
|
||||||
|
.pipe(gulp.dest(destinationPath + plugin.modulePrefix))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ESM_addImportSuffix() {
|
||||||
|
return es.through(function(data) {
|
||||||
|
if (!/\.js$/.test(data.path)) {
|
||||||
|
this.emit('data', data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let contents = data.contents.toString();
|
||||||
|
|
||||||
|
const info = ts.preProcessFile(contents);
|
||||||
|
for (let i = info.importedFiles.length - 1; i >= 0; i--) {
|
||||||
|
const importText = info.importedFiles[i].fileName;
|
||||||
|
const pos = info.importedFiles[i].pos;
|
||||||
|
const end = info.importedFiles[i].end;
|
||||||
|
|
||||||
|
if (/\.css$/.test(importText)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
contents = (
|
||||||
|
contents.substring(0, pos + 1)
|
||||||
|
+ importText + '.js'
|
||||||
|
+ contents.substring(end + 1)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
data.contents = new Buffer(contents);
|
||||||
|
this.emit('data', data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* - Rename esm/vs/editor/editor.main.js to esm/vs/editor/edcore.main.js
|
||||||
|
* - Create esm/vs/editor/editor.main.js that that stiches things together
|
||||||
|
*/
|
||||||
|
function ESM_addPluginContribs(dest) {
|
||||||
|
const DESTINATION = path.join(__dirname, dest);
|
||||||
|
return es.through(function(data) {
|
||||||
|
if (!/editor\.main\.js$/.test(data.path)) {
|
||||||
|
this.emit('data', data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.emit('data', new File({
|
||||||
|
path: data.path.replace(/editor\.main/, 'edcore.main'),
|
||||||
|
base: data.base,
|
||||||
|
contents: data.contents
|
||||||
|
}));
|
||||||
|
|
||||||
|
const mainFileDestPath = path.join(DESTINATION, 'vs/editor/editor.main.js');
|
||||||
|
let mainFileImports = [];
|
||||||
|
metadata.METADATA.PLUGINS.forEach(function(plugin) {
|
||||||
|
const contribDestPath = path.join(DESTINATION, plugin.contrib);
|
||||||
|
|
||||||
|
let relativePath = path.relative(path.dirname(mainFileDestPath), contribDestPath);
|
||||||
|
if (!/(^\.\/)|(^\.\.\/)/.test(relativePath)) {
|
||||||
|
relativePath = './' + relativePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
mainFileImports.push(relativePath);
|
||||||
|
});
|
||||||
|
|
||||||
|
let mainFileContents = (
|
||||||
|
mainFileImports.map((name) => `import '${name}';`).join('\n')
|
||||||
|
+ `\n\nexport * from './edcore.main';`
|
||||||
|
);
|
||||||
|
|
||||||
|
this.emit('data', new File({
|
||||||
|
path: data.path,
|
||||||
|
base: data.base,
|
||||||
|
contents: new Buffer(mainFileContents)
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit monaco.d.ts:
|
* Edit monaco.d.ts:
|
||||||
* - append monaco.d.ts from plugins
|
* - append monaco.d.ts from plugins
|
||||||
|
|
@ -159,7 +390,8 @@ function addPluginDTS() {
|
||||||
|
|
||||||
var extraContent = [];
|
var extraContent = [];
|
||||||
metadata.METADATA.PLUGINS.forEach(function(plugin) {
|
metadata.METADATA.PLUGINS.forEach(function(plugin) {
|
||||||
var dtsPath = path.join(plugin.paths.npm, 'monaco.d.ts');
|
var pluginPath = plugin.paths[`npm/min`]; // npm/dev or npm/min
|
||||||
|
var dtsPath = path.join(pluginPath, '../monaco.d.ts');
|
||||||
try {
|
try {
|
||||||
extraContent.push(fs.readFileSync(dtsPath).toString());
|
extraContent.push(fs.readFileSync(dtsPath).toString());
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
|
||||||
110
metadata.js
110
metadata.js
|
|
@ -1,60 +1,76 @@
|
||||||
(function() {
|
(function () {
|
||||||
|
|
||||||
var METADATA = {
|
var METADATA = {
|
||||||
CORE: {
|
CORE: {
|
||||||
paths: {
|
paths: {
|
||||||
npm: 'node_modules/monaco-editor-core/min/vs',
|
src: '/vscode/out/vs',
|
||||||
// npm: 'node_modules/monaco-editor-core/dev/vs',
|
'npm/dev': 'node_modules/monaco-editor-core/dev/vs',
|
||||||
dev: '/vscode/out/vs',
|
'npm/min': 'node_modules/monaco-editor-core/min/vs',
|
||||||
built: '/vscode/out-monaco-editor-core/min/vs',
|
built: '/vscode/out-monaco-editor-core/min/vs',
|
||||||
releaseDev: 'release/dev/vs',
|
releaseDev: 'release/dev/vs',
|
||||||
releaseMin: 'release/min/vs',
|
releaseMin: 'release/min/vs',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
PLUGINS: [{
|
PLUGINS: [
|
||||||
name: 'monaco-typescript',
|
{
|
||||||
contrib: 'vs/language/typescript/src/monaco.contribution',
|
name: 'monaco-typescript',
|
||||||
modulePrefix: 'vs/language/typescript',
|
contrib: 'vs/language/typescript/monaco.contribution',
|
||||||
thirdPartyNotices: 'node_modules/monaco-typescript/ThirdPartyNotices.txt',
|
modulePrefix: 'vs/language/typescript',
|
||||||
paths: {
|
thirdPartyNotices: 'node_modules/monaco-typescript/ThirdPartyNotices.txt',
|
||||||
npm: 'node_modules/monaco-typescript/release',
|
paths: {
|
||||||
dev: '/monaco-typescript/out'
|
src: '/monaco-typescript/release/dev',
|
||||||
|
'npm/dev': 'node_modules/monaco-typescript/release/dev',
|
||||||
|
'npm/min': 'node_modules/monaco-typescript/release/min',
|
||||||
|
esm: 'node_modules/monaco-typescript/release/esm',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'monaco-css',
|
||||||
|
contrib: 'vs/language/css/monaco.contribution',
|
||||||
|
modulePrefix: 'vs/language/css',
|
||||||
|
paths: {
|
||||||
|
src: '/monaco-css/release/dev',
|
||||||
|
'npm/dev': 'node_modules/monaco-css/release/dev',
|
||||||
|
'npm/min': 'node_modules/monaco-css/release/min',
|
||||||
|
esm: 'node_modules/monaco-css/release/esm',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'monaco-json',
|
||||||
|
contrib: 'vs/language/json/monaco.contribution',
|
||||||
|
modulePrefix: 'vs/language/json',
|
||||||
|
paths: {
|
||||||
|
src: '/monaco-json/release/dev',
|
||||||
|
'npm/dev': 'node_modules/monaco-json/release/dev',
|
||||||
|
'npm/min': 'node_modules/monaco-json/release/min',
|
||||||
|
esm: 'node_modules/monaco-json/release/esm',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'monaco-html',
|
||||||
|
contrib: 'vs/language/html/monaco.contribution',
|
||||||
|
modulePrefix: 'vs/language/html',
|
||||||
|
thirdPartyNotices: 'node_modules/monaco-html/ThirdPartyNotices.txt',
|
||||||
|
paths: {
|
||||||
|
src: '/monaco-html/release/dev',
|
||||||
|
'npm/dev': 'node_modules/monaco-html/release/dev',
|
||||||
|
'npm/min': 'node_modules/monaco-html/release/min',
|
||||||
|
esm: 'node_modules/monaco-html/release/esm',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'monaco-languages',
|
||||||
|
contrib: 'vs/basic-languages/monaco.contribution',
|
||||||
|
modulePrefix: 'vs/basic-languages',
|
||||||
|
thirdPartyNotices: 'node_modules/monaco-languages/ThirdPartyNotices.txt',
|
||||||
|
paths: {
|
||||||
|
src: '/monaco-languages/release/dev',
|
||||||
|
'npm/dev': 'node_modules/monaco-languages/release/dev',
|
||||||
|
'npm/min': 'node_modules/monaco-languages/release/min',
|
||||||
|
esm: 'node_modules/monaco-languages/release/esm',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},{
|
]
|
||||||
name: 'monaco-css',
|
|
||||||
contrib: 'vs/language/css/monaco.contribution',
|
|
||||||
modulePrefix: 'vs/language/css',
|
|
||||||
paths: {
|
|
||||||
npm: 'node_modules/monaco-css/release/min',
|
|
||||||
dev: '/monaco-css/release/dev'
|
|
||||||
}
|
|
||||||
},{
|
|
||||||
name: 'monaco-json',
|
|
||||||
contrib: 'vs/language/json/monaco.contribution',
|
|
||||||
modulePrefix: 'vs/language/json',
|
|
||||||
paths: {
|
|
||||||
npm: 'node_modules/monaco-json/release/min',
|
|
||||||
dev: '/monaco-json/release/dev'
|
|
||||||
}
|
|
||||||
},{
|
|
||||||
name: 'monaco-html',
|
|
||||||
contrib: 'vs/language/html/monaco.contribution',
|
|
||||||
modulePrefix: 'vs/language/html',
|
|
||||||
thirdPartyNotices: 'node_modules/monaco-html/ThirdPartyNotices.txt',
|
|
||||||
paths: {
|
|
||||||
npm: 'node_modules/monaco-html/release/min',
|
|
||||||
dev: '/monaco-html/release/dev'
|
|
||||||
}
|
|
||||||
},{
|
|
||||||
name: 'monaco-languages',
|
|
||||||
contrib: 'vs/basic-languages/src/monaco.contribution',
|
|
||||||
modulePrefix: 'vs/basic-languages',
|
|
||||||
thirdPartyNotices: 'node_modules/monaco-languages/ThirdPartyNotices.txt',
|
|
||||||
paths: {
|
|
||||||
npm: 'node_modules/monaco-languages/release',
|
|
||||||
dev: '/monaco-languages/out'
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof exports !== 'undefined') {
|
if (typeof exports !== 'undefined') {
|
||||||
|
|
|
||||||
1326
monaco.d.ts
vendored
1326
monaco.d.ts
vendored
File diff suppressed because it is too large
Load diff
4296
package-lock.json
generated
Normal file
4296
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
21
package.json
21
package.json
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "monaco-editor",
|
"name": "monaco-editor",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.10.0",
|
"version": "0.10.1",
|
||||||
"description": "A browser based code editor",
|
"description": "A browser based code editor",
|
||||||
"author": "Microsoft Corporation",
|
"author": "Microsoft Corporation",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
"website": "gulp website"
|
"website": "gulp website"
|
||||||
},
|
},
|
||||||
"typings": "./monaco.d.ts",
|
"typings": "./monaco.d.ts",
|
||||||
|
"module": "./esm/vs/editor/editor.main.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/Microsoft/monaco-editor"
|
"url": "https://github.com/Microsoft/monaco-editor"
|
||||||
|
|
@ -20,15 +21,17 @@
|
||||||
"event-stream": "^3.3.2",
|
"event-stream": "^3.3.2",
|
||||||
"gulp": "^3.9.1",
|
"gulp": "^3.9.1",
|
||||||
"gulp-typedoc": "^2.0.0",
|
"gulp-typedoc": "^2.0.0",
|
||||||
"http-server": "^0.9.0",
|
"http-server": "^0.11.1",
|
||||||
"monaco-css": "1.3.3",
|
"monaco-css": "2.0.1",
|
||||||
"monaco-editor-core": "0.10.0",
|
"monaco-editor-core": "0.11.3",
|
||||||
"monaco-html": "1.3.2",
|
"monaco-html": "2.0.2",
|
||||||
"monaco-json": "1.3.2",
|
"monaco-json": "2.0.1",
|
||||||
"monaco-languages": "0.9.0",
|
"monaco-languages": "1.0.2",
|
||||||
"monaco-typescript": "2.3.0",
|
"monaco-typescript": "3.0.0",
|
||||||
"rimraf": "^2.5.2",
|
"rimraf": "^2.5.2",
|
||||||
"typedoc": "^0.8.0",
|
"typedoc": "^0.8.0",
|
||||||
"uncss": "^0.14.1"
|
"typescript": "^2.7.2",
|
||||||
|
"uncss": "^0.14.1",
|
||||||
|
"vinyl": "^0.5.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,9 @@
|
||||||
}
|
}
|
||||||
var overwrites = parseQueryString();
|
var overwrites = parseQueryString();
|
||||||
var result = {};
|
var result = {};
|
||||||
result['editor'] = overwrites['editor'] || 'npm';
|
result['editor'] = overwrites['editor'] || 'npm/dev';
|
||||||
METADATA.PLUGINS.map(function(plugin) {
|
METADATA.PLUGINS.map(function(plugin) {
|
||||||
result[plugin.name] = overwrites[plugin.name] || 'npm';
|
result[plugin.name] = overwrites[plugin.name] || 'npm/dev';
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
})();
|
})();
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
};
|
};
|
||||||
Component.prototype.getResolvedPath = function() {
|
Component.prototype.getResolvedPath = function() {
|
||||||
var resolvedPath = this.paths[this.selectedPath];
|
var resolvedPath = this.paths[this.selectedPath];
|
||||||
if (this.selectedPath === 'npm' || this.isRelease()) {
|
if (this.selectedPath === 'npm/dev' || this.selectedPath === 'npm/min' || this.isRelease()) {
|
||||||
if (IS_FILE_PROTOCOL) {
|
if (IS_FILE_PROTOCOL) {
|
||||||
resolvedPath = DIRNAME + '/../' + resolvedPath;
|
resolvedPath = DIRNAME + '/../' + resolvedPath;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -76,9 +76,9 @@
|
||||||
Component.prototype.generateUrlForPath = function(pathName) {
|
Component.prototype.generateUrlForPath = function(pathName) {
|
||||||
var NEW_LOADER_OPTS = {};
|
var NEW_LOADER_OPTS = {};
|
||||||
Object.keys(LOADER_OPTS).forEach(function(key) {
|
Object.keys(LOADER_OPTS).forEach(function(key) {
|
||||||
NEW_LOADER_OPTS[key] = (LOADER_OPTS[key] === 'npm' ? undefined : LOADER_OPTS[key]);
|
NEW_LOADER_OPTS[key] = (LOADER_OPTS[key] === 'npm/dev' ? undefined : LOADER_OPTS[key]);
|
||||||
});
|
});
|
||||||
NEW_LOADER_OPTS[this.name] = (pathName === 'npm' ? undefined : pathName);
|
NEW_LOADER_OPTS[this.name] = (pathName === 'npm/dev' ? undefined : pathName);
|
||||||
|
|
||||||
var search = Object.keys(NEW_LOADER_OPTS).map(function(key) {
|
var search = Object.keys(NEW_LOADER_OPTS).map(function(key) {
|
||||||
var value = NEW_LOADER_OPTS[key];
|
var value = NEW_LOADER_OPTS[key];
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,7 @@ window.setTimeout(function () {
|
||||||
|
|
||||||
if (location.hash) {
|
if (location.hash) {
|
||||||
START_SAMPLE = location.hash.replace(/^\#/, '');
|
START_SAMPLE = location.hash.replace(/^\#/, '');
|
||||||
|
START_SAMPLE = decodeURIComponent(START_SAMPLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
samplesData[START_SAMPLE]();
|
samplesData[START_SAMPLE]();
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ var editor = monaco.editor.create(document.getElementById("container"), {
|
||||||
value: "// First line\nfunction hello() {\n\talert('Hello world!');\n}\n// Last line",
|
value: "// First line\nfunction hello() {\n\talert('Hello world!');\n}\n// Last line",
|
||||||
language: "javascript",
|
language: "javascript",
|
||||||
|
|
||||||
lineNumbers: false,
|
lineNumbers: "off",
|
||||||
roundedSelection: false,
|
roundedSelection: false,
|
||||||
scrollBeyondLastLine: false,
|
scrollBeyondLastLine: false,
|
||||||
readOnly: false,
|
readOnly: false,
|
||||||
|
|
@ -52,7 +52,7 @@ var editor = monaco.editor.create(document.getElementById("container"), {
|
||||||
});
|
});
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
editor.updateOptions({
|
editor.updateOptions({
|
||||||
lineNumbers: true
|
lineNumbers: "on"
|
||||||
});
|
});
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,13 @@ loadEditor(function() {
|
||||||
|
|
||||||
// Configures two JSON schemas, with references.
|
// Configures two JSON schemas, with references.
|
||||||
|
|
||||||
|
var id = "foo.json";
|
||||||
|
|
||||||
monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
|
monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
|
||||||
|
validate: true,
|
||||||
schemas: [{
|
schemas: [{
|
||||||
uri: "http://myserver/foo-schema.json",
|
uri: "http://myserver/foo-schema.json",
|
||||||
|
fileMatch: [id],
|
||||||
schema: {
|
schema: {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
|
|
@ -54,6 +58,7 @@ monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
uri: "http://myserver/bar-schema.json",
|
uri: "http://myserver/bar-schema.json",
|
||||||
|
fileMatch: [id],
|
||||||
schema: {
|
schema: {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
|
|
@ -68,15 +73,18 @@ monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
|
||||||
|
|
||||||
var jsonCode = [
|
var jsonCode = [
|
||||||
'{',
|
'{',
|
||||||
' "$schema": "http://myserver/foo-schema.json"',
|
' "p1": "v3",',
|
||||||
|
' "p2": false',
|
||||||
"}"
|
"}"
|
||||||
].join('\n');
|
].join('\n');
|
||||||
|
|
||||||
|
var model = monaco.editor.createModel(jsonCode, "json", id);
|
||||||
|
|
||||||
monaco.editor.create(document.getElementById("container"), {
|
monaco.editor.create(document.getElementById("container"), {
|
||||||
value: jsonCode,
|
model: model
|
||||||
language: "json"
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------SAMPLE CSS END*/
|
/*----------------------------------------SAMPLE CSS END*/
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@
|
||||||
<img src="https://opensource.microsoft.com/img/microsoft.png" alt="Microsoft" style="max-height:23px;margin-bottom:12px;">
|
<img src="https://opensource.microsoft.com/img/microsoft.png" alt="Microsoft" style="max-height:23px;margin-bottom:12px;">
|
||||||
</a>
|
</a>
|
||||||
<br/>
|
<br/>
|
||||||
<small>© 2017 Microsoft</small>
|
<small>© 2018 Microsoft</small>
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4291,7 +4291,7 @@ return {
|
||||||
<footer class="container">
|
<footer class="container">
|
||||||
<hr>
|
<hr>
|
||||||
<p class="text-center">
|
<p class="text-center">
|
||||||
<small>© 2017 Microsoft</small>
|
<small>© 2018 Microsoft</small>
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@
|
||||||
<footer class="container">
|
<footer class="container">
|
||||||
<hr>
|
<hr>
|
||||||
<p class="text-center">
|
<p class="text-center">
|
||||||
<small>© 2017 Microsoft</small>
|
<small>© 2018 Microsoft</small>
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -6,7 +6,7 @@ var editor = monaco.editor.create(document.getElementById("container"), {
|
||||||
value: "// First line\nfunction hello() {\n\talert('Hello world!');\n}\n// Last line",
|
value: "// First line\nfunction hello() {\n\talert('Hello world!');\n}\n// Last line",
|
||||||
language: "javascript",
|
language: "javascript",
|
||||||
|
|
||||||
lineNumbers: false,
|
lineNumbers: "off",
|
||||||
roundedSelection: false,
|
roundedSelection: false,
|
||||||
scrollBeyondLastLine: false,
|
scrollBeyondLastLine: false,
|
||||||
readOnly: false,
|
readOnly: false,
|
||||||
|
|
@ -14,6 +14,6 @@ var editor = monaco.editor.create(document.getElementById("container"), {
|
||||||
});
|
});
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
editor.updateOptions({
|
editor.updateOptions({
|
||||||
lineNumbers: true
|
lineNumbers: "on"
|
||||||
});
|
});
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,8 @@ monaco.languages.registerCompletionItemProvider('json', {
|
||||||
provideCompletionItems: function(model, position) {
|
provideCompletionItems: function(model, position) {
|
||||||
// find out if we are completing a property in the 'dependencies' object.
|
// find out if we are completing a property in the 'dependencies' object.
|
||||||
var textUntilPosition = model.getValueInRange({startLineNumber: 1, startColumn: 1, endLineNumber: position.lineNumber, endColumn: position.column});
|
var textUntilPosition = model.getValueInRange({startLineNumber: 1, startColumn: 1, endLineNumber: position.lineNumber, endColumn: position.column});
|
||||||
var match = textUntilPosition.match(/"dependencies"\s*:\s*{\s*("[^"]*"\s*:\s*"[^"]*"\s*,\s*)*("[^"]*)?$/); if (match) {
|
var match = textUntilPosition.match(/"dependencies"\s*:\s*{\s*("[^"]*"\s*:\s*"[^"]*"\s*,\s*)*("[^"]*)?$/);
|
||||||
|
if (match) {
|
||||||
return createDependencyProposals();
|
return createDependencyProposals();
|
||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,12 @@
|
||||||
// Configures two JSON schemas, with references.
|
// Configures two JSON schemas, with references.
|
||||||
|
|
||||||
|
var id = "foo.json";
|
||||||
|
|
||||||
monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
|
monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
|
||||||
|
validate: true,
|
||||||
schemas: [{
|
schemas: [{
|
||||||
uri: "http://myserver/foo-schema.json",
|
uri: "http://myserver/foo-schema.json",
|
||||||
|
fileMatch: [id],
|
||||||
schema: {
|
schema: {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
|
|
@ -16,6 +20,7 @@ monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
uri: "http://myserver/bar-schema.json",
|
uri: "http://myserver/bar-schema.json",
|
||||||
|
fileMatch: [id],
|
||||||
schema: {
|
schema: {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
|
|
@ -30,11 +35,13 @@ monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
|
||||||
|
|
||||||
var jsonCode = [
|
var jsonCode = [
|
||||||
'{',
|
'{',
|
||||||
' "$schema": "http://myserver/foo-schema.json"',
|
' "p1": "v3",',
|
||||||
|
' "p2": false',
|
||||||
"}"
|
"}"
|
||||||
].join('\n');
|
].join('\n');
|
||||||
|
|
||||||
|
var model = monaco.editor.createModel(jsonCode, "json", id);
|
||||||
|
|
||||||
monaco.editor.create(document.getElementById("container"), {
|
monaco.editor.create(document.getElementById("container"), {
|
||||||
value: jsonCode,
|
model: model
|
||||||
language: "json"
|
|
||||||
});
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue