Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
412a6441
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,发现更多精彩内容 >>
提交
412a6441
编写于
6月 01, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make single suggestion a special case
fixes #6163
上级
6c5b3da8
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
15 deletion
+21
-15
src/vs/editor/contrib/suggest/browser/suggest.ts
src/vs/editor/contrib/suggest/browser/suggest.ts
+9
-9
src/vs/editor/contrib/suggest/browser/suggestWidget.ts
src/vs/editor/contrib/suggest/browser/suggestWidget.ts
+7
-4
src/vs/editor/contrib/suggest/common/suggest.ts
src/vs/editor/contrib/suggest/common/suggest.ts
+5
-2
未找到文件。
src/vs/editor/contrib/suggest/browser/suggest.ts
浏览文件 @
412a6441
...
...
@@ -18,7 +18,7 @@ import { ISuggestSupport, SuggestRegistry } from 'vs/editor/common/modes';
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
EditorBrowserRegistry
}
from
'
vs/editor/browser/editorBrowserExtensions
'
;
import
{
getSnippetController
}
from
'
vs/editor/contrib/snippet/common/snippet
'
;
import
{
C
ONTEXT_SUGGEST_WIDGET_VISIBLE
}
from
'
vs/editor/contrib/suggest/common/suggest
'
;
import
{
C
ontext
as
SuggestContext
}
from
'
vs/editor/contrib/suggest/common/suggest
'
;
import
{
KeybindingsRegistry
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
withCodeEditorFromCommandHandler
}
from
'
vs/editor/common/config/config
'
;
import
{
SuggestModel
}
from
'
./suggestModel
'
;
...
...
@@ -225,7 +225,7 @@ KeybindingsRegistry.registerCommandDesc({
id
:
'
acceptSelectedSuggestion
'
,
handler
:
handler
(
'
acceptSelectedSuggestion
'
,
c
=>
c
.
acceptSelectedSuggestion
()),
weight
,
when
:
KbExpr
.
and
(
KbExpr
.
has
(
KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS
),
KbExpr
.
has
(
CONTEXT_SUGGEST_WIDGET_VISIBLE
)),
when
:
KbExpr
.
and
(
KbExpr
.
has
(
KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS
),
KbExpr
.
has
(
SuggestContext
.
Visible
)),
primary
:
KeyCode
.
Tab
});
...
...
@@ -233,7 +233,7 @@ KeybindingsRegistry.registerCommandDesc({
id
:
'
acceptSelectedSuggestionOnEnter
'
,
handler
:
handler
(
'
acceptSelectedSuggestionOnEnter
'
,
c
=>
c
.
acceptSelectedSuggestion
()),
weight
,
when
:
KbExpr
.
and
(
KbExpr
.
has
(
KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS
),
KbExpr
.
has
(
CONTEXT_SUGGEST_WIDGET_VISIBLE
),
KbExpr
.
has
(
'
config.editor.acceptSuggestionOnEnter
'
)),
when
:
KbExpr
.
and
(
KbExpr
.
has
(
KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS
),
KbExpr
.
has
(
SuggestContext
.
Visible
),
KbExpr
.
has
(
'
config.editor.acceptSuggestionOnEnter
'
)),
primary
:
KeyCode
.
Enter
});
...
...
@@ -241,7 +241,7 @@ KeybindingsRegistry.registerCommandDesc({
id
:
'
hideSuggestWidget
'
,
handler
:
handler
(
'
hideSuggestWidget
'
,
c
=>
c
.
cancelSuggestWidget
()),
weight
,
when
:
KbExpr
.
and
(
KbExpr
.
has
(
KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS
),
KbExpr
.
has
(
CONTEXT_SUGGEST_WIDGET_VISIBLE
)),
when
:
KbExpr
.
and
(
KbExpr
.
has
(
KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS
),
KbExpr
.
has
(
SuggestContext
.
Visible
)),
primary
:
KeyCode
.
Escape
,
secondary
:
[
KeyMod
.
Shift
|
KeyCode
.
Escape
]
});
...
...
@@ -250,7 +250,7 @@ KeybindingsRegistry.registerCommandDesc({
id
:
'
selectNextSuggestion
'
,
handler
:
handler
(
'
selectNextSuggestion
'
,
c
=>
c
.
selectNextSuggestion
()),
weight
,
when
:
KbExpr
.
and
(
KbExpr
.
has
(
KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS
),
KbExpr
.
has
(
CONTEXT_SUGGEST_WIDGET_VISIBLE
)),
when
:
KbExpr
.
and
(
KbExpr
.
has
(
KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS
),
KbExpr
.
has
(
SuggestContext
.
Visible
),
KbExpr
.
has
(
SuggestContext
.
MultipleSuggestions
)),
primary
:
KeyCode
.
DownArrow
,
secondary
:
[
KeyMod
.
Alt
|
KeyCode
.
DownArrow
]
});
...
...
@@ -259,7 +259,7 @@ KeybindingsRegistry.registerCommandDesc({
id
:
'
selectNextPageSuggestion
'
,
handler
:
handler
(
'
selectNextPageSuggestion
'
,
c
=>
c
.
selectNextPageSuggestion
()),
weight
,
when
:
KbExpr
.
and
(
KbExpr
.
has
(
KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS
),
KbExpr
.
has
(
CONTEXT_SUGGEST_WIDGET_VISIBLE
)),
when
:
KbExpr
.
and
(
KbExpr
.
has
(
KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS
),
KbExpr
.
has
(
SuggestContext
.
Visible
),
KbExpr
.
has
(
SuggestContext
.
MultipleSuggestions
)),
primary
:
KeyCode
.
PageDown
,
secondary
:
[
KeyMod
.
Alt
|
KeyCode
.
PageDown
]
});
...
...
@@ -268,7 +268,7 @@ KeybindingsRegistry.registerCommandDesc({
id
:
'
selectPrevSuggestion
'
,
handler
:
handler
(
'
selectPrevSuggestion
'
,
c
=>
c
.
selectPrevSuggestion
()),
weight
,
when
:
KbExpr
.
and
(
KbExpr
.
has
(
KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS
),
KbExpr
.
has
(
CONTEXT_SUGGEST_WIDGET_VISIBLE
)),
when
:
KbExpr
.
and
(
KbExpr
.
has
(
KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS
),
KbExpr
.
has
(
SuggestContext
.
Visible
),
KbExpr
.
has
(
SuggestContext
.
MultipleSuggestions
)),
primary
:
KeyCode
.
UpArrow
,
secondary
:
[
KeyMod
.
Alt
|
KeyCode
.
UpArrow
]
});
...
...
@@ -277,7 +277,7 @@ KeybindingsRegistry.registerCommandDesc({
id
:
'
selectPrevPageSuggestion
'
,
handler
:
handler
(
'
selectPrevPageSuggestion
'
,
c
=>
c
.
selectPrevPageSuggestion
()),
weight
,
when
:
KbExpr
.
and
(
KbExpr
.
has
(
KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS
),
KbExpr
.
has
(
CONTEXT_SUGGEST_WIDGET_VISIBLE
)),
when
:
KbExpr
.
and
(
KbExpr
.
has
(
KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS
),
KbExpr
.
has
(
SuggestContext
.
Visible
),
KbExpr
.
has
(
SuggestContext
.
MultipleSuggestions
)),
primary
:
KeyCode
.
PageUp
,
secondary
:
[
KeyMod
.
Alt
|
KeyCode
.
PageUp
]
});
...
...
@@ -286,7 +286,7 @@ KeybindingsRegistry.registerCommandDesc({
id
:
'
toggleSuggestionDetails
'
,
handler
:
handler
(
'
toggleSuggestionDetails
'
,
c
=>
c
.
toggleSuggestionDetails
()),
weight
,
when
:
KbExpr
.
and
(
KbExpr
.
has
(
KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS
),
KbExpr
.
has
(
CONTEXT_SUGGEST_WIDGET_VISIBLE
)),
when
:
KbExpr
.
and
(
KbExpr
.
has
(
KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS
),
KbExpr
.
has
(
SuggestContext
.
Visible
)),
primary
:
KeyMod
.
CtrlCmd
|
KeyCode
.
Space
,
mac
:
{
primary
:
KeyMod
.
WinCtrl
|
KeyCode
.
Space
}
});
...
...
src/vs/editor/contrib/suggest/browser/suggestWidget.ts
浏览文件 @
412a6441
...
...
@@ -22,7 +22,7 @@ import { IKeybindingContextKey, IKeybindingService } from 'vs/platform/keybind
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IConfigurationChangedEvent
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ContentWidgetPositionPreference
,
ICodeEditor
,
IContentWidget
,
IContentWidgetPosition
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
C
ONTEXT_SUGGEST_WIDGET_VISIBLE
,
CONTEXT_SUGGESTION_SUPPORTS_ACCEPT_ON_KEY
}
from
'
../common/suggest
'
;
import
{
C
ontext
as
SuggestContext
}
from
'
../common/suggest
'
;
import
{
CompletionItem
,
CompletionModel
}
from
'
./completionModel
'
;
import
{
ICancelEvent
,
ISuggestEvent
,
ITriggerEvent
,
SuggestModel
}
from
'
./suggestModel
'
;
import
{
alert
}
from
'
vs/base/browser/ui/aria/aria
'
;
...
...
@@ -327,8 +327,9 @@ export class SuggestWidget implements IContentWidget, IDisposable {
private
delegate
:
IDelegate
<
CompletionItem
>
;
private
list
:
List
<
CompletionItem
>
;
private
suggestionSupportsAutoAccept
:
IKeybindingContextKey
<
boolean
>
;
private
suggestWidgetVisible
:
IKeybindingContextKey
<
boolean
>
;
private
suggestWidgetMultipleSuggestions
:
IKeybindingContextKey
<
boolean
>
;
private
suggestionSupportsAutoAccept
:
IKeybindingContextKey
<
boolean
>
;
private
editorBlurTimeout
:
TPromise
<
void
>
;
private
showTimeout
:
TPromise
<
void
>
;
...
...
@@ -375,8 +376,9 @@ export class SuggestWidget implements IContentWidget, IDisposable {
this
.
model
.
onDidCancel
(
e
=>
this
.
onDidCancel
(
e
))
];
this
.
suggestionSupportsAutoAccept
=
keybindingService
.
createKey
(
CONTEXT_SUGGESTION_SUPPORTS_ACCEPT_ON_KEY
,
true
);
this
.
suggestWidgetVisible
=
keybindingService
.
createKey
(
CONTEXT_SUGGEST_WIDGET_VISIBLE
,
false
);
this
.
suggestWidgetVisible
=
keybindingService
.
createKey
(
SuggestContext
.
Visible
,
false
);
this
.
suggestWidgetMultipleSuggestions
=
keybindingService
.
createKey
(
SuggestContext
.
MultipleSuggestions
,
false
);
this
.
suggestionSupportsAutoAccept
=
keybindingService
.
createKey
(
SuggestContext
.
AcceptOnKey
,
true
);
this
.
editor
.
addContentWidget
(
this
);
this
.
setState
(
State
.
Hidden
);
...
...
@@ -590,6 +592,7 @@ export class SuggestWidget implements IContentWidget, IDisposable {
let
visibleCount
=
this
.
completionModel
.
items
.
length
;
const
isEmpty
=
visibleCount
===
0
;
this
.
suggestWidgetMultipleSuggestions
.
set
(
visibleCount
>
1
);
if
(
isEmpty
)
{
if
(
e
.
auto
)
{
...
...
src/vs/editor/contrib/suggest/common/suggest.ts
浏览文件 @
412a6441
...
...
@@ -14,8 +14,11 @@ import {ISuggestResult, ISuggestSupport, SuggestRegistry} from 'vs/editor/common
import
{
SnippetsRegistry
}
from
'
vs/editor/common/modes/supports
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
export
var
CONTEXT_SUGGEST_WIDGET_VISIBLE
=
'
suggestWidgetVisible
'
;
export
var
CONTEXT_SUGGESTION_SUPPORTS_ACCEPT_ON_KEY
=
'
suggestionSupportsAcceptOnKey
'
;
export
const
Context
=
{
Visible
:
'
suggestWidgetVisible
'
,
MultipleSuggestions
:
'
suggestWidgetMultipleSuggestions
'
,
AcceptOnKey
:
'
suggestionSupportsAcceptOnKey
'
};
export
interface
ISuggestResult2
extends
ISuggestResult
{
support
?:
ISuggestSupport
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录