Merge from master

This commit is contained in:
Raj Musuku
2019-02-21 17:56:04 -08:00
parent 5a146e34fa
commit 666ae11639
11482 changed files with 119352 additions and 255574 deletions

View File

@@ -2,12 +2,10 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as assert from 'assert';
import URI from 'vs/base/common/uri';
import { URI } from 'vs/base/common/uri';
import { IDisposable } from 'vs/base/common/lifecycle';
import { SuggestRegistry } from 'vs/editor/common/modes';
import { CompletionProviderRegistry, CompletionItemKind } from 'vs/editor/common/modes';
import { provideSuggestionItems } from 'vs/editor/contrib/suggest/suggest';
import { Position } from 'vs/editor/common/core/position';
import { TextModel } from 'vs/editor/common/model/textModel';
@@ -21,21 +19,21 @@ suite('Suggest', function () {
setup(function () {
model = TextModel.createFromString('FOO\nbar\BAR\nfoo', undefined, undefined, URI.parse('foo:bar/path'));
registration = SuggestRegistry.register({ pattern: 'bar/path', scheme: 'foo' }, {
registration = CompletionProviderRegistry.register({ pattern: 'bar/path', scheme: 'foo' }, {
provideCompletionItems() {
return {
incomplete: false,
suggestions: [{
label: 'aaa',
type: 'snippet',
kind: CompletionItemKind.Snippet,
insertText: 'aaa'
}, {
label: 'zzz',
type: 'snippet',
kind: CompletionItemKind.Snippet,
insertText: 'zzz'
}, {
label: 'fff',
type: 'property',
kind: CompletionItemKind.Property,
insertText: 'fff'
}]
};
@@ -48,38 +46,34 @@ suite('Suggest', function () {
model.dispose();
});
test('sort - snippet inline', function () {
return provideSuggestionItems(model, new Position(1, 1), 'inline').then(items => {
assert.equal(items.length, 3);
assert.equal(items[0].suggestion.label, 'aaa');
assert.equal(items[1].suggestion.label, 'fff');
assert.equal(items[2].suggestion.label, 'zzz');
});
test('sort - snippet inline', async function () {
const items = await provideSuggestionItems(model, new Position(1, 1), 'inline');
assert.equal(items.length, 3);
assert.equal(items[0].suggestion.label, 'aaa');
assert.equal(items[1].suggestion.label, 'fff');
assert.equal(items[2].suggestion.label, 'zzz');
});
test('sort - snippet top', function () {
return provideSuggestionItems(model, new Position(1, 1), 'top').then(items => {
assert.equal(items.length, 3);
assert.equal(items[0].suggestion.label, 'aaa');
assert.equal(items[1].suggestion.label, 'zzz');
assert.equal(items[2].suggestion.label, 'fff');
});
test('sort - snippet top', async function () {
const items = await provideSuggestionItems(model, new Position(1, 1), 'top');
assert.equal(items.length, 3);
assert.equal(items[0].suggestion.label, 'aaa');
assert.equal(items[1].suggestion.label, 'zzz');
assert.equal(items[2].suggestion.label, 'fff');
});
test('sort - snippet bottom', function () {
return provideSuggestionItems(model, new Position(1, 1), 'bottom').then(items => {
assert.equal(items.length, 3);
assert.equal(items[0].suggestion.label, 'fff');
assert.equal(items[1].suggestion.label, 'aaa');
assert.equal(items[2].suggestion.label, 'zzz');
});
test('sort - snippet bottom', async function () {
const items = await provideSuggestionItems(model, new Position(1, 1), 'bottom');
assert.equal(items.length, 3);
assert.equal(items[0].suggestion.label, 'fff');
assert.equal(items[1].suggestion.label, 'aaa');
assert.equal(items[2].suggestion.label, 'zzz');
});
test('sort - snippet none', function () {
return provideSuggestionItems(model, new Position(1, 1), 'none').then(items => {
assert.equal(items.length, 1);
assert.equal(items[0].suggestion.label, 'fff');
});
test('sort - snippet none', async function () {
const items = await provideSuggestionItems(model, new Position(1, 1), 'none');
assert.equal(items.length, 1);
assert.equal(items[0].suggestion.label, 'fff');
});
test('only from', function () {
@@ -98,7 +92,7 @@ suite('Suggest', function () {
};
}
};
const registration = SuggestRegistry.register({ pattern: 'bar/path', scheme: 'foo' }, foo);
const registration = CompletionProviderRegistry.register({ pattern: 'bar/path', scheme: 'foo' }, foo);
provideSuggestionItems(model, new Position(1, 1), undefined, [foo]).then(items => {
registration.dispose();