mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-22 04:40:30 -04:00
Merge VS Code 1.31.1 (#4283)
This commit is contained in:
@@ -9,6 +9,7 @@ import { CompletionProviderRegistry, CompletionItemKind } from 'vs/editor/common
|
||||
import { provideSuggestionItems } from 'vs/editor/contrib/suggest/suggest';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
|
||||
|
||||
suite('Suggest', function () {
|
||||
@@ -20,21 +21,24 @@ suite('Suggest', function () {
|
||||
|
||||
model = TextModel.createFromString('FOO\nbar\BAR\nfoo', undefined, undefined, URI.parse('foo:bar/path'));
|
||||
registration = CompletionProviderRegistry.register({ pattern: 'bar/path', scheme: 'foo' }, {
|
||||
provideCompletionItems() {
|
||||
provideCompletionItems(_doc, pos) {
|
||||
return {
|
||||
incomplete: false,
|
||||
suggestions: [{
|
||||
label: 'aaa',
|
||||
kind: CompletionItemKind.Snippet,
|
||||
insertText: 'aaa'
|
||||
insertText: 'aaa',
|
||||
range: Range.fromPositions(pos)
|
||||
}, {
|
||||
label: 'zzz',
|
||||
kind: CompletionItemKind.Snippet,
|
||||
insertText: 'zzz'
|
||||
insertText: 'zzz',
|
||||
range: Range.fromPositions(pos)
|
||||
}, {
|
||||
label: 'fff',
|
||||
kind: CompletionItemKind.Property,
|
||||
insertText: 'fff'
|
||||
insertText: 'fff',
|
||||
range: Range.fromPositions(pos)
|
||||
}]
|
||||
};
|
||||
}
|
||||
@@ -49,31 +53,31 @@ suite('Suggest', function () {
|
||||
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');
|
||||
assert.equal(items[0].completion.label, 'aaa');
|
||||
assert.equal(items[1].completion.label, 'fff');
|
||||
assert.equal(items[2].completion.label, 'zzz');
|
||||
});
|
||||
|
||||
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');
|
||||
assert.equal(items[0].completion.label, 'aaa');
|
||||
assert.equal(items[1].completion.label, 'zzz');
|
||||
assert.equal(items[2].completion.label, 'fff');
|
||||
});
|
||||
|
||||
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');
|
||||
assert.equal(items[0].completion.label, 'fff');
|
||||
assert.equal(items[1].completion.label, 'aaa');
|
||||
assert.equal(items[2].completion.label, 'zzz');
|
||||
});
|
||||
|
||||
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');
|
||||
assert.equal(items[0].completion.label, 'fff');
|
||||
});
|
||||
|
||||
test('only from', function () {
|
||||
@@ -98,7 +102,7 @@ suite('Suggest', function () {
|
||||
registration.dispose();
|
||||
|
||||
assert.equal(items.length, 1);
|
||||
assert.ok(items[0].support === foo);
|
||||
assert.ok(items[0].provider === foo);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user