make ISuggestSupport#triggerCharacters optional

This commit is contained in:
Johannes Rieken 2017-02-20 15:40:51 +01:00
parent 9a97cb1037
commit 4ab19b3614
7 changed files with 4 additions and 11 deletions

View file

@ -236,7 +236,7 @@ export interface ISuggestResult {
*/
export interface ISuggestSupport {
triggerCharacters: string[];
triggerCharacters?: string[];
provideCompletionItems(model: editorCommon.IReadOnlyModel, position: Position, token: CancellationToken): ISuggestResult | Thenable<ISuggestResult>;

View file

@ -47,7 +47,6 @@ export class EditorWorkerServiceImpl implements IEditorWorkerService {
}
});
const completionProvider = modes.SuggestRegistry.register('*', <modes.ISuggestSupport>{
triggerCharacters: [],
provideCompletionItems: (model, position, token) => {
if (configurationService.lookup<boolean>('editor.wordBasedSuggestions').value) {
return this._workerManager.withWorker().then(client => client.textualSuggest(model.uri, position));

View file

@ -31,7 +31,6 @@ suite('CompletionModel', function () {
};
support: ISuggestSupport = {
triggerCharacters: [],
provideCompletionItems(): any {
return;
}
@ -98,7 +97,7 @@ suite('CompletionModel', function () {
assert.equal(model.incomplete, true);
assert.equal(model.items.length, 2);
const {complete, incomplete} = model.resolveIncompleteInfo();
const { complete, incomplete } = model.resolveIncompleteInfo();
assert.equal(incomplete.length, 1);
assert.ok(incomplete[0] === incompleteItem.support);

View file

@ -22,7 +22,6 @@ suite('Suggest', function () {
model = Model.createFromString('FOO\nbar\BAR\nfoo', undefined, undefined, URI.parse('foo:bar/path'));
registration = SuggestRegistry.register({ pattern: 'bar/path' }, {
triggerCharacters: [],
provideCompletionItems() {
return {
incomplete: false,
@ -108,4 +107,4 @@ suite('Suggest', function () {
assert.ok(items[0].support === foo);
});
});
});
});

View file

@ -68,7 +68,6 @@ suite('SuggestModel - TriggerAndCancelOracle', function () {
const alwaysEmptySupport: ISuggestSupport = {
triggerCharacters: [],
provideCompletionItems(doc, pos) {
return <ISuggestResult>{
incomplete: false,
@ -78,7 +77,6 @@ suite('SuggestModel - TriggerAndCancelOracle', function () {
};
const alwaysSomethingSupport: ISuggestSupport = {
triggerCharacters: [],
provideCompletionItems(doc, pos) {
return <ISuggestResult>{
currentWord: '',
@ -224,7 +222,6 @@ suite('SuggestModel - TriggerAndCancelOracle', function () {
test('#17400: Keep filtering suggestModel.ts after space', function () {
disposables.push(SuggestRegistry.register({ scheme: 'test' }, {
triggerCharacters: [],
provideCompletionItems(doc, pos) {
return <ISuggestResult>{
currentWord: '',

View file

@ -225,7 +225,7 @@ export class MainThreadLanguageFeatures extends MainThreadLanguageFeaturesShape
$registerSuggestSupport(handle: number, selector: vscode.DocumentSelector, triggerCharacters: string[]): TPromise<any> {
this._registrations[handle] = modes.SuggestRegistry.register(selector, <modes.ISuggestSupport>{
triggerCharacters: triggerCharacters,
triggerCharacters,
provideCompletionItems: (model: IReadOnlyModel, position: EditorPosition, token: CancellationToken): Thenable<modes.ISuggestResult> => {
return this._heapService.trackRecursive(wireCancellationToken(token, this._proxy.$provideCompletionItems(handle, model.uri, position)));
},

View file

@ -43,7 +43,6 @@ class SnippetsService implements ISnippetsService {
constructor() {
setSnippetSuggestSupport({
triggerCharacters: undefined,
provideCompletionItems: (model, position) => {
const suggestions = this.getSnippetCompletions(<any>model, position);
return { suggestions };