diff --git a/.github/calendar.yml b/.github/calendar.yml index 7bc555c3f6e..7deb804acb4 100644 --- a/.github/calendar.yml +++ b/.github/calendar.yml @@ -1,5 +1,8 @@ { - '2018-01-30T00:00Z': 'endgame', - '2018-02-07T20:00Z': 'release', - '2018-02-12T20:00Z': 'development', + '2018-01-29 18:00, US/Pacific': 'endgame', + '2018-02-07 12:00, US/Pacific': 'release', # 1.20.0 + '2018-02-12 12:00, US/Pacific': 'development', + '2018-02-14 16:00, Europe/Zurich': 'release', # 1.20.1 + '2018-02-19 16:00, Europe/Zurich': 'development', + '2018-02-26 18:00, US/Pacific': 'endgame', } \ No newline at end of file diff --git a/.github/commands.yml b/.github/commands.yml index 8076f05fd1f..ba8c8d7f3ce 100644 --- a/.github/commands.yml +++ b/.github/commands.yml @@ -56,5 +56,11 @@ action: 'updateLabels', addLabel: 'confirmed' }, + { + type: 'comment', + name: 'findDuplicates', + action: 'comment', + comment: "Potential duplicates:\n${potentialDuplicates}" + }, ] } diff --git a/.github/similarity.yml b/.github/similarity.yml new file mode 100644 index 00000000000..cd51cd2da64 --- /dev/null +++ b/.github/similarity.yml @@ -0,0 +1,5 @@ +{ + perform: true, + whenCreatedByTeam: false, + comment: "(Experimental duplicate detection)\nThanks for submitting this issue. Please also check if it is already covered by an existing one, like:\n${potentialDuplicates}" +} diff --git a/.travis.yml b/.travis.yml index d789e84c612..693cdcbb4d1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,8 +12,8 @@ cache: notifications: email: false webhooks: - - http://vscode-probot.westus.cloudapp.azure.com:3450/travis/notifications - - http://vscode-test-probot.westus.cloudapp.azure.com:3450/travis/notifications + - https://vscode-probot.westus.cloudapp.azure.com:7890/travis/notifications + - https://vscode-test-probot.westus.cloudapp.azure.com:7890/travis/notifications addons: apt: diff --git a/build/builtInExtensions.json b/build/builtInExtensions.json index 5c05672fc78..47453c14afb 100644 --- a/build/builtInExtensions.json +++ b/build/builtInExtensions.json @@ -1,7 +1,7 @@ [ { "name": "ms-vscode.node-debug", - "version": "1.21.1", + "version": "1.21.2", "repo": "https://github.com/Microsoft/vscode-node-debug" }, { diff --git a/build/builtin/browser-main.js b/build/builtin/browser-main.js index 160bac61968..83a5ba4e592 100644 --- a/build/builtin/browser-main.js +++ b/build/builtin/browser-main.js @@ -6,6 +6,7 @@ const fs = require('fs'); const path = require('path'); const os = require('os'); +// @ts-ignore review const { remote } = require('electron'); const dialog = remote.dialog; @@ -13,6 +14,7 @@ const builtInExtensionsPath = path.join(__dirname, '..', 'builtInExtensions.json const controlFilePath = path.join(os.homedir(), '.vscode-oss-dev', 'extensions', 'control.json'); function readJson(filePath) { + //@ts-ignore review return JSON.parse(fs.readFileSync(filePath)); } diff --git a/build/gulpfile.editor.js b/build/gulpfile.editor.js index 1a09abd4f55..f282b006cd8 100644 --- a/build/gulpfile.editor.js +++ b/build/gulpfile.editor.js @@ -12,6 +12,7 @@ var File = require('vinyl'); var root = path.dirname(__dirname); var sha1 = util.getVersion(root); +// @ts-ignore Microsoft/TypeScript#21262 complains about a require of a JSON file var semver = require('./monaco/package.json').version; var headerVersion = semver + '(' + sha1 + ')'; @@ -21,14 +22,14 @@ var editorEntryPoints = [ { name: 'vs/editor/editor.main', include: [], - exclude: [ 'vs/css', 'vs/nls' ], - prepend: [ 'out-build/vs/css.js', 'out-build/vs/nls.js' ], + exclude: ['vs/css', 'vs/nls'], + prepend: ['out-build/vs/css.js', 'out-build/vs/nls.js'], }, { name: 'vs/base/common/worker/simpleWorker', - include: [ 'vs/editor/common/services/editorSimpleWorker' ], - prepend: [ 'vs/loader.js' ], - append: [ 'vs/base/worker/workerMain' ], + include: ['vs/editor/common/services/editorSimpleWorker'], + prepend: ['vs/loader.js'], + append: ['vs/base/worker/workerMain'], dest: 'vs/base/worker/workerMain.js' } ]; @@ -79,14 +80,15 @@ gulp.task('optimize-editor', ['clean-optimized-editor', 'compile-client-build'], bundleLoader: false, header: BUNDLED_FILE_HEADER, bundleInfo: true, - out: 'out-editor' + out: 'out-editor', + languages: undefined })); gulp.task('clean-minified-editor', util.rimraf('out-editor-min')); gulp.task('minify-editor', ['clean-minified-editor', 'optimize-editor'], common.minifyTask('out-editor')); gulp.task('clean-editor-distro', util.rimraf('out-monaco-editor-core')); -gulp.task('editor-distro', ['clean-editor-distro', 'minify-editor', 'optimize-editor'], function() { +gulp.task('editor-distro', ['clean-editor-distro', 'minify-editor', 'optimize-editor'], function () { return es.merge( // other assets es.merge( @@ -97,7 +99,7 @@ gulp.task('editor-distro', ['clean-editor-distro', 'minify-editor', 'optimize-ed // package.json gulp.src('build/monaco/package.json') - .pipe(es.through(function(data) { + .pipe(es.through(function (data) { var json = JSON.parse(data.contents.toString()); json.private = false; data.contents = new Buffer(JSON.stringify(json, null, ' ')); @@ -107,7 +109,7 @@ gulp.task('editor-distro', ['clean-editor-distro', 'minify-editor', 'optimize-ed // README.md gulp.src('build/monaco/README-npm.md') - .pipe(es.through(function(data) { + .pipe(es.through(function (data) { this.emit('data', new File({ path: data.path.replace(/README-npm\.md/, 'README.md'), base: data.base, @@ -124,10 +126,10 @@ gulp.task('editor-distro', ['clean-editor-distro', 'minify-editor', 'optimize-ed // min folder es.merge( gulp.src('out-editor-min/**/*') - ).pipe(filterStream(function(path) { + ).pipe(filterStream(function (path) { // no map files return !/(\.js\.map$)|(nls\.metadata\.json$)|(bundleInfo\.json$)/.test(path); - })).pipe(es.through(function(data) { + })).pipe(es.through(function (data) { // tweak the sourceMappingURL if (!/\.js$/.test(data.path)) { this.emit('data', data); @@ -147,42 +149,43 @@ gulp.task('editor-distro', ['clean-editor-distro', 'minify-editor', 'optimize-ed // min-maps folder es.merge( gulp.src('out-editor-min/**/*') - ).pipe(filterStream(function(path) { + ).pipe(filterStream(function (path) { // no map files return /\.js\.map$/.test(path); })).pipe(gulp.dest('out-monaco-editor-core/min-maps')) ); }); -gulp.task('analyze-editor-distro', function() { +gulp.task('analyze-editor-distro', function () { + // @ts-ignore Microsoft/TypeScript#21262 complains about a require of a JSON file var bundleInfo = require('../out-editor/bundleInfo.json'); var graph = bundleInfo.graph; var bundles = bundleInfo.bundles; var inverseGraph = {}; - Object.keys(graph).forEach(function(module) { + Object.keys(graph).forEach(function (module) { var dependencies = graph[module]; - dependencies.forEach(function(dep) { + dependencies.forEach(function (dep) { inverseGraph[dep] = inverseGraph[dep] || []; inverseGraph[dep].push(module); }); }); var detailed = {}; - Object.keys(bundles).forEach(function(entryPoint) { + Object.keys(bundles).forEach(function (entryPoint) { var included = bundles[entryPoint]; var includedMap = {}; - included.forEach(function(included) { + included.forEach(function (included) { includedMap[included] = true; }); var explanation = []; - included.map(function(included) { + included.map(function (included) { if (included.indexOf('!') >= 0) { return; } - var reason = (inverseGraph[included]||[]).filter(function(mod) { + var reason = (inverseGraph[included] || []).filter(function (mod) { return !!includedMap[mod]; }); explanation.push({ @@ -198,7 +201,7 @@ gulp.task('analyze-editor-distro', function() { }); function filterStream(testFunc) { - return es.through(function(data) { + return es.through(function (data) { if (!testFunc(data.relative)) { return; } diff --git a/build/gulpfile.extensions.js b/build/gulpfile.extensions.js index 55094f4f449..ac1b08c6fd2 100644 --- a/build/gulpfile.extensions.js +++ b/build/gulpfile.extensions.js @@ -31,7 +31,7 @@ const compilations = glob.sync('**/tsconfig.json', { const getBaseUrl = out => `https://ticino.blob.core.windows.net/sourcemaps/${commit}/${out}`; -const languages = i18n.defaultLanguages.concat(process.env.VSCODE_QUALITY !== 'stable' ? i18n.extraLanguages: []); +const languages = i18n.defaultLanguages.concat(process.env.VSCODE_QUALITY !== 'stable' ? i18n.extraLanguages : []); const tasks = compilations.map(function (tsconfigFile) { const absolutePath = path.join(extensionsPath, tsconfigFile); @@ -94,8 +94,11 @@ const tasks = compilations.map(function (tsconfigFile) { sourceRoot: '../src' })) .pipe(tsFilter.restore) + // @ts-ignore review .pipe(build ? nlsDev.createAdditionalLanguageFiles(languages, i18nPath, out) : es.through()) + // @ts-ignore review .pipe(build ? nlsDev.bundleMetaDataFiles(headerId, headerOut) : es.through()) + // @ts-ignore review .pipe(build ? nlsDev.bundleLanguageFiles() : es.through()) .pipe(reporter.end(emitError)); @@ -143,6 +146,7 @@ const tasks = compilations.map(function (tsconfigFile) { const watchInput = watcher(src, srcOpts); return watchInput + // @ts-ignore review .pipe(util.incremental(() => pipeline(true), input)) .pipe(gulp.dest(out)); }); diff --git a/build/gulpfile.hygiene.js b/build/gulpfile.hygiene.js index ec9108dc67f..edefbf721a4 100644 --- a/build/gulpfile.hygiene.js +++ b/build/gulpfile.hygiene.js @@ -151,8 +151,8 @@ gulp.task('tslint', () => { return vfs.src(all, { base: '.', follow: true, allowEmpty: true }) .pipe(filter(tslintFilter)) - .pipe(gulptslint({ rulesDirectory: 'build/lib/tslint' })) - .pipe(gulptslint.report(options)); + .pipe(gulptslint.default({ rulesDirectory: 'build/lib/tslint' })) + .pipe(gulptslint.default.report(options)); }); const hygiene = exports.hygiene = (some, options) => { @@ -202,6 +202,11 @@ const hygiene = exports.hygiene = (some, options) => { verify: true, tsfmt: true, // verbose: true + // keep checkJS happy + editorconfig: undefined, + replace: undefined, + tsconfig: undefined, + tslint: undefined }).then(result => { if (result.error) { console.error(result.message); @@ -261,12 +266,12 @@ const hygiene = exports.hygiene = (some, options) => { const tslintResult = linter.getResult(); if (tslintResult.failures.length > 0) { for (const failure of tslintResult.failures) { - const name = failure.name || failure.fileName; - const position = failure.startPosition; - const line = position.lineAndCharacter ? position.lineAndCharacter.line : position.line; - const character = position.lineAndCharacter ? position.lineAndCharacter.character : position.character; + const name = failure.getFailure() || failure.getFileName; + const position = failure.getStartPosition(); + const line = position.getLineAndCharacter().line; + const character = position.getLineAndCharacter().character; - console.error(`${name}:${line + 1}:${character + 1}:${failure.failure}`); + console.error(`${name}:${line + 1}:${character + 1}:${failure.getFailure()}`); } errorCount += tslintResult.failures.length; diff --git a/build/gulpfile.mixin.js b/build/gulpfile.mixin.js index abf3ce4a90c..a370981ab3c 100644 --- a/build/gulpfile.mixin.js +++ b/build/gulpfile.mixin.js @@ -14,6 +14,8 @@ const util = require('./lib/util'); const remote = require('gulp-remote-src'); const zip = require('gulp-vinyl-zip'); const assign = require('object-assign'); + +// @ts-ignore Microsoft/TypeScript#21262 complains about a require of a JSON file const pkg = require('../package.json'); gulp.task('mixin', function () { @@ -54,6 +56,7 @@ gulp.task('mixin', function () { .pipe(util.rebase(2)) .pipe(productJsonFilter) .pipe(buffer()) + // @ts-ignore Microsoft/TypeScript#21262 complains about a require of a JSON file .pipe(json(o => assign({}, require('../product.json'), o))) .pipe(productJsonFilter.restore); diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js index 69c7b1b4af9..849a8a1018d 100644 --- a/build/gulpfile.vscode.js +++ b/build/gulpfile.vscode.js @@ -27,7 +27,9 @@ const common = require('./lib/optimize'); const nlsDev = require('vscode-nls-dev'); const root = path.dirname(__dirname); const commit = util.getVersion(root); +// @ts-ignore Microsoft/TypeScript#21262 complains about a require of a JSON file const packageJson = require('../package.json'); +// @ts-ignore Microsoft/TypeScript#21262 complains about a require of a JSON file const product = require('../product.json'); const crypto = require('crypto'); const i18n = require('./lib/i18n'); @@ -37,6 +39,7 @@ const getElectronVersion = require('./lib/electron').getElectronVersion; // const createAsar = require('./lib/asar').createAsar; const productionDependencies = deps.getProductionDependencies(path.dirname(__dirname)); +//@ts-ignore review const baseModules = Object.keys(process.binding('natives')).filter(n => !/^_|\//.test(n)); const nodeModules = ['electron', 'original-fs'] .concat(Object.keys(product.dependencies || {})) @@ -44,8 +47,8 @@ const nodeModules = ['electron', 'original-fs'] .concat(baseModules); // Build - -const builtInExtensions = require('./builtInExtensions'); +// @ts-ignore Microsoft/TypeScript#21262 complains about a require of a JSON file +const builtInExtensions = require('./builtInExtensions.json'); const excludedExtensions = [ 'vscode-api-tests', @@ -104,6 +107,8 @@ gulp.task('optimize-vscode', ['clean-optimized-vscode', 'compile-build', 'compil header: BUNDLED_FILE_HEADER, out: 'out-vscode', languages: languages, + // @ts-ignore review + bundleInfo: undefined })); @@ -245,6 +250,7 @@ function packageTask(platform, arch, opts) { // // TODO@Dirk: this filter / buffer is here to make sure the nls.json files are buffered .pipe(nlsFilter) .pipe(buffer()) + //@ts-ignore review .pipe(nlsDev.createAdditionalLanguageFiles(languages, path.join(__dirname, '..', 'i18n'))) .pipe(nlsFilter.restore); })); @@ -297,6 +303,7 @@ function packageTask(platform, arch, opts) { .pipe(util.cleanNodeModule('native-is-elevated', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], ['**/*.node'])) .pipe(util.cleanNodeModule('native-watchdog', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node'])) .pipe(util.cleanNodeModule('spdlog', ['binding.gyp', 'build/**', 'deps/**', 'src/**', 'test/**'], ['**/*.node'])) + //@ts-ignore review .pipe(util.cleanNodeModule('jschardet', ['dist/**'])) .pipe(util.cleanNodeModule('windows-foreground-love', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node'])) .pipe(util.cleanNodeModule('windows-process-tree', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node'])) @@ -305,7 +312,7 @@ function packageTask(platform, arch, opts) { .pipe(util.cleanNodeModule('node-pty', ['binding.gyp', 'build/**', 'src/**', 'tools/**'], ['build/Release/*.exe', 'build/Release/*.dll', 'build/Release/*.node'])) .pipe(util.cleanNodeModule('nsfw', ['binding.gyp', 'build/**', 'src/**', 'openpa/**', 'includes/**'], ['**/*.node', '**/*.a'])) .pipe(util.cleanNodeModule('vsda', ['binding.gyp', 'README.md', 'build/**', '*.bat', '*.sh', '*.cpp', '*.h'], ['build/Release/vsda.node'])); - // .pipe(createAsar(path.join(process.cwd(), 'node_modules'), ['**/*.node', '**/vscode-ripgrep/bin/*', '**/node-pty/build/Release/*'], 'app/node_modules.asar')); + // .pipe(createAsar(path.join(process.cwd(), 'node_modules'), ['**/*.node', '**/vscode-ripgrep/bin/*', '**/node-pty/build/Release/*'], 'app/node_modules.asar')); let all = es.merge( packageJsonStream, @@ -401,7 +408,7 @@ const apiHostname = process.env.TRANSIFEX_API_URL; const apiName = process.env.TRANSIFEX_API_NAME; const apiToken = process.env.TRANSIFEX_API_TOKEN; -gulp.task('vscode-translations-push', [ 'optimize-vscode' ], function () { +gulp.task('vscode-translations-push', ['optimize-vscode'], function () { const pathToMetadata = './out-vscode/nls.metadata.json'; const pathToExtensions = './extensions/*'; const pathToSetup = 'build/win32/**/{Default.isl,messages.en.isl}'; @@ -411,10 +418,10 @@ gulp.task('vscode-translations-push', [ 'optimize-vscode' ], function () { gulp.src(pathToSetup).pipe(i18n.createXlfFilesForIsl()), gulp.src(pathToExtensions).pipe(i18n.createXlfFilesForExtensions()) ).pipe(i18n.findObsoleteResources(apiHostname, apiName, apiToken) - ).pipe(i18n.pushXlfFiles(apiHostname, apiName, apiToken)); + ).pipe(i18n.pushXlfFiles(apiHostname, apiName, apiToken)); }); -gulp.task('vscode-translations-push-test', [ 'optimize-vscode' ], function () { +gulp.task('vscode-translations-push-test', ['optimize-vscode'], function () { const pathToMetadata = './out-vscode/nls.metadata.json'; const pathToExtensions = './extensions/*'; const pathToSetup = 'build/win32/**/{Default.isl,messages.en.isl}'; @@ -424,7 +431,7 @@ gulp.task('vscode-translations-push-test', [ 'optimize-vscode' ], function () { gulp.src(pathToSetup).pipe(i18n.createXlfFilesForIsl()), gulp.src(pathToExtensions).pipe(i18n.createXlfFilesForExtensions()) ).pipe(i18n.findObsoleteResources(apiHostname, apiName, apiToken) - ).pipe(vfs.dest('../vscode-transifex-input')); + ).pipe(vfs.dest('../vscode-transifex-input')); }); gulp.task('vscode-translations-pull', function () { @@ -439,6 +446,7 @@ gulp.task('vscode-translations-pull', function () { gulp.task('vscode-translations-import', function () { [...i18n.defaultLanguages, ...i18n.extraLanguages].forEach(language => { gulp.src(`../vscode-localization/${language.id}/build/*/*.xlf`) + //@ts-ignore review .pipe(i18n.prepareI18nFiles(language)) .pipe(vfs.dest(`./i18n/${language.folderName}`)); gulp.src(`../vscode-localization/${language.id}/setup/*/*.xlf`) @@ -470,6 +478,7 @@ gulp.task('upload-vscode-sourcemaps', ['minify-vscode'], () => { const allConfigDetailsPath = path.join(os.tmpdir(), 'configuration.json'); gulp.task('upload-vscode-configuration', ['generate-vscode-configuration'], () => { const branch = process.env.BUILD_SOURCEBRANCH; + //@ts-ignore review if (!branch.endsWith('/master') && branch.indexOf('/release/') < 0) { console.log(`Only runs on master and release branches, not ${branch}`); return; diff --git a/build/gulpfile.vscode.linux.js b/build/gulpfile.vscode.linux.js index 28f062bf749..a658758de98 100644 --- a/build/gulpfile.vscode.linux.js +++ b/build/gulpfile.vscode.linux.js @@ -12,9 +12,12 @@ const shell = require('gulp-shell'); const es = require('event-stream'); const vfs = require('vinyl-fs'); const util = require('./lib/util'); +// @ts-ignore Microsoft/TypeScript#21262 complains about a require of a JSON file const packageJson = require('../package.json'); +// @ts-ignore Microsoft/TypeScript#21262 complains about a require of a JSON file const product = require('../product.json'); -const rpmDependencies = require('../resources/linux/rpm/dependencies'); +// @ts-ignore Microsoft/TypeScript#21262 complains about a require of a JSON file +const rpmDependencies = require('../resources/linux/rpm/dependencies.json'); const linuxPackageRevision = Math.floor(new Date().getTime() / 1000); diff --git a/build/gulpfile.vscode.win32.js b/build/gulpfile.vscode.win32.js index 15459f7dae8..636d9e8300b 100644 --- a/build/gulpfile.vscode.win32.js +++ b/build/gulpfile.vscode.win32.js @@ -11,7 +11,9 @@ const assert = require('assert'); const cp = require('child_process'); const _7z = require('7zip')['7z']; const util = require('./lib/util'); +// @ts-ignore Microsoft/TypeScript#21262 complains about a require of a JSON file const pkg = require('../package.json'); +// @ts-ignore Microsoft/TypeScript#21262 complains about a require of a JSON file const product = require('../product.json'); const vfs = require('vinyl-fs'); @@ -78,7 +80,7 @@ gulp.task('vscode-win32-x64-setup', ['clean-vscode-win32-x64-setup'], buildWin32 function archiveWin32Setup(arch) { return cb => { - const args = ['a', '-tzip', zipPath(arch), '.', '-r', '-x!inno_updater.exe']; + const args = ['a', '-tzip', zipPath(arch), '.', '-r']; cp.spawn(_7z, args, { stdio: 'inherit', cwd: buildPath(arch) }) .on('error', cb) @@ -94,8 +96,8 @@ gulp.task('vscode-win32-x64-archive', ['clean-vscode-win32-x64-archive'], archiv function copyInnoUpdater(arch) { return () => { - return gulp.src('build/win32/inno_updater.exe', { base: 'build/win32' }) - .pipe(vfs.dest(buildPath(arch))); + return gulp.src('build/win32/{inno_updater.exe,vcruntime140.dll}', { base: 'build/win32' }) + .pipe(vfs.dest(path.join(buildPath(arch), 'tools'))); }; } diff --git a/build/lib/builtInExtensions.js b/build/lib/builtInExtensions.js index 245509379c1..c538416ce4d 100644 --- a/build/lib/builtInExtensions.js +++ b/build/lib/builtInExtensions.js @@ -17,7 +17,8 @@ const ext = require('./extensions'); const util = require('gulp-util'); const root = path.dirname(path.dirname(__dirname)); -const builtInExtensions = require('../builtInExtensions'); +// @ts-ignore Microsoft/TypeScript#21262 complains about a require of a JSON file +const builtInExtensions = require('../builtInExtensions.json'); const controlFilePath = path.join(os.homedir(), '.vscode-oss-dev', 'extensions', 'control.json'); function getExtensionPath(extension) { @@ -34,6 +35,7 @@ function isUpToDate(extension) { const packageContents = fs.readFileSync(packagePath); try { + //@ts-ignore review const diskVersion = JSON.parse(packageContents).version; return (diskVersion === extension.version); } catch (err) { diff --git a/build/lib/bundle.js b/build/lib/bundle.js index 89c5b9b50bd..d7e142e5e36 100644 --- a/build/lib/bundle.js +++ b/build/lib/bundle.js @@ -217,6 +217,7 @@ function removeDuplicateTSBoilerplate(destFiles) { { start: /^var __metadata/, end: /^};$/ }, { start: /^var __param/, end: /^};$/ }, { start: /^var __awaiter/, end: /^};$/ }, + { start: /^var __generator/, end: /^};$/ }, ]; destFiles.forEach(function (destFile) { var SEEN_BOILERPLATE = []; diff --git a/build/lib/bundle.ts b/build/lib/bundle.ts index e188ce44de1..da38acec4f4 100644 --- a/build/lib/bundle.ts +++ b/build/lib/bundle.ts @@ -44,11 +44,11 @@ interface ILoaderPluginReqFunc { export interface IEntryPoint { name: string; - include: string[]; - exclude: string[]; + include?: string[]; + exclude?: string[]; prepend: string[]; - append: string[]; - dest: string; + append?: string[]; + dest?: string; } interface IEntryPointMap { @@ -339,6 +339,7 @@ function removeDuplicateTSBoilerplate(destFiles: IConcatFile[]): IConcatFile[] { { start: /^var __metadata/, end: /^};$/ }, { start: /^var __param/, end: /^};$/ }, { start: /^var __awaiter/, end: /^};$/ }, + { start: /^var __generator/, end: /^};$/ }, ]; destFiles.forEach((destFile) => { diff --git a/build/lib/i18n.resources.json b/build/lib/i18n.resources.json index a94b0a43327..28ff359e8d5 100644 --- a/build/lib/i18n.resources.json +++ b/build/lib/i18n.resources.json @@ -146,6 +146,10 @@ "name": "vs/workbench/services/crashReporter", "project": "vscode-workbench" }, + { + "name": "vs/workbench/services/dialogs", + "project": "vscode-workbench" + }, { "name": "vs/workbench/services/editor", "project": "vscode-workbench" @@ -162,10 +166,6 @@ "name": "vs/workbench/services/keybinding", "project": "vscode-workbench" }, - { - "name": "vs/workbench/services/message", - "project": "vscode-workbench" - }, { "name": "vs/workbench/services/mode", "project": "vscode-workbench" diff --git a/build/lib/optimize.ts b/build/lib/optimize.ts index c47f513e436..bf818454343 100644 --- a/build/lib/optimize.ts +++ b/build/lib/optimize.ts @@ -30,7 +30,7 @@ function log(prefix: string, message: string): void { gulpUtil.log(gulpUtil.colors.cyan('[' + prefix + ']'), message); } -export function loaderConfig(emptyPaths: string[]) { +export function loaderConfig(emptyPaths?: string[]) { const result = { paths: { 'vs': 'out-build/vs', @@ -293,7 +293,7 @@ function uglifyWithCopyrights(): NodeJS.ReadWriteStream { return es.duplex(input, output); } -export function minifyTask(src: string, sourceMapBaseUrl: string): (cb: any) => void { +export function minifyTask(src: string, sourceMapBaseUrl?: string): (cb: any) => void { const sourceMappingURL = sourceMapBaseUrl && (f => `${sourceMapBaseUrl}/${f.relative}.map`); return cb => { diff --git a/build/lib/util.js b/build/lib/util.js index f9f3f7a792a..679e049f5a5 100644 --- a/build/lib/util.js +++ b/build/lib/util.js @@ -173,7 +173,6 @@ function rimraf(dir) { if (!err) { return cb(); } - ; if (err.code === 'ENOTEMPTY' && ++retries < 5) { return setTimeout(function () { return retry(cb); }, 10); } diff --git a/build/lib/util.ts b/build/lib/util.ts index 8f4f1ea75e9..9a4a2b44346 100644 --- a/build/lib/util.ts +++ b/build/lib/util.ts @@ -28,7 +28,7 @@ export interface IStreamProvider { (cancellationToken?: ICancellationToken): NodeJS.ReadWriteStream; } -export function incremental(streamProvider: IStreamProvider, initial: NodeJS.ReadWriteStream, supportsCancellation: boolean): NodeJS.ReadWriteStream { +export function incremental(streamProvider: IStreamProvider, initial: NodeJS.ReadWriteStream, supportsCancellation?: boolean): NodeJS.ReadWriteStream { const input = es.through(); const output = es.through(); let state = 'idle'; @@ -223,7 +223,7 @@ export function rimraf(dir: string): (cb: any) => void { _rimraf(dir, { maxBusyTries: 1 }, (err: any) => { if (!err) { return cb(); - }; + } if (err.code === 'ENOTEMPTY' && ++retries < 5) { return setTimeout(() => retry(cb), 10); diff --git a/build/lib/watch/watch-nsfw.js b/build/lib/watch/watch-nsfw.js index c9fe9192f31..306ab481039 100644 --- a/build/lib/watch/watch-nsfw.js +++ b/build/lib/watch/watch-nsfw.js @@ -30,12 +30,12 @@ function watch(root) { path: path, base: root }); - + //@ts-ignore review file.event = type; result.emit('data', file); } - nsfw(root, function(events) { + nsfw(root, function (events) { for (var i = 0; i < events.length; i++) { var e = events[i]; var changeType = e.action; @@ -47,16 +47,16 @@ function watch(root) { handleEvent(path.join(e.directory, e.file), toChangeType(changeType)); } } - }).then(function(watcher) { + }).then(function (watcher) { watcher.start(); - }); + }); - return result; + return result; } var cache = Object.create(null); -module.exports = function(pattern, options) { +module.exports = function (pattern, options) { options = options || {}; var cwd = path.normalize(options.cwd || process.cwd()); @@ -66,7 +66,7 @@ module.exports = function(pattern, options) { watcher = cache[cwd] = watch(cwd); } - var rebase = !options.base ? es.through() : es.mapSync(function(f) { + var rebase = !options.base ? es.through() : es.mapSync(function (f) { f.base = options.base; return f; }); @@ -74,13 +74,13 @@ module.exports = function(pattern, options) { return watcher .pipe(filter(['**', '!.git{,/**}'])) // ignore all things git .pipe(filter(pattern)) - .pipe(es.map(function(file, cb) { - fs.stat(file.path, function(err, stat) { + .pipe(es.map(function (file, cb) { + fs.stat(file.path, function (err, stat) { if (err && err.code === 'ENOENT') { return cb(null, file); } if (err) { return cb(); } if (!stat.isFile()) { return cb(); } - fs.readFile(file.path, function(err, contents) { + fs.readFile(file.path, function (err, contents) { if (err && err.code === 'ENOENT') { return cb(null, file); } if (err) { return cb(); } diff --git a/build/lib/watch/watch-win32.js b/build/lib/watch/watch-win32.js index a6c4ea66470..de9c76c90d6 100644 --- a/build/lib/watch/watch-win32.js +++ b/build/lib/watch/watch-win32.js @@ -24,7 +24,8 @@ function watch(root) { var result = es.through(); var child = cp.spawn(watcherPath, [root]); - child.stdout.on('data', function(data) { + child.stdout.on('data', function (data) { + //@ts-ignore review var lines = data.toString('utf8').split('\n'); for (var i = 0; i < lines.length; i++) { var line = lines[i].trim(); @@ -46,17 +47,17 @@ function watch(root) { path: changePathFull, base: root }); - + //@ts-ignore review file.event = toChangeType(changeType); result.emit('data', file); } }); - child.stderr.on('data', function(data) { + child.stderr.on('data', function (data) { result.emit('error', data); }); - child.on('exit', function(code) { + child.on('exit', function (code) { result.emit('error', 'Watcher died with code ' + code); child = null; }); @@ -70,7 +71,7 @@ function watch(root) { var cache = Object.create(null); -module.exports = function(pattern, options) { +module.exports = function (pattern, options) { options = options || {}; var cwd = path.normalize(options.cwd || process.cwd()); diff --git a/build/npm/postinstall.js b/build/npm/postinstall.js index 4d7b1524998..5a2eb75d6b4 100644 --- a/build/npm/postinstall.js +++ b/build/npm/postinstall.js @@ -49,6 +49,7 @@ extensions.forEach(extension => yarnInstall(`extensions/${extension}`)); function yarnInstallBuildDependencies() { // make sure we install the deps of build/lib/watch for the system installed // node, since that is the driver of gulp + //@ts-ignore review const env = Object.assign({}, process.env); const watchPath = path.join(path.dirname(__dirname), 'lib', 'watch'); const yarnrcPath = path.join(watchPath, '.yarnrc'); diff --git a/build/npm/update-grammar.js b/build/npm/update-grammar.js index d65112b3456..822de7c59c2 100644 --- a/build/npm/update-grammar.js +++ b/build/npm/update-grammar.js @@ -37,12 +37,16 @@ function download(url, redirectCount) { response.on('data', function (data) { content += data.toString(); }).on('end', function () { + if (response.statusCode === 403 && response.headers['x-ratelimit-remaining'] === '0') { + e('GitHub API rate exceeded. Set GITHUB_TOKEN environment variable to increase rate limit.'); + return; + } let count = redirectCount || 0; if (count < 5 && response.statusCode >= 300 && response.statusCode <= 303 || response.statusCode === 307) { let location = response.headers['location']; if (location) { console.log("Redirected " + url + " to " + location); - download(location, count+1).then(c, e); + download(location, count + 1).then(c, e); return; } } @@ -64,12 +68,8 @@ function getCommitSha(repoId, repoPath) { commitDate: lastCommit.commit.author.date }); } catch (e) { - console.error("Failed extracting the SHA: " + content); - return Promise.resolve(null); + return Promise.reject(new Error("Failed extracting the SHA: " + content)); } - }, function () { - console.error('Failed loading ' + commitInfo); - return Promise.resolve(null); }); } @@ -86,8 +86,7 @@ exports.update = function (repoId, repoPath, dest, modifyGrammar, version = 'mas } else if (ext === '.json') { grammar = JSON.parse(content); } else { - console.error('Unknown file extension: ' + ext); - return; + return Promise.reject(new Error('Unknown file extension: ' + ext)); } if (modifyGrammar) { modifyGrammar(grammar); @@ -104,8 +103,10 @@ exports.update = function (repoId, repoPath, dest, modifyGrammar, version = 'mas if (info) { result.version = 'https://github.com/' + repoId + '/commit/' + info.commitSha; } - for (let key in grammar) { - if (!result.hasOwnProperty(key)) { + + let keys = ['name', 'scopeName', 'comment', 'injections', 'patterns', 'repository']; + for (let key of keys) { + if (grammar.hasOwnProperty(key)) { result[key] = grammar[key]; } } @@ -118,11 +119,14 @@ exports.update = function (repoId, repoPath, dest, modifyGrammar, version = 'mas console.log('Updated ' + path.basename(dest)); } } catch (e) { - console.error(e); + return Promise.reject(e); } }); - }, console.error); + }, console.error).catch(e => { + console.error(e); + process.exit(1); + }); }; if (path.basename(process.argv[1]) === 'update-grammar.js') { diff --git a/build/npm/update-localization-extension.js b/build/npm/update-localization-extension.js index ca41f25783e..985fbd28cb7 100644 --- a/build/npm/update-localization-extension.js +++ b/build/npm/update-localization-extension.js @@ -15,7 +15,6 @@ let rimraf = require('rimraf'); function update(idOrPath) { if (!idOrPath) { throw new Error('Argument must be the location of the localization extension.'); - return; } let locExtFolder = idOrPath; if (/^\w{2}(-\w+)?$/.test(idOrPath)) { diff --git a/build/package.json b/build/package.json index 25acf1c2251..bcc32e8dec0 100644 --- a/build/package.json +++ b/build/package.json @@ -17,8 +17,9 @@ "xml2js": "^0.4.17" }, "scripts": { - "compile": "tsc", - "watch": "tsc --watch", - "postinstall": "npm run compile" + "compile": "tsc -p tsconfig.build.json", + "watch": "tsc -p tsconfig.build.json --watch", + "postinstall": "npm run compile", + "npmCheckJs": "tsc --noEmit" } } \ No newline at end of file diff --git a/build/tsconfig.build.json b/build/tsconfig.build.json new file mode 100644 index 00000000000..2402a092886 --- /dev/null +++ b/build/tsconfig.build.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "allowJs": false, + "checkJs": false + } +} \ No newline at end of file diff --git a/build/tsconfig.json b/build/tsconfig.json index 04f3963055d..b68c9b6dafa 100644 --- a/build/tsconfig.json +++ b/build/tsconfig.json @@ -7,7 +7,12 @@ "preserveConstEnums": true, "sourceMap": false, "experimentalDecorators": true, - "newLine": "LF" + "newLine": "LF", + // enable JavaScript type checking for the language service + // use the tsconfig.build.json for compiling wich disable JavaScript + // type checking so that JavaScript file are not transpiled + "allowJs": true, + "checkJs": true }, "exclude": [ "node_modules/**" diff --git a/build/win32/code.iss b/build/win32/code.iss index 22c0096e0c5..7cadcd9a5c1 100644 --- a/build/win32/code.iss +++ b/build/win32/code.iss @@ -57,7 +57,6 @@ Type: files; Name: "{app}\resources\app\Credits_45.0.2454.85.html"; Check: IsNot [UninstallDelete] Type: filesandordirs; Name: "{app}\_" -Type: filesandordirs; Name: "{app}\old" [Tasks] Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked @@ -69,8 +68,8 @@ Name: "addtopath"; Description: "{cm:AddToPath}"; GroupDescription: "{cm:Other}" Name: "runcode"; Description: "{cm:RunAfter,{#NameShort}}"; GroupDescription: "{cm:Other}"; Check: WizardSilent [Files] -Source: "*"; Excludes: "inno_updater.exe"; DestDir: "{code:GetDestDir}"; Flags: ignoreversion recursesubdirs createallsubdirs -Source: "inno_updater.exe"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "*"; Excludes: "\tools,\tools\*"; DestDir: "{code:GetDestDir}"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "tools\*"; DestDir: "{app}\tools"; Flags: ignoreversion [Icons] Name: "{group}\{#NameLong}"; Filename: "{app}\{#ExeBasename}.exe"; AppUserModelID: "{#AppUserId}" @@ -1027,7 +1026,7 @@ begin Sleep(1000); end; - Exec(ExpandConstant('{app}\inno_updater.exe'), ExpandConstant('"{app}\{#ExeBasename}.exe" ' + BoolToStr(LockFileExists())), '', SW_SHOW, ewWaitUntilTerminated, UpdateResultCode); + Exec(ExpandConstant('{app}\tools\inno_updater.exe'), ExpandConstant('"{app}\{#ExeBasename}.exe" ' + BoolToStr(LockFileExists())), '', SW_SHOW, ewWaitUntilTerminated, UpdateResultCode); end; end; diff --git a/build/win32/inno_updater.exe b/build/win32/inno_updater.exe index ffc04fb7661..05441e94e15 100644 Binary files a/build/win32/inno_updater.exe and b/build/win32/inno_updater.exe differ diff --git a/build/win32/vcruntime140.dll b/build/win32/vcruntime140.dll new file mode 100644 index 00000000000..d26d2948972 Binary files /dev/null and b/build/win32/vcruntime140.dll differ diff --git a/extensions/bat/language-configuration.json b/extensions/bat/language-configuration.json index 2fb5445a34a..2064cd941ca 100644 --- a/extensions/bat/language-configuration.json +++ b/extensions/bat/language-configuration.json @@ -11,7 +11,8 @@ ["{", "}"], ["[", "]"], ["(", ")"], - ["\"", "\""] + ["\"", "\""], + ["`", "`"] ], "surroundingPairs": [ ["{", "}"], diff --git a/extensions/bat/package.json b/extensions/bat/package.json index d9f1cba592b..e5809eb032e 100644 --- a/extensions/bat/package.json +++ b/extensions/bat/package.json @@ -1,5 +1,7 @@ { "name": "bat", + "displayName": "%displayName%", + "description": "%description%", "version": "0.1.0", "publisher": "vscode", "engines": { "vscode": "*" }, diff --git a/extensions/bat/package.nls.json b/extensions/bat/package.nls.json new file mode 100644 index 00000000000..a3842b35c73 --- /dev/null +++ b/extensions/bat/package.nls.json @@ -0,0 +1,4 @@ +{ + "displayName": "Windows Bat Language Features", + "description": "Provides Syntax highlighting, Folding, Bracket matching, Snippets and other language features in Windows batch files" +} \ No newline at end of file diff --git a/extensions/bat/syntaxes/batchfile.tmLanguage.json b/extensions/bat/syntaxes/batchfile.tmLanguage.json index 42adcf64854..2aee0692ad8 100644 --- a/extensions/bat/syntaxes/batchfile.tmLanguage.json +++ b/extensions/bat/syntaxes/batchfile.tmLanguage.json @@ -5,12 +5,8 @@ "Once accepted there, we are happy to receive an update request." ], "version": "https://github.com/mmims/language-batchfile/commit/3dd105c31484e5975144478dac1aa91d8f51e528", - "scopeName": "source.batchfile", "name": "Batch File", - "fileTypes": [ - "bat", - "cmd" - ], + "scopeName": "source.batchfile", "patterns": [ { "include": "#commands" diff --git a/extensions/clojure/package.json b/extensions/clojure/package.json index b404ef5fb8a..7be42cc30c1 100644 --- a/extensions/clojure/package.json +++ b/extensions/clojure/package.json @@ -1,5 +1,7 @@ { "name": "clojure", + "displayName": "%displayName%", + "description": "%description%", "version": "0.1.0", "publisher": "vscode", "engines": { "vscode": "*" }, diff --git a/extensions/clojure/package.nls.json b/extensions/clojure/package.nls.json new file mode 100644 index 00000000000..d443e17ed45 --- /dev/null +++ b/extensions/clojure/package.nls.json @@ -0,0 +1,4 @@ +{ + "displayName": "Clojure Language Features", + "description": "Provides Syntax highlighting, Bracket matching and other language features in Clojure files" +} \ No newline at end of file diff --git a/extensions/clojure/syntaxes/clojure.tmLanguage.json b/extensions/clojure/syntaxes/clojure.tmLanguage.json index 033e3e2a178..3d059513af0 100644 --- a/extensions/clojure/syntaxes/clojure.tmLanguage.json +++ b/extensions/clojure/syntaxes/clojure.tmLanguage.json @@ -5,25 +5,8 @@ "Once accepted there, we are happy to receive an update request." ], "version": "https://github.com/atom/language-clojure/commit/ecc790326bc8e14220e4d2d72a392a30876c3219", - "scopeName": "source.clojure", - "fileTypes": [ - "boot", - "clj", - "clj.hl", - "cljc", - "cljs", - "cljs.hl", - "cljx", - "clojure", - "edn", - "org", - "joke", - "joker" - ], - "foldingStartMarker": "\\(\\s*$", - "foldingStopMarker": "^\\s*\\)", - "firstLineMatch": "(?x)\n# Hashbang\n^\\#!.*(?:\\s|\\/)\n boot\n(?:$|\\s)\n|\n# Modeline\n(?i:\n # Emacs\n -\\*-(?:\\s*(?=[^:;\\s]+\\s*-\\*-)|(?:.*?[;\\s]|(?<=-\\*-))mode\\s*:\\s*)\n clojure(script)?\n (?=[\\s;]|(?]?\\d+|m)?|\\sex)(?=:(?=\\s*set?\\s[^\\n:]+:)|:(?!\\s*set?\\s))(?:(?:\\s|\\s*:\\s*)\\w*(?:\\s*=(?:[^\\n\\\\\\s]|\\\\.)*)?)*[\\s:](?:filetype|ft|syntax)\\s*=\n clojure\n (?=\\s|:|$)\n)", "name": "Clojure", + "scopeName": "source.clojure", "patterns": [ { "include": "#comment" diff --git a/extensions/coffeescript/package.json b/extensions/coffeescript/package.json index c688f7b0836..706b55220ce 100644 --- a/extensions/coffeescript/package.json +++ b/extensions/coffeescript/package.json @@ -1,5 +1,7 @@ { "name": "coffeescript", + "displayName": "%displayName%", + "description": "%description%", "version": "0.1.0", "publisher": "vscode", "engines": { "vscode": "*" }, diff --git a/extensions/coffeescript/package.nls.json b/extensions/coffeescript/package.nls.json new file mode 100644 index 00000000000..e891ba0ab2a --- /dev/null +++ b/extensions/coffeescript/package.nls.json @@ -0,0 +1,4 @@ +{ + "displayName": "Coffeescript Language Features", + "description": "Provides Syntax highlighting, Folding, Bracket matching, Snippets and other language features in Coffeescript files" +} \ No newline at end of file diff --git a/extensions/coffeescript/syntaxes/coffeescript.tmLanguage.json b/extensions/coffeescript/syntaxes/coffeescript.tmLanguage.json index 0e4c904a029..5fcff295c61 100644 --- a/extensions/coffeescript/syntaxes/coffeescript.tmLanguage.json +++ b/extensions/coffeescript/syntaxes/coffeescript.tmLanguage.json @@ -5,16 +5,8 @@ "Once accepted there, we are happy to receive an update request." ], "version": "https://github.com/atom/language-coffee-script/commit/a0da2a73ad817e2fc13c2ef8fcd2624017c39610", - "scopeName": "source.coffee", "name": "CoffeeScript", - "fileTypes": [ - "coffee", - "Cakefile", - "coffee.erb", - "cson", - "_coffee" - ], - "firstLineMatch": "(?x)\n# Hashbang\n^\\#!.*(?:\\s|\\/)\n coffee\n(?:$|\\s)\n|\n# Modeline\n(?i:\n # Emacs\n -\\*-(?:\\s*(?=[^:;\\s]+\\s*-\\*-)|(?:.*?[;\\s]|(?<=-\\*-))mode\\s*:\\s*)\n coffee\n (?=[\\s;]|(?]?\\d+|m)?|\\sex)(?=:(?=\\s*set?\\s[^\\n:]+:)|:(?!\\s*set?\\s))(?:(?:\\s|\\s*:\\s*)\\w*(?:\\s*=(?:[^\\n\\\\\\s]|\\\\.)*)?)*[\\s:](?:filetype|ft|syntax)\\s*=\n coffee\n (?=\\s|:|$)\n)", + "scopeName": "source.coffee", "patterns": [ { "match": "(new)\\s+(?:(?:(class)\\s+(\\w+(?:\\.\\w*)*)?)|(\\w+(?:\\.\\w*)*))", diff --git a/extensions/configuration-editing/package.json b/extensions/configuration-editing/package.json index c5030630b40..da25e2e643e 100644 --- a/extensions/configuration-editing/package.json +++ b/extensions/configuration-editing/package.json @@ -1,5 +1,7 @@ { "name": "configuration-editing", + "displayName": "%displayName%", + "description": "%description%", "version": "0.0.1", "publisher": "vscode", "engines": { @@ -81,4 +83,4 @@ "devDependencies": { "@types/node": "7.0.4" } -} +} \ No newline at end of file diff --git a/extensions/configuration-editing/package.nls.json b/extensions/configuration-editing/package.nls.json new file mode 100644 index 00000000000..7e75dbe9053 --- /dev/null +++ b/extensions/configuration-editing/package.nls.json @@ -0,0 +1,4 @@ +{ + "displayName": "Configuration Editing", + "description": "Provides capabilities (advanced intelli-sense, auto-fixing) in configuration files like settings, launch and extension recommendation files" +} \ No newline at end of file diff --git a/extensions/cpp/package.json b/extensions/cpp/package.json index bb2f0b6aaab..5541288995d 100644 --- a/extensions/cpp/package.json +++ b/extensions/cpp/package.json @@ -1,5 +1,7 @@ { "name": "cpp", + "displayName": "%displayName%", + "description": "%description%", "version": "0.1.0", "publisher": "vscode", "engines": { "vscode": "*" }, @@ -15,7 +17,7 @@ }, { "id": "cpp", - "extensions": [ ".cpp", ".cc", ".cxx", ".hpp", ".hh", ".hxx", ".h", ".ino", ".inl" ], + "extensions": [ ".cpp", ".cc", ".cxx", ".hpp", ".hh", ".hxx", ".h", ".ino", ".inl", ".ipp" ], "aliases": [ "C++", "Cpp", "cpp"], "configuration": "./language-configuration.json" }], diff --git a/extensions/cpp/package.nls.json b/extensions/cpp/package.nls.json new file mode 100644 index 00000000000..241d7a1adbf --- /dev/null +++ b/extensions/cpp/package.nls.json @@ -0,0 +1,4 @@ +{ + "displayName": "C/C++ Language Features", + "description": "Provides Syntax highlighting, Folding, Bracket matching, Snippets and other language features in C/C++ files" +} \ No newline at end of file diff --git a/extensions/cpp/syntaxes/c.tmLanguage.json b/extensions/cpp/syntaxes/c.tmLanguage.json index d5143bd4901..bcd5470a64c 100644 --- a/extensions/cpp/syntaxes/c.tmLanguage.json +++ b/extensions/cpp/syntaxes/c.tmLanguage.json @@ -5,14 +5,8 @@ "Once accepted there, we are happy to receive an update request." ], "version": "https://github.com/atom/language-c/commit/9c0c5f202741a5647025db8d5df5fefba47b036c", - "scopeName": "source.c", - "fileTypes": [ - "c", - "h.in", - "xpm" - ], - "firstLineMatch": "(?i)-\\*-[^*]*(Mode:\\s*)?C(\\s*;.*?)?\\s*-\\*-", "name": "C", + "scopeName": "source.c", "patterns": [ { "include": "#preprocessor-rule-enabled" diff --git a/extensions/cpp/syntaxes/cpp.tmLanguage.json b/extensions/cpp/syntaxes/cpp.tmLanguage.json index 4cd5c4e8d91..f29bc255ba8 100644 --- a/extensions/cpp/syntaxes/cpp.tmLanguage.json +++ b/extensions/cpp/syntaxes/cpp.tmLanguage.json @@ -5,28 +5,8 @@ "Once accepted there, we are happy to receive an update request." ], "version": "https://github.com/atom/language-c/commit/3a269f88b12e512fb9495dc006a1dabf325d3d7f", - "scopeName": "source.cpp", - "fileTypes": [ - "cc", - "cpp", - "cp", - "cxx", - "c++", - "cu", - "cuh", - "h", - "hh", - "hpp", - "hxx", - "h++", - "inl", - "ino", - "ipp", - "tcc", - "tpp" - ], - "firstLineMatch": "(?i)-\\*-[^*]*(Mode:\\s*)?C\\+\\+(\\s*;.*?)?\\s*-\\*-", "name": "C++", + "scopeName": "source.cpp", "patterns": [ { "include": "#special_block" diff --git a/extensions/cpp/syntaxes/platform.tmLanguage.json b/extensions/cpp/syntaxes/platform.tmLanguage.json index bc4821b4f63..14fb45016c0 100644 --- a/extensions/cpp/syntaxes/platform.tmLanguage.json +++ b/extensions/cpp/syntaxes/platform.tmLanguage.json @@ -5,10 +5,9 @@ "Once accepted there, we are happy to receive an update request." ], "version": "https://github.com/textmate/c.tmbundle/commit/9aa365882274ca52f01722f3dbb169b9539a20ee", - "comment": "This file was generated with clang-C using MacOSX10.12.sdk", - "fileTypes": [], - "hideFromUser": true, "name": "Platform", + "scopeName": "source.c.platform", + "comment": "This file was generated with clang-C using MacOSX10.12.sdk", "patterns": [ { "match": "\\bkCF(?:CalendarUnitWeek|Gregorian(?:AllUnits|Units(?:Days|Hours|M(?:inutes|onths)|Seconds|Years)))\\b", @@ -568,7 +567,5 @@ } ] } - }, - "scopeName": "source.c.platform", - "uuid": "3E3CB242-CEBA-4B61-9806-9A97B5783D2A" + } } \ No newline at end of file diff --git a/extensions/csharp/package.json b/extensions/csharp/package.json index 137ce2656d6..e5aae513537 100644 --- a/extensions/csharp/package.json +++ b/extensions/csharp/package.json @@ -1,5 +1,7 @@ { "name": "csharp", + "displayName": "%displayName%", + "description": "%description%", "version": "0.1.0", "publisher": "vscode", "engines": { diff --git a/extensions/csharp/package.nls.json b/extensions/csharp/package.nls.json new file mode 100644 index 00000000000..ff75c382146 --- /dev/null +++ b/extensions/csharp/package.nls.json @@ -0,0 +1,4 @@ +{ + "displayName": "C# Language Features", + "description": "Provides Syntax highlighting, Folding, Bracket matching, Snippets and other language features in C# files" +} \ No newline at end of file diff --git a/extensions/csharp/syntaxes/csharp.tmLanguage.json b/extensions/csharp/syntaxes/csharp.tmLanguage.json index 074c761a4d5..fb3f667f5b1 100644 --- a/extensions/csharp/syntaxes/csharp.tmLanguage.json +++ b/extensions/csharp/syntaxes/csharp.tmLanguage.json @@ -7,10 +7,6 @@ "version": "https://github.com/dotnet/csharp-tmLanguage/commit/ca22c5211b87a6a1a8fd5356895237bb821df728", "name": "C#", "scopeName": "source.cs", - "fileTypes": [ - "cs" - ], - "uuid": "f7de61e2-bdde-4e2a-a139-8221b179584e", "patterns": [ { "include": "#preprocessor" diff --git a/extensions/css/client/src/cssMain.ts b/extensions/css/client/src/cssMain.ts index 930deba4a6e..a8aaa53a18a 100644 --- a/extensions/css/client/src/cssMain.ts +++ b/extensions/css/client/src/cssMain.ts @@ -8,12 +8,9 @@ import * as path from 'path'; import * as nls from 'vscode-nls'; const localize = nls.loadMessageBundle(); -import { languages, window, commands, ExtensionContext, TextDocument, ColorInformation, ColorPresentation, Color, Range, Position, CompletionItem, CompletionItemKind, TextEdit, SnippetString } from 'vscode'; +import { languages, window, commands, ExtensionContext, Range, Position, CompletionItem, CompletionItemKind, TextEdit, SnippetString } from 'vscode'; import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind } from 'vscode-languageclient'; -import { ConfigurationFeature } from 'vscode-languageclient/lib/configuration.proposed'; -import { DocumentColorRequest, DocumentColorParams, ColorPresentationRequest, ColorPresentationParams } from 'vscode-languageserver-protocol/lib/protocol.colorProvider.proposed'; - // this method is called when vs code is activated export function activate(context: ExtensionContext) { @@ -35,7 +32,7 @@ export function activate(context: ExtensionContext) { let clientOptions: LanguageClientOptions = { documentSelector, synchronize: { - configurationSection: ['css', 'scss', 'less'] + configurationSection: ['css', 'scss', 'less', 'emmet'] }, initializationOptions: { } @@ -43,46 +40,13 @@ export function activate(context: ExtensionContext) { // Create the language client and start the client. let client = new LanguageClient('css', localize('cssserver.name', 'CSS Language Server'), serverOptions, clientOptions); - client.registerFeature(new ConfigurationFeature(client)); + client.registerProposedFeatures(); let disposable = client.start(); // Push the disposable to the context's subscriptions so that the // client can be deactivated on extension deactivation context.subscriptions.push(disposable); - client.onReady().then(_ => { - // register color provider - context.subscriptions.push(languages.registerColorProvider(documentSelector, { - provideDocumentColors(document: TextDocument): Thenable { - let params: DocumentColorParams = { - textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(document) - }; - return client.sendRequest(DocumentColorRequest.type, params).then(symbols => { - return symbols.map(symbol => { - let range = client.protocol2CodeConverter.asRange(symbol.range); - let color = new Color(symbol.color.red, symbol.color.green, symbol.color.blue, symbol.color.alpha); - return new ColorInformation(range, color); - }); - }); - }, - provideColorPresentations(color: Color, context): ColorPresentation[] | Thenable { - let params: ColorPresentationParams = { - textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(context.document), - color, - range: client.code2ProtocolConverter.asRange(context.range) - }; - return client.sendRequest(ColorPresentationRequest.type, params).then(presentations => { - return presentations.map(p => { - let presentation = new ColorPresentation(p.label); - presentation.textEdit = p.textEdit && client.protocol2CodeConverter.asTextEdit(p.textEdit); - presentation.additionalTextEdits = p.additionalTextEdits && client.protocol2CodeConverter.asTextEdits(p.additionalTextEdits); - return presentation; - }); - }); - } - })); - }); - let indentationRules = { increaseIndentPattern: /(^.*\{[^}]*$)/, decreaseIndentPattern: /^\s*\}/ diff --git a/extensions/css/client/tsconfig.json b/extensions/css/client/tsconfig.json index 7f8b647d04b..ee67f8333d4 100644 --- a/extensions/css/client/tsconfig.json +++ b/extensions/css/client/tsconfig.json @@ -1,11 +1,11 @@ { "compilerOptions": { - "target": "es5", + "target": "es6", "module": "commonjs", "outDir": "./out", "noUnusedLocals": true, "lib": [ - "es5", "es2015.promise" + "es2016" ], "strict": true }, diff --git a/extensions/css/package.json b/extensions/css/package.json index 8893cc34b93..c5022b59db6 100644 --- a/extensions/css/package.json +++ b/extensions/css/package.json @@ -1,5 +1,7 @@ { "name": "css", + "displayName": "%displayName%", + "description": "%description%", "version": "0.1.0", "publisher": "vscode", "engines": { @@ -713,10 +715,10 @@ ] }, "dependencies": { - "vscode-languageclient": "^3.5.0", + "vscode-languageclient": "^4.0.0-next.9", "vscode-nls": "^3.2.1" }, "devDependencies": { "@types/node": "7.0.43" } -} \ No newline at end of file +} diff --git a/extensions/css/package.nls.json b/extensions/css/package.nls.json index 33fbf6d5c28..cbe77ea0abb 100644 --- a/extensions/css/package.nls.json +++ b/extensions/css/package.nls.json @@ -1,4 +1,6 @@ { + "displayName": "CSS Language Features", + "description": "Provides rich language support for CSS, LESS and SCSS files.", "css.title": "CSS", "css.lint.argumentsInColorFunction.desc": "Invalid number of parameters", "css.lint.boxModel.desc": "Do not use width or height when using padding or border", diff --git a/extensions/css/server/.vscode/launch.json b/extensions/css/server/.vscode/launch.json index 68a18d7bb9e..624ac31332f 100644 --- a/extensions/css/server/.vscode/launch.json +++ b/extensions/css/server/.vscode/launch.json @@ -7,6 +7,7 @@ "type": "node", "request": "attach", "port": 6044, + "protocol": "inspector", "sourceMaps": true, "outFiles": ["${workspaceFolder}/out/**/*.js"] }, diff --git a/extensions/css/server/package.json b/extensions/css/server/package.json index bd00c7a2c6d..eaf6a20397b 100644 --- a/extensions/css/server/package.json +++ b/extensions/css/server/package.json @@ -8,10 +8,12 @@ "node": "*" }, "dependencies": { - "vscode-css-languageservice": "^3.0.5", - "vscode-languageserver": "^3.5.0" + "vscode-css-languageservice": "^3.0.6", + "vscode-emmet-helper": "^1.1.34", + "vscode-languageserver": "^4.0.0-next.4" }, "devDependencies": { + "@types/mocha": "2.2.33", "@types/node": "7.0.43" }, "scripts": { @@ -20,6 +22,7 @@ "install-service-next": "yarn add vscode-css-languageservice@next", "install-service-local": "npm install ../../../../vscode-css-languageservice -f", "install-server-next": "yarn add vscode-languageserver@next", - "install-server-local": "npm install ../../../../vscode-languageserver-node/server -f" + "install-server-local": "npm install ../../../../vscode-languageserver-node/server -f", + "test": "../../../node_modules/.bin/mocha" } } diff --git a/extensions/css/server/src/cssServerMain.ts b/extensions/css/server/src/cssServerMain.ts index c388bebe832..0a63d245559 100644 --- a/extensions/css/server/src/cssServerMain.ts +++ b/extensions/css/server/src/cssServerMain.ts @@ -5,22 +5,26 @@ 'use strict'; import { - createConnection, IConnection, TextDocuments, InitializeParams, InitializeResult, ServerCapabilities + createConnection, IConnection, TextDocuments, InitializeParams, InitializeResult, ServerCapabilities, CompletionTriggerKind } from 'vscode-languageserver'; -import { TextDocument } from 'vscode-languageserver-types'; +import { TextDocument, CompletionList } from 'vscode-languageserver-types'; import { ConfigurationRequest } from 'vscode-languageserver-protocol/lib/protocol.configuration.proposed'; +import { WorkspaceFolder } from 'vscode-languageserver-protocol/lib/protocol.workspaceFolders.proposed'; import { DocumentColorRequest, ServerCapabilities as CPServerCapabilities, ColorPresentationRequest } from 'vscode-languageserver-protocol/lib/protocol.colorProvider.proposed'; -import { getCSSLanguageService, getSCSSLanguageService, getLESSLanguageService, LanguageSettings, LanguageService, Stylesheet } from 'vscode-css-languageservice'; +import { getCSSLanguageService, getSCSSLanguageService, getLESSLanguageService, LanguageSettings, LanguageService, Stylesheet, ICompletionParticipant } from 'vscode-css-languageservice'; import { getLanguageModelCache } from './languageModelCache'; import { formatError, runSafe } from './utils/errors'; +import { doComplete as emmetDoComplete, updateExtensionsPath as updateEmmetExtensionsPath, getEmmetCompletionParticipants } from 'vscode-emmet-helper'; +import uri from 'vscode-uri'; export interface Settings { css: LanguageSettings; less: LanguageSettings; scss: LanguageSettings; + emmet: { [key: string]: any }; } // Create a connection for the server. @@ -49,9 +53,22 @@ connection.onShutdown(() => { }); let scopedSettingsSupport = false; +let workspaceFolders: WorkspaceFolder[] | undefined; +let emmetSettings = {}; +let currentEmmetExtensionsPath: string; +const emmetTriggerCharacters = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; + // After the server has started the client sends an initilize request. The server receives // in the passed params the rootPath of the workspace plus the client capabilities. connection.onInitialize((params: InitializeParams): InitializeResult => { + workspaceFolders = (params).workspaceFolders; + if (!Array.isArray(workspaceFolders)) { + workspaceFolders = []; + if (params.rootPath) { + workspaceFolders.push({ name: '', uri: uri.file(params.rootPath).toString() }); + } + } + function hasClientCapability(name: string) { let keys = name.split('.'); let c: any = params.capabilities; @@ -65,7 +82,7 @@ connection.onInitialize((params: InitializeParams): InitializeResult => { let capabilities: ServerCapabilities & CPServerCapabilities = { // Tell the client that the server works in FULL text document sync mode textDocumentSync: documents.syncKind, - completionProvider: snippetSupport ? { resolveProvider: false } : undefined, + completionProvider: snippetSupport ? { resolveProvider: false, triggerCharacters: emmetTriggerCharacters } : undefined, hoverProvider: true, documentSymbolProvider: true, referencesProvider: true, @@ -124,6 +141,13 @@ function updateConfiguration(settings: Settings) { documentSettings = {}; // Revalidate any open text documents documents.all().forEach(triggerValidation); + + emmetSettings = settings.emmet; + if (currentEmmetExtensionsPath !== emmetSettings['extensionsPath']) { + currentEmmetExtensionsPath = emmetSettings['extensionsPath']; + const workspaceUri = (workspaceFolders && workspaceFolders.length === 1) ? uri.parse(workspaceFolders[0].uri) : null; + updateEmmetExtensionsPath(currentEmmetExtensionsPath, workspaceUri ? workspaceUri.fsPath : null); + } } let pendingValidationRequests: { [uri: string]: NodeJS.Timer } = {}; @@ -169,11 +193,43 @@ function validateTextDocument(textDocument: TextDocument): void { }); } +let cachedCompletionList: CompletionList; +const hexColorRegex = /^#[\d,a-f,A-F]{1,6}$/; connection.onCompletion(textDocumentPosition => { return runSafe(() => { let document = documents.get(textDocumentPosition.textDocument.uri); - let stylesheet = stylesheets.get(document); - return getLanguageService(document).doComplete(document, textDocumentPosition.position, stylesheet)!; /* TODO: remove ! once LS has null annotations */ + if (cachedCompletionList + && !cachedCompletionList.isIncomplete + && textDocumentPosition.context + && textDocumentPosition.context.triggerKind === CompletionTriggerKind.TriggerForIncompleteCompletions + ) { + let result: CompletionList = emmetDoComplete(document, textDocumentPosition.position, document.languageId, emmetSettings); + if (result && result.items) { + result.items.push(...cachedCompletionList.items); + } else { + result = cachedCompletionList; + cachedCompletionList = null; + } + return result; + } + + cachedCompletionList = null; + let emmetCompletionList: CompletionList = { + isIncomplete: true, + items: undefined + }; + const emmetCompletionParticipant: ICompletionParticipant = getEmmetCompletionParticipants(document, textDocumentPosition.position, document.languageId, emmetSettings, emmetCompletionList); + getLanguageService(document).setCompletionParticipants([emmetCompletionParticipant]); + + const result = getLanguageService(document).doComplete(document, textDocumentPosition.position, stylesheets.get(document))!; /* TODO: remove ! once LS has null annotations */ + if (emmetCompletionList && emmetCompletionList.items) { + cachedCompletionList = result; + if (emmetCompletionList.items.length && hexColorRegex.test(emmetCompletionList.items[0].label) && result.items.some(x => x.label === emmetCompletionList.items[0].label)) { + emmetCompletionList.items.shift(); + } + return { isIncomplete: true, items: [...emmetCompletionList.items, ...result.items] }; + } + return result; }, null, `Error while computing completions for ${textDocumentPosition.textDocument.uri}`); }); diff --git a/extensions/css/server/src/test/emmet.test.ts b/extensions/css/server/src/test/emmet.test.ts new file mode 100644 index 00000000000..ef8441153d7 --- /dev/null +++ b/extensions/css/server/src/test/emmet.test.ts @@ -0,0 +1,68 @@ +/*--------------------------------------------------------------------------------------------- + * 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 'mocha'; +import * as assert from 'assert'; +import { getCSSLanguageService, getSCSSLanguageService } from 'vscode-css-languageservice/lib/cssLanguageService'; +import { TextDocument, CompletionList } from 'vscode-languageserver-types'; +import { getEmmetCompletionParticipants } from 'vscode-emmet-helper'; + +suite('Emmet Support', () => { + + const cssLanguageService = getCSSLanguageService(); + const scssLanguageService = getSCSSLanguageService(); + + function assertCompletions(syntax: string, value: string, expectedProposal: string, expectedProposalDoc: string): void { + const offset = value.indexOf('|'); + value = value.substr(0, offset) + value.substr(offset + 1); + + const document = TextDocument.create('test://test/test.' + syntax, syntax, 0, value); + const position = document.positionAt(offset); + const emmetCompletionList: CompletionList = { + isIncomplete: true, + items: undefined + } + const languageService = syntax === 'scss' ? scssLanguageService : cssLanguageService; + languageService.setCompletionParticipants([getEmmetCompletionParticipants(document, position, document.languageId, {}, emmetCompletionList)]) + const stylesheet = languageService.parseStylesheet(document); + const list = languageService.doComplete!(document, position, stylesheet); + + assert.ok(list); + assert.ok(emmetCompletionList) + + if (expectedProposal && expectedProposalDoc) { + let actualLabels = emmetCompletionList!.items.map(c => c.label).sort(); + let actualDocs = emmetCompletionList!.items.map(c => c.documentation).sort(); + assert.ok(actualLabels.indexOf(expectedProposal) !== -1, 'Not found:' + expectedProposal + ' is ' + actualLabels.join(', ')); + assert.ok(actualDocs.indexOf(expectedProposalDoc) !== -1, 'Not found:' + expectedProposalDoc + ' is ' + actualDocs.join(', ')); + } else { + assert.ok(!emmetCompletionList || !emmetCompletionList.items); + } + } + + test('Css Emmet Completions', function (): any { + assertCompletions('css', '.foo { display: none; m10| }', 'margin: 10px;', 'margin: 10px;'); + assertCompletions('css', 'foo { display: none; pos:f| }', 'position: fixed;', 'position: fixed;'); + assertCompletions('css', 'foo { display: none; margin: a| }', null, null); + assertCompletions('css', 'foo| { display: none; }', null, null); + assertCompletions('css', 'foo {| display: none; }', null, null); + assertCompletions('css', 'foo { display: none;| }', null, null); + assertCompletions('css', 'foo { display: none|; }', null, null); + assertCompletions('css', '.foo { display: none; -m-m10| }', 'margin: 10px;', '-moz-margin: 10px;\nmargin: 10px;'); + }); + + test('Scss Emmet Completions', function (): any { + assertCompletions('scss', '.foo { display: none; .bar { m10| } }', 'margin: 10px;', 'margin: 10px;'); + assertCompletions('scss', 'foo { display: none; .bar { pos:f| } }', 'position: fixed;', 'position: fixed;'); + assertCompletions('scss', 'foo { display: none; margin: a| .bar {}}', null, null); + assertCompletions('scss', 'foo| { display: none; }', null, null); + assertCompletions('scss', 'foo {| display: none; }', null, null); + assertCompletions('scss', 'foo { display: none;| }', null, null); + assertCompletions('scss', 'foo { display: none|; }', null, null); + assertCompletions('scss', '.foo { display: none; -m-m10| }', 'margin: 10px;', '-moz-margin: 10px;\nmargin: 10px;'); + }); + +}); \ No newline at end of file diff --git a/extensions/css/server/test/mocha.opts b/extensions/css/server/test/mocha.opts new file mode 100644 index 00000000000..97e8b723ae2 --- /dev/null +++ b/extensions/css/server/test/mocha.opts @@ -0,0 +1,3 @@ +--ui tdd +--useColors true +./out/test \ No newline at end of file diff --git a/extensions/css/server/yarn.lock b/extensions/css/server/yarn.lock index 5e8284700f9..3deaf65197a 100644 --- a/extensions/css/server/yarn.lock +++ b/extensions/css/server/yarn.lock @@ -2,37 +2,57 @@ # yarn lockfile v1 +"@emmetio/extract-abbreviation@^0.1.4": + version "0.1.4" + resolved "https://registry.yarnpkg.com/@emmetio/extract-abbreviation/-/extract-abbreviation-0.1.4.tgz#f5be070db97901ecc37e5204f2ace68242cdcefa" + +"@types/mocha@2.2.33": + version "2.2.33" + resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.33.tgz#d79a0061ec270379f4d9e225f4096fb436669def" + "@types/node@7.0.43": version "7.0.43" resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.43.tgz#a187e08495a075f200ca946079c914e1a5fe962c" -vscode-css-languageservice@^3.0.5: - version "3.0.5" - resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-3.0.5.tgz#8470989c07bbe740db4fa621423e98384d2c342f" +jsonc-parser@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-1.0.0.tgz#ddcc864ae708e60a7a6dd36daea00172fa8d9272" + +vscode-css-languageservice@^3.0.6: + version "3.0.6" + resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-3.0.6.tgz#0e9230347040ba0161fba941885195215ec9be40" dependencies: - vscode-languageserver-types "3.5.0" + vscode-languageserver-types "^3.6.0-next.1" vscode-nls "^2.0.1" -vscode-jsonrpc@^3.5.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-3.5.0.tgz#87239d9e166b2d7352245b8a813597804c1d63aa" - -vscode-languageserver-protocol@^3.5.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.5.0.tgz#067c5cbe27709795398d119692c97ebba1452209" +vscode-emmet-helper@^1.1.34: + version "1.1.35" + resolved "https://registry.yarnpkg.com/vscode-emmet-helper/-/vscode-emmet-helper-1.1.35.tgz#1a704811d573df55cb313e232d5b2e6ea6dca96c" dependencies: - vscode-jsonrpc "^3.5.0" - vscode-languageserver-types "^3.5.0" + "@emmetio/extract-abbreviation" "^0.1.4" + jsonc-parser "^1.0.0" + vscode-languageserver-types "^3.6.0-next.1" -vscode-languageserver-types@3.5.0, vscode-languageserver-types@^3.5.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.5.0.tgz#e48d79962f0b8e02de955e3f524908e2b19c0374" +vscode-jsonrpc@^3.6.0-next.1: + version "3.6.0-next.1" + resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-3.6.0-next.1.tgz#3cb463dffe5842d6aec16718ca9252708cd6aabe" -vscode-languageserver@^3.5.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/vscode-languageserver/-/vscode-languageserver-3.5.0.tgz#d28099bc6ddda8c1dd16b707e454e1b1ddae0dba" +vscode-languageserver-protocol@^3.6.0-next.5: + version "3.6.0-next.5" + resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.6.0-next.5.tgz#ed2ec2db759826f753c0a13977dfb2bedc4d31b3" dependencies: - vscode-languageserver-protocol "^3.5.0" + vscode-jsonrpc "^3.6.0-next.1" + vscode-languageserver-types "^3.6.0-next.1" + +vscode-languageserver-types@^3.6.0-next.1: + version "3.6.0-next.1" + resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.6.0-next.1.tgz#98e488d3f87b666b4ee1a3d89f0023e246d358f3" + +vscode-languageserver@^4.0.0-next.4: + version "4.0.0-next.4" + resolved "https://registry.yarnpkg.com/vscode-languageserver/-/vscode-languageserver-4.0.0-next.4.tgz#162440b15bedaab07e1676f046e4d9b8578b3d92" + dependencies: + vscode-languageserver-protocol "^3.6.0-next.5" vscode-uri "^1.0.1" vscode-nls@^2.0.1: diff --git a/extensions/css/syntaxes/css.tmLanguage.json b/extensions/css/syntaxes/css.tmLanguage.json index 4c734ddba93..a8fc2fe565e 100644 --- a/extensions/css/syntaxes/css.tmLanguage.json +++ b/extensions/css/syntaxes/css.tmLanguage.json @@ -5,13 +5,8 @@ "Once accepted there, we are happy to receive an update request." ], "version": "https://github.com/atom/language-css/commit/2bc1e294e2440ad91197263cd9f95dc4b00bab2f", - "scopeName": "source.css", "name": "CSS", - "fileTypes": [ - "css", - "css.erb" - ], - "firstLineMatch": "(?xi)\n# Emacs modeline\n-\\*-(?:\\s*(?=[^:;\\s]+\\s*-\\*-)|(?:.*?[;\\s]|(?<=-\\*-))mode\\s*:\\s*)\n css\n(?=[\\s;]|(?]?\\d+|m)?|\\sex)(?=:(?=\\s*set?\\s[^\\n:]+:)|:(?!\\s*set?\\s))(?:(?:\\s|\\s*:\\s*)\\w*(?:\\s*=(?:[^\\n\\\\\\s]|\\\\.)*)?)*[\\s:](?:filetype|ft|syntax)\\s*=\n css\n(?=\\s|:|$)", + "scopeName": "source.css", "patterns": [ { "include": "#comment-block" diff --git a/extensions/css/yarn.lock b/extensions/css/yarn.lock index d7ec451f0e1..7ab2a57b25f 100644 --- a/extensions/css/yarn.lock +++ b/extensions/css/yarn.lock @@ -6,26 +6,26 @@ version "7.0.43" resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.43.tgz#a187e08495a075f200ca946079c914e1a5fe962c" -vscode-jsonrpc@^3.5.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-3.5.0.tgz#87239d9e166b2d7352245b8a813597804c1d63aa" +vscode-jsonrpc@^3.6.0-next.1: + version "3.6.0-next.1" + resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-3.6.0-next.1.tgz#3cb463dffe5842d6aec16718ca9252708cd6aabe" -vscode-languageclient@^3.5.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/vscode-languageclient/-/vscode-languageclient-3.5.0.tgz#36d02cc186a8365a4467719a290fb200a9ae490a" +vscode-languageclient@^4.0.0-next.9: + version "4.0.0-next.9" + resolved "https://registry.yarnpkg.com/vscode-languageclient/-/vscode-languageclient-4.0.0-next.9.tgz#2a06568f46ee9de3490f85e227d3740a21a03d3a" dependencies: - vscode-languageserver-protocol "^3.5.0" + vscode-languageserver-protocol "^3.6.0-next.5" -vscode-languageserver-protocol@^3.5.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.5.0.tgz#067c5cbe27709795398d119692c97ebba1452209" +vscode-languageserver-protocol@^3.6.0-next.5: + version "3.6.0-next.5" + resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.6.0-next.5.tgz#ed2ec2db759826f753c0a13977dfb2bedc4d31b3" dependencies: - vscode-jsonrpc "^3.5.0" - vscode-languageserver-types "^3.5.0" + vscode-jsonrpc "^3.6.0-next.1" + vscode-languageserver-types "^3.6.0-next.1" -vscode-languageserver-types@^3.5.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.5.0.tgz#e48d79962f0b8e02de955e3f524908e2b19c0374" +vscode-languageserver-types@^3.6.0-next.1: + version "3.6.0-next.1" + resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.6.0-next.1.tgz#98e488d3f87b666b4ee1a3d89f0023e246d358f3" vscode-nls@^3.2.1: version "3.2.1" diff --git a/extensions/diff/package.json b/extensions/diff/package.json index a62e57243c3..79d69c4e472 100644 --- a/extensions/diff/package.json +++ b/extensions/diff/package.json @@ -1,5 +1,7 @@ { "name": "diff", + "displayName": "%displayName%", + "description": "%description%", "version": "0.1.0", "publisher": "vscode", "engines": { "vscode": "*" }, diff --git a/extensions/diff/package.nls.json b/extensions/diff/package.nls.json new file mode 100644 index 00000000000..2159c202e68 --- /dev/null +++ b/extensions/diff/package.nls.json @@ -0,0 +1,4 @@ +{ + "displayName": "Diff File Language Features", + "description": "Provides Syntax highlighting, Bracket matching and other language features in Diff files" +} \ No newline at end of file diff --git a/extensions/diff/syntaxes/diff.tmLanguage.json b/extensions/diff/syntaxes/diff.tmLanguage.json index e0d60de1081..d60bbb145f7 100644 --- a/extensions/diff/syntaxes/diff.tmLanguage.json +++ b/extensions/diff/syntaxes/diff.tmLanguage.json @@ -5,14 +5,8 @@ "Once accepted there, we are happy to receive an update request." ], "version": "https://github.com/textmate/diff.tmbundle/commit/0593bb775eab1824af97ef2172fd38822abd97d7", - "fileTypes": [ - "patch", - "diff", - "rej" - ], - "firstLineMatch": "(?x)^\n\t\t(===\\ modified\\ file\n\t\t|==== \\s* // .+ \\s - \\s .+ \\s+ ====\n\t\t|Index:\\ \n\t\t|---\\ [^%\\n]\n\t\t|\\*\\*\\*.*\\d{4}\\s*$\n\t\t|\\d+(,\\d+)* (a|d|c) \\d+(,\\d+)* $\n\t\t|diff\\ --git\\ \n\t\t|commit\\ [0-9a-f]{40}$\n\t\t)", - "keyEquivalent": "^~D", "name": "Diff", + "scopeName": "source.diff", "patterns": [ { "captures": { @@ -162,7 +156,5 @@ "match": "^Only in .*: .*$\\n?", "name": "meta.diff.only-in" } - ], - "scopeName": "source.diff", - "uuid": "7E848FF4-708E-11D9-97B4-0011242E4184" + ] } \ No newline at end of file diff --git a/extensions/docker/package.json b/extensions/docker/package.json index e58f0826419..905cca458a9 100644 --- a/extensions/docker/package.json +++ b/extensions/docker/package.json @@ -1,5 +1,7 @@ { "name": "docker", + "displayName": "%displayName%", + "description": "%description%", "version": "0.1.0", "publisher": "vscode", "engines": { "vscode": "*" }, diff --git a/extensions/docker/package.nls.json b/extensions/docker/package.nls.json new file mode 100644 index 00000000000..3a8c10f1a23 --- /dev/null +++ b/extensions/docker/package.nls.json @@ -0,0 +1,4 @@ +{ + "displayName": "Docker Language Features", + "description": "Provides Syntax highlighting, Bracket matching and other language features in Docker files" +} \ No newline at end of file diff --git a/extensions/docker/syntaxes/docker.tmLanguage.json b/extensions/docker/syntaxes/docker.tmLanguage.json index 44a028e7858..f7f414636c4 100644 --- a/extensions/docker/syntaxes/docker.tmLanguage.json +++ b/extensions/docker/syntaxes/docker.tmLanguage.json @@ -5,10 +5,8 @@ "Once accepted there, we are happy to receive an update request." ], "version": "https://github.com/moby/moby/commit/abd39744c6f3ed854500e423f5fabf952165161f", - "fileTypes": [ - "Dockerfile" - ], "name": "Dockerfile", + "scopeName": "source.dockerfile", "patterns": [ { "captures": { @@ -100,7 +98,5 @@ "comment": "comment.line", "match": "^(\\s*)((#).*$\\n?)" } - ], - "scopeName": "source.dockerfile", - "uuid": "a39d8795-59d2-49af-aa00-fe74ee29576e" + ] } \ No newline at end of file diff --git a/extensions/emmet/package.json b/extensions/emmet/package.json index 61134ba415a..5974d63911d 100644 --- a/extensions/emmet/package.json +++ b/extensions/emmet/package.json @@ -337,7 +337,7 @@ "@emmetio/html-matcher": "^0.3.3", "@emmetio/css-parser": "ramya-rao-a/css-parser#vscode", "@emmetio/math-expression": "^0.1.1", - "vscode-emmet-helper": "^1.1.25", + "vscode-emmet-helper": "^1.1.36", "vscode-languageserver-types": "^3.5.0", "image-size": "^0.5.2", "vscode-nls": "3.2.1" diff --git a/extensions/emmet/src/abbreviationActions.ts b/extensions/emmet/src/abbreviationActions.ts index f0349269969..309b345c28a 100644 --- a/extensions/emmet/src/abbreviationActions.ts +++ b/extensions/emmet/src/abbreviationActions.ts @@ -10,6 +10,12 @@ import { getEmmetHelper, getNode, getInnerRange, getMappingForIncludedLanguages, const trimRegex = /[\u00a0]*[\d|#|\-|\*|\u2022]+\.?/; const hexColorRegex = /^#\d+$/; +const inlineElements = ['a', 'abbr', 'acronym', 'applet', 'b', 'basefont', 'bdo', + 'big', 'br', 'button', 'cite', 'code', 'del', 'dfn', 'em', 'font', 'i', + 'iframe', 'img', 'input', 'ins', 'kbd', 'label', 'map', 'object', 'q', + 's', 'samp', 'select', 'small', 'span', 'strike', 'strong', 'sub', 'sup', + 'textarea', 'tt', 'u', 'var']; + interface ExpandAbbreviationInput { syntax: string; abbreviation: string; @@ -62,7 +68,8 @@ export function wrapWithAbbreviation(args: any) { const preceedingWhiteSpace = matches ? matches[1].length : 0; rangeToReplace = new vscode.Range(rangeToReplace.start.line, rangeToReplace.start.character + preceedingWhiteSpace, rangeToReplace.end.line, rangeToReplace.end.character); - expandAbbrList.push({ syntax, abbreviation, rangeToReplace, textToWrap: ['\n\t$TM_SELECTED_TEXT\n'], filter }); + let textToWrap = rangeToReplace.isSingleLine ? ['$TM_SELECTED_TEXT'] : ['\n\t$TM_SELECTED_TEXT\n']; + expandAbbrList.push({ syntax, abbreviation, rangeToReplace, textToWrap, filter }); }); return expandAbbreviationInRange(editor, expandAbbrList, true); @@ -253,12 +260,14 @@ export function isValidLocationForEmmetAbbreviation(document: vscode.TextDocumen if (propertyNode.terminatorToken && propertyNode.separator && position.isAfterOrEqual(propertyNode.separatorToken.end) - && position.isBeforeOrEqual(propertyNode.terminatorToken.start)) { + && position.isBeforeOrEqual(propertyNode.terminatorToken.start) + && abbreviation.indexOf(':') === -1) { return hexColorRegex.test(abbreviation); } if (!propertyNode.terminatorToken && propertyNode.separator - && position.isAfterOrEqual(propertyNode.separatorToken.end)) { + && position.isAfterOrEqual(propertyNode.separatorToken.end) + && abbreviation.indexOf(':') === -1) { return hexColorRegex.test(abbreviation); } } @@ -433,17 +442,29 @@ function expandAbbr(input: ExpandAbbreviationInput): string | undefined { try { // Expand the abbreviation - let expandedText = helper.expandAbbreviation(input.abbreviation, expandOptions); + let expandedText; if (input.textToWrap) { + let parsedAbbr = helper.parseAbbreviation(input.abbreviation, expandOptions); + if (input.rangeToReplace.isSingleLine && input.textToWrap.length === 1) { + + // Fetch rightmost element in the parsed abbreviation (i.e the element that will contain the wrapped text). + let wrappingNode = parsedAbbr; + while (wrappingNode && wrappingNode.children && wrappingNode.children.length > 0) { + wrappingNode = wrappingNode.children[wrappingNode.children.length - 1]; + } + + // If wrapping with a block element, insert newline in the text to wrap. + if (wrappingNode && inlineElements.indexOf(wrappingNode.name) === -1) { + wrappingNode.value = '\n\t' + wrappingNode.value + '\n'; + } + } + expandedText = helper.expandAbbreviation(parsedAbbr, expandOptions); // All $anyword would have been escaped by the emmet helper. // Remove the escaping backslash from $TM_SELECTED_TEXT so that VS Code Snippet controller can treat it as a variable expandedText = expandedText.replace('\\$TM_SELECTED_TEXT', '$TM_SELECTED_TEXT'); - - // If the expanded text is single line then we dont need the \t and \n we added to $TM_SELECTED_TEXT earlier - if (input.textToWrap.length === 1 && expandedText.indexOf('\n') === -1) { - expandedText = expandedText.replace(/\s*\$TM_SELECTED_TEXT\s*/, '$TM_SELECTED_TEXT'); - } + } else { + expandedText = helper.expandAbbreviation(input.abbreviation, expandOptions); } return expandedText; diff --git a/extensions/emmet/src/extension.ts b/extensions/emmet/src/extension.ts index 3079a1764fe..0f7364a7de8 100644 --- a/extensions/emmet/src/extension.ts +++ b/extensions/emmet/src/extension.ts @@ -142,6 +142,7 @@ export function activate(context: vscode.ExtensionContext) { */ const languageMappingForCompletionProviders: Map = new Map(); const completionProvidersMapping: Map = new Map(); +const languagesToSkipCompletionProviders = ['html', 'css', 'scss', 'less']; function registerCompletionProviders(context: vscode.ExtensionContext) { let completionProvider = new DefaultCompletionItemProvider(); @@ -169,7 +170,7 @@ function registerCompletionProviders(context: vscode.ExtensionContext) { }); Object.keys(LANGUAGE_MODES).forEach(language => { - if (!languageMappingForCompletionProviders.has(language)) { + if (languagesToSkipCompletionProviders.indexOf(language) === -1 && !languageMappingForCompletionProviders.has(language)) { const provider = vscode.languages.registerCompletionItemProvider(language, completionProvider, ...LANGUAGE_MODES[language]); context.subscriptions.push(provider); diff --git a/extensions/emmet/src/test/cssAbbreviationAction.test.ts b/extensions/emmet/src/test/cssAbbreviationAction.test.ts index 39fc7df5755..4f07358638b 100644 --- a/extensions/emmet/src/test/cssAbbreviationAction.test.ts +++ b/extensions/emmet/src/test/cssAbbreviationAction.test.ts @@ -14,9 +14,9 @@ const completionProvider = new DefaultCompletionItemProvider(); const cssContents = ` .boo { margin: 20px 10px; - m10 + pos:f background-image: url('tryme.png'); - m10 + pos:f } .boo .hoo { @@ -57,9 +57,9 @@ suite('Tests for Expand Abbreviations (CSS)', () => { test('Expand abbreviation (CSS)', () => { return withRandomFileEditor(cssContents, 'css', (editor, doc) => { - editor.selections = [new Selection(3, 1, 3, 4), new Selection(5, 1, 5, 4)]; + editor.selections = [new Selection(3, 1, 3, 6), new Selection(5, 1, 5, 6)]; return expandEmmetAbbreviation(null).then(() => { - assert.equal(editor.document.getText(), cssContents.replace(/m10/g, 'margin: 10px;')); + assert.equal(editor.document.getText(), cssContents.replace(/pos:f/g, 'position: fixed;')); return Promise.resolve(); }); }); @@ -243,22 +243,22 @@ nav# }); test('Expand abbreviation in completion list (CSS)', () => { - const abbreviation = 'm10'; - const expandedText = 'margin: 10px;'; + const abbreviation = 'pos:f'; + const expandedText = 'position: fixed;'; return withRandomFileEditor(cssContents, 'css', (editor, doc) => { - editor.selection = new Selection(3, 1, 3, 4); + editor.selection = new Selection(3, 1, 3, 6); const cancelSrc = new CancellationTokenSource(); - const completionPromise1 = completionProvider.provideCompletionItems(editor.document, new Position(3, 4), cancelSrc.token); - const completionPromise2 = completionProvider.provideCompletionItems(editor.document, new Position(5, 4), cancelSrc.token); + const completionPromise1 = completionProvider.provideCompletionItems(editor.document, new Position(3, 6), cancelSrc.token); + const completionPromise2 = completionProvider.provideCompletionItems(editor.document, new Position(5, 6), cancelSrc.token); if (!completionPromise1 || !completionPromise2) { - assert.equal(1, 2, `Problem with expanding m10`); + assert.equal(1, 2, `Problem with expanding pos:f`); return Promise.resolve(); } const callBack = (completionList: CompletionList) => { if (!completionList.items || !completionList.items.length) { - assert.equal(1, 2, `Problem with expanding m10`); + assert.equal(1, 2, `Problem with expanding pos:f`); return; } const emmetCompletionItem = completionList.items[0]; diff --git a/extensions/emmet/src/test/wrapWithAbbreviation.test.ts b/extensions/emmet/src/test/wrapWithAbbreviation.test.ts index 801b24b273e..0862af36db9 100644 --- a/extensions/emmet/src/test/wrapWithAbbreviation.test.ts +++ b/extensions/emmet/src/test/wrapWithAbbreviation.test.ts @@ -197,6 +197,31 @@ suite('Tests for Wrap with Abbreviations', () => { }); }); + test('Wrap with multiline abbreviation doesnt add extra spaces', () => { + // Issue #29898 + const contents = ` + hello + `; + const expectedContents = ` + + `; + + return withRandomFileEditor(contents, 'html', (editor, doc) => { + editor.selections = [new Selection(1, 2, 1, 2)]; + const promise = wrapWithAbbreviation({ abbreviation: 'ul>li>a' }); + if (!promise) { + assert.equal(1, 2, 'Wrap returned undefined instead of promise.'); + return Promise.resolve(); + } + return promise.then(() => { + assert.equal(editor.document.getText(), expectedContents); + return Promise.resolve(); + }); + }); + }); + test('Wrap individual lines with abbreviation', () => { const contents = `