Merge branch 'Microsoft/master' into update-css-intellisense

This commit is contained in:
David Storey 2015-11-23 19:22:15 -08:00
commit 70208296a0
81 changed files with 1448 additions and 1163 deletions

View file

@ -1,8 +1,9 @@
sudo: false
language: node_js
language: cpp
node_js:
- "0.12"
os:
- linux
- osx
addons:
apt:
@ -17,8 +18,20 @@ addons:
- libgtk2.0-0
before_install:
- export CXX="g++-4.9" CC="gcc-4.9"
- git submodule update --init --recursive
- git clone https://github.com/creationix/nvm.git ./.nvm
- source ./.nvm/nvm.sh
- nvm install 0.12
- nvm use 0.12
- npm config set python `which python`
- npm install -g gulp
- if [ $TRAVIS_OS_NAME == "linux" ]; then
export CXX="g++-4.9" CC="gcc-4.9";
fi
install:
- ./scripts/npm.sh install
- gulp electron compile
script:
- ./test/run.sh

View file

@ -1,253 +1,253 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var path = require('path');
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var filter = require('gulp-filter');
var minifyCSS = require('gulp-minify-css');
var uglify = require('gulp-uglify');
var es = require('event-stream');
var concat = require('gulp-concat');
var File = require('vinyl');
var underscore = require('underscore');
var bundle = require('./lib/bundle');
var util = require('./lib/util');
var tsOptions = {
target: 'ES5',
module: 'amd',
verbose: true,
preserveConstEnums: true,
experimentalDecorators: true,
sourceMap: true,
rootDir: path.join(path.dirname(__dirname), 'src')
};
exports.loaderConfig = function (emptyPaths) {
var result = {
paths: {
'vs': 'out-build/vs',
'vs/extensions': 'extensions',
'vscode': 'empty:',
'lib': 'out-build/lib'
},
'vs/text': {
paths: {
'vs/extensions': 'extensions'
}
}
};
(emptyPaths || []).forEach(function(m) { result.paths[m] = 'empty:'; });
return result;
};
var IS_OUR_COPYRIGHT_REGEXP = /Copyright \(C\) Microsoft Corporation/i;
function loader(bundledFileHeader) {
var isFirst = true;
return gulp.src([
'out-build/vs/loader.js',
'out-build/vs/css.js',
'out-build/vs/nls.js',
'out-build/vs/text.js'
], { base: 'out-build' })
.pipe(es.through(function(data) {
if (isFirst) {
isFirst = false;
this.emit('data', new File({
path: 'fake',
base: '',
contents: new Buffer(bundledFileHeader)
}));
this.emit('data', data);
} else {
this.emit('data', data);
}
}))
.pipe(util.loadSourcemaps())
.pipe(concat('vs/loader.js'))
.pipe(es.mapSync(function (f) {
f.sourceMap.sourceRoot = util.toFileUri(tsOptions.rootDir);
return f;
}));
}
function toConcatStream(bundledFileHeader, sources, dest) {
var useSourcemaps = /\.js$/.test(dest) && !/\.nls\.js$/.test(dest);
// If a bundle ends up including in any of the sources our copyright, then
// insert a fake source at the beginning of each bundle with our copyright
var containsOurCopyright = false;
for (var i = 0, len = sources.length; i < len; i++) {
var fileContents = sources[i].contents;
if (IS_OUR_COPYRIGHT_REGEXP.test(fileContents)) {
containsOurCopyright = true;
break;
}
}
if (containsOurCopyright) {
sources.unshift({
path: null,
contents: bundledFileHeader
});
}
var treatedSources = sources.map(function(source) {
var root = source.path ? path.dirname(__dirname).replace(/\\/g, '/') : '';
var base = source.path ? root + '/out-build' : '';
return new File({
path: source.path ? root + '/' + source.path.replace(/\\/g, '/') : 'fake',
base: base,
contents: new Buffer(source.contents)
});
});
return es.readArray(treatedSources)
.pipe(useSourcemaps ? util.loadSourcemaps() : es.through())
.pipe(concat(dest));
}
function toBundleStream(bundledFileHeader, bundles) {
return es.merge(bundles.map(function(bundle) {
return toConcatStream(bundledFileHeader, bundle.sources, bundle.dest);
}));
}
/**
* opts:
* - entryPoints (for AMD files, will get bundled and get Copyright treatment)
* - otherSources (for non-AMD files that should get Copyright treatment)
* - resources (svg, etc.)
* - loaderConfig
* - header (basically the Copyright treatment)
* - out (out folder name)
*/
exports.optimizeTask = function(opts) {
var entryPoints = opts.entryPoints;
var otherSources = opts.otherSources;
var resources = opts.resources;
var loaderConfig = opts.loaderConfig;
var bundledFileHeader = opts.header;
var out = opts.out;
return function() {
var bundlesStream = es.through();
bundle.bundle(entryPoints, loaderConfig, function(err, result) {
if (err) { return bundlesStream.emit('error', JSON.stringify(err)); }
toBundleStream(bundledFileHeader, result).pipe(bundlesStream);
});
var otherSourcesStream = es.through();
var otherSourcesStreamArr = [];
gulp.src(otherSources, { base: 'out-build' })
.pipe(es.through(function (data) {
otherSourcesStreamArr.push(toConcatStream(bundledFileHeader, [data], data.relative));
}, function () {
if (!otherSourcesStreamArr.length) {
setTimeout(function () { otherSourcesStream.emit('end'); }, 0);
} else {
es.merge(otherSourcesStreamArr).pipe(otherSourcesStream);
}
}));
var result = es.merge(
loader(bundledFileHeader),
bundlesStream,
otherSourcesStream,
gulp.src(resources, { base: 'out-build' })
);
return result
.pipe(sourcemaps.write('./', {
sourceRoot: null,
addComment: true,
includeContent: true
}))
.pipe(gulp.dest(out));
};
};
/**
* wrap around uglify and allow the preserveComments function
* to have a file "context" to include our copyright only once per file
*/
function uglifyWithCopyrights() {
var currentFileHasOurCopyright = false;
var onNewFile = function() {
currentFileHasOurCopyright = false;
};
var preserveComments = function(node, comment) {
var text = comment.value;
var type = comment.type;
if (/@minifier_do_not_preserve/.test(text)) {
return false;
}
var isOurCopyright = IS_OUR_COPYRIGHT_REGEXP.test(text);
if (isOurCopyright) {
if (currentFileHasOurCopyright) {
return false;
}
currentFileHasOurCopyright = true;
return true;
}
if ('comment2' === type) {
// check for /*!. Note that text doesn't contain leading /*
return (text.length > 0 && text[0] === '!') || /@preserve|license|@cc_on|copyright/i.test(text);
} else if ('comment1' === type) {
return /license|copyright/i.test(text);
}
return false;
};
var uglifyStream = uglify({ preserveComments: preserveComments });
return es.through(function write(data) {
var _this = this;
onNewFile();
uglifyStream.once('data', function(data) {
_this.emit('data', data);
})
uglifyStream.write(data);
}, function end() {
this.emit('end')
});
}
exports.minifyTask = function (src, addSourceMapsComment) {
return function() {
var jsFilter = filter('**/*.js', { restore: true });
var cssFilter = filter('**/*.css', { restore: true });
return gulp.src([src + '/**', '!' + src + '/**/*.map'])
.pipe(jsFilter)
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(uglifyWithCopyrights())
.pipe(jsFilter.restore)
.pipe(cssFilter)
.pipe(minifyCSS())
.pipe(cssFilter.restore)
.pipe(sourcemaps.write('./', {
sourceRoot: null,
includeContent: true,
addComment: addSourceMapsComment
}))
.pipe(gulp.dest(src + '-min'));
};
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var path = require('path');
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var filter = require('gulp-filter');
var minifyCSS = require('gulp-minify-css');
var uglify = require('gulp-uglify');
var es = require('event-stream');
var concat = require('gulp-concat');
var File = require('vinyl');
var underscore = require('underscore');
var bundle = require('./lib/bundle');
var util = require('./lib/util');
var tsOptions = {
target: 'ES5',
module: 'amd',
verbose: true,
preserveConstEnums: true,
experimentalDecorators: true,
sourceMap: true,
rootDir: path.join(path.dirname(__dirname), 'src')
};
exports.loaderConfig = function (emptyPaths) {
var result = {
paths: {
'vs': 'out-build/vs',
'vs/extensions': 'extensions',
'vscode': 'empty:',
'lib': 'out-build/lib'
},
'vs/text': {
paths: {
'vs/extensions': 'extensions'
}
}
};
(emptyPaths || []).forEach(function(m) { result.paths[m] = 'empty:'; });
return result;
};
var IS_OUR_COPYRIGHT_REGEXP = /Copyright \(C\) Microsoft Corporation/i;
function loader(bundledFileHeader) {
var isFirst = true;
return gulp.src([
'out-build/vs/loader.js',
'out-build/vs/css.js',
'out-build/vs/nls.js',
'out-build/vs/text.js'
], { base: 'out-build' })
.pipe(es.through(function(data) {
if (isFirst) {
isFirst = false;
this.emit('data', new File({
path: 'fake',
base: '',
contents: new Buffer(bundledFileHeader)
}));
this.emit('data', data);
} else {
this.emit('data', data);
}
}))
.pipe(util.loadSourcemaps())
.pipe(concat('vs/loader.js'))
.pipe(es.mapSync(function (f) {
f.sourceMap.sourceRoot = util.toFileUri(tsOptions.rootDir);
return f;
}));
}
function toConcatStream(bundledFileHeader, sources, dest) {
var useSourcemaps = /\.js$/.test(dest) && !/\.nls\.js$/.test(dest);
// If a bundle ends up including in any of the sources our copyright, then
// insert a fake source at the beginning of each bundle with our copyright
var containsOurCopyright = false;
for (var i = 0, len = sources.length; i < len; i++) {
var fileContents = sources[i].contents;
if (IS_OUR_COPYRIGHT_REGEXP.test(fileContents)) {
containsOurCopyright = true;
break;
}
}
if (containsOurCopyright) {
sources.unshift({
path: null,
contents: bundledFileHeader
});
}
var treatedSources = sources.map(function(source) {
var root = source.path ? path.dirname(__dirname).replace(/\\/g, '/') : '';
var base = source.path ? root + '/out-build' : '';
return new File({
path: source.path ? root + '/' + source.path.replace(/\\/g, '/') : 'fake',
base: base,
contents: new Buffer(source.contents)
});
});
return es.readArray(treatedSources)
.pipe(useSourcemaps ? util.loadSourcemaps() : es.through())
.pipe(concat(dest));
}
function toBundleStream(bundledFileHeader, bundles) {
return es.merge(bundles.map(function(bundle) {
return toConcatStream(bundledFileHeader, bundle.sources, bundle.dest);
}));
}
/**
* opts:
* - entryPoints (for AMD files, will get bundled and get Copyright treatment)
* - otherSources (for non-AMD files that should get Copyright treatment)
* - resources (svg, etc.)
* - loaderConfig
* - header (basically the Copyright treatment)
* - out (out folder name)
*/
exports.optimizeTask = function(opts) {
var entryPoints = opts.entryPoints;
var otherSources = opts.otherSources;
var resources = opts.resources;
var loaderConfig = opts.loaderConfig;
var bundledFileHeader = opts.header;
var out = opts.out;
return function() {
var bundlesStream = es.through();
bundle.bundle(entryPoints, loaderConfig, function(err, result) {
if (err) { return bundlesStream.emit('error', JSON.stringify(err)); }
toBundleStream(bundledFileHeader, result).pipe(bundlesStream);
});
var otherSourcesStream = es.through();
var otherSourcesStreamArr = [];
gulp.src(otherSources, { base: 'out-build' })
.pipe(es.through(function (data) {
otherSourcesStreamArr.push(toConcatStream(bundledFileHeader, [data], data.relative));
}, function () {
if (!otherSourcesStreamArr.length) {
setTimeout(function () { otherSourcesStream.emit('end'); }, 0);
} else {
es.merge(otherSourcesStreamArr).pipe(otherSourcesStream);
}
}));
var result = es.merge(
loader(bundledFileHeader),
bundlesStream,
otherSourcesStream,
gulp.src(resources, { base: 'out-build' })
);
return result
.pipe(sourcemaps.write('./', {
sourceRoot: null,
addComment: true,
includeContent: true
}))
.pipe(gulp.dest(out));
};
};
/**
* wrap around uglify and allow the preserveComments function
* to have a file "context" to include our copyright only once per file
*/
function uglifyWithCopyrights() {
var currentFileHasOurCopyright = false;
var onNewFile = function() {
currentFileHasOurCopyright = false;
};
var preserveComments = function(node, comment) {
var text = comment.value;
var type = comment.type;
if (/@minifier_do_not_preserve/.test(text)) {
return false;
}
var isOurCopyright = IS_OUR_COPYRIGHT_REGEXP.test(text);
if (isOurCopyright) {
if (currentFileHasOurCopyright) {
return false;
}
currentFileHasOurCopyright = true;
return true;
}
if ('comment2' === type) {
// check for /*!. Note that text doesn't contain leading /*
return (text.length > 0 && text[0] === '!') || /@preserve|license|@cc_on|copyright/i.test(text);
} else if ('comment1' === type) {
return /license|copyright/i.test(text);
}
return false;
};
var uglifyStream = uglify({ preserveComments: preserveComments });
return es.through(function write(data) {
var _this = this;
onNewFile();
uglifyStream.once('data', function(data) {
_this.emit('data', data);
})
uglifyStream.write(data);
}, function end() {
this.emit('end')
});
}
exports.minifyTask = function (src, addSourceMapsComment) {
return function() {
var jsFilter = filter('**/*.js', { restore: true });
var cssFilter = filter('**/*.css', { restore: true });
return gulp.src([src + '/**', '!' + src + '/**/*.map'])
.pipe(jsFilter)
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(uglifyWithCopyrights())
.pipe(jsFilter.restore)
.pipe(cssFilter)
.pipe(minifyCSS())
.pipe(cssFilter.restore)
.pipe(sourcemaps.write('./', {
sourceRoot: null,
includeContent: true,
addComment: addSourceMapsComment
}))
.pipe(gulp.dest(src + '-min'));
};
};

View file

@ -1,107 +1,107 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var gulp = require('gulp');
var path = require('path');
var rename = require('gulp-rename');
var filter = require('gulp-filter');
var _ = require('underscore');
var es = require('event-stream');
var buildfile = require('../src/buildfile');
var util = require('./lib/util');
var common = require('./gulpfile.common');
var root = path.dirname(__dirname);
var commit = process.env['BUILD_SOURCEVERSION'] || require('./lib/git').getVersion(root);
// Build
var editorEntryPoints = _.flatten([
buildfile.entrypoint('vs/editor/editor.main'),
buildfile.base,
buildfile.standaloneLanguages,
buildfile.editor,
buildfile.languages
]);
var editorResources = [
'out-build/vs/{base,editor}/**/*.{svg,png}',
'out-build/vs/base/worker/workerMainCompatibility.html',
'out-build/vs/base/worker/workerMain.{js,js.map}',
'out-build/vs/languages/typescript/common/lib/lib.{d.ts,es6.d.ts}',
'!out-build/vs/workbench/**',
'!**/test/**'
];
var editorOtherSources = [
'out-build/vs/css.js',
'out-build/vs/nls.js',
'out-build/vs/text.js',
'out-build/vs/editor/css/*.css'
];
var BUNDLED_FILE_HEADER = [
'/*!-----------------------------------------------------------',
' * Copyright (C) Microsoft Corporation. All rights reserved.',
' * Version: ' + commit,
' * Released under the MIT license',
' * https://github.com/Microsoft/vscode/blob/master/LICENSE.txt',
' *-----------------------------------------------------------*/',
''
].join('\n');
function editorLoaderConfig(removeAllOSS) {
var result = common.loaderConfig();
// never ship marked in editor
result.paths['vs/languages/markdown/common/marked'] = 'out-build/vs/languages/markdown/common/marked.mock';
if (removeAllOSS) {
result.paths['vs/languages/lib/common/beautify-html'] = 'out-build/vs/languages/lib/common/beautify-html.mock';
}
return result;
}
gulp.task('clean-optimized-editor', util.rimraf('out-editor'));
gulp.task('optimize-editor', ['clean-optimized-editor', 'compile-build'], common.optimizeTask({
entryPoints: editorEntryPoints,
otherSources: editorOtherSources,
resources: editorResources,
loaderConfig: editorLoaderConfig(false),
header: BUNDLED_FILE_HEADER,
out: 'out-editor'
}));
gulp.task('clean-minified-editor', util.rimraf('out-editor-min'));
gulp.task('minify-editor', ['clean-minified-editor', 'optimize-editor'], common.minifyTask('out-editor', true));
// Package
var root = path.dirname(__dirname);
function copyTask(src, dest, FILTER) {
return function () {
return (
gulp.src(src + '/**', { base: src })
.pipe(FILTER ? filter(FILTER) : es.through())
.pipe(gulp.dest(dest))
);
};
}
var DISTRO_DEV_FOLDER_PATH = path.join(path.dirname(root), 'Monaco-Editor');
gulp.task('clean-editor-distro-dev', util.rimraf(DISTRO_DEV_FOLDER_PATH));
gulp.task('editor-distro-dev', ['clean-editor-distro-dev', 'optimize-editor'], copyTask('out-editor', DISTRO_DEV_FOLDER_PATH));
var DISTRO_MIN_FOLDER_PATH = path.join(path.dirname(root), 'Monaco-Editor-Min');
gulp.task('clean-editor-distro-min', util.rimraf(DISTRO_MIN_FOLDER_PATH));
gulp.task('editor-distro-min', ['clean-editor-distro-min', 'minify-editor'], copyTask('out-editor-min', DISTRO_MIN_FOLDER_PATH, ['**', '!**/*.js.map', '!nls.metadata.json']));
var DISTRO_MIN_SOURCEMAPS_FOLDER_PATH = path.join(path.dirname(root), 'Monaco-Editor-Min-SourceMaps');
gulp.task('clean-editor-distro-min-sourcemaps', util.rimraf(DISTRO_MIN_SOURCEMAPS_FOLDER_PATH));
gulp.task('editor-distro-min-sourcemaps', ['clean-editor-distro-min-sourcemaps', 'minify-editor'], copyTask('out-editor-min', DISTRO_MIN_SOURCEMAPS_FOLDER_PATH, ['**/*.js.map']));
gulp.task('editor-distro', ['editor-distro-min', 'editor-distro-min-sourcemaps', 'editor-distro-dev']);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var gulp = require('gulp');
var path = require('path');
var rename = require('gulp-rename');
var filter = require('gulp-filter');
var _ = require('underscore');
var es = require('event-stream');
var buildfile = require('../src/buildfile');
var util = require('./lib/util');
var common = require('./gulpfile.common');
var root = path.dirname(__dirname);
var commit = process.env['BUILD_SOURCEVERSION'] || require('./lib/git').getVersion(root);
// Build
var editorEntryPoints = _.flatten([
buildfile.entrypoint('vs/editor/editor.main'),
buildfile.base,
buildfile.standaloneLanguages,
buildfile.editor,
buildfile.languages
]);
var editorResources = [
'out-build/vs/{base,editor}/**/*.{svg,png}',
'out-build/vs/base/worker/workerMainCompatibility.html',
'out-build/vs/base/worker/workerMain.{js,js.map}',
'out-build/vs/languages/typescript/common/lib/lib.{d.ts,es6.d.ts}',
'!out-build/vs/workbench/**',
'!**/test/**'
];
var editorOtherSources = [
'out-build/vs/css.js',
'out-build/vs/nls.js',
'out-build/vs/text.js',
'out-build/vs/editor/css/*.css'
];
var BUNDLED_FILE_HEADER = [
'/*!-----------------------------------------------------------',
' * Copyright (C) Microsoft Corporation. All rights reserved.',
' * Version: ' + commit,
' * Released under the MIT license',
' * https://github.com/Microsoft/vscode/blob/master/LICENSE.txt',
' *-----------------------------------------------------------*/',
''
].join('\n');
function editorLoaderConfig(removeAllOSS) {
var result = common.loaderConfig();
// never ship marked in editor
result.paths['vs/languages/markdown/common/marked'] = 'out-build/vs/languages/markdown/common/marked.mock';
if (removeAllOSS) {
result.paths['vs/languages/lib/common/beautify-html'] = 'out-build/vs/languages/lib/common/beautify-html.mock';
}
return result;
}
gulp.task('clean-optimized-editor', util.rimraf('out-editor'));
gulp.task('optimize-editor', ['clean-optimized-editor', 'compile-build'], common.optimizeTask({
entryPoints: editorEntryPoints,
otherSources: editorOtherSources,
resources: editorResources,
loaderConfig: editorLoaderConfig(false),
header: BUNDLED_FILE_HEADER,
out: 'out-editor'
}));
gulp.task('clean-minified-editor', util.rimraf('out-editor-min'));
gulp.task('minify-editor', ['clean-minified-editor', 'optimize-editor'], common.minifyTask('out-editor', true));
// Package
var root = path.dirname(__dirname);
function copyTask(src, dest, FILTER) {
return function () {
return (
gulp.src(src + '/**', { base: src })
.pipe(FILTER ? filter(FILTER) : es.through())
.pipe(gulp.dest(dest))
);
};
}
var DISTRO_DEV_FOLDER_PATH = path.join(path.dirname(root), 'Monaco-Editor');
gulp.task('clean-editor-distro-dev', util.rimraf(DISTRO_DEV_FOLDER_PATH));
gulp.task('editor-distro-dev', ['clean-editor-distro-dev', 'optimize-editor'], copyTask('out-editor', DISTRO_DEV_FOLDER_PATH));
var DISTRO_MIN_FOLDER_PATH = path.join(path.dirname(root), 'Monaco-Editor-Min');
gulp.task('clean-editor-distro-min', util.rimraf(DISTRO_MIN_FOLDER_PATH));
gulp.task('editor-distro-min', ['clean-editor-distro-min', 'minify-editor'], copyTask('out-editor-min', DISTRO_MIN_FOLDER_PATH, ['**', '!**/*.js.map', '!nls.metadata.json']));
var DISTRO_MIN_SOURCEMAPS_FOLDER_PATH = path.join(path.dirname(root), 'Monaco-Editor-Min-SourceMaps');
gulp.task('clean-editor-distro-min-sourcemaps', util.rimraf(DISTRO_MIN_SOURCEMAPS_FOLDER_PATH));
gulp.task('editor-distro-min-sourcemaps', ['clean-editor-distro-min-sourcemaps', 'minify-editor'], copyTask('out-editor-min', DISTRO_MIN_SOURCEMAPS_FOLDER_PATH, ['**/*.js.map']));
gulp.task('editor-distro', ['editor-distro-min', 'editor-distro-min-sourcemaps', 'editor-distro-dev']);

View file

@ -1,258 +1,258 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/*global process,__dirname, Buffer*/
var gulp = require('gulp');
var fs = require('fs');
var path = require('path');
var es = require('event-stream');
var azure = require('gulp-azure-storage');
var electron = require('gulp-atom-electron');
var symdest = require('gulp-symdest');
var rename = require('gulp-rename');
var filter = require('gulp-filter');
var json = require('gulp-json-editor');
var insert = require('gulp-insert');
var remote = require('gulp-remote-src');
var File = require('vinyl');
var rimraf = require('rimraf');
var _ = require('underscore');
var packagejson = require('../package.json');
var util = require('./lib/util');
var buildfile = require('../src/buildfile');
var common = require('./gulpfile.common');
var root = path.dirname(__dirname);
var commit = process.env['BUILD_SOURCEVERSION'] || require('./lib/git').getVersion(root);
var baseModules = [
'app', 'applicationinsights', 'assert', 'auto-updater', 'browser-window',
'child_process', 'chokidar', 'crash-reporter', 'crypto', 'dialog', 'emmet',
'events', 'fs', 'getmac', 'glob', 'graceful-fs', 'http', 'http-proxy-agent',
'https', 'https-proxy-agent', 'iconv-lite', 'ipc', 'menu', 'menu-item', 'net',
'original-fs', 'os', 'path', 'readline', 'remote', 'sax', 'screen', 'semver',
'shell', 'stream', 'string_decoder', 'url', 'vscode-textmate', 'web-frame', 'winreg',
'yauzl'
];
// Build
var vscodeEntryPoints = _.flatten([
buildfile.entrypoint('vs/workbench/workbench.main'),
buildfile.base,
buildfile.editor,
buildfile.languages,
buildfile.vscode
]);
var vscodeResources = [
'out-build/bootstrap.js',
'out-build/vs/**/*.{svg,png,cur}',
'out-build/vs/base/node/{stdForkStart.js,terminateProcess.sh}',
'out-build/vs/base/worker/workerMainCompatibility.html',
'out-build/vs/base/worker/workerMain.{js,js.map}',
'out-build/vs/editor/css/*.css',
'out-build/vs/languages/typescript/common/lib/lib.{d.ts,es6.d.ts}',
'out-build/vs/languages/markdown/common/*.css',
'out-build/vs/workbench/browser/media/*-theme.css',
'out-build/vs/workbench/browser/media/octicons/**',
'out-build/vs/workbench/electron-browser/index.html',
'out-build/vs/workbench/electron-main/bootstrap.js',
'out-build/vs/workbench/parts/debug/**/*.json',
'out-build/vs/workbench/parts/execution/**/*.scpt',
'out-build/vs/workbench/parts/git/**/*.html',
'out-build/vs/workbench/parts/git/**/*.sh',
'out-build/vs/workbench/parts/markdown/**/*.md',
'out-build/vs/workbench/parts/tasks/**/*.json',
'out-build/vs/workbench/services/files/**/*.exe',
'out-build/vs/workbench/services/files/**/*.md',
'!**/test/**'
];
var BUNDLED_FILE_HEADER = [
'/*!--------------------------------------------------------',
' * Copyright (C) Microsoft Corporation. All rights reserved.',
' *--------------------------------------------------------*/'
].join('\n');
gulp.task('clean-optimized-vscode', util.rimraf('out-vscode'));
gulp.task('optimize-vscode', ['clean-optimized-vscode', 'compile-build', 'compile-plugins'], common.optimizeTask({
entryPoints: vscodeEntryPoints,
otherSources: [],
resources: vscodeResources,
loaderConfig: common.loaderConfig(baseModules),
header: BUNDLED_FILE_HEADER,
out: 'out-vscode'
}));
gulp.task('clean-minified-vscode', util.rimraf('out-vscode-min'));
gulp.task('minify-vscode', ['clean-minified-vscode', 'optimize-vscode'], common.minifyTask('out-vscode', false));
// Package
var product = JSON.parse(fs.readFileSync(path.join(root, 'product.json'), 'utf8'));
var darwinCreditsTemplate = product.darwinCredits && _.template(fs.readFileSync(path.join(root, product.darwinCredits), 'utf8'));
var config = {
version: packagejson.electronVersion,
productAppName: product.nameLong,
companyName: product.companyName,
copyright: product.copyright,
darwinIcon: product.icons.application.icns,
darwinBundleIdentifier: product.darwinBundleIdentifier,
darwinApplicationCategoryType: product.darwinApplicationCategoryType, // Finder: View-->Arrange by Application Category
darwinBundleDocumentTypes: product.darwinBundleDocumentTypes,
darwinCredits: darwinCreditsTemplate ? new Buffer(darwinCreditsTemplate({ commit: commit, date: new Date().toISOString() })) : void 0,
winIcon: product.icons.application.ico,
win32ExeBasename: product.win32ExeBasename,
token: process.env['GITHUB_TOKEN'] || void 0
};
gulp.task('electron', function () {
// Force windows to use ia32
var arch = (process.platform === 'win32' ? 'ia32' : process.arch);
return electron.dest(path.join(path.dirname(root), 'Electron-Build'), _.extend({}, config, { arch: arch }));
});
function mixinProduct() {
var product;
var url = process.env['PRODUCT_JSON_URL'];
if (url) {
var opts = { base: '' };
var username = process.env['PRODUCT_JSON_USERNAME'];
var password = process.env['PRODUCT_JSON_PASSWORD'];
if (username || password) {
opts.auth = { username: username || '', password: password || '' };
}
product = remote(url, opts);
} else {
product = gulp.src(['product.json'], { base: '.' });
}
return product.pipe(json({
commit: commit,
date: new Date().toISOString()
}));
}
function packageTask(platform, arch, opts) {
opts = opts || {};
var destination = path.join(path.dirname(root), 'VSCode') + (platform ? '-' + platform : '') + (arch ? '-' + arch : '');
platform = platform || process.platform;
arch = platform === 'win32' ? 'ia32' : arch;
return function () {
var out = opts.minified ? 'out-vscode-min' : 'out-vscode';
var pluginHostFilter = filter(out + '/vs/workbench/node/pluginHostProcess.js', { restore: true });
var src = gulp.src(out + '/**', { base: '.' })
.pipe(pluginHostFilter)
.pipe(insert.append('\n//# sourceMappingURL=pluginHostProcess.js.map'))
.pipe(pluginHostFilter.restore)
.pipe(rename(function (path) { path.dirname = path.dirname.replace(new RegExp('^' + out), 'out'); }))
.pipe(util.setExecutableBit(['**/*.sh']));
var extensions = gulp.src([
'extensions/**',
'!extensions/*/src/**',
'!extensions/*/out/**/test/**',
'!extensions/typescript/bin/**',
'!extensions/csharp-o/node_modules/del/**',
'!extensions/csharp-o/node_modules/gulp/**',
'!extensions/csharp-o/node_modules/gulp-decompress/**',
'!extensions/csharp-o/node_modules/gulp-download/**',
'!extensions/csharp-o/node_modules/typescript/**'
], { base: '.' });
var pluginHostSourceMap = gulp.src(out + '/vs/workbench/node/pluginHostProcess.js.map', { base: '.' })
.pipe(rename(function (path) { path.dirname = path.dirname.replace(new RegExp('^' + out), 'out'); }));
var sources = es.merge(
es.merge(src, extensions).pipe(filter(['**', '!**/*.js.map'])),
pluginHostSourceMap
).pipe(util.handleAzureJson({ platform: platform }));
var packageJson = gulp.src(['package.json'], { base: '.' }).pipe(json({ name: product.nameShort }));
var license = gulp.src(['Credits_*', 'LICENSE.txt', 'ThirdPartyNotices.txt'], { base: '.' });
var api = gulp.src('src/vs/vscode.d.ts').pipe(rename('out/vs/vscode.d.ts'));
var depsSrc = _.flatten(Object.keys(packagejson.dependencies)
.map(function (d) { return ['node_modules/' + d + '/**', '!node_modules/' + d + '/**/{test,tests}/**']; }));
var deps = gulp.src(depsSrc, { base: '.', dot: true })
.pipe(util.cleanNodeModule('fsevents', ['binding.gyp', 'fsevents.cc', 'build/**', 'src/**', 'test/**'], true))
.pipe(util.cleanNodeModule('oniguruma', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], true));
var resources = gulp.src('resources/*', { base: '.' });
if (platform === 'win32') {
resources = es.merge(resources, gulp.src(product.icons.file.ico, { base: '.' }));
} else if (platform === 'linux') {
resources = es.merge(resources, gulp.src(product.icons.application.png, { base: '.' }));
}
var all = es.merge(
api,
packageJson,
mixinProduct(),
license,
sources,
deps,
resources
).pipe(util.skipDirectories());
var result = all
.pipe(util.fixWin32DirectoryPermissions())
.pipe(electron(_.extend({}, config, { platform: platform, arch: arch })))
.pipe(filter(['**', '!LICENSE', '!version']));
if (platform === 'win32') {
result = es.merge(result, gulp.src('resources/win32/bin/**', { base: 'resources/win32' }));
}
return result.pipe(opts.zip ? electron.zfsdest(destination + '.zip') : symdest(destination));
};
}
gulp.task('clean-vscode-win32', util.rimraf(path.join(path.dirname(root), 'VSCode-win32')));
gulp.task('clean-vscode-darwin', util.rimraf(path.join(path.dirname(root), 'VSCode-darwin')));
gulp.task('clean-vscode-linux-ia32', util.rimraf(path.join(path.dirname(root), 'VSCode-linux-ia32')));
gulp.task('clean-vscode-linux-x64', util.rimraf(path.join(path.dirname(root), 'VSCode-linux-x64')));
gulp.task('vscode-win32', ['optimize-vscode', 'clean-vscode-win32'], packageTask('win32'));
gulp.task('vscode-darwin', ['optimize-vscode', 'clean-vscode-darwin'], packageTask('darwin'));
gulp.task('vscode-linux-ia32', ['optimize-vscode', 'clean-vscode-linux-ia32'], packageTask('linux', 'ia32'));
gulp.task('vscode-linux-x64', ['optimize-vscode', 'clean-vscode-linux-x64'], packageTask('linux', 'x64'));
gulp.task('vscode-win32-min', ['minify-vscode', 'clean-vscode-win32'], packageTask('win32', null, { minified: true }));
gulp.task('vscode-darwin-min', ['minify-vscode', 'clean-vscode-darwin'], packageTask('darwin', null, { minified: true }));
gulp.task('vscode-linux-ia32-min', ['minify-vscode', 'clean-vscode-linux-ia32'], packageTask('linux', 'ia32', { minified: true }));
gulp.task('vscode-linux-x64-min', ['minify-vscode', 'clean-vscode-linux-x64'], packageTask('linux', 'x64', { minified: true }));
gulp.task('vscode-win32-zip', ['optimize-vscode'], packageTask('win32', null, { zip: true }));
gulp.task('vscode-darwin-zip', ['optimize-vscode'], packageTask('darwin', null, { zip: true }));
gulp.task('vscode-linux-ia32-zip', ['optimize-vscode'], packageTask('linux', 'ia32', { zip: true }));
gulp.task('vscode-linux-x64-zip', ['optimize-vscode'], packageTask('linux', 'x64', { zip: true }));
gulp.task('vscode-win32-zip-min', ['minify-vscode'], packageTask('win32', null, { zip: true, minified: true }));
gulp.task('vscode-darwin-zip-min', ['minify-vscode'], packageTask('darwin', null, { zip: true, minified: true }));
gulp.task('vscode-linux-zip-ia32-min', ['minify-vscode'], packageTask('linux', 'ia32', { zip: true, minified: true }));
gulp.task('vscode-linux-zip-x64-min', ['minify-vscode'], packageTask('linux', 'x64', { zip: true, minified: true }));
// Sourcemaps
gulp.task('vscode-sourcemaps', ['minify-vscode'], function () {
return gulp.src('out-vscode-min/**/*.map')
.pipe(azure.upload({
account: process.env.AZURE_STORAGE_ACCOUNT,
key: process.env.AZURE_STORAGE_ACCESS_KEY,
container: 'sourcemaps',
prefix: commit + '/'
}));
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/*global process,__dirname, Buffer*/
var gulp = require('gulp');
var fs = require('fs');
var path = require('path');
var es = require('event-stream');
var azure = require('gulp-azure-storage');
var electron = require('gulp-atom-electron');
var symdest = require('gulp-symdest');
var rename = require('gulp-rename');
var filter = require('gulp-filter');
var json = require('gulp-json-editor');
var insert = require('gulp-insert');
var remote = require('gulp-remote-src');
var File = require('vinyl');
var rimraf = require('rimraf');
var _ = require('underscore');
var packagejson = require('../package.json');
var util = require('./lib/util');
var buildfile = require('../src/buildfile');
var common = require('./gulpfile.common');
var root = path.dirname(__dirname);
var commit = process.env['BUILD_SOURCEVERSION'] || require('./lib/git').getVersion(root);
var baseModules = [
'app', 'applicationinsights', 'assert', 'auto-updater', 'browser-window',
'child_process', 'chokidar', 'crash-reporter', 'crypto', 'dialog', 'emmet',
'events', 'fs', 'getmac', 'glob', 'graceful-fs', 'http', 'http-proxy-agent',
'https', 'https-proxy-agent', 'iconv-lite', 'ipc', 'menu', 'menu-item', 'net',
'original-fs', 'os', 'path', 'readline', 'remote', 'sax', 'screen', 'semver',
'shell', 'stream', 'string_decoder', 'url', 'vscode-textmate', 'web-frame', 'winreg',
'yauzl'
];
// Build
var vscodeEntryPoints = _.flatten([
buildfile.entrypoint('vs/workbench/workbench.main'),
buildfile.base,
buildfile.editor,
buildfile.languages,
buildfile.vscode
]);
var vscodeResources = [
'out-build/bootstrap.js',
'out-build/vs/**/*.{svg,png,cur}',
'out-build/vs/base/node/{stdForkStart.js,terminateProcess.sh}',
'out-build/vs/base/worker/workerMainCompatibility.html',
'out-build/vs/base/worker/workerMain.{js,js.map}',
'out-build/vs/editor/css/*.css',
'out-build/vs/languages/typescript/common/lib/lib.{d.ts,es6.d.ts}',
'out-build/vs/languages/markdown/common/*.css',
'out-build/vs/workbench/browser/media/*-theme.css',
'out-build/vs/workbench/browser/media/octicons/**',
'out-build/vs/workbench/electron-browser/index.html',
'out-build/vs/workbench/electron-main/bootstrap.js',
'out-build/vs/workbench/parts/debug/**/*.json',
'out-build/vs/workbench/parts/execution/**/*.scpt',
'out-build/vs/workbench/parts/git/**/*.html',
'out-build/vs/workbench/parts/git/**/*.sh',
'out-build/vs/workbench/parts/markdown/**/*.md',
'out-build/vs/workbench/parts/tasks/**/*.json',
'out-build/vs/workbench/services/files/**/*.exe',
'out-build/vs/workbench/services/files/**/*.md',
'!**/test/**'
];
var BUNDLED_FILE_HEADER = [
'/*!--------------------------------------------------------',
' * Copyright (C) Microsoft Corporation. All rights reserved.',
' *--------------------------------------------------------*/'
].join('\n');
gulp.task('clean-optimized-vscode', util.rimraf('out-vscode'));
gulp.task('optimize-vscode', ['clean-optimized-vscode', 'compile-build', 'compile-plugins'], common.optimizeTask({
entryPoints: vscodeEntryPoints,
otherSources: [],
resources: vscodeResources,
loaderConfig: common.loaderConfig(baseModules),
header: BUNDLED_FILE_HEADER,
out: 'out-vscode'
}));
gulp.task('clean-minified-vscode', util.rimraf('out-vscode-min'));
gulp.task('minify-vscode', ['clean-minified-vscode', 'optimize-vscode'], common.minifyTask('out-vscode', false));
// Package
var product = JSON.parse(fs.readFileSync(path.join(root, 'product.json'), 'utf8'));
var darwinCreditsTemplate = product.darwinCredits && _.template(fs.readFileSync(path.join(root, product.darwinCredits), 'utf8'));
var config = {
version: packagejson.electronVersion,
productAppName: product.nameLong,
companyName: product.companyName,
copyright: product.copyright,
darwinIcon: product.icons.application.icns,
darwinBundleIdentifier: product.darwinBundleIdentifier,
darwinApplicationCategoryType: product.darwinApplicationCategoryType, // Finder: View-->Arrange by Application Category
darwinBundleDocumentTypes: product.darwinBundleDocumentTypes,
darwinCredits: darwinCreditsTemplate ? new Buffer(darwinCreditsTemplate({ commit: commit, date: new Date().toISOString() })) : void 0,
winIcon: product.icons.application.ico,
win32ExeBasename: product.win32ExeBasename,
token: process.env['GITHUB_TOKEN'] || void 0
};
gulp.task('electron', function () {
// Force windows to use ia32
var arch = (process.platform === 'win32' ? 'ia32' : process.arch);
return electron.dest(path.join(path.dirname(root), 'Electron-Build'), _.extend({}, config, { arch: arch }));
});
function mixinProduct() {
var product;
var url = process.env['PRODUCT_JSON_URL'];
if (url) {
var opts = { base: '' };
var username = process.env['PRODUCT_JSON_USERNAME'];
var password = process.env['PRODUCT_JSON_PASSWORD'];
if (username || password) {
opts.auth = { username: username || '', password: password || '' };
}
product = remote(url, opts);
} else {
product = gulp.src(['product.json'], { base: '.' });
}
return product.pipe(json({
commit: commit,
date: new Date().toISOString()
}));
}
function packageTask(platform, arch, opts) {
opts = opts || {};
var destination = path.join(path.dirname(root), 'VSCode') + (platform ? '-' + platform : '') + (arch ? '-' + arch : '');
platform = platform || process.platform;
arch = platform === 'win32' ? 'ia32' : arch;
return function () {
var out = opts.minified ? 'out-vscode-min' : 'out-vscode';
var pluginHostFilter = filter(out + '/vs/workbench/node/pluginHostProcess.js', { restore: true });
var src = gulp.src(out + '/**', { base: '.' })
.pipe(pluginHostFilter)
.pipe(insert.append('\n//# sourceMappingURL=pluginHostProcess.js.map'))
.pipe(pluginHostFilter.restore)
.pipe(rename(function (path) { path.dirname = path.dirname.replace(new RegExp('^' + out), 'out'); }))
.pipe(util.setExecutableBit(['**/*.sh']));
var extensions = gulp.src([
'extensions/**',
'!extensions/*/src/**',
'!extensions/*/out/**/test/**',
'!extensions/typescript/bin/**',
'!extensions/csharp-o/node_modules/del/**',
'!extensions/csharp-o/node_modules/gulp/**',
'!extensions/csharp-o/node_modules/gulp-decompress/**',
'!extensions/csharp-o/node_modules/gulp-download/**',
'!extensions/csharp-o/node_modules/typescript/**'
], { base: '.' });
var pluginHostSourceMap = gulp.src(out + '/vs/workbench/node/pluginHostProcess.js.map', { base: '.' })
.pipe(rename(function (path) { path.dirname = path.dirname.replace(new RegExp('^' + out), 'out'); }));
var sources = es.merge(
es.merge(src, extensions).pipe(filter(['**', '!**/*.js.map'])),
pluginHostSourceMap
).pipe(util.handleAzureJson({ platform: platform }));
var packageJson = gulp.src(['package.json'], { base: '.' }).pipe(json({ name: product.nameShort }));
var license = gulp.src(['Credits_*', 'LICENSE.txt', 'ThirdPartyNotices.txt'], { base: '.' });
var api = gulp.src('src/vs/vscode.d.ts').pipe(rename('out/vs/vscode.d.ts'));
var depsSrc = _.flatten(Object.keys(packagejson.dependencies)
.map(function (d) { return ['node_modules/' + d + '/**', '!node_modules/' + d + '/**/{test,tests}/**']; }));
var deps = gulp.src(depsSrc, { base: '.', dot: true })
.pipe(util.cleanNodeModule('fsevents', ['binding.gyp', 'fsevents.cc', 'build/**', 'src/**', 'test/**'], true))
.pipe(util.cleanNodeModule('oniguruma', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], true));
var resources = gulp.src('resources/*', { base: '.' });
if (platform === 'win32') {
resources = es.merge(resources, gulp.src(product.icons.file.ico, { base: '.' }));
} else if (platform === 'linux') {
resources = es.merge(resources, gulp.src(product.icons.application.png, { base: '.' }));
}
var all = es.merge(
api,
packageJson,
mixinProduct(),
license,
sources,
deps,
resources
).pipe(util.skipDirectories());
var result = all
.pipe(util.fixWin32DirectoryPermissions())
.pipe(electron(_.extend({}, config, { platform: platform, arch: arch })))
.pipe(filter(['**', '!LICENSE', '!version']));
if (platform === 'win32') {
result = es.merge(result, gulp.src('resources/win32/bin/**', { base: 'resources/win32' }));
}
return result.pipe(opts.zip ? electron.zfsdest(destination + '.zip') : symdest(destination));
};
}
gulp.task('clean-vscode-win32', util.rimraf(path.join(path.dirname(root), 'VSCode-win32')));
gulp.task('clean-vscode-darwin', util.rimraf(path.join(path.dirname(root), 'VSCode-darwin')));
gulp.task('clean-vscode-linux-ia32', util.rimraf(path.join(path.dirname(root), 'VSCode-linux-ia32')));
gulp.task('clean-vscode-linux-x64', util.rimraf(path.join(path.dirname(root), 'VSCode-linux-x64')));
gulp.task('vscode-win32', ['optimize-vscode', 'clean-vscode-win32'], packageTask('win32'));
gulp.task('vscode-darwin', ['optimize-vscode', 'clean-vscode-darwin'], packageTask('darwin'));
gulp.task('vscode-linux-ia32', ['optimize-vscode', 'clean-vscode-linux-ia32'], packageTask('linux', 'ia32'));
gulp.task('vscode-linux-x64', ['optimize-vscode', 'clean-vscode-linux-x64'], packageTask('linux', 'x64'));
gulp.task('vscode-win32-min', ['minify-vscode', 'clean-vscode-win32'], packageTask('win32', null, { minified: true }));
gulp.task('vscode-darwin-min', ['minify-vscode', 'clean-vscode-darwin'], packageTask('darwin', null, { minified: true }));
gulp.task('vscode-linux-ia32-min', ['minify-vscode', 'clean-vscode-linux-ia32'], packageTask('linux', 'ia32', { minified: true }));
gulp.task('vscode-linux-x64-min', ['minify-vscode', 'clean-vscode-linux-x64'], packageTask('linux', 'x64', { minified: true }));
gulp.task('vscode-win32-zip', ['optimize-vscode'], packageTask('win32', null, { zip: true }));
gulp.task('vscode-darwin-zip', ['optimize-vscode'], packageTask('darwin', null, { zip: true }));
gulp.task('vscode-linux-ia32-zip', ['optimize-vscode'], packageTask('linux', 'ia32', { zip: true }));
gulp.task('vscode-linux-x64-zip', ['optimize-vscode'], packageTask('linux', 'x64', { zip: true }));
gulp.task('vscode-win32-zip-min', ['minify-vscode'], packageTask('win32', null, { zip: true, minified: true }));
gulp.task('vscode-darwin-zip-min', ['minify-vscode'], packageTask('darwin', null, { zip: true, minified: true }));
gulp.task('vscode-linux-zip-ia32-min', ['minify-vscode'], packageTask('linux', 'ia32', { zip: true, minified: true }));
gulp.task('vscode-linux-zip-x64-min', ['minify-vscode'], packageTask('linux', 'x64', { zip: true, minified: true }));
// Sourcemaps
gulp.task('vscode-sourcemaps', ['minify-vscode'], function () {
return gulp.src('out-vscode-min/**/*.map')
.pipe(azure.upload({
account: process.env.AZURE_STORAGE_ACCOUNT,
key: process.env.AZURE_STORAGE_ACCESS_KEY,
container: 'sourcemaps',
prefix: commit + '/'
}));
});

View file

@ -9,53 +9,13 @@ var copyright = [
' *--------------------------------------------------------------------------------------------*/'
].join('\n');
var ignoreList = [
'/src/vs/languages/typescript/common/lib/lib.d.ts',
'/src/vs/languages/typescript/common/lib/lib.es6.d.ts',
'/src/vs/languages/typescript/common/lib/typescriptServices.d.ts',
'/src/vs/workbench/parts/emmet/node/emmet.d.ts',
'/src/vs/editor/standalone-languages/swift.ts',
'/src/vs/workbench/browser/media/octicons/octicons.css',
'/src/vs/base/test/node/encoding/fixtures/some_utf16be.css',
'/src/vs/base/test/node/encoding/fixtures/some_utf16le.css',
'/src/vs/workbench/services/search/test/node/fixtures/site.css',
'/src/vs/workbench/services/search/test/node/fixtures/some_utf16be.css',
'/src/vs/workbench/services/search/test/node/fixtures/some_utf16le.css',
'/src/vs/workbench/services/files/test/node/fixtures/service/some_utf16le.css',
'/extensions/lib.core.d.ts',
'/extensions/node.d.ts',
'/extensions/csharp-o/src/typings/applicationinsights.d.ts',
'/extensions/typescript/out/lib/lib.core.d.ts',
'/extensions/typescript/out/lib/lib.core.es6.d.ts',
'/extensions/typescript/out/lib/lib.d.ts',
'/extensions/typescript/out/lib/lib.dom.d.ts',
'/extensions/typescript/out/lib/lib.es6.d.ts',
'/extensions/typescript/out/lib/lib.scriptHost.d.ts',
'/extensions/typescript/out/lib/lib.webworker.d.ts',
'/extensions/typescript/src/lib/lib.core.d.ts',
'/extensions/typescript/src/lib/lib.core.es6.d.ts',
'/extensions/typescript/src/lib/lib.d.ts',
'/extensions/typescript/src/lib/lib.dom.d.ts',
'/extensions/typescript/src/lib/lib.es6.d.ts',
'/extensions/typescript/src/lib/lib.scriptHost.d.ts',
'/extensions/typescript/src/lib/lib.webworker.d.ts',
'/extensions/csharp-o/src/typings/semver/semver.d.ts'
];
function ignore(filePath) {
filePath = path.posix.normalize(filePath);
return ignoreList.some(function(p) {
return filePath.indexOf(p) !== -1;
});
}
exports.copyrights = function () {
return es.mapSync(function (file) {
if (file.contents) {
var contents = file.contents.toString('utf8');
if (contents.indexOf(copyright) !== 0 && !ignore(file.path)) {
if (contents.indexOf(copyright) !== 0) {
throw new Error('File ' + file.path + ' does not contain copyright statement.');
}
}
@ -67,7 +27,7 @@ exports.insertCopyrights = function() {
if (file.contents) {
var contents = file.contents.toString('utf8');
if (contents.indexOf(copyright) !== 0 && !ignore(file.path)) {
if (contents.indexOf(copyright) !== 0) {
contents = copyright + '\n\n' + contents;
fs.writeFileSync(file.path, contents, 'utf8');
}

View file

@ -6,13 +6,13 @@
"contributes": {
"languages": [{
"id": "c",
"extensions": [ ".c", ".h" ],
"extensions": [ ".c" ],
"aliases": [ "C", "c" ],
"configuration": "./cpp.configuration.json"
},
{
"id": "cpp",
"extensions": [ ".cpp", ".cc", ".cxx", ".hpp", ".hh", ".hxx" ],
"extensions": [ ".cpp", ".cc", ".cxx", ".hpp", ".hh", ".hxx", ".h" ],
"aliases": [ "C++", "Cpp", "cpp"],
"configuration": "./cpp.configuration.json"
}],

13
extensions/csharp-o/typings/mocha.d.ts vendored Normal file
View file

@ -0,0 +1,13 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare function run(): void;
declare function suite(name: string, fn: (err?)=>void);
declare function test(name: string, fn: (done?: (err?)=>void)=>void);
declare function suiteSetup(fn: (done?: (err?)=>void)=>void);
declare function suiteTeardown(fn: (done?: (err?)=>void)=>void);
declare function setup(fn: (done?: (err?)=>void)=>void);
declare function teardown(fn: (done?: (err?)=>void)=>void);

View file

@ -2,10 +2,9 @@
"transition property": {
"prefix": "transition",
"body": [
"transition: ${property} ${duration} ${timing-function} ${delay};",
"-webkit-transition: ${property} ${duration} ${timing-function} ${delay};",
"-o-transition: ${property} ${duration} ${timing-function} ${delay};",
"-moz-transition: ${property} ${duration} ${timing-function} ${delay};"
"-moz-transition: ${property} ${duration} ${timing-function} ${delay};",
"transition: ${property} ${duration} ${timing-function} ${delay};"
],
"description": "The transition property across browsers"
},

View file

@ -708,7 +708,7 @@
<array>
<dict>
<key>match</key>
<string>\b(a|abbr|acronym|address|area|article|aside|audio|b|base|big|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|datalist|dd|del|details|dfn|dialog|div|dl|dt|em|eventsource|fieldset|figure|figcaption|footer|form|frame|frameset|(h[1-6])|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|label|legend|li|link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|samp|script|section|select|small|span|strike|strong|style|sub|summary|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video)\b</string>
<string>\b(a|abbr|address|area|article|aside|audio|b|base|bdi|bdo|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|data|datalist|dd|del|details|dfn|dialog|div|dl|dt|em|embed|fieldset|figcaption|figure|footer|form|(h[1-6])|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|label|legend|li|link|main|map|mark|menu|menuitem|meta|meter|nav|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rb|rp|rt|rtc|ruby|s|samp|script|section|select|small|source|span|strong|style|sub|summary|sup|svg|table|tbody|td|template|textarea|tfoot|th|thead|time|title|tr|track|u|ul|var|video|wbr)\b</string>
<key>name</key>
<string>entity.name.tag.css</string>
</dict>

View file

@ -639,7 +639,7 @@
<key>match</key>
<string>(?&lt;!\w)([\p{L}\p{Nl}$_][\p{L}\p{Nl}$\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*)(?=\()</string>
<key>name</key>
<string>meta.function.js</string>
<string>meta.function-call.js</string>
</dict>
</array>
<key>repository</key>

View file

@ -1,6 +1,6 @@
{
"account": "monacobuild",
"container": "debuggers",
"zip": "ad2bb1d/node-debug.zip",
"zip": "a7f6203/node-debug.zip",
"output": ""
}

13
extensions/php/typings/mocha.d.ts vendored Normal file
View file

@ -0,0 +1,13 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare function run(): void;
declare function suite(name: string, fn: (err?)=>void);
declare function test(name: string, fn: (done?: (err?)=>void)=>void);
declare function suiteSetup(fn: (done?: (err?)=>void)=>void);
declare function suiteTeardown(fn: (done?: (err?)=>void)=>void);
declare function setup(fn: (done?: (err?)=>void)=>void);
declare function teardown(fn: (done?: (err?)=>void)=>void);

View file

@ -522,7 +522,7 @@
<key>function</key>
<dict>
<key>begin</key>
<string>((?i:function|filter|configuration|workflow))\s+((?:\p{L}|\d|_|-|\.)+)</string>
<string>(?&lt;!\S)(?i)(function|filter|configuration|workflow)\s+(?:(global|local|script|private):)?((?:\p{L}|\d|_|-|\.)+)</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
@ -538,7 +538,12 @@
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.function</string>
<string>storage.modifier.scope.powershell</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>entity.name.function.powershell</string>
</dict>
</dict>
<key>end</key>
@ -1178,4 +1183,4 @@
<key>uuid</key>
<string>f8f5ffb0-503e-11df-9879-0800200c9a66</string>
</dict>
</plist>
</plist>

View file

@ -1,7 +1,8 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { workspace, TextDocument, TextDocumentChangeEvent, TextDocumentContentChangeEvent, Disposable } from 'vscode';

View file

@ -1,7 +1,8 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { CompletionItem, TextDocument, Position, CompletionItemKind, CompletionItemProvider, CancellationToken } from 'vscode';

View file

@ -1,7 +1,8 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { workspace } from 'vscode';

View file

@ -1,7 +1,8 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { workspace, DefinitionProvider, TextDocument, Position, Range, CancellationToken, Location } from 'vscode';

View file

@ -1,7 +1,8 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { workspace, DocumentHighlightProvider, DocumentHighlight, DocumentHighlightKind, TextDocument, Position, Range, CancellationToken } from 'vscode';

View file

@ -1,7 +1,8 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { workspace, DocumentSymbolProvider, SymbolInformation, SymbolKind, TextDocument, Position, Range, CancellationToken } from 'vscode';

View file

@ -1,7 +1,8 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { workspace, DocumentRangeFormattingEditProvider, OnTypeFormattingEditProvider, FormattingOptions, TextDocument, Position, Range, CancellationToken, TextEdit } from 'vscode';

View file

@ -1,7 +1,8 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { workspace, HoverProvider, Hover, TextDocument, Position, Range, CancellationToken } from 'vscode';

View file

@ -1,7 +1,7 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';

View file

@ -1,7 +1,8 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { workspace, ReferenceProvider, Location, TextDocument, Position, Range, CancellationToken } from 'vscode';

View file

@ -1,7 +1,8 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { workspace, RenameProvider, WorkspaceEdit, TextDocument, Position, Range, CancellationToken } from 'vscode';

View file

@ -1,7 +1,8 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { workspace, SignatureHelpProvider, SignatureHelp, SignatureInformation, ParameterInformation, TextDocument, Position, CancellationToken } from 'vscode';

View file

@ -1,7 +1,8 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { workspace, Uri, WorkspaceSymbolProvider, SymbolInformation, SymbolKind, TextDocument, Position, Range, CancellationToken } from 'vscode';

View file

@ -1,7 +1,8 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
export class Kind {

View file

@ -3,6 +3,7 @@
"noLib": true,
"target": "ES5",
"module": "commonjs",
"sourceMap": true,
"outDir": "../out"
},
"exclude": [

View file

@ -1,7 +1,7 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* --------------------------------------------------------------------------------------------
* Includes code from typescript-sublime-plugin project, obtained from

View file

@ -1,7 +1,8 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { CancellationToken, Uri } from 'vscode';

View file

@ -1,7 +1,8 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as cp from 'child_process';

View file

@ -1,7 +1,8 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
export interface ITask<T> {

View file

@ -1,7 +1,8 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import path = require('path');

View file

@ -1,7 +1,8 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var net = require('net'),
fs = require('fs'),
stream = require('stream'),

View file

@ -1,7 +1,8 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
const toString = Object.prototype.toString;

View file

@ -1,7 +1,8 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import stream = require('stream');

View file

@ -0,0 +1,13 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare function run(): void;
declare function suite(name: string, fn: (err?)=>void);
declare function test(name: string, fn: (done?: (err?)=>void)=>void);
declare function suiteSetup(fn: (done?: (err?)=>void)=>void);
declare function suiteTeardown(fn: (done?: (err?)=>void)=>void);
declare function setup(fn: (done?: (err?)=>void)=>void);
declare function teardown(fn: (done?: (err?)=>void)=>void);

View file

@ -1,3 +1,8 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
function farboo() {
return 42;
}

View file

@ -0,0 +1,13 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare function run(): void;
declare function suite(name: string, fn: (err?)=>void);
declare function test(name: string, fn: (done?: (err?)=>void)=>void);
declare function suiteSetup(fn: (done?: (err?)=>void)=>void);
declare function suiteTeardown(fn: (done?: (err?)=>void)=>void);
declare function setup(fn: (done?: (err?)=>void)=>void);
declare function teardown(fn: (done?: (err?)=>void)=>void);

View file

@ -163,12 +163,21 @@ gulp.task('fix-whitespace-style', function() {
return gulp.src(WHITESPACE_FILES, { base: '.' }).pipe(style({whitespace:true})).pipe(gulp.dest('.'));
});
var COPYRIGHTS_FILES = WHITESPACE_FILES.concat([
'!**/*.json',
'!**/*.html',
'!**/test/**',
'!**/*.md',
'!**/*.sh',
'!**/*.txt',
'!src/vs/editor/standalone-languages/swift.ts',
]);
gulp.task('copyrights', function() {
return gulp.src(['src/vs/**/*.ts', 'src/vs/**/*.css', 'extensions/**/*.ts', 'extensions/**/*.css']).pipe(copyrights.copyrights());
return gulp.src(COPYRIGHTS_FILES, { base: '.' }).pipe(copyrights.copyrights());
});
gulp.task('insert-copyrights', function() {
return gulp.src(['src/vs/**/*.ts', 'src/vs/**/*.css', 'extensions/**/*.ts', 'extensions/**/*.css']).pipe(copyrights.insertCopyrights());
return gulp.src(COPYRIGHTS_FILES, { base: '.' }).pipe(copyrights.insertCopyrights());
});
gulp.task('test', function () {

View file

@ -15,7 +15,7 @@ export function tail<T>(array: T[], n: number = 0): T {
/**
* Iterates the provided array and allows to remove
* element while iterating.
* elements while iterating.
*/
export function forEach<T>(array: T[], callback: (element: T, remove: Function) => void): void {
for (var i = 0, len = array.length; i < len; i++) {
@ -76,7 +76,7 @@ export function binarySearch(array: any[], key: any, comparator: (op1: any, op2:
/**
* Takes a sorted array and a function p. The array is sorted in such a way that all elements where p(x) is false
* are located before all elements where p(x) is true.
* Returns the least x for which p(x) is true or array.length if no element fullfills the given function
* @returns the least x for which p(x) is true or array.length if no element fullfills the given function.
*/
export function findFirst<T>(array: T[], p: (x: T) => boolean): number {
var low = 0, high = array.length;
@ -118,7 +118,7 @@ export function merge<T>(arrays: T[][], hashFn?: (element: T) => string): T[] {
}
/**
* Returns a new array with all undefined or null values removed. The original array is not modified at all.
* @returns a new array with all undefined or null values removed. The original array is not modified at all.
*/
export function coalesce<T>(array: T[]): T[] {
if (!array) {
@ -129,7 +129,7 @@ export function coalesce<T>(array: T[]): T[] {
}
/**
* Returns true if the given item is contained in the array
* @returns true if the given item is contained in the array.
*/
export function contains<T>(array: T[], item: T): boolean {
return array.indexOf(item) >= 0;
@ -154,7 +154,7 @@ export function move(array: any[], from: number, to: number): void {
}
/**
* @returns false if the provided object is an array
* @returns {{false}} if the provided object is an array
* and not empty.
*/
export function isFalsyOrEmpty(obj: any): boolean {

View file

@ -477,7 +477,7 @@ export class RunOnceScheduler {
}
/**
* Cancel current scheduled runner (if any)
* Cancel current scheduled runner (if any).
*/
public cancel(): void {
if (this.timeoutToken !== -1) {

View file

@ -35,7 +35,7 @@ export function createNumberDictionary<V>():INumberDictionary<V> {
* @param what The key.
* @param from A native JavaScript object that stores items.
* @param alternate A default value this is return in case an item with
* the key isn't found
* the key isn't found.
*/
export function lookup<T>(from:IStringDictionary<T>, what:string, alternate?:T):T;
export function lookup<T>(from:INumberDictionary<T>, what:number, alternate?:T):T;

View file

@ -22,7 +22,7 @@ export interface ErrorListenerUnbind {
(): void;
}
// avoid circular dependency on EventEmitter by implementing a subset of the interface
// Avoid circular dependency on EventEmitter by implementing a subset of the interface.
export class ErrorHandler {
private unexpectedErrorHandler: (e: any) => void;
private listeners: ErrorListenerCallback[];
@ -255,6 +255,7 @@ function _exceptionToErrorMessage(exception: any, verbose: boolean): string {
/**
* Tries to generate a human readable error message out of the error. If the verbose parameter
* is set to true, the error message will include stacktrace details if provided.
* @returns A string containing the error message.
*/
export function toErrorMessage(error: any = null, verbose: boolean = false): string {
if (!error) {

View file

@ -19,7 +19,7 @@ export interface IMatch {
// Combined filters
/**
* Returns a filter which combines the provided set
* @returns A filter which combines the provided set
* of filters with an or. The *first* filters that
* matches defined the return value of the returned
* filter.
@ -37,7 +37,7 @@ export function or(...filter:IFilter[]):IFilter {
}
/**
* Returns a filter which combines the provided set
* @returns A filter which combines the provided set
* of filters with an and. The combines matches are
* returned if *all* filters match.
*/

View file

@ -11,11 +11,11 @@ import Platform = require('vs/base/common/platform');
/**
* Virtual Key Codes, the value does not hold any inherent meaning.
* Inspired somewhat from https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx
* But these are "more general", as they should work across browsers & OS`s
* But these are "more general", as they should work across browsers & OS`s.
*/
export enum KeyCode {
/**
* Placed first to cover the 0 value of the enum
* Placed first to cover the 0 value of the enum.
*/
Unknown,

View file

@ -289,7 +289,7 @@ export class URL extends URI implements objects.IEqualable {
/**
* Creates a new URL from the provided value
* by decoding it first.
* @param value A encoded url value.
* @param value An encoded url value.
*/
public static fromEncoded(value:string):URL {
return new URL(decodeURIComponent(value));
@ -354,7 +354,7 @@ export class URL extends URI implements objects.IEqualable {
}
/**
* Strip out the hash part of the URL
* Strips out the hash part of the URL.
* http://www.test.com:8000/this/that/theother.html?query=foo for http://www.test.com:8000/this/that/theother.html?query=foo#hash
*/
public toUnique():string {

View file

@ -9,7 +9,7 @@ import * as Types from 'vs/base/common/types';
/**
* Equalable objects can compute a
* hash-code and can also tell if they
* are equal to other objects
* are equal to other objects.
*/
export interface IEqualable {
hashCode(): number;

View file

@ -97,7 +97,7 @@ export function dirnames(path: string): { next: () => { done: boolean; value: st
}
/**
* Returns the directory name of a path.
* @returns the directory name of a path.
*/
export function dirname(path: string): string {
var idx = ~path.lastIndexOf('/') || ~path.lastIndexOf('\\');
@ -111,7 +111,7 @@ export function dirname(path: string): string {
}
/**
* Returns the base name of a path.
* @returns the base name of a path.
*/
export function basename(path: string): string {
var idx = ~path.lastIndexOf('/') || ~path.lastIndexOf('\\');
@ -125,7 +125,7 @@ export function basename(path: string): string {
}
/**
* Returns {{.far}} from boo.far or the empty string.
* @returns {{.far}} from boo.far or the empty string.
*/
export function extname(path: string): string {
path = basename(path);

View file

@ -15,7 +15,7 @@ import { ValidationStatus, ValidationState, ILogger, Parser, ISystemVariables }
/**
* Options to be passed to the external program or shell
* Options to be passed to the external program or shell.
*/
export interface CommandOptions {
/**
@ -33,25 +33,25 @@ export interface CommandOptions {
export interface Executable {
/**
* The command to be executed. Can be an external program or a shell
* command.
*/
* The command to be executed. Can be an external program or a shell
* command.
*/
command: string;
/**
* Specifies whether the command is a shell command and therefore must
* be executed in a shell interpreter (e.g. cmd.exe, bash, ...).
*/
* Specifies whether the command is a shell command and therefore must
* be executed in a shell interpreter (e.g. cmd.exe, bash, ...).
*/
isShellCommand: boolean;
/**
* The arguments passed to the command.
*/
* The arguments passed to the command.
*/
args: string[];
/**
* The command options used when the command is executed. Can be omitted.
*/
* The command options used when the command is executed. Can be omitted.
*/
options?: CommandOptions;
}
@ -90,68 +90,68 @@ export interface TerminateResponse {
export namespace Config {
/**
* Options to be passed to the external program or shell
*/
* Options to be passed to the external program or shell
*/
export interface CommandOptions {
/**
* The current working directory of the executed program or shell.
* If omitted VSCode's current workspace root is used.
*/
* The current working directory of the executed program or shell.
* If omitted VSCode's current workspace root is used.
*/
cwd?: string;
/**
* The additional environment of the executed program or shell. If omitted
* the parent process' environment is used.
*/
* The additional environment of the executed program or shell. If omitted
* the parent process' environment is used.
*/
env?: IStringDictionary<string>;
/**
* Index signature
*/
* Index signature
*/
[key:string]: string | string[] | IStringDictionary<string>;
}
export interface BaseExecutable {
/**
* The command to be executed. Can be an external program or a shell
* command.
*/
* The command to be executed. Can be an external program or a shell
* command.
*/
command?: string;
/**
* Specifies whether the command is a shell command and therefore must
* be executed in a shell interpreter (e.g. cmd.exe, bash, ...).
*
* Defaults to false if omitted.
*/
* Specifies whether the command is a shell command and therefore must
* be executed in a shell interpreter (e.g. cmd.exe, bash, ...).
*
* Defaults to false if omitted.
*/
isShellCommand?: boolean;
/**
* The arguments passed to the command. Can be omitted.
*/
* The arguments passed to the command. Can be omitted.
*/
args?: string[];
/**
* The command options used when the command is executed. Can be omitted.
*/
* The command options used when the command is executed. Can be omitted.
*/
options?: CommandOptions;
}
export interface Executable extends BaseExecutable {
/**
* Windows specific executable configuration
*/
* Windows specific executable configuration
*/
windows?: BaseExecutable;
/**
* Mac specific executable configuration
*/
* Mac specific executable configuration
*/
osx?: BaseExecutable;
/**
* Linux specific executable configuration
*/
* Linux specific executable configuration
*/
linux?: BaseExecutable;
}

View file

@ -12,7 +12,7 @@ import nls = require('vs/nls');
export var empty = '';
/**
* Returns the provided number with the given number of preceding zeros.
* @returns the provided number with the given number of preceding zeros.
*/
export function pad(n: number, l: number, char: string = '0'): string {
var str = '' + n;
@ -262,9 +262,14 @@ export function createRegExp(searchString: string, isRegex: boolean, matchCase:
}
export function regExpLeadsToEndlessLoop(regexp: RegExp): boolean {
// Exit early if it's one of these special cases which are meant to match
// against an empty string
if (regexp.source === "^" || regexp.source === "^$" || regexp.source === "$") {
return false;
}
// We check against an empty string. If the regular expression doesn't advance
// (e.g. ends in an endless loop) it will match an empty string.
var match = regexp.exec('');
return (match && <any>regexp.lastIndex === 0);
}
@ -273,7 +278,7 @@ export function regExpLeadsToEndlessLoop(regexp: RegExp): boolean {
* The normalize() method returns the Unicode Normalization Form of a given string. The form will be
* the Normalization Form Canonical Composition.
*
* See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize}
*/
export var canNormalize = typeof ((<any>'').normalize) === 'function';
export function normalizeNFC(str: string, cache?:{[str: string]: string}): string {
@ -435,7 +440,7 @@ export function equalsIgnoreCase(a: string, b: string): boolean {
}
/**
* Returns the length of the common prefix of the two strings.
* @returns the length of the common prefix of the two strings.
*/
export function commonPrefixLength(a: string, b: string): number {
@ -452,7 +457,7 @@ export function commonPrefixLength(a: string, b: string): number {
}
/**
* Returns the length of the common suffix of the two strings.
* @returns the length of the common suffix of the two strings.
*/
export function commonSuffixLength(a: string, b: string): number {
@ -599,4 +604,4 @@ export var UTF8_BOM_CHARACTER = String.fromCharCode(__utf8_bom);
export function startsWithUTF8BOM(str: string): boolean {
return (str && str.length > 0 && str.charCodeAt(0) === __utf8_bom);
}
}

View file

@ -7,7 +7,7 @@
import {TPromise} from 'vs/base/common/winjs.base';
/**
* Returns whether the provided parameter is a JavaScript Array or not.
* @returns whether the provided parameter is a JavaScript Array or not.
*/
export function isArray(array: any): array is any[] {
if (Array.isArray) {
@ -22,7 +22,7 @@ export function isArray(array: any): array is any[] {
}
/**
* Returns whether the provided parameter is a JavaScript String or not.
* @returns whether the provided parameter is a JavaScript String or not.
*/
export function isString(str: any): str is string {
if (typeof (str) === 'string' || str instanceof String) {
@ -33,15 +33,14 @@ export function isString(str: any): str is string {
}
/**
* Returns whether the provided parameter is a JavaScript Array and each element in the
* array is a string.
* @returns whether the provided parameter is a JavaScript Array and each element in the array is a string.
*/
export function isStringArray(value: any): value is string[] {
return isArray(value) && (<any[]>value).every(elem => isString(elem));
}
/**
* Returns whether the provided parameter is a JavaScript Object or not.
* @returns whether the provided parameter is a JavaScript Object or not.
*/
export function isObject(obj: any): obj is any {
@ -54,7 +53,7 @@ export function isObject(obj: any): obj is any {
}
/**
* Returns whether the provided parameter is a JavaScript Number or not.
* @returns whether the provided parameter is a JavaScript Number or not.
*/
export function isNumber(obj: any): obj is number {
if ((typeof (obj) === 'number' || obj instanceof Number) && !isNaN(obj)) {
@ -65,21 +64,21 @@ export function isNumber(obj: any): obj is number {
}
/**
* Returns whether the provided parameter is a JavaScript Boolean or not.
* @returns whether the provided parameter is a JavaScript Boolean or not.
*/
export function isBoolean(obj: any): obj is boolean {
return obj === true || obj === false;
}
/**
* Returns whether the provided parameter is undefined.
* @returns whether the provided parameter is undefined.
*/
export function isUndefined(obj: any): boolean {
return typeof (obj) === 'undefined';
}
/**
* Returns whether the provided parameter is undefined or null.
* @returns whether the provided parameter is undefined or null.
*/
export function isUndefinedOrNull(obj: any): boolean {
return isUndefined(obj) || obj === null;
@ -89,7 +88,7 @@ export function isUndefinedOrNull(obj: any): boolean {
var hasOwnProperty = Object.prototype.hasOwnProperty;
/**
* Returns whether the provided parameter is an empty JavaScript Object or not.
* @returns whether the provided parameter is an empty JavaScript Object or not.
*/
export function isEmptyObject(obj: any): obj is any {
if (!isObject(obj)) {
@ -106,14 +105,14 @@ export function isEmptyObject(obj: any): obj is any {
}
/**
* Returns whether the provided parameter is a JavaScript Function or not.
* @returns whether the provided parameter is a JavaScript Function or not.
*/
export function isFunction(obj: any): obj is Function {
return Object.prototype.toString.call(obj) === '[object Function]';
}
/**
* Returns whether the provided parameters is are JavaScript Function or not.
* @returns whether the provided parameters is are JavaScript Function or not.
*/
export function areFunctions(...objects: any[]): boolean {
return objects && objects.length > 0 && objects.every((object) => isFunction(object));

View file

@ -18,7 +18,7 @@ function fixedEncodeURIComponent(str: string): string {
* (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation
* and encoding.
*
* foo://example.com:8042/over/there?name=ferret#nose
* foo://example.com:8042/over/there?name=ferret#nose
* \_/ \______________/\_________/ \_________/ \__/
* | | | | |
* scheme authority path query fragment

View file

@ -10,8 +10,7 @@
export interface UUID {
/**
* Returns the canonical representation in sets of
* hexadecimal numbers separated by dashes.
* @returns the canonical representation in sets of hexadecimal numbers separated by dashes.
*/
asHex():string;

View file

@ -10,9 +10,12 @@ import extfs = require('vs/base/node/extfs');
import paths = require('vs/base/common/paths');
import { dirname, join } from 'path';
import { nfcall } from 'vs/base/common/async';
import fs = require('fs');
export function isRoot(path: string): boolean {
return path === dirname(path);
}
export function readdir(path: string): TPromise<string[]> {
return nfcall(extfs.readdir, path);
}
@ -38,6 +41,10 @@ export function mkdirp(path: string, mode?: number): TPromise<boolean> {
return TPromise.wrapError<boolean>(err);
});
if (isRoot(path)) {
return TPromise.as(true);
}
return mkdir().then(null, (err: NodeJS.ErrnoException) => {
if (err.code === 'ENOENT') {
return mkdirp(dirname(path), mode).then(mkdir);

View file

@ -1,3 +1,8 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var net = require('net'),
fs = require('fs'),
stream = require('stream'),

View file

@ -979,10 +979,17 @@ export class TextModel extends OrderGuaranteeEventEmitter implements EditorCommo
private _findMatchesInLine(searchRegex:RegExp, text:string, lineNumber:number, deltaOffset:number, counter:number, result:EditorCommon.IEditorRange[], limitResultCount:number): number {
var m:RegExpExecArray;
// Reset regex to search from the beginning
searchRegex.lastIndex = 0;
do {
m = searchRegex.exec(text);
if (m) {
result.push(new Range(lineNumber, m.index + 1 + deltaOffset, lineNumber, m.index + 1 + m[0].length + deltaOffset));
var range = new Range(lineNumber, m.index + 1 + deltaOffset, lineNumber, m.index + 1 + m[0].length + deltaOffset);
// Exit early if the regex matches the same range
if (range.equalsRange(result[result.length - 1])) {
return counter;
}
result.push(range);
counter++;
if (counter >= limitResultCount) {
return counter;
@ -991,4 +998,4 @@ export class TextModel extends OrderGuaranteeEventEmitter implements EditorCommo
} while(m);
return counter;
}
}
}

View file

@ -187,13 +187,17 @@ export class ModeServiceImpl implements IModeService {
if (this._activationPromises.hasOwnProperty(modeId)) {
return this._activationPromises[modeId];
}
this._activationPromises[modeId] = this._createMode(modeId).then((mode) => {
var c, e;
var promise = new TPromise((cc,ee,pp) => { c = cc; e = ee; });
this._activationPromises[modeId] = promise;
this._createMode(modeId).then((mode) => {
this._instantiatedModes[modeId] = mode;
delete this._activationPromises[modeId];
return this._instantiatedModes[modeId];
});
return this._activationPromises[modeId];
}).then(c, e);
return promise;
}
protected _createMode(modeId:string): TPromise<Modes.IMode> {

View file

@ -9,7 +9,7 @@ import {EditorBrowserRegistry} from 'vs/editor/browser/editorBrowserExtensions';
import {CommonEditorRegistry, ContextKey, EditorActionDescriptor} from 'vs/editor/common/editorCommonExtensions';
import {EditorAction, Behaviour} from 'vs/editor/common/editorAction';
import FindWidget = require('./findWidget');
import FindModel = require('./findModel');
import FindModel = require('vs/editor/contrib/find/common/findModel');
import nls = require('vs/nls');
import EventEmitter = require('vs/base/common/eventEmitter');
import EditorBrowser = require('vs/editor/browser/editorBrowser');

View file

@ -16,7 +16,7 @@ import InputBox = require('vs/base/browser/ui/inputbox/inputBox');
import Findinput = require('vs/base/browser/ui/findinput/findInput');
import EditorBrowser = require('vs/editor/browser/editorBrowser');
import EditorCommon = require('vs/editor/common/editorCommon');
import FindModel = require('./findModel');
import FindModel = require('vs/editor/contrib/find/common/findModel');
import Lifecycle = require('vs/base/common/lifecycle');
import {CommonKeybindings} from 'vs/base/common/keyCodes';

View file

@ -214,7 +214,7 @@ export class FindModelBoundToEditorModel extends Events.EventEmitter implements
this.findScopeDecorationId = decorations[0];
}
this.addMatchesDecorations(changeAccessor, this.editor.getModel().findMatches(this.searchString, this._getSearchRange(), this.isRegex, this.matchCase, this.wholeWord));
this.addMatchesDecorations(changeAccessor, this._findMatches());
});
this.highlightedDecorationId = null;
@ -326,7 +326,6 @@ export class FindModelBoundToEditorModel extends Events.EventEmitter implements
}
}
private setSelectionToDecoration(decorationId:string): void {
this.editor.changeDecorations((changeAccessor: EditorCommon.IModelDecorationsChangeAccessor) => {
if (this.highlightedDecorationId !== null) {
@ -346,8 +345,10 @@ export class FindModelBoundToEditorModel extends Events.EventEmitter implements
if (!this.isRegex) {
return this.replaceString;
}
var regexp = Strings.createRegExp(this.searchString, this.isRegex, this.matchCase, this.wholeWord);
return matchedString.replace(regexp, this.replaceString);
let regexp = Strings.createRegExp(this.searchString, this.isRegex, this.matchCase, this.wholeWord);
// Parse the replace string to support that \t or \n mean the right thing
let parsedReplaceString = parseReplaceString(this.replaceString);
return matchedString.replace(regexp, parsedReplaceString);
}
public replace(): void {
@ -379,6 +380,10 @@ export class FindModelBoundToEditorModel extends Events.EventEmitter implements
}
}
private _findMatches(limitResultCount?:number): EditorCommon.IEditorRange[] {
return this.editor.getModel().findMatches(this.searchString, this._getSearchRange(), this.isRegex, this.matchCase, this.wholeWord, limitResultCount);
}
public replaceAll(): void {
if (this.decorations.length === 0) {
return;
@ -387,7 +392,7 @@ export class FindModelBoundToEditorModel extends Events.EventEmitter implements
let model = this.editor.getModel();
// Get all the ranges (even more than the highlighted ones)
let ranges = this.editor.getModel().findMatches(this.searchString, this._getSearchRange(), this.isRegex, this.matchCase, this.wholeWord, Number.MAX_VALUE);
let ranges = this._findMatches(Number.MAX_VALUE);
// Remove all decorations
this.editor.changeDecorations((changeAccessor:EditorCommon.IModelDecorationsChangeAccessor) => {
@ -474,3 +479,64 @@ export class FindModelBoundToEditorModel extends Events.EventEmitter implements
}
const BACKSLASH_CHAR_CODE = '\\'.charCodeAt(0);
const n_CHAR_CODE = 'n'.charCodeAt(0);
const t_CHAR_CODE = 't'.charCodeAt(0);
/**
* \n => LF
* \t => TAB
* \\ => \
* everything else stays untouched
*/
export function parseReplaceString(input:string): string {
if (!input || input.length === 0) {
return input;
}
let substrFrom = 0, result = '';
for (let i = 0, len = input.length; i < len; i++) {
let chCode = input.charCodeAt(i);
if (chCode === BACKSLASH_CHAR_CODE) {
// move to next char
i++;
if (i >= len) {
// string ends with a \
break;
}
let nextChCode = input.charCodeAt(i);
let replaceWithCharacter: string = null;
switch (nextChCode) {
case BACKSLASH_CHAR_CODE:
// \\ => \
replaceWithCharacter = '\\';
break;
case n_CHAR_CODE:
// \n => LF
replaceWithCharacter = '\n';
break;
case t_CHAR_CODE:
// \t => TAB
replaceWithCharacter = '\t';
break;
}
if (replaceWithCharacter) {
result += input.substring(substrFrom, i - 1) + replaceWithCharacter;
substrFrom = i + 1;
}
}
}
if (substrFrom === 0) {
// no replacement occured
return input;
}
return result + input.substring(substrFrom);
}

View file

@ -0,0 +1,48 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import assert = require('assert');
import {FindModelBoundToEditorModel, parseReplaceString} from 'vs/editor/contrib/find/common/findModel';
suite('FindModel', () => {
test('parseFindWidgetString', () => {
let testParse = (input:string, expected:string) => {
let actual = parseReplaceString(input);
assert.equal(actual, expected);
let actual2 = parseReplaceString('hello' + input + 'hi');
assert.equal(actual2, 'hello' + expected + 'hi');
};
// no backslash => no treatment
testParse('hello', 'hello');
// \t => TAB
testParse('\\thello', '\thello');
// \n => LF
testParse('\\nhello', '\nhello');
// \\t => \t
testParse('\\\\thello', '\\thello');
// \\\t => \TAB
testParse('\\\\\\thello', '\\\thello');
// \\\\t => \\t
testParse('\\\\\\\\thello', '\\\\thello');
// \ at the end => no treatment
testParse('hello\\', 'hello\\');
// \ with unknown char => no treatment
testParse('hello\\x', 'hello\\x');
// \ with back reference => no treatment
testParse('hello\\0', 'hello\\0');
});
});

View file

@ -603,5 +603,57 @@ suite('Editor Model - Find', () => {
rangeEqual(matches[i], ranges[i][0], ranges[i][1], ranges[i][2], ranges[i][3]);
}
});
});
test('/^/ find', () => {
var ranges = [
[1, 1, 1, 1],
[2, 1, 2, 1],
[3, 1, 3, 1],
[4, 1, 4, 1],
[5, 1, 5, 1]
];
var matches = thisModel.findMatches('^', false, true, false, false);
assert.equal(matches.length, ranges.length);
for (var i = 0; i < matches.length; i++) {
rangeEqual(matches[i], ranges[i][0], ranges[i][1], ranges[i][2], ranges[i][3]);
}
});
test('/$/ find', () => {
var ranges = [
[1, 74, 1, 74],
[2, 69, 2, 69],
[3, 54, 3, 54],
[4, 65, 4, 65],
[5, 31, 5, 31]
];
var matches = thisModel.findMatches('$', false, true, false, false);
assert.equal(matches.length, ranges.length);
for (var i = 0; i < matches.length; i++) {
rangeEqual(matches[i], ranges[i][0], ranges[i][1], ranges[i][2], ranges[i][3]);
}
});
test('/^$/ find', () => {
var text = [
'This is some foo - bar text which contains foo and bar - as in Barcelona.',
'',
'And here\'s a dull line with nothing interesting in it',
'',
'Again nothing interesting here'
];
var model = new Model.Model(text.join('\n'), null);
var ranges = [
[2, 1, 2, 1],
[4, 1, 4, 1]
];
var matches = model.findMatches('^$', false, true, false, false);
assert.equal(matches.length, ranges.length);
for (var i = 0; i < matches.length; i++) {
rangeEqual(matches[i], ranges[i][0], ranges[i][1], ranges[i][2], ranges[i][3]);
}
model.dispose();
});
});

View file

@ -1,8 +1,10 @@
/*---------------------------------------------------------
* Copyright (C) Microsoft Corporation. All rights reserved.
*---------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// file generated from css-schema.xml using css-exclude_generate_browserjs.js
define(["require", "exports"], function(require, exports) {
define(["require", "exports"], function(require, exports) {
exports.data ={
"css": {

View file

@ -194,7 +194,7 @@ export var colorKeywords : { [name:string]:string } = {
};
export var units : { [unitName:string]:string[] } = {
'length': ['em', 'rem', 'ex', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ch', 'vw', 'vh', 'vmin', 'vmax'],
'length': ['em', 'rem', 'ex', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ch', 'vw', 'vh', 'vmin', 'vmax'],
'angle': ['deg', 'rad', 'grad', 'turn'],
'time': ['ms', 's'],
'frequency': ['Hz', 'kHz'],
@ -206,7 +206,7 @@ export var html5Tags = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'aud
'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer',
'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link',
'main', 'map', 'mark', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'pre', 'progress', 'q', 'rb',
'rp', 'rt', 'rtc', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template',
'rp', 'rt', 'rtc', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'svg', 'table', 'tbody', 'td', 'template',
'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr' ];
export function isColorConstructor(node:nodes.Function): boolean {
@ -302,6 +302,7 @@ export function getBrowserLabel(b: Browsers): string {
}
export interface Browsers {
E:string;
FF:string;
IE:string;
O:string;
@ -326,7 +327,7 @@ export interface IEntry {
}
function evalBrowserEntry(browsers: string) {
var browserEntry : Browsers = { all: false, FF: '', S: '', C: '', IE: '', O: '', count: 0};
var browserEntry : Browsers = { all: false, E: '', FF: '', S: '', C: '', IE: '', O: '', count: 0};
var count = 0;
if (browsers) {
browsers.split(',').forEach(
@ -474,6 +475,7 @@ export function getPseudoClasses(): IEntry[]{
}
export var browserNames = {
E : 'Edge',
FF : 'Firefox',
S : 'Safari',
C : 'Chrome',

View file

@ -6,7 +6,7 @@
import strings = require('vs/base/common/strings');
import arrays = require('vs/base/common/arrays');
var emptyElements:string[] = ['area', 'base', 'basefont', 'br', 'col', 'command', 'embed', 'frame', 'hr', 'img', 'input', 'isindex', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
var emptyElements:string[] = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'];
export function isEmptyElement(e: string) : boolean {
return arrays.binarySearch(emptyElements, e,(s1: string, s2: string) => s1.localeCompare(s2)) >= 0;
@ -26,6 +26,7 @@ export function getHTML5TagProvider(): IHTMLTagProvider {
head: none,
title: none,
noscript: none,
main: none,
section: none,
nav: none,
article: none,
@ -44,7 +45,7 @@ export function getHTML5TagProvider(): IHTMLTagProvider {
hr: none,
pre: none,
blockquote: ['cite'],
ol: ['reversed:v', 'start'],
ol: ['reversed:v', 'start', 'type:lt'],
ul: none,
li: ['value'],
dl: none,
@ -53,7 +54,7 @@ export function getHTML5TagProvider(): IHTMLTagProvider {
figure: none,
figcaption: none,
div: none,
a: ['href', 'target', 'ping', 'rel', 'media', 'hreflang', 'type'],
a: ['href', 'target', 'download', 'ping', 'rel', 'hreflang', 'type'],
em: none,
strong: none,
small: none,
@ -63,7 +64,7 @@ export function getHTML5TagProvider(): IHTMLTagProvider {
dfn: none,
abbr: none,
data: ['value'],
time: ['datetime', 'pubdate'],
time: ['datetime'],
code: none,
var: none,
samp: none,
@ -75,8 +76,10 @@ export function getHTML5TagProvider(): IHTMLTagProvider {
u: none,
mark: none,
ruby: none,
rt: none,
rb: none,
rp: none,
rt: none,
rtc: none,
bdi: none,
bdo: none,
span: none,
@ -85,25 +88,26 @@ export function getHTML5TagProvider(): IHTMLTagProvider {
ins: ['cite', 'datetime'],
del: ['cite', 'datetime'],
img: ['alt', 'src', 'srcset', 'crossorigin:xo', 'usemap', 'ismap:v', 'width', 'height'],
iframe: ['src', 'srcdoc', 'name', 'sandbox', 'seamless', 'width', 'height'],
iframe: ['src', 'srcdoc', 'name', 'sandbox:sb', 'seamless:v', 'allowfullscreen:v', 'width', 'height'],
embed: ['src', 'type', 'width', 'height'],
object: ['data', 'type', 'typemustmatch:v', 'name', 'usemap', 'form', 'width', 'height'],
param: ['name', 'value'],
video: ['src', 'crossorigin:xo', 'poster', 'preload', 'autoplay:v', 'mediagroup', 'loop:v', 'muted:v', 'controls:v', 'width', 'height'],
audio: ['src', 'crossorigin:xo', 'preload', 'autoplay:v', 'mediagroup', 'loop:v', 'muted:v', 'controls:v'],
source: ['src', 'type', 'media'],
track: ['default:v', 'kind', 'label', 'src', 'srclang'],
video: ['src', 'crossorigin:xo', 'poster', 'preload:pl', 'autoplay:v', 'mediagroup', 'loop:v', 'muted:v', 'controls:v', 'width', 'height'],
audio: ['src', 'crossorigin:xo', 'preload:pl', 'autoplay:v', 'mediagroup', 'loop:v', 'muted:v', 'controls:v'],
source: ['src', 'type'],
track: ['default:v', 'kind:tk', 'label', 'src', 'srclang'],
canvas: ['width', 'height'],
map: ['name'],
area: ['alt', 'coords', 'shape', 'href', 'target', 'ping', 'rel', 'media', 'hreflang', 'type'],
area: ['alt', 'coords', 'shape:sh', 'href', 'target', 'download', 'ping', 'rel', 'hreflang', 'type'],
base: ['href', 'target'],
link: ['href', 'rel', 'media', 'hreflang', 'type', 'sizes'],
link: ['href', 'crossorigin:xo', 'rel', 'media', 'hreflang', 'type', 'sizes'],
meta: ['name', 'http-equiv', 'content', 'charset'],
style: ['media', 'type', 'scoped:v'],
script: ['src', 'async:v', 'defer:v', 'type', 'charset'],
body: ['onafterprint', 'onbeforeprint', 'onbeforeunload', 'onblur', 'onerror', 'onfocus', 'onhashchange', 'onload', 'onmessage',
'onoffline', 'ononline', 'onpagehide', 'onpageshow', 'onpopstate', 'onresize', 'onscroll', 'onstorage', 'onunload'],
table: none,
style: ['media', 'nonce', 'type', 'scoped:v'],
script: ['src', 'type', 'charset', 'async:v', 'defer:v', 'crossorigin:xo', 'nonce'],
template: none,
body: ['onafterprint', 'onbeforeprint', 'onbeforeunload', 'onhashchange', 'onlanguagechange', 'onmessage', 'onoffline', 'ononline', 'onpagehide',
'onpageshow', 'onpopstate', 'onstorage', 'onunload'],
table: ['sortable:v', 'border'],
caption: none,
colgroup: ['span'],
col: ['span'],
@ -112,28 +116,28 @@ export function getHTML5TagProvider(): IHTMLTagProvider {
tfoot: none,
tr: none,
td: ['colspan', 'rowspan', 'headers'],
th: ['colspan', 'rowspan', 'headers', 'scope', 'abbr'],
form: ['accept-charset', 'action', 'autocomplete:o', 'enctype', 'method:m', 'name', 'novalidate:v', 'target'],
th: ['colspan', 'rowspan', 'headers', 'scope:s', 'sorted', 'abbr'],
form: ['accept-charset', 'action', 'autocomplete:o', 'enctype:et', 'method:m', 'name', 'novalidate:v', 'target'],
fieldset: ['disabled:v', 'form', 'name'],
legend: none,
label: ['form', 'for'],
input: ['accept', 'alt', 'autocomplete:o', 'autofocus:v', 'checked:v', 'dirname', 'disabled:v', 'form', 'formaction', 'formenctype',
'formmethod:m', 'formnovalidate:v', 'formtarget', 'height', 'inputmode', 'list', 'max', 'maxlength', 'min', 'multiple:v', 'name',
'pattern', 'placeholder', 'readonly:v', 'required', 'size', 'src', 'step', 'type:t', 'value', 'width'],
button: ['autofocus:v', 'disabled:v', 'form', 'formaction', 'formenctype', 'formmethod:m', 'formnovalidate:v', 'formtarget', 'name', 'type:bt', 'value'],
select: ['autofocus:v', 'disabled:v', 'form', 'multiple:v', 'name', 'required:v', 'size'],
datalist: ['option'],
input: ['accept', 'alt', 'autocomplete:o', 'autofocus:v', 'checked:v', 'dirname', 'disabled:v', 'form', 'formaction', 'formenctype:et',
'formmethod:fm', 'formnovalidate:v', 'formtarget', 'height', 'inputmode:im', 'list', 'max', 'maxlength', 'min', 'minlength', 'multiple:v', 'name',
'pattern', 'placeholder', 'readonly:v', 'required:v', 'size', 'src', 'step', 'type:t', 'value', 'width'],
button: ['autofocus:v', 'disabled:v', 'form', 'formaction', 'formenctype:et', 'formmethod:fm', 'formnovalidate:v', 'formtarget', 'name', 'type:bt', 'value'],
select: ['autocomplete:o', 'autofocus:v', 'disabled:v', 'form', 'multiple:v', 'name', 'required:v', 'size'],
datalist: none,
optgroup: ['disabled:v', 'label'],
option: ['disabled:v', 'label', 'selected:v', 'value'],
textarea: ['autocomplete:o', 'autofocus:v', 'cols', 'dirname', 'disabled:v', 'form', 'inputmode', 'maxlength', 'name', 'placeholder', 'readonly:v', 'required:v', 'rows', 'wrap'],
textarea: ['autocomplete:o', 'autofocus:v', 'cols', 'dirname', 'disabled:v', 'form', 'inputmode:im', 'maxlength', 'minlength', 'name', 'placeholder', 'readonly:v', 'required:v', 'rows', 'wrap:w'],
keygen: ['autofocus:v', 'challenge', 'disabled:v', 'form', 'keytype', 'name'],
output: ['for', 'form', 'name'],
progress: ['value', 'max'],
meter: ['value', 'min', 'max', 'low', 'high', 'optimum'],
details: ['open:v'],
summary: none,
command: ['type', 'label', 'icon', 'disabled:v', 'checked:v', 'radiogroup', 'command'],
menu: ['type', 'label'],
menu: ['type:mt', 'label'],
menuitem: ['type:mit', 'label', 'icon', 'disabled:v', 'checked:v', 'radiogroup', 'default:v', 'command'],
dialog: ['open:v']
};
@ -142,24 +146,36 @@ export function getHTML5TagProvider(): IHTMLTagProvider {
'aria-describedby', 'aria-disabled:b', 'aria-dropeffect:dropeffect', 'aria-errormessage', 'aria-expanded:u', 'aria-flowto', 'aria-grabbed:u', 'aria-haspopup:b', 'aria-hidden:b', 'aria-invalid:invalid', 'aria-kbdshortcuts',
'aria-label', 'aria-labelledby', 'aria-level', 'aria-live:live', 'aria-modal:b', 'aria-multiline:b', 'aria-multiselectable:b', 'aria-orientation:orientation', 'aria-owns', 'aria-placeholder', 'aria-posinset', 'aria-pressed:tristate',
'aria-readonly:b','aria-relevant:relevant', 'aria-required:b', 'aria-roledescription', 'aria-rowcount', 'aria-rowindex', 'aria-rowspan', 'aria-selected:u', 'aria-setsize', 'aria-sort:sort', 'aria-valuemax', 'aria-valuemin', 'aria-valuenow', 'aria-valuetext',
'accesskey', 'class', 'contenteditable:b', 'contextmenu', 'dir:d', 'draggable:a', 'dropzone', 'hidden:v', 'id', 'inert:v', 'itemid', 'itemprop', 'itemref', 'itemscope:v', 'itemtype', 'lang', 'role:roles', 'spellcheck:b', 'style', 'tabindex',
'title', 'translate'];
'accesskey', 'class', 'contenteditable:b', 'contextmenu', 'dir:d', 'draggable:b', 'dropzone', 'hidden:v', 'id', 'itemid', 'itemprop', 'itemref', 'itemscope:v', 'itemtype', 'lang', 'role:roles', 'spellcheck:b', 'style', 'tabindex',
'title', 'translate:y'];
var eventHandlers = ['onabort', 'onblur', 'oncanplay', 'oncanplaythrough', 'onchange', 'onclick', 'oncontextmenu', 'ondblclick', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart',
'ondrop', 'ondurationchange', 'onemptied', 'onended', 'onerror', 'onfocus', 'onformchange', 'onforminput', 'oninput', 'oninvalid', 'onkeydown', 'onkeypress', 'onkeyup', 'onload', 'onloadeddata', 'onloadedmetadata',
'onloadstart', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onpause', 'onplay', 'onplaying', 'onprogress', 'onratechange', 'onreset', 'onreadystatechange', 'onseeked',
'onseeking', 'onselect', 'onshow', 'onstalled', 'onsubmit', 'onsuspend', 'ontimeupdate', 'onvolumechange', 'onwaiting'];
'onloadstart', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onpause', 'onplay', 'onplaying', 'onprogress', 'onratechange', 'onreset', 'onresize', 'onreadystatechange', 'onscroll',
'onseeked', 'onseeking', 'onselect', 'onshow', 'onstalled', 'onsubmit', 'onsuspend', 'ontimeupdate', 'onvolumechange', 'onwaiting'];
var valueSets : { [tag:string]: string[]} = {
b: ['true', 'false'],
a: ['true', 'false', 'auto'],
u: ['true', 'false', 'undefined'],
d: ['ltr', 'rtl'],
m: ['get', 'post'],
o: ['on', 'off'],
y: ['yes', 'no'],
w: ['soft', 'hard'],
d: ['ltr', 'rtl', 'auto'],
m: ['GET', 'POST', 'dialog'],
fm: ['GET', 'POST'],
s: ['row', 'col', 'rowgroup', 'colgroup'],
t: ['hidden', 'text', 'search', 'tel', 'url', 'email', 'password', 'datetime', 'date', 'month', 'week', 'time', 'datetime-local', 'number', 'range', 'color', 'checkbox', 'radio', 'file', 'submit', 'image', 'reset', 'button'],
bt: ['button', 'submit', 'reset'],
im: ['verbatim', 'latin', 'latin-name', 'latin-prose', 'full-width-latin', 'kana', 'kana-name', 'katakana', 'numeric', 'tel', 'email', 'url'],
bt: ['button', 'submit', 'reset', 'menu'],
lt: ['1', 'a', 'A', 'i', 'I'],
mt: ['context', 'toolbar'],
mit: ['command', 'checkbox', 'radio'],
et: ['application/x-www-form-urlencoded', 'multipart/form-data', 'text/plain'],
tk: ['subtitles', 'captions', 'descriptions', 'chapters', 'metadata'],
pl: ['none', 'metadata', 'auto'],
sh: ['circle', 'default', 'poly', 'rect'],
xo: ['anonymous', 'use-credentials'],
sb: ['allow-forms', 'allow-modals', 'allow-pointer-lock', 'allow-popups', 'allow-popups-to-escape-sandbox', 'allow-same-origin', 'allow-scripts', 'allow-top-navigation'],
tristate: ['true', 'false', 'mixed', 'undefined'],
autocomplete: ['inline', 'list', 'both', 'none'],
current: ['page', 'step', 'location', 'date', 'time', 'true', 'false'],

View file

@ -52,7 +52,7 @@ export const language =
root: [
// headers (with #)
[/^(\s*)(#+)((?:[^\\#]|@escapes)+)((?:#+)?)/, ['white', markdownTokenTypes.TOKEN_HEADER_LEAD, markdownTokenTypes.TOKEN_HEADER, markdownTokenTypes.TOKEN_HEADER]],
[/^(\s{0,3})(#+)((?:[^\\#]|@escapes)+)((?:#+)?)/, ['white', markdownTokenTypes.TOKEN_HEADER_LEAD, markdownTokenTypes.TOKEN_HEADER, markdownTokenTypes.TOKEN_HEADER]],
// headers (with =)
[/^\s*(=+|\-+)\s*$/, markdownTokenTypes.TOKEN_EXT_HEADER],

View file

@ -8,10 +8,10 @@ export const TOKEN_HEADER_LEAD = 'entity.name.type';
export const TOKEN_HEADER = 'entity.name.type';
export const TOKEN_EXT_HEADER = 'entity.other.atribute-name';
export const TOKEN_SEPARATOR = 'meta.separator';
export const TOKEN_QUOTE = 'meta.tag';
export const TOKEN_LIST = 'punctuation.section.embedded';
export const TOKEN_QUOTE = 'comment';
export const TOKEN_LIST = 'keyword';
export const TOKEN_BLOCK = 'string';
export const TOKEN_BLOCK_CODE = 'string.source';
export const TOKEN_BLOCK_CODE = 'variable.source';
/*
// old settings

View file

@ -67,7 +67,7 @@ export interface ProblemPattern {
mostSignifikant?: boolean;
[key:string]: any;
[key: string]: any;
}
export let problemPatternProperties = ['file', 'message', 'location', 'line', 'column', 'endLine', 'endColumn', 'code', 'severity', 'loop', 'mostSignifikant'];
@ -110,7 +110,7 @@ export interface ProblemMatcher {
fileLocation: FileLocationKind;
filePrefix?: string;
pattern: ProblemPattern | ProblemPattern[];
severity?:Severity;
severity?: Severity;
watching?: WatchingMatcher;
}
@ -122,7 +122,7 @@ export function isNamedProblemMatcher(value: ProblemMatcher): value is NamedProb
return Types.isString((<NamedProblemMatcher>value).name);
}
let valueMap: {[key:string]:string;} = {
let valueMap: { [key: string]: string; } = {
E: 'error',
W: 'warning',
I: 'info',
@ -137,7 +137,7 @@ interface Location {
interface ProblemData {
file?: string;
location?:string;
location?: string;
line?: string;
column?: string;
endLine?: string;
@ -145,7 +145,7 @@ interface ProblemData {
message?: string;
severity?: string;
code?: string;
[key:string]: string;
[key: string]: string;
}
export interface ProblemMatch {
@ -159,7 +159,7 @@ export interface HandleResult {
continue: boolean;
}
export function getResource(filename:string, matcher: ProblemMatcher): URI {
export function getResource(filename: string, matcher: ProblemMatcher): URI {
let kind = matcher.fileLocation;
let fullPath: string;
if (kind === FileLocationKind.Absolute) {
@ -233,7 +233,7 @@ class AbstractLineMatcher implements ILineMatcher {
protected getMarkerMatch(data: ProblemData): ProblemMatch {
let location = this.getLocation(data);
if (data.file && location && data.message) {
let marker:IMarkerData = {
let marker: IMarkerData = {
severity: this.getSeverity(data),
startLineNumber: location.startLineNumber,
startColumn: location.startColumn,
@ -252,7 +252,7 @@ class AbstractLineMatcher implements ILineMatcher {
}
}
protected getResource(filename:string):URI {
protected getResource(filename: string): URI {
return getResource(filename, this.matcher);
}
@ -266,11 +266,11 @@ class AbstractLineMatcher implements ILineMatcher {
let startLine = parseInt(data.line);
let startColumn = data.column ? parseInt(data.column) : undefined;
let endLine = data.endLine ? parseInt(data.endLine) : undefined;
let endColumn = data.endColumn ? parseInt(data.endColumn): undefined;
let endColumn = data.endColumn ? parseInt(data.endColumn) : undefined;
return this.createLocation(startLine, startColumn, endLine, endColumn);
}
private parseLocationInfo(value:string):Location {
private parseLocationInfo(value: string): Location {
if (!value || !value.match(/(\d+|\d+,\d+|\d+,\d+,\d+,\d+)/)) {
return null;
}
@ -284,9 +284,9 @@ class AbstractLineMatcher implements ILineMatcher {
}
}
private createLocation(startLine:number, startColumn:number, endLine:number, endColumn:number):Location {
private createLocation(startLine: number, startColumn: number, endLine: number, endColumn: number): Location {
if (startLine && startColumn && endLine && endColumn) {
return {startLineNumber: startLine, startColumn: startColumn, endLineNumber: endLine, endColumn: endColumn };
return { startLineNumber: startLine, startColumn: startColumn, endLineNumber: endLine, endColumn: endColumn };
}
if (startLine && startColumn) {
return { startLineNumber: startLine, startColumn: startColumn, endLineNumber: startLine, endColumn: startColumn };
@ -294,8 +294,8 @@ class AbstractLineMatcher implements ILineMatcher {
return { startLineNumber: startLine, startColumn: 1, endLineNumber: startLine, endColumn: Number.MAX_VALUE };
}
private getSeverity(data: ProblemData):Severity {
let result:Severity = null;
private getSeverity(data: ProblemData): Severity {
let result: Severity = null;
if (data.severity) {
let value = data.severity;
if (value && value.length > 0) {
@ -366,7 +366,7 @@ class MultiLineMatcher extends AbstractLineMatcher {
let pattern = this.patterns[i];
let matches = pattern.regexp.exec(lines[i + start]);
if (!matches) {
return { match: null, continue: false};
return { match: null, continue: false };
} else {
// Only the last pattern can loop
if (pattern.loop && i === this.patterns.length - 1) {
@ -379,7 +379,7 @@ class MultiLineMatcher extends AbstractLineMatcher {
if (!loop) {
this.data = null;
}
return { match: this.getMarkerMatch(data), continue: loop };
return { match: this.getMarkerMatch(data), continue: loop };
}
public next(line: string): ProblemMatch {
@ -396,7 +396,7 @@ class MultiLineMatcher extends AbstractLineMatcher {
}
}
let _defaultPatterns:{ [name:string]: ProblemPattern | ProblemPattern[];} = Object.create(null);
let _defaultPatterns: { [name: string]: ProblemPattern | ProblemPattern[]; } = Object.create(null);
_defaultPatterns['msCompile'] = {
regexp: /^([^\s].*)\((\d+|\d+,\d+|\d+,\d+,\d+,\d+)\):\s+(error|warning|info)\s+(\w{1,2}\d+)\s*:\s*(.*)$/,
file: 1,
@ -600,7 +600,7 @@ export namespace Config {
*/
loop?: boolean;
[key:string]: any;
[key: string]: any;
}
/**
@ -856,7 +856,7 @@ export class ProblemMatcherParser extends Parser {
private createProblemPattern(value: string | Config.ProblemPattern | Config.ProblemPattern[]): ProblemPattern | ProblemPattern[] {
let pattern: ProblemPattern;
if (Types.isString(value)) {
let variableName:string = <string>value;
let variableName: string = <string>value;
if (variableName.length > 1 && variableName[0] === '$') {
return defaultPattern(variableName.substring(1));
}
@ -889,7 +889,7 @@ export class ProblemMatcherParser extends Parser {
return null;
}
private createSingleProblemPattern(value: Config.ProblemPattern, setDefaults:boolean): ProblemPattern {
private createSingleProblemPattern(value: Config.ProblemPattern, setDefaults: boolean): ProblemPattern {
let result: ProblemPattern = {
regexp: this.createRegularExpression(value.regexp)
};
@ -969,7 +969,7 @@ export class ProblemMatcherParser extends Parser {
}
}
private createWatchingPattern(external: string| Config.WatchingPattern): WatchingPattern {
private createWatchingPattern(external: string | Config.WatchingPattern): WatchingPattern {
if (Types.isUndefinedOrNull(external)) {
return null;
}
@ -986,10 +986,10 @@ export class ProblemMatcherParser extends Parser {
if (!regexp) {
return null;
}
return file ? { regexp, file} : { regexp };
return file ? { regexp, file } : { regexp };
}
private createRegularExpression(value:string):RegExp {
private createRegularExpression(value: string): RegExp {
let result: RegExp = null;
if (!value) {
return result;

View file

@ -8,7 +8,7 @@ import {TPromise} from 'vs/base/common/winjs.base';
import types = require('vs/base/common/types');
import {isBinaryMime} from 'vs/base/common/mime';
import {EventType} from 'vs/base/common/events';
import {EditorModel, IFileEditorInput, EditorInput, IInputStatus, DiffEditorInput as CommonDiffEditorInput} from 'vs/workbench/common/editor';
import {EditorModel, IFileEditorInput, EditorInput, IInputStatus, BaseDiffEditorInput} from 'vs/workbench/common/editor';
import {BaseTextEditorModel} from 'vs/workbench/browser/parts/editor/textEditorModel';
import {DiffEditorModel} from 'vs/workbench/browser/parts/editor/diffEditorModel';
import {TextDiffEditor} from 'vs/workbench/browser/parts/editor/textDiffEditor';
@ -20,7 +20,7 @@ import {BinaryResourceDiffEditor} from 'vs/workbench/browser/parts/editor/binary
* The base editor input for the diff editor. It is made up of two editor inputs, the original version
* and the modified version.
*/
export class DiffEditorInput extends CommonDiffEditorInput {
export class DiffEditorInput extends BaseDiffEditorInput {
public static ID = 'workbench.editors.diffEditorInput';

View file

@ -136,12 +136,10 @@ export abstract class BaseTextEditor extends BaseEditor {
this._editorContainer = parent;
this.editorControl = this.createEditorControl(parent);
// Hook Listener for Selection changes (and only react to api, mouse or keyboard source, not any internal source of the editor)
// Hook Listener for Selection changes
this.toUnbind.push(this.editorControl.addListener(EventType.CursorPositionChanged, (event: ICursorPositionChangedEvent) => {
if (event.source === 'api' || event.source === 'mouse' || event.source === 'keyboard') {
let selection = this.editorControl.getSelection();
this.eventService.emit(WorkbenchEventType.TEXT_EDITOR_SELECTION_CHANGED, new TextEditorSelectionEvent(selection, this, this.getId(), this.input, null, this.position, event));
}
let selection = this.editorControl.getSelection();
this.eventService.emit(WorkbenchEventType.TEXT_EDITOR_SELECTION_CHANGED, new TextEditorSelectionEvent(selection, this, this.getId(), this.input, null, this.position, event));
}));
// Hook Listener for mode changes

View file

@ -125,7 +125,7 @@ export abstract class EditorInput extends EventEmitter implements IEditorInput {
/**
* The base class of editor inputs that have an original and modified side.
*/
export abstract class DiffEditorInput extends EditorInput {
export abstract class BaseDiffEditorInput extends EditorInput {
private _originalInput: EditorInput;
private _modifiedInput: EditorInput;
@ -477,8 +477,8 @@ export function asFileEditorInput(obj: any, supportDiff?: boolean): IFileEditorI
}
// Check for diff if we are asked to
if (supportDiff && types.isFunction((<DiffEditorInput>obj).getModifiedInput)) {
obj = (<DiffEditorInput>obj).getModifiedInput();
if (supportDiff && types.isFunction((<BaseDiffEditorInput>obj).getModifiedInput)) {
obj = (<BaseDiffEditorInput>obj).getModifiedInput();
}
let i = <IFileEditorInput>obj;

View file

@ -47,10 +47,10 @@ configurationRegistry.registerConfiguration({
'title': nls.localize('windowConfigurationTitle', "Window configuration"),
'type': 'object',
'properties': {
'window.openInNewWindow': {
'window.openFilesInNewWindow': {
'type': 'boolean',
'default': true,
'description': nls.localize('openInNewWindow', "When enabled, will open files in a new window instead of reusing an existing instance.")
'description': nls.localize('openFilesInNewWindow', "When enabled, will open files in a new window instead of reusing an existing instance.")
},
'window.reopenFolders': {
'type': 'string',

View file

@ -369,8 +369,12 @@ export class WindowsManager {
// Let the user settings override how files are open in a new window or same window
let openFilesInNewWindow = openConfig.forceNewWindow;
if (openFilesInNewWindow && !openConfig.cli.pluginDevelopmentPath) {
openFilesInNewWindow = settings.manager.getValue('window.openInNewWindow', openFilesInNewWindow); // can be overriden via settings (not for PDE though!)
if (openFilesInNewWindow && !openConfig.cli.pluginDevelopmentPath) { // can be overriden via settings (not for PDE though!)
if (settings.manager.getValue('window.openInNewWindow', null) !== null) {
openFilesInNewWindow = settings.manager.getValue('window.openInNewWindow', openFilesInNewWindow); // TODO@Ben remove legacy setting in a couple of versions
} else {
openFilesInNewWindow = settings.manager.getValue('window.openFilesInNewWindow', openFilesInNewWindow);
}
}
// Open Files in last instance if any and flag tells us so

View file

@ -1,209 +1,209 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import fs = require('fs');
import path = require('path');
import json = require('vs/base/common/json');
import objects = require('vs/base/common/objects');
import {EventProvider} from 'vs/base/common/eventProvider';
import {TPromise} from 'vs/base/common/winjs.base';
import {EventSource} from 'vs/base/common/eventSource';
import {IWorkspaceContextService} from 'vs/workbench/services/workspace/common/contextService';
export interface ISettings {
settings: any;
settingsParseErrors?: string[];
keybindings: any
}
export class UserSettings {
private static CHANGE_BUFFER_DELAY = 300;
public globalSettings: ISettings;
private timeoutHandle: number;
private watcher: fs.FSWatcher;
private appSettingsPath: string;
private appKeybindingsPath: string;
private _onChange: EventSource<(settings: ISettings) => void>;
constructor(appSettingsPath: string, appKeybindingsPath: string) {
this.appSettingsPath = appSettingsPath;
this.appKeybindingsPath = appKeybindingsPath;
this._onChange = new EventSource<(settings: ISettings) => void>();
this.registerWatchers();
}
public static getValue(contextService: IWorkspaceContextService, key: string, fallback?: any): TPromise<any> {
return new TPromise((c, e) => {
const appSettingsPath = contextService.getConfiguration().env.appSettingsPath;
fs.readFile(appSettingsPath, (error /* ignore */, fileContents) => {
let root = Object.create(null);
let content = fileContents ? fileContents.toString() : '{}';
let contents = Object.create(null);
try {
contents = json.parse(content);
} catch (error) {
// ignore parse problem
}
for (let key in contents) {
UserSettings.setNode(root, key, contents[key]);
}
return c(UserSettings.doGetValue(root, key, fallback));
});
});
}
public get onChange(): EventProvider<(settings: ISettings) => void> {
return this._onChange.value;
}
public getValue(key: string, fallback?: any): any {
return UserSettings.doGetValue(this.globalSettings.settings, key, fallback);
}
private static doGetValue(globalSettings: any, key: string, fallback?: any): any {
if (!key) {
return fallback;
}
let value = globalSettings;
let parts = key.split('\.');
while (parts.length && value) {
let part = parts.shift();
value = value[part];
}
return typeof value !== 'undefined' ? value : fallback;
}
private registerWatchers(): void {
this.watcher = fs.watch(path.dirname(this.appSettingsPath));
this.watcher.on('change', (eventType: string, fileName: string) => this.onSettingsFileChange(eventType, fileName));
}
private onSettingsFileChange(eventType: string, fileName: string): void {
// we can get multiple change events for one change, so we buffer through a timeout
if (this.timeoutHandle) {
global.clearTimeout(this.timeoutHandle);
delete this.timeoutHandle;
}
this.timeoutHandle = global.setTimeout(() => {
// Reload
let didChange = this.loadSync();
// Emit event
if (didChange) {
this._onChange.fire(this.globalSettings);
}
}, UserSettings.CHANGE_BUFFER_DELAY);
}
public loadSync(): boolean {
let loadedSettings = this.doLoadSync();
if (!objects.equals(loadedSettings, this.globalSettings)) {
// Keep in class
this.globalSettings = loadedSettings;
return true; // changed value
}
return false; // no changed value
}
private doLoadSync(): ISettings {
let settings = this.doLoadSettingsSync();
return {
settings: settings.contents,
settingsParseErrors: settings.parseErrors,
keybindings: this.doLoadKeybindingsSync()
};
}
private doLoadSettingsSync(): { contents: any; parseErrors?: string[]; } {
let root = Object.create(null);
let content = '{}';
try {
content = fs.readFileSync(this.appSettingsPath).toString();
} catch (error) {
// ignore
}
let contents = Object.create(null);
try {
contents = json.parse(content);
} catch (error) {
// parse problem
return {
contents: Object.create(null),
parseErrors: [this.appSettingsPath]
};
}
for (let key in contents) {
UserSettings.setNode(root, key, contents[key]);
}
return {
contents: root
};
}
private static setNode(root: any, key: string, value: any): any {
let segments = key.split('.');
let last = segments.pop();
let curr = root;
segments.forEach((s) => {
let obj = curr[s];
switch (typeof obj) {
case 'undefined':
obj = curr[s] = {};
break;
case 'object':
break;
default:
console.log('Conflicting user settings: ' + key + ' at ' + s + ' with ' + JSON.stringify(obj));
}
curr = obj;
});
curr[last] = value;
}
private doLoadKeybindingsSync(): any {
try {
return json.parse(fs.readFileSync(this.appKeybindingsPath).toString());
} catch (error) {
// Ignore loading and parsing errors
}
return [];
}
public dispose(): void {
if (this.watcher) {
this.watcher.close();
this.watcher = null;
}
}
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import fs = require('fs');
import path = require('path');
import json = require('vs/base/common/json');
import objects = require('vs/base/common/objects');
import {EventProvider} from 'vs/base/common/eventProvider';
import {TPromise} from 'vs/base/common/winjs.base';
import {EventSource} from 'vs/base/common/eventSource';
import {IWorkspaceContextService} from 'vs/workbench/services/workspace/common/contextService';
export interface ISettings {
settings: any;
settingsParseErrors?: string[];
keybindings: any
}
export class UserSettings {
private static CHANGE_BUFFER_DELAY = 300;
public globalSettings: ISettings;
private timeoutHandle: number;
private watcher: fs.FSWatcher;
private appSettingsPath: string;
private appKeybindingsPath: string;
private _onChange: EventSource<(settings: ISettings) => void>;
constructor(appSettingsPath: string, appKeybindingsPath: string) {
this.appSettingsPath = appSettingsPath;
this.appKeybindingsPath = appKeybindingsPath;
this._onChange = new EventSource<(settings: ISettings) => void>();
this.registerWatchers();
}
public static getValue(contextService: IWorkspaceContextService, key: string, fallback?: any): TPromise<any> {
return new TPromise((c, e) => {
const appSettingsPath = contextService.getConfiguration().env.appSettingsPath;
fs.readFile(appSettingsPath, (error /* ignore */, fileContents) => {
let root = Object.create(null);
let content = fileContents ? fileContents.toString() : '{}';
let contents = Object.create(null);
try {
contents = json.parse(content);
} catch (error) {
// ignore parse problem
}
for (let key in contents) {
UserSettings.setNode(root, key, contents[key]);
}
return c(UserSettings.doGetValue(root, key, fallback));
});
});
}
public get onChange(): EventProvider<(settings: ISettings) => void> {
return this._onChange.value;
}
public getValue(key: string, fallback?: any): any {
return UserSettings.doGetValue(this.globalSettings.settings, key, fallback);
}
private static doGetValue(globalSettings: any, key: string, fallback?: any): any {
if (!key) {
return fallback;
}
let value = globalSettings;
let parts = key.split('\.');
while (parts.length && value) {
let part = parts.shift();
value = value[part];
}
return typeof value !== 'undefined' ? value : fallback;
}
private registerWatchers(): void {
this.watcher = fs.watch(path.dirname(this.appSettingsPath));
this.watcher.on('change', (eventType: string, fileName: string) => this.onSettingsFileChange(eventType, fileName));
}
private onSettingsFileChange(eventType: string, fileName: string): void {
// we can get multiple change events for one change, so we buffer through a timeout
if (this.timeoutHandle) {
global.clearTimeout(this.timeoutHandle);
delete this.timeoutHandle;
}
this.timeoutHandle = global.setTimeout(() => {
// Reload
let didChange = this.loadSync();
// Emit event
if (didChange) {
this._onChange.fire(this.globalSettings);
}
}, UserSettings.CHANGE_BUFFER_DELAY);
}
public loadSync(): boolean {
let loadedSettings = this.doLoadSync();
if (!objects.equals(loadedSettings, this.globalSettings)) {
// Keep in class
this.globalSettings = loadedSettings;
return true; // changed value
}
return false; // no changed value
}
private doLoadSync(): ISettings {
let settings = this.doLoadSettingsSync();
return {
settings: settings.contents,
settingsParseErrors: settings.parseErrors,
keybindings: this.doLoadKeybindingsSync()
};
}
private doLoadSettingsSync(): { contents: any; parseErrors?: string[]; } {
let root = Object.create(null);
let content = '{}';
try {
content = fs.readFileSync(this.appSettingsPath).toString();
} catch (error) {
// ignore
}
let contents = Object.create(null);
try {
contents = json.parse(content);
} catch (error) {
// parse problem
return {
contents: Object.create(null),
parseErrors: [this.appSettingsPath]
};
}
for (let key in contents) {
UserSettings.setNode(root, key, contents[key]);
}
return {
contents: root
};
}
private static setNode(root: any, key: string, value: any): any {
let segments = key.split('.');
let last = segments.pop();
let curr = root;
segments.forEach((s) => {
let obj = curr[s];
switch (typeof obj) {
case 'undefined':
obj = curr[s] = {};
break;
case 'object':
break;
default:
console.log('Conflicting user settings: ' + key + ' at ' + s + ' with ' + JSON.stringify(obj));
}
curr = obj;
});
curr[last] = value;
}
private doLoadKeybindingsSync(): any {
try {
return json.parse(fs.readFileSync(this.appKeybindingsPath).toString());
} catch (error) {
// Ignore loading and parsing errors
}
return [];
}
public dispose(): void {
if (this.watcher) {
this.watcher.close();
this.watcher = null;
}
}
}

View file

@ -217,7 +217,7 @@ export class StackFrame implements debug.IStackFrame {
if (!this.scopes) {
this.scopes = debugService.getActiveSession().scopes({ frameId: this.frameId }).then(response => {
return response.body.scopes.map(rs => new Scope(this.threadId, rs.name, rs.variablesReference, rs.expensive));
});
}, err => []);
}
return this.scopes;

View file

@ -221,11 +221,11 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
this.toDispose.push(this.session.addListener2(debug.SessionEvents.THREAD, (event: DebugProtocol.ThreadEvent) => {
if (event.body.reason === 'started') {
this.session.threads().done((result) => {
var threads = result.body.threads.filter(thread => thread.id === event.body.threadId);
if (threads.length === 1) {
const thread = result.body.threads.filter(thread => thread.id === event.body.threadId).pop();
if (thread) {
this.model.rawUpdate({
threadId: threads[0].id,
thread: threads[0]
threadId: thread.id,
thread: thread
});
}
}, errors.onUnexpectedError);
@ -266,14 +266,14 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
private getThreadData(threadId: number): Promise {
return this.model.getThreads()[threadId] ? Promise.as(true) :
this.session.threads().then((response: DebugProtocol.ThreadsResponse) => {
var threads = response.body.threads.filter(t => t.id === threadId);
if (threads.length !== 1) {
throw new Error('Did not get exactly one thread from debug adapter with id ' + threadId);
const thread = response.body.threads.filter(t => t.id === threadId).pop();
if (!thread) {
throw new Error('Did not get a thread from debug adapter with id ' + threadId);
}
this.model.rawUpdate({
threadId: threads[0].id,
thread: threads[0]
threadId: thread.id,
thread: thread
});
});
}
@ -588,11 +588,14 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
// No task running, execute the preLaunchTask.
this.outputService.showOutput('Tasks', true, true);
this.taskService.run(filteredTasks[0].id).then(result => {
const taskPromise = this.taskService.run(filteredTasks[0].id).then(result => {
this.lastTaskEvent = null;
}, err => {
this.lastTaskEvent = null;
});
return filteredTasks[0].isWatching ? Promise.as(true) : taskPromise;
});
}

View file

@ -22,6 +22,9 @@ export abstract class DerivedFrameEditorInput extends IFrameEditorInput {
public abstract createNew(resource: URI): DerivedFrameEditorInput;
/**
* This is the resource that this input is derived from.
*/
public getResource(): URI {
return this.resource;
}

View file

@ -2068,8 +2068,8 @@ export class CloseFileAction extends Action {
// Otherwise just dispose
else {
if (input instanceof workbenchEditorCommon.DiffEditorInput) {
input = (<workbenchEditorCommon.DiffEditorInput>input).getModifiedInput();
if (input instanceof DiffEditorInput) {
input = (<DiffEditorInput>input).getModifiedInput();
}
// File Input

View file

@ -25,8 +25,6 @@ suite('FileService', () => {
let testDir: string;
setup(function (done) {
this.timeout(20000);
let id = uuid.generateUuid();
testDir = path.join(parentDir, id);
let sourceDir = require.toUrl('./fixtures/service');
@ -59,6 +57,8 @@ suite('FileService', () => {
});
test('createFile', function(done: () => void) {
this.timeout(10000); // test tends to need longer?
let contents = 'Hello World';
service.createFile(uri.file(path.join(testDir, 'test.txt')), contents).done(s => {
assert.equal(s.name, 'test.txt');