Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
cf9e62d3
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cf9e62d3
编写于
12月 19, 2018
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Merge update and cancel events to a single change event
上级
5e2ec87c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
22 deletion
+15
-22
src/vs/editor/contrib/parameterHints/parameterHintsModel.ts
src/vs/editor/contrib/parameterHints/parameterHintsModel.ts
+6
-13
src/vs/editor/contrib/parameterHints/parameterHintsWidget.ts
src/vs/editor/contrib/parameterHints/parameterHintsWidget.ts
+7
-7
src/vs/editor/contrib/parameterHints/test/parameterHintsModel.test.ts
...r/contrib/parameterHints/test/parameterHintsModel.test.ts
+2
-2
未找到文件。
src/vs/editor/contrib/parameterHints/parameterHintsModel.ts
浏览文件 @
cf9e62d3
...
...
@@ -5,7 +5,7 @@
import
{
CancelablePromise
,
createCancelablePromise
,
Delayer
}
from
'
vs/base/common/async
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
ICursorSelectionChangedEvent
}
from
'
vs/editor/common/controller/cursorEvents
'
;
...
...
@@ -18,10 +18,6 @@ export interface TriggerContext {
readonly
triggerCharacter
?:
string
;
}
export
interface
IHintEvent
{
readonly
hints
:
modes
.
SignatureHelp
;
}
const
DefaultState
=
new
class
{
readonly
state
=
'
default
'
;
};
const
PendingState
=
new
class
{
readonly
state
=
'
pending
'
;
};
...
...
@@ -38,11 +34,8 @@ export class ParameterHintsModel extends Disposable {
private
static
readonly
DEFAULT_DELAY
=
120
;
// ms
private
readonly
_onHint
=
this
.
_register
(
new
Emitter
<
IHintEvent
>
());
public
readonly
onHint
:
Event
<
IHintEvent
>
=
this
.
_onHint
.
event
;
private
readonly
_onCancel
=
this
.
_register
(
new
Emitter
<
void
>
());
public
readonly
onCancel
:
Event
<
void
>
=
this
.
_onCancel
.
event
;
private
readonly
_onChangedHints
=
this
.
_register
(
new
Emitter
<
modes
.
SignatureHelp
|
undefined
>
());
public
readonly
onChangedHints
=
this
.
_onChangedHints
.
event
;
private
editor
:
ICodeEditor
;
private
enabled
:
boolean
;
...
...
@@ -82,7 +75,7 @@ export class ParameterHintsModel extends Disposable {
this
.
throttledDelayer
.
cancel
();
if
(
!
silent
)
{
this
.
_onC
ancel
.
fire
(
void
0
);
this
.
_onC
hangedHints
.
fire
(
undefined
);
}
if
(
this
.
provideSignatureHelpRequest
)
{
...
...
@@ -153,7 +146,7 @@ export class ParameterHintsModel extends Disposable {
state
:
'
active
'
,
hints
:
{
...
this
.
state
.
hints
,
activeSignature
}
};
this
.
_on
Hint
.
fire
(
this
.
state
);
this
.
_on
ChangedHints
.
fire
(
this
.
state
.
hints
);
}
private
doTrigger
(
triggerContext
:
modes
.
SignatureHelpContext
):
Promise
<
boolean
>
{
...
...
@@ -177,7 +170,7 @@ export class ParameterHintsModel extends Disposable {
return
false
;
}
else
{
this
.
state
=
new
ActiveState
(
result
);
this
.
_on
Hint
.
fire
(
this
.
state
);
this
.
_on
ChangedHints
.
fire
(
this
.
state
.
hints
);
return
true
;
}
}).
catch
(
error
=>
{
...
...
src/vs/editor/contrib/parameterHints/parameterHintsWidget.ts
浏览文件 @
cf9e62d3
...
...
@@ -59,13 +59,13 @@ export class ParameterHintsWidget implements IContentWidget, IDisposable {
this
.
visible
=
false
;
this
.
disposables
=
[];
this
.
disposables
.
push
(
this
.
model
.
on
Hint
(
e
=>
{
this
.
show
();
this
.
render
(
e
.
hints
);
})
);
this
.
disposables
.
push
(
this
.
model
.
onCancel
(()
=>
{
this
.
hide
();
this
.
disposables
.
push
(
this
.
model
.
on
ChangedHints
(
newParameterHints
=>
{
if
(
newParameterHints
)
{
this
.
show
(
);
this
.
render
(
newParameterHints
);
}
else
{
this
.
hide
();
}
}));
}
...
...
src/vs/editor/contrib/parameterHints/test/parameterHintsModel.test.ts
浏览文件 @
cf9e62d3
...
...
@@ -244,10 +244,10 @@ suite('ParameterHintsModel', () => {
assert
.
strictEqual
(
-
1
,
didRequestCancellationOf
);
return
new
Promise
((
resolve
,
reject
)
=>
hintsModel
.
on
Hint
(
e
=>
{
hintsModel
.
on
ChangedHints
(
newParamterHints
=>
{
try
{
assert
.
strictEqual
(
0
,
didRequestCancellationOf
);
assert
.
strictEqual
(
'
1
'
,
e
.
h
ints
.
signatures
[
0
].
label
);
assert
.
strictEqual
(
'
1
'
,
newParamterH
ints
.
signatures
[
0
].
label
);
resolve
();
}
catch
(
e
)
{
reject
(
e
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录