Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
1babeac1
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1babeac1
编写于
4月 27, 2016
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "add smartSuggestionsOnly settings, fixes #5574"
This reverts commit
4858b591
.
上级
80753fd2
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
14 addition
and
60 deletion
+14
-60
src/vs/editor/common/config/commonEditorConfig.ts
src/vs/editor/common/config/commonEditorConfig.ts
+2
-10
src/vs/editor/common/config/defaultConfig.ts
src/vs/editor/common/config/defaultConfig.ts
+0
-1
src/vs/editor/common/editorCommon.ts
src/vs/editor/common/editorCommon.ts
+1
-7
src/vs/editor/contrib/suggest/browser/suggestModel.ts
src/vs/editor/contrib/suggest/browser/suggestModel.ts
+1
-4
src/vs/editor/contrib/suggest/common/suggest.ts
src/vs/editor/contrib/suggest/common/suggest.ts
+4
-9
src/vs/workbench/test/node/api/extHostLanguageFeatures.test.ts
...s/workbench/test/node/api/extHostLanguageFeatures.test.ts
+6
-29
未找到文件。
src/vs/editor/common/config/commonEditorConfig.ts
浏览文件 @
1babeac1
...
...
@@ -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
,
...
...
src/vs/editor/common/config/defaultConfig.ts
浏览文件 @
1babeac1
...
...
@@ -69,7 +69,6 @@ class ConfigClass implements IConfiguration {
mouseWheelScrollSensitivity
:
1
,
quickSuggestions
:
true
,
quickSuggestionsDelay
:
10
,
smartSuggestionsOnly
:
false
,
iconsInSuggestions
:
true
,
autoClosingBrackets
:
true
,
formatOnType
:
false
,
...
...
src/vs/editor/common/editorCommon.ts
浏览文件 @
1babeac1
...
...
@@ -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
;
...
...
src/vs/editor/contrib/suggest/browser/suggestModel.ts
浏览文件 @
1babeac1
...
...
@@ -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
)
{
...
...
src/vs/editor/contrib/suggest/common/suggest.ts
浏览文件 @
1babeac1
...
...
@@ -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
);
});
src/vs/workbench/test/node/api/extHostLanguageFeatures.test.ts
浏览文件 @
1babeac1
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录