Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
40a823ba
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
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,发现更多精彩内容 >>
提交
40a823ba
编写于
6月 22, 2018
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make hover delay time configurable (#15667)
上级
a29f4923
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
47 addition
and
18 deletion
+47
-18
src/vs/editor/common/config/commonEditorConfig.ts
src/vs/editor/common/config/commonEditorConfig.ts
+5
-0
src/vs/editor/common/config/editorOptions.ts
src/vs/editor/common/config/editorOptions.ts
+11
-2
src/vs/editor/contrib/hover/hoverOperation.ts
src/vs/editor/contrib/hover/hoverOperation.ts
+22
-16
src/vs/editor/contrib/hover/modesContentHover.ts
src/vs/editor/contrib/hover/modesContentHover.ts
+3
-0
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+6
-0
未找到文件。
src/vs/editor/common/config/commonEditorConfig.ts
浏览文件 @
40a823ba
...
...
@@ -347,6 +347,11 @@ const editorConfiguration: IConfigurationNode = {
'
default
'
:
EDITOR_DEFAULTS
.
contribInfo
.
hover
.
enabled
,
'
description
'
:
nls
.
localize
(
'
hover.enabled
'
,
"
Controls if the hover is shown
"
)
},
'
editor.hover.delay
'
:
{
'
type
'
:
'
number
'
,
'
default
'
:
EDITOR_DEFAULTS
.
contribInfo
.
hover
.
delay
,
'
description
'
:
nls
.
localize
(
'
hover.delay
'
,
"
Controls the delay after which to show the hover
"
)
},
'
editor.find.seedSearchStringFromSelection
'
:
{
'
type
'
:
'
boolean
'
,
'
default
'
:
EDITOR_DEFAULTS
.
contribInfo
.
find
.
seedSearchStringFromSelection
,
...
...
src/vs/editor/common/config/editorOptions.ts
浏览文件 @
40a823ba
...
...
@@ -146,6 +146,11 @@ export interface IEditorHoverOptions {
* Defaults to true.
*/
enabled
?:
boolean
;
/**
* Delay for showing the hover.
* Defaults to 300.
*/
delay
?:
number
;
}
/**
...
...
@@ -816,6 +821,7 @@ export interface InternalEditorFindOptions {
export
interface
InternalEditorHoverOptions
{
readonly
enabled
:
boolean
;
readonly
delay
:
number
;
}
export
interface
EditorWrappingInfo
{
...
...
@@ -1209,6 +1215,7 @@ export class InternalEditorOptions {
private
static
_equalsHoverOptions
(
a
:
InternalEditorHoverOptions
,
b
:
InternalEditorHoverOptions
):
boolean
{
return
(
a
.
enabled
===
b
.
enabled
&&
a
.
delay
===
b
.
delay
);
}
...
...
@@ -1694,7 +1701,8 @@ export class EditorOptionsValidator {
}
return
{
enabled
:
_boolean
(
opts
.
enabled
,
defaults
.
enabled
)
enabled
:
_boolean
(
opts
.
enabled
,
defaults
.
enabled
),
delay
:
_clampedInt
(
opts
.
delay
,
defaults
.
delay
,
0
,
10000
)
};
}
...
...
@@ -2392,7 +2400,8 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = {
contribInfo
:
{
selectionClipboard
:
true
,
hover
:
{
enabled
:
true
enabled
:
true
,
delay
:
300
},
links
:
true
,
contextmenu
:
true
,
...
...
src/vs/editor/contrib/hover/hoverOperation.ts
浏览文件 @
40a823ba
...
...
@@ -10,11 +10,6 @@ import { TPromise } from 'vs/base/common/winjs.base';
export
interface
IHoverComputer
<
Result
>
{
/**
* Overwrite the default hover time
*/
getHoverTimeMillis
?:
()
=>
number
;
/**
* This is called after half the hover time
*/
...
...
@@ -57,6 +52,7 @@ export class HoverOperation<Result> {
private
_computer
:
IHoverComputer
<
Result
>
;
private
_state
:
ComputeHoverOperationState
;
private
_hoverTime
:
number
;
private
_firstWaitScheduler
:
RunOnceScheduler
;
private
_secondWaitScheduler
:
RunOnceScheduler
;
...
...
@@ -71,10 +67,11 @@ export class HoverOperation<Result> {
constructor
(
computer
:
IHoverComputer
<
Result
>
,
success
:
(
r
:
Result
)
=>
void
,
error
:
(
err
:
any
)
=>
void
,
progress
:
(
progress
:
any
)
=>
void
)
{
this
.
_computer
=
computer
;
this
.
_state
=
ComputeHoverOperationState
.
IDLE
;
this
.
_hoverTime
=
HoverOperation
.
HOVER_TIME
;
this
.
_firstWaitScheduler
=
new
RunOnceScheduler
(()
=>
this
.
_triggerAsyncComputation
(),
this
.
_getHoverTimeMillis
()
/
2
);
this
.
_secondWaitScheduler
=
new
RunOnceScheduler
(()
=>
this
.
_triggerSyncComputation
(),
this
.
_getHoverTimeMillis
()
/
2
);
this
.
_loadingMessageScheduler
=
new
RunOnceScheduler
(()
=>
this
.
_showLoadingMessage
(),
3
*
this
.
_getHoverTimeMillis
()
);
this
.
_firstWaitScheduler
=
new
RunOnceScheduler
(()
=>
this
.
_triggerAsyncComputation
(),
0
);
this
.
_secondWaitScheduler
=
new
RunOnceScheduler
(()
=>
this
.
_triggerSyncComputation
(),
0
);
this
.
_loadingMessageScheduler
=
new
RunOnceScheduler
(()
=>
this
.
_showLoadingMessage
(),
0
);
this
.
_asyncComputationPromise
=
null
;
this
.
_asyncComputationPromiseDone
=
false
;
...
...
@@ -84,16 +81,25 @@ export class HoverOperation<Result> {
this
.
_progressCallback
=
progress
;
}
private
_getHoverTimeMillis
():
number
{
if
(
this
.
_computer
.
getHoverTimeMillis
)
{
return
this
.
_computer
.
getHoverTimeMillis
();
public
setHoverTime
(
hoverTime
:
number
):
void
{
this
.
_hoverTime
=
hoverTime
;
}
private
_firstWaitTime
():
number
{
return
this
.
_hoverTime
/
2
;
}
private
_secondWaitTime
():
number
{
return
this
.
_hoverTime
/
2
;
}
return
HoverOperation
.
HOVER_TIME
;
private
_loadingMessageTime
():
number
{
return
3
*
this
.
_hoverTime
;
}
private
_triggerAsyncComputation
():
void
{
this
.
_state
=
ComputeHoverOperationState
.
SECOND_WAIT
;
this
.
_secondWaitScheduler
.
schedule
();
this
.
_secondWaitScheduler
.
schedule
(
this
.
_secondWaitTime
()
);
if
(
this
.
_computer
.
computeAsync
)
{
this
.
_asyncComputationPromiseDone
=
false
;
...
...
@@ -161,8 +167,8 @@ export class HoverOperation<Result> {
if
(
mode
===
HoverStartMode
.
Delayed
)
{
if
(
this
.
_state
===
ComputeHoverOperationState
.
IDLE
)
{
this
.
_state
=
ComputeHoverOperationState
.
FIRST_WAIT
;
this
.
_firstWaitScheduler
.
schedule
();
this
.
_loadingMessageScheduler
.
schedule
();
this
.
_firstWaitScheduler
.
schedule
(
this
.
_firstWaitTime
()
);
this
.
_loadingMessageScheduler
.
schedule
(
this
.
_loadingMessageTime
()
);
}
}
else
{
switch
(
this
.
_state
)
{
...
...
src/vs/editor/contrib/hover/modesContentHover.ts
浏览文件 @
40a823ba
...
...
@@ -199,6 +199,9 @@ export class ModesContentHoverWidget extends ContentHoverWidget {
this
.
toDispose
.
push
(
dom
.
addStandardDisposableListener
(
this
.
getDomNode
(),
dom
.
EventType
.
BLUR
,
()
=>
{
dom
.
removeClass
(
this
.
getDomNode
(),
'
colorpicker-hover
'
);
}));
this
.
toDispose
.
push
(
editor
.
onDidChangeConfiguration
((
e
)
=>
{
this
.
_hoverOperation
.
setHoverTime
(
this
.
_editor
.
getConfiguration
().
contribInfo
.
hover
.
delay
);
}));
}
dispose
():
void
{
...
...
src/vs/monaco.d.ts
浏览文件 @
40a823ba
...
...
@@ -2496,6 +2496,11 @@ declare namespace monaco.editor {
* Defaults to true.
*/
enabled
?:
boolean
;
/**
* Delay for showing the hover.
* Defaults to 300.
*/
delay
?:
number
;
}
/**
...
...
@@ -3095,6 +3100,7 @@ declare namespace monaco.editor {
export
interface
InternalEditorHoverOptions
{
readonly
enabled
:
boolean
;
readonly
delay
:
number
;
}
export
interface
EditorWrappingInfo
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录