Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
ab0958ea
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,发现更多精彩内容 >>
提交
ab0958ea
编写于
4月 29, 2020
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add hover delay to env var widget
Fixes #96574
上级
232ff6c4
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
34 addition
and
4 deletion
+34
-4
src/vs/workbench/contrib/terminal/browser/widgets/environmentVariableInfoWidget.ts
...terminal/browser/widgets/environmentVariableInfoWidget.ts
+34
-4
未找到文件。
src/vs/workbench/contrib/terminal/browser/widgets/environmentVariableInfoWidget.ts
浏览文件 @
ab0958ea
...
...
@@ -5,11 +5,14 @@
import
{
Widget
}
from
'
vs/base/browser/ui/widget
'
;
import
{
IEnvironmentVariableInfo
}
from
'
vs/workbench/contrib/terminal/common/environmentVariable
'
;
import
{
getDomNodePagePosition
}
from
'
vs/base/browser/dom
'
;
import
{
MarkdownString
}
from
'
vs/base/common/htmlContent
'
;
import
{
ITerminalWidget
,
IHoverTarget
,
IHoverAnchor
,
HorizontalAnchorSide
,
VerticalAnchorSide
}
from
'
vs/workbench/contrib/terminal/browser/widgets/widgets
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
HoverWidget
}
from
'
vs/workbench/contrib/terminal/browser/widgets/hoverWidget
'
;
import
{
RunOnceScheduler
}
from
'
vs/base/common/async
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
*
as
dom
from
'
vs/base/browser/dom
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
export
class
EnvironmentVariableInfoWidget
extends
Widget
implements
ITerminalWidget
{
readonly
id
=
'
env-var-info
'
;
...
...
@@ -17,12 +20,14 @@ export class EnvironmentVariableInfoWidget extends Widget implements ITerminalWi
private
_domNode
:
HTMLElement
|
undefined
;
private
_container
:
HTMLElement
|
undefined
;
private
_hoverWidget
:
HoverWidget
|
undefined
;
private
_mouseMoveListener
:
IDisposable
|
undefined
;
get
requiresAction
()
{
return
this
.
_info
.
requiresAction
;
}
constructor
(
private
_info
:
IEnvironmentVariableInfo
,
@
IInstantiationService
private
readonly
_instantiationService
:
IInstantiationService
@
IInstantiationService
private
readonly
_instantiationService
:
IInstantiationService
,
@
IConfigurationService
private
readonly
_configurationService
:
IConfigurationService
)
{
super
();
}
...
...
@@ -32,12 +37,37 @@ export class EnvironmentVariableInfoWidget extends Widget implements ITerminalWi
this
.
_domNode
=
document
.
createElement
(
'
div
'
);
this
.
_domNode
.
classList
.
add
(
'
terminal-env-var-info
'
,
'
codicon
'
,
`codicon-
${
this
.
_info
.
getIcon
()}
`
);
container
.
appendChild
(
this
.
_domNode
);
this
.
onmouseover
(
this
.
_domNode
,
()
=>
this
.
_showHover
());
const
timeout
=
this
.
_configurationService
.
getValue
<
number
>
(
'
editor.hover.delay
'
);
const
scheduler
:
RunOnceScheduler
=
new
RunOnceScheduler
(()
=>
this
.
_showHover
(),
timeout
);
this
.
_register
(
scheduler
);
let
origin
=
{
x
:
0
,
y
:
0
};
this
.
onmouseover
(
this
.
_domNode
,
e
=>
{
origin
.
x
=
e
.
browserEvent
.
pageX
;
origin
.
y
=
e
.
browserEvent
.
pageY
;
scheduler
.
schedule
();
this
.
_mouseMoveListener
=
dom
.
addDisposableListener
(
this
.
_domNode
!
,
dom
.
EventType
.
MOUSE_MOVE
,
e
=>
{
// Reset the scheduler if the mouse moves too much
if
(
Math
.
abs
(
e
.
pageX
-
origin
.
x
)
>
window
.
devicePixelRatio
*
2
||
Math
.
abs
(
e
.
pageY
-
origin
.
y
)
>
window
.
devicePixelRatio
*
2
)
{
origin
.
x
=
e
.
pageX
;
origin
.
y
=
e
.
pageY
;
scheduler
.
schedule
();
}
});
});
this
.
onnonbubblingmouseout
(
this
.
_domNode
,
()
=>
{
scheduler
.
cancel
();
this
.
_mouseMoveListener
?.
dispose
();
});
}
dispose
()
{
super
.
dispose
();
this
.
_domNode
?.
parentElement
?.
removeChild
(
this
.
_domNode
);
this
.
_mouseMoveListener
?.
dispose
();
}
focus
()
{
...
...
@@ -67,7 +97,7 @@ class ElementHoverTarget implements IHoverTarget {
}
get
anchor
():
IHoverAnchor
{
const
position
=
getDomNodePagePosition
(
this
.
_element
);
const
position
=
dom
.
getDomNodePagePosition
(
this
.
_element
);
return
{
x
:
position
.
left
,
horizontalAnchorSide
:
HorizontalAnchorSide
.
Left
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录