merged master

This commit is contained in:
Erich Gamma
2018-02-21 17:20:38 +01:00
656 changed files with 11811 additions and 6798 deletions
+6 -3
View File
@@ -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',
}
+6
View File
@@ -56,5 +56,11 @@
action: 'updateLabels',
addLabel: 'confirmed'
},
{
type: 'comment',
name: 'findDuplicates',
action: 'comment',
comment: "Potential duplicates:\n${potentialDuplicates}"
},
]
}
+5
View File
@@ -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}"
}
+2 -2
View File
@@ -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:
+1 -1
View File
@@ -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"
},
{
+2
View File
@@ -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));
}
+23 -20
View File
@@ -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;
}
+5 -1
View File
@@ -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));
});
+12 -7
View File
@@ -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;
+3
View File
@@ -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);
+16 -7
View File
@@ -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;
+4 -1
View File
@@ -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);
+5 -3
View File
@@ -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')));
};
}
+3 -1
View File
@@ -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) {
+1
View File
@@ -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 = [];
+5 -4
View File
@@ -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) => {
+4 -4
View File
@@ -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"
+2 -2
View File
@@ -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 => {
-1
View File
@@ -173,7 +173,6 @@ function rimraf(dir) {
if (!err) {
return cb();
}
;
if (err.code === 'ENOTEMPTY' && ++retries < 5) {
return setTimeout(function () { return retry(cb); }, 10);
}
+2 -2
View File
@@ -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);
+10 -10
View File
@@ -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(); }
+6 -5
View File
@@ -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());
+1
View File
@@ -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');
+16 -12
View File
@@ -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') {
@@ -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)) {
+4 -3
View File
@@ -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"
}
}
+7
View File
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"allowJs": false,
"checkJs": false
}
}
+6 -1
View File
@@ -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/**"
+3 -4
View File
@@ -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;
Binary file not shown.
Binary file not shown.
+2 -1
View File
@@ -11,7 +11,8 @@
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""]
["\"", "\""],
["`", "`"]
],
"surroundingPairs": [
["{", "}"],
+2
View File
@@ -1,5 +1,7 @@
{
"name": "bat",
"displayName": "%displayName%",
"description": "%description%",
"version": "0.1.0",
"publisher": "vscode",
"engines": { "vscode": "*" },
+4
View File
@@ -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"
}
@@ -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"
+2
View File
@@ -1,5 +1,7 @@
{
"name": "clojure",
"displayName": "%displayName%",
"description": "%description%",
"version": "0.1.0",
"publisher": "vscode",
"engines": { "vscode": "*" },
+4
View File
@@ -0,0 +1,4 @@
{
"displayName": "Clojure Language Features",
"description": "Provides Syntax highlighting, Bracket matching and other language features in Clojure files"
}
@@ -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;]|(?<![-*])-\\*-).*?-\\*-\n |\n # Vim\n (?:(?:\\s|^)vi(?:m[<=>]?\\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"
+2
View File
@@ -1,5 +1,7 @@
{
"name": "coffeescript",
"displayName": "%displayName%",
"description": "%description%",
"version": "0.1.0",
"publisher": "vscode",
"engines": { "vscode": "*" },
+4
View File
@@ -0,0 +1,4 @@
{
"displayName": "Coffeescript Language Features",
"description": "Provides Syntax highlighting, Folding, Bracket matching, Snippets and other language features in Coffeescript files"
}
@@ -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;]|(?<![-*])-\\*-).*?-\\*-\n |\n # Vim\n (?:(?:\\s|^)vi(?:m[<=>]?\\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*)*))",
@@ -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"
}
}
}
@@ -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"
}
+3 -1
View File
@@ -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"
}],
+4
View File
@@ -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"
}
+1 -7
View File
@@ -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"
+1 -21
View File
@@ -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"
@@ -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"
}
}
+2
View File
@@ -1,5 +1,7 @@
{
"name": "csharp",
"displayName": "%displayName%",
"description": "%description%",
"version": "0.1.0",
"publisher": "vscode",
"engines": {
+4
View File
@@ -0,0 +1,4 @@
{
"displayName": "C# Language Features",
"description": "Provides Syntax highlighting, Folding, Bracket matching, Snippets and other language features in C# files"
}
@@ -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"
+3 -39
View File
@@ -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<ColorInformation[]> {
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<ColorPresentation[]> {
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*\}/
+2 -2
View File
@@ -1,11 +1,11 @@
{
"compilerOptions": {
"target": "es5",
"target": "es6",
"module": "commonjs",
"outDir": "./out",
"noUnusedLocals": true,
"lib": [
"es5", "es2015.promise"
"es2016"
],
"strict": true
},
+4 -2
View File
@@ -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"
}
}
}
+2
View File
@@ -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",
+1
View File
@@ -7,6 +7,7 @@
"type": "node",
"request": "attach",
"port": 6044,
"protocol": "inspector",
"sourceMaps": true,
"outFiles": ["${workspaceFolder}/out/**/*.js"]
},
+6 -3
View File
@@ -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"
}
}
+62 -6
View File
@@ -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 = (<any>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}`);
});
@@ -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;');
});
});
+3
View File
@@ -0,0 +1,3 @@
--ui tdd
--useColors true
./out/test
+40 -20
View File
@@ -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:
+1 -6
View File
@@ -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;]|(?<![-*])-\\*-).*?-\\*-\n|\n# Vim modeline\n(?:(?:\\s|^)vi(?:m[<=>]?\\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"
+15 -15
View File
@@ -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"
+2
View File
@@ -1,5 +1,7 @@
{
"name": "diff",
"displayName": "%displayName%",
"description": "%description%",
"version": "0.1.0",
"publisher": "vscode",
"engines": { "vscode": "*" },
+4
View File
@@ -0,0 +1,4 @@
{
"displayName": "Diff File Language Features",
"description": "Provides Syntax highlighting, Bracket matching and other language features in Diff files"
}
+2 -10
View File
@@ -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"
]
}
+2
View File
@@ -1,5 +1,7 @@
{
"name": "docker",
"displayName": "%displayName%",
"description": "%description%",
"version": "0.1.0",
"publisher": "vscode",
"engines": { "vscode": "*" },
+4
View File
@@ -0,0 +1,4 @@
{
"displayName": "Docker Language Features",
"description": "Provides Syntax highlighting, Bracket matching and other language features in Docker files"
}
@@ -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"
]
}
+1 -1
View File
@@ -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"
+30 -9
View File
@@ -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;
+2 -1
View File
@@ -142,6 +142,7 @@ export function activate(context: vscode.ExtensionContext) {
*/
const languageMappingForCompletionProviders: Map<string, string> = new Map<string, string>();
const completionProvidersMapping: Map<string, vscode.Disposable> = new Map<string, vscode.Disposable>();
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);
@@ -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];
@@ -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 = `
<ul>
<li><a href="">hello</a></li>
</ul>
`;
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 = `
<ul class="nav main">
+1 -11
View File
@@ -8,7 +8,6 @@ import parse from '@emmetio/html-matcher';
import parseStylesheet from '@emmetio/css-parser';
import { Node, HtmlNode, CssToken, Property, Rule } from 'EmmetNode';
import { DocumentStreamReader } from './bufferStream';
import * as path from 'path';
let _emmetHelper: any;
let _currentExtensionsPath: string | undefined = undefined;
@@ -26,17 +25,9 @@ export function resolveUpdateExtensionsPath() {
return;
}
let extensionsPath = vscode.workspace.getConfiguration('emmet')['extensionsPath'];
if (extensionsPath && !path.isAbsolute(extensionsPath)) {
extensionsPath = path.join(vscode.workspace.rootPath || '', extensionsPath);
}
if (_currentExtensionsPath !== extensionsPath) {
_currentExtensionsPath = extensionsPath;
if (_currentExtensionsPath && !path.isAbsolute(_currentExtensionsPath)) {
vscode.window.showErrorMessage('The path provided in emmet.extensionsPath setting should be absolute path');
_emmetHelper.updateExtensionsPath();
return;
}
_emmetHelper.updateExtensionsPath(_currentExtensionsPath).then(null, (err: string) => vscode.window.showErrorMessage(err));
_emmetHelper.updateExtensionsPath(extensionsPath, vscode.workspace.rootPath).then(null, (err: string) => vscode.window.showErrorMessage(err));
}
}
@@ -63,7 +54,6 @@ const emmetModes = ['html', 'pug', 'slim', 'haml', 'xml', 'xsl', 'jsx', 'css', '
// For other languages, users will have to use `emmet.includeLanguages` or
// language specific extensions can provide emmet completion support
export const MAPPED_MODES: Object = {
'handlebars': 'html',
'php': 'html'
};
+8 -8
View File
@@ -2052,22 +2052,22 @@ vinyl@~2.0.1:
remove-trailing-separator "^1.0.1"
replace-ext "^1.0.0"
vscode-emmet-helper@^1.1.25:
version "1.1.25"
resolved "https://registry.yarnpkg.com/vscode-emmet-helper/-/vscode-emmet-helper-1.1.25.tgz#2c43df3e8502d420fb91032826fc0cb6efee5611"
vscode-emmet-helper@^1.1.36:
version "1.1.36"
resolved "https://registry.yarnpkg.com/vscode-emmet-helper/-/vscode-emmet-helper-1.1.36.tgz#537cbf91041a3d426f6f24dd9834550a26e61685"
dependencies:
"@emmetio/extract-abbreviation" "^0.1.4"
jsonc-parser "^1.0.0"
vscode-languageserver-types "^3.0.3"
vscode-languageserver-types@^3.0.3:
version "3.3.0"
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.3.0.tgz#8964dc7c2247536fbefd2d6836bf3febac80dd00"
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"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-3.2.1.tgz#b1f3e04e8a94a715d5a7bcbc8339c51e6d74ca51"
@@ -1,5 +1,7 @@
{
"name": "extension-editing",
"displayName": "%displayName%",
"description": "%description%",
"version": "0.0.1",
"publisher": "vscode",
"engines": {
@@ -0,0 +1,4 @@
{
"displayName": "Package File Editing",
"description": "Provides intelli-sense for VS Code extension points and linting capabilities in Package json files"
}
+2
View File
@@ -1,5 +1,7 @@
{
"name": "fsharp",
"displayName": "%displayName%",
"description": "%description%",
"version": "0.1.0",
"publisher": "vscode",
"engines": { "vscode": "*" },
+4
View File
@@ -0,0 +1,4 @@
{
"displayName": "F# Language Features",
"description": "Provides Syntax highlighting, Folding, Bracket matching, Snippets and other language features in F# files"
}
@@ -7,11 +7,6 @@
"version": "https://github.com/ionide/ionide-fsgrammar/commit/9aa4b1055e3173225bc0d4b4e48542c2450beb99",
"name": "fsharp",
"scopeName": "source.fsharp",
"fileTypes": [
"fs"
],
"foldingStartMarker": "",
"foldingStopMarker": "",
"patterns": [
{
"include": "#comments"
+2 -1
View File
@@ -1,4 +1,5 @@
src/**
test/**
out/test/**
tsconfig.json
tsconfig.json
build/**
+41 -28
View File
@@ -1,29 +1,42 @@
// ATTENTION - THIS DIRECTORY CONTAINS THIRD PARTY OPEN SOURCE MATERIALS:
[{
"name": "textmate/git.tmbundle",
"version": "0.0.0",
"license": "MIT",
"repositoryURL": "https://github.com/textmate/git.tmbundle",
"licenseDetail": [
"Copyright (c) 2008 Tim Harper",
"",
"Permission is hereby granted, free of charge, to any person obtaining",
"a copy of this software and associated documentation files (the\"",
"Software\"), to deal in the Software without restriction, including",
"without limitation the rights to use, copy, modify, merge, publish,",
"distribute, sublicense, and/or sell copies of the Software, and to",
"permit persons to whom the Software is furnished to do so, subject to",
"the following conditions:",
"",
"The above copyright notice and this permission notice shall be",
"included in all copies or substantial portions of the Software.",
"",
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,",
"EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF",
"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND",
"NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE",
"LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION",
"OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION",
"WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
]
}]
[
{
"name": "textmate/git.tmbundle",
"version": "0.0.0",
"license": "MIT",
"repositoryURL": "https://github.com/textmate/git.tmbundle",
"licenseDetail": [
"Copyright (c) 2008 Tim Harper",
"",
"Permission is hereby granted, free of charge, to any person obtaining",
"a copy of this software and associated documentation files (the\"",
"Software\"), to deal in the Software without restriction, including",
"without limitation the rights to use, copy, modify, merge, publish,",
"distribute, sublicense, and/or sell copies of the Software, and to",
"permit persons to whom the Software is furnished to do so, subject to",
"the following conditions:",
"",
"The above copyright notice and this permission notice shall be",
"included in all copies or substantial portions of the Software.",
"",
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,",
"EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF",
"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND",
"NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE",
"LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION",
"OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION",
"WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
]
},
{
"name": "textmate/diff.tmbundle",
"version": "0.0.0",
"repositoryURL": "https://github.com/textmate/diff.tmbundle",
"licenseDetail": [
"Permission to copy, use, modify, sell and distribute this",
"software is granted. This software is provided \"as is\" without",
"express or implied warranty, and with no claim as to its",
"suitability for any purpose."
]
}
]
+2
View File
@@ -0,0 +1,2 @@
# Git integration for Visual Studio Code
+69 -5
View File
@@ -1,8 +1,8 @@
{
"name": "git",
"displayName": "%displayName%",
"description": "%description%",
"publisher": "vscode",
"displayName": "git",
"description": "Git",
"version": "0.0.1",
"engines": {
"vscode": "^1.5.0"
@@ -16,9 +16,11 @@
"*"
],
"main": "./out/main",
"icon": "resources/icons/git.png",
"scripts": {
"compile": "gulp compile-extension:git",
"watch": "gulp watch-extension:git"
"watch": "gulp watch-extension:git",
"update-grammar": "node ./build/update-grammars.js"
},
"contributes": {
"commands": [
@@ -1020,13 +1022,75 @@
"highContrast": "#8db9e2"
}
}
]
],
"languages": [
{
"id": "git-commit",
"aliases": [
"Git Commit Message",
"git-commit"
],
"filenames": [
"COMMIT_EDITMSG",
"MERGE_MSG"
],
"configuration": "./languages/git-commit.language-configuration.json"
},
{
"id": "git-rebase",
"aliases": [
"Git Rebase Message",
"git-rebase"
],
"filenames": [
"git-rebase-todo"
],
"configuration": "./languages/git-rebase.language-configuration.json"
},
{
"id": "diff",
"aliases": [
"Diff",
"diff"
],
"extensions": [
".patch",
".diff",
".rej"
],
"configuration": "./languages/diff.language-configuration.json"
}
],
"grammars": [
{
"language": "git-commit",
"scopeName": "text.git-commit",
"path": "./syntaxes/git-commit.tmLanguage.json"
},
{
"language": "git-rebase",
"scopeName": "text.git-rebase",
"path": "./syntaxes/git-rebase.tmLanguage.json"
},
{
"language": "diff",
"scopeName": "source.diff",
"path": "./syntaxes/diff.tmLanguage.json"
}
],
"configurationDefaults": {
"[git-commit]": {
"editor.rulers": [
72
]
}
}
},
"dependencies": {
"byline": "^5.0.0",
"file-type": "^7.2.0",
"iconv-lite": "0.4.19",
"vscode-extension-telemetry": "0.0.11",
"vscode-extension-telemetry": "0.0.13",
"vscode-nls": "^3.2.1",
"which": "^1.3.0"
},
+2
View File
@@ -1,4 +1,6 @@
{
"displayName": "Git",
"description": "Git SCM Integration",
"command.clone": "Clone",
"command.init": "Initialize Repository",
"command.close": "Close Repository",
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

+1 -1
View File
@@ -57,7 +57,7 @@ export class AutoFetcher {
const readMore: MessageItem = { title: localize('read more', "Read More") };
const no: MessageItem = { isCloseAffordance: true, title: localize('no', "No") };
const askLater: MessageItem = { title: localize('not now', "Ask Me Later") };
const result = await window.showInformationMessage(localize('suggest auto fetch', "Would you like Code to periodically run `git fetch`?"), yes, readMore, no, askLater);
const result = await window.showInformationMessage(localize('suggest auto fetch', "Would you like Code to periodically run 'git fetch'?"), yes, readMore, no, askLater);
if (result === askLater) {
return;
@@ -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"
]
}
@@ -5,13 +5,8 @@
"Once accepted there, we are happy to receive an update request."
],
"version": "https://github.com/textmate/git.tmbundle/commit/93897a78c6e52bef13dadc0d4091d203c5facb40",
"fileTypes": [
"COMMIT_EDITMSG",
"MERGE_MSG"
],
"foldingStartMarker": "^\\+\\+\\+",
"foldingStopMarker": "^---",
"name": "Git Commit Message",
"scopeName": "text.git-commit",
"patterns": [
{
"begin": "\\A(?!# Please enter the commit message)",
@@ -142,7 +137,5 @@
}
]
}
},
"scopeName": "text.git-commit",
"uuid": "BFE83C06-8508-44BE-A975-95A57BF619A7"
}
}
@@ -5,10 +5,8 @@
"Once accepted there, we are happy to receive an update request."
],
"version": "https://github.com/textmate/git.tmbundle/commit/d1db42c2d71948662098183a6df519fb53a7a15b",
"fileTypes": [
"git-rebase-todo"
],
"name": "Git Rebase Message",
"scopeName": "text.git-rebase",
"patterns": [
{
"captures": {
@@ -34,7 +32,5 @@
"match": "^\\s*(pick|p|reword|r|edit|e|squash|s|fixup|f|exec|x|drop|d)\\s+([0-9a-f]+)\\s+(.*)$",
"name": "meta.commit-command.git-rebase"
}
],
"scopeName": "text.git-rebase",
"uuid": "7F1CC209-5F6D-486A-8180-09FA282381A1"
]
}

Some files were not shown because too many files have changed in this diff Show More