提交 1babeac1 编写于 作者: J Johannes Rieken

Revert "add smartSuggestionsOnly settings, fixes #5574"

This reverts commit 4858b591.
上级 80753fd2
......@@ -96,8 +96,7 @@ export class InternalEditorOptions implements editorCommon.IInternalEditorOption
hover:boolean;
contextmenu:boolean;
quickSuggestions:boolean;
quickSuggestionsDelay: number;
smartSuggestionsOnly: boolean;
quickSuggestionsDelay:number;
iconsInSuggestions:boolean;
autoClosingBrackets:boolean;
formatOnType:boolean;
......@@ -166,8 +165,7 @@ export class InternalEditorOptions implements editorCommon.IInternalEditorOption
this.hover = Boolean(input.hover);
this.contextmenu = Boolean(input.contextmenu);
this.quickSuggestions = Boolean(input.quickSuggestions);
this.quickSuggestionsDelay = Number(input.quickSuggestionsDelay) | 0;
this.smartSuggestionsOnly = Boolean(input.smartSuggestionsOnly);
this.quickSuggestionsDelay = Number(input.quickSuggestionsDelay)|0;
this.iconsInSuggestions = Boolean(input.iconsInSuggestions);
this.autoClosingBrackets = Boolean(input.autoClosingBrackets);
this.formatOnType = Boolean(input.formatOnType);
......@@ -359,7 +357,6 @@ class InternalEditorOptionsHelper {
contextmenu: toBoolean(opts.contextmenu),
quickSuggestions: toBoolean(opts.quickSuggestions),
quickSuggestionsDelay: toInteger(opts.quickSuggestionsDelay),
smartSuggestionsOnly: toBoolean(opts.smartSuggestionsOnly),
iconsInSuggestions: toBoolean(opts.iconsInSuggestions),
autoClosingBrackets: toBoolean(opts.autoClosingBrackets),
formatOnType: toBoolean(opts.formatOnType),
......@@ -877,11 +874,6 @@ let editorConfiguration:IConfigurationNode = {
'minimum': 0,
'description': nls.localize('quickSuggestionsDelay', "Controls the delay in ms after which quick suggestions will show up")
},
'editor.smartSuggestionsOnly' : {
'type': 'boolean',
'default': DefaultConfig.editor.smartSuggestionsOnly,
'description': nls.localize('smartSuggestionsOnly', "Controls if less smart suggestions show up when a language service cannot compute them")
},
'editor.autoClosingBrackets' : {
'type': 'boolean',
'default': DefaultConfig.editor.autoClosingBrackets,
......
......@@ -69,7 +69,6 @@ class ConfigClass implements IConfiguration {
mouseWheelScrollSensitivity: 1,
quickSuggestions: true,
quickSuggestionsDelay: 10,
smartSuggestionsOnly: false,
iconsInSuggestions: true,
autoClosingBrackets: true,
formatOnType: false,
......
......@@ -468,12 +468,7 @@ export interface IEditorOptions {
* Quick suggestions show delay (in ms)
* Defaults to 500 (ms)
*/
quickSuggestionsDelay?: number;
/**
* Don't fallback to providers that only propose textual completions.
* Default to true.
*/
smartSuggestionsOnly?: boolean;
quickSuggestionsDelay?:number;
/**
* Render icons in suggestions box.
* Defaults to true.
......@@ -643,7 +638,6 @@ export interface IInternalEditorOptions {
contextmenu:boolean;
quickSuggestions:boolean;
quickSuggestionsDelay:number;
smartSuggestionsOnly: boolean;
iconsInSuggestions:boolean;
autoClosingBrackets:boolean;
formatOnType:boolean;
......
......@@ -311,10 +311,7 @@ export class SuggestModel implements IDisposable {
const position = this.editor.getPosition();
this.requestPromise = suggest(model, position, triggerCharacter,
this.editor.getConfiguration().smartSuggestionsOnly,
groups
).then(all => {
this.requestPromise = suggest(model, position, triggerCharacter, groups).then(all => {
this.requestPromise = null;
if (this.state === State.Idle) {
......
......@@ -5,6 +5,7 @@
'use strict';
import {sequence} from 'vs/base/common/async';
import {isFalsyOrEmpty} from 'vs/base/common/arrays';
import {illegalArgument, onUnexpectedError} from 'vs/base/common/errors';
import {TPromise} from 'vs/base/common/winjs.base';
import {IModel, IPosition} from 'vs/editor/common/editorCommon';
......@@ -20,7 +21,7 @@ export interface ISuggestResult2 extends ISuggestResult {
support?: ISuggestSupport;
}
export function suggest(model: IModel, position: IPosition, triggerCharacter: string, acceptEmptyArray: boolean, groups?: ISuggestSupport[][]): TPromise<ISuggestResult2[]> {
export function suggest(model: IModel, position: IPosition, triggerCharacter: string, groups?: ISuggestSupport[][]): TPromise<ISuggestResult2[]> {
if (!groups) {
groups = SuggestRegistry.orderedGroups(model);
......@@ -47,13 +48,7 @@ export function suggest(model: IModel, position: IPosition, triggerCharacter: st
for (let suggestResult of values) {
if (!suggestResult || !Array.isArray(suggestResult.suggestions)) {
// unacceptable result
continue;
}
if (suggestResult.suggestions.length === 0 && !acceptEmptyArray) {
// empty result -> check configuration
if (!suggestResult || isFalsyOrEmpty(suggestResult.suggestions)) {
continue;
}
......@@ -85,5 +80,5 @@ CommonEditorRegistry.registerDefaultLanguageCommand('_executeCompletionItemProvi
throw illegalArgument('triggerCharacter');
}
return suggest(model, position, triggerCharacter, false);
return suggest(model, position, triggerCharacter);
});
......@@ -824,7 +824,7 @@ suite('ExtHostLanguageFeatures', function() {
}, []));
threadService.sync().then(() => {
suggest(model, { lineNumber: 1, column: 1 }, ',', false).then(value => {
suggest(model, { lineNumber: 1, column: 1 }, ',').then(value => {
assert.ok(value.length >= 1); // check for min because snippets and others contribute
let [first] = value;
assert.equal(first.suggestions.length, 1);
......@@ -834,7 +834,7 @@ suite('ExtHostLanguageFeatures', function() {
});
});
test('Suggest, order 2/3 (!smartSuggestionsOnly)', function(done) {
test('Suggest, order 2/3', function(done) {
disposables.push(extHost.registerCompletionItemProvider('*', <vscode.CompletionItemProvider>{
provideCompletionItems(): any {
......@@ -849,7 +849,7 @@ suite('ExtHostLanguageFeatures', function() {
}, []));
threadService.sync().then(() => {
suggest(model, { lineNumber: 1, column: 1 }, ',', false).then(value => {
suggest(model, { lineNumber: 1, column: 1 }, ',').then(value => {
assert.ok(value.length >= 1);
let [first] = value;
assert.equal(first.suggestions.length, 1);
......@@ -859,29 +859,6 @@ suite('ExtHostLanguageFeatures', function() {
});
});
test('Suggest, order 2/3 (smartSuggestionsOnly)', function() {
disposables.push(extHost.registerCompletionItemProvider('*', <vscode.CompletionItemProvider>{
provideCompletionItems(): any {
return [new types.CompletionItem('weak-selector')]; // weaker selector but result
}
}, []));
disposables.push(extHost.registerCompletionItemProvider(defaultSelector, <vscode.CompletionItemProvider>{
provideCompletionItems(): any {
return []; // stronger selector but not a good result;
}
}, []));
return threadService.sync().then(() => {
return suggest(model, { lineNumber: 1, column: 1 }, ',', true).then(value => {
assert.ok(value.length >= 1);
let [first] = value;
assert.equal(first.suggestions.length, 0);
});
});
});
test('Suggest, order 2/3', function(done) {
disposables.push(extHost.registerCompletionItemProvider(defaultSelector, <vscode.CompletionItemProvider>{
......@@ -898,7 +875,7 @@ suite('ExtHostLanguageFeatures', function() {
}, []));
threadService.sync().then(() => {
suggest(model, { lineNumber: 1, column: 1 }, ',', false).then(value => {
suggest(model, { lineNumber: 1, column: 1 }, ',').then(value => {
assert.ok(value.length >= 2);
let [first, second] = value;
assert.equal(first.suggestions.length, 1);
......@@ -927,7 +904,7 @@ suite('ExtHostLanguageFeatures', function() {
threadService.sync().then(() => {
suggest(model, { lineNumber: 1, column: 1 }, ',', false).then(value => {
suggest(model, { lineNumber: 1, column: 1 }, ',').then(value => {
assert.equal(value[0].incomplete, undefined);
done();
});
......@@ -944,7 +921,7 @@ suite('ExtHostLanguageFeatures', function() {
return threadService.sync().then(() => {
suggest(model, { lineNumber: 1, column: 1 }, ',', false).then(value => {
suggest(model, { lineNumber: 1, column: 1 }, ',').then(value => {
assert.equal(value[0].incomplete, true);
});
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册