mirror of
https://github.com/Microsoft/vscode
synced 2024-10-30 01:37:20 +00:00
make ISuggestSupport#triggerCharacters optional
This commit is contained in:
parent
9a97cb1037
commit
4ab19b3614
7 changed files with 4 additions and 11 deletions
|
@ -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>;
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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: '',
|
||||
|
|
|
@ -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)));
|
||||
},
|
||||
|
|
|
@ -43,7 +43,6 @@ class SnippetsService implements ISnippetsService {
|
|||
|
||||
constructor() {
|
||||
setSnippetSuggestSupport({
|
||||
triggerCharacters: undefined,
|
||||
provideCompletionItems: (model, position) => {
|
||||
const suggestions = this.getSnippetCompletions(<any>model, position);
|
||||
return { suggestions };
|
||||
|
|
Loading…
Reference in a new issue