Revert "Merge from vscode 81d7885dc2e9dc617e1522697a2966bc4025a45d (#5949)" (#5983)

This reverts commit d15a3fcc98.
This commit is contained in:
Karl Burtram
2019-06-11 12:35:58 -07:00
committed by GitHub
parent 95a50b7892
commit 5a7562a37b
926 changed files with 11394 additions and 19540 deletions

View File

@@ -43,7 +43,7 @@ const languageScopeSchema: IJSONSchema = {
type: ['string', 'array']
},
body: {
description: nls.localize('snippetSchema.json.body', 'The snippet content. Use \'$1\', \'${1:defaultText}\' to define cursor positions, use \'$0\' for the final cursor position. Insert variable values with \'${varName}\' and \'${varName:defaultText}\', e.g. \'This is file: $TM_FILENAME\'.'),
description: nls.localize('snippetSchema.json.body', 'The snippet content. Use \'$1\', \'${1:defaultText}\' to define cursor positions, use \'$0\' for the final cursor position. Insert variable values with \'${varName}\' and \'${varName:defaultText}\', e.g \'This is file: $TM_FILENAME\'.'),
type: ['string', 'array'],
items: {
type: 'string'
@@ -78,11 +78,11 @@ const globalSchema: IJSONSchema = {
type: ['string', 'array']
},
scope: {
description: nls.localize('snippetSchema.json.scope', "A list of language names to which this snippet applies, e.g. 'typescript,javascript'."),
description: nls.localize('snippetSchema.json.scope', "A list of language names to which this snippet applies, e.g 'typescript,javascript'."),
type: 'string'
},
body: {
description: nls.localize('snippetSchema.json.body', 'The snippet content. Use \'$1\', \'${1:defaultText}\' to define cursor positions, use \'$0\' for the final cursor position. Insert variable values with \'${varName}\' and \'${varName:defaultText}\', e.g. \'This is file: $TM_FILENAME\'.'),
description: nls.localize('snippetSchema.json.body', 'The snippet content. Use \'$1\', \'${1:defaultText}\' to define cursor positions, use \'$0\' for the final cursor position. Insert variable values with \'${varName}\' and \'${varName:defaultText}\', e.g \'This is file: $TM_FILENAME\'.'),
type: ['string', 'array'],
items: {
type: 'string'

View File

@@ -5,7 +5,7 @@
import { join } from 'vs/base/common/path';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import { combinedDisposable, dispose, IDisposable, DisposableStore } from 'vs/base/common/lifecycle';
import { combinedDisposable, dispose, IDisposable } from 'vs/base/common/lifecycle';
import { values } from 'vs/base/common/map';
import * as resources from 'vs/base/common/resources';
import { endsWith, isFalsyOrWhitespace } from 'vs/base/common/strings';
@@ -114,7 +114,7 @@ namespace snippetExt {
}
function watch(service: IFileService, resource: URI, callback: (type: FileChangeType, resource: URI) => any): IDisposable {
return combinedDisposable(
return combinedDisposable([
service.watch(resource),
service.onFileChanges(e => {
for (const change of e.changes) {
@@ -123,7 +123,7 @@ function watch(service: IFileService, resource: URI, callback: (type: FileChange
}
}
})
);
]);
}
class SnippetsService implements ISnippetsService {
@@ -295,16 +295,15 @@ class SnippetsService implements ISnippetsService {
}
private _initFolderSnippets(source: SnippetSource, folder: URI, bucket: IDisposable[]): Promise<any> {
const disposables = new DisposableStore();
const addFolderSnippets = (type?: FileChangeType) => {
disposables.clear();
let disposables: IDisposable[] = [];
let addFolderSnippets = (type?: FileChangeType) => {
disposables = dispose(disposables);
if (type === FileChangeType.DELETED) {
return Promise.resolve();
}
return this._fileService.resolve(folder).then(stat => {
for (const entry of stat.children || []) {
disposables.add(this._addSnippetFile(entry.resource, source));
disposables.push(this._addSnippetFile(entry.resource, source));
}
}, err => {
this._logService.error(`Failed snippets from folder '${folder.toString()}'`, err);
@@ -312,7 +311,7 @@ class SnippetsService implements ISnippetsService {
};
bucket.push(watch(this._fileService, folder, addFolderSnippets));
bucket.push(disposables);
bucket.push(combinedDisposable(disposables));
return addFolderSnippets();
}