Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
a29f4923
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,发现更多精彩内容 >>
提交
a29f4923
编写于
6月 22, 2018
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Show hover from action immediately (#15667)
上级
6d8e8f2f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
36 addition
and
16 deletion
+36
-16
src/vs/editor/contrib/hover/hover.ts
src/vs/editor/contrib/hover/hover.ts
+5
-4
src/vs/editor/contrib/hover/hoverOperation.ts
src/vs/editor/contrib/hover/hoverOperation.ts
+24
-5
src/vs/editor/contrib/hover/modesContentHover.ts
src/vs/editor/contrib/hover/modesContentHover.ts
+4
-4
src/vs/editor/contrib/hover/modesGlyphHover.ts
src/vs/editor/contrib/hover/modesGlyphHover.ts
+3
-3
未找到文件。
src/vs/editor/contrib/hover/hover.ts
浏览文件 @
a29f4923
...
...
@@ -24,6 +24,7 @@ import { editorHoverHighlight, editorHoverBackground, editorHoverBorder, textLin
import
{
EditorContextKeys
}
from
'
vs/editor/common/editorContextKeys
'
;
import
{
MarkdownRenderer
}
from
'
vs/editor/contrib/markdown/markdownRenderer
'
;
import
{
IEmptyContentData
}
from
'
vs/editor/browser/controller/mouseTarget
'
;
import
{
HoverStartMode
}
from
'
vs/editor/contrib/hover/hoverOperation
'
;
export
class
ModesHoverController
implements
editorCommon
.
IEditorContribution
{
...
...
@@ -143,7 +144,7 @@ export class ModesHoverController implements editorCommon.IEditorContribution {
if
(
this
.
_editor
.
getConfiguration
().
contribInfo
.
hover
&&
targetType
===
MouseTargetType
.
CONTENT_TEXT
)
{
this
.
glyphWidget
.
hide
();
this
.
contentWidget
.
startShowingAt
(
mouseEvent
.
target
.
range
,
false
);
this
.
contentWidget
.
startShowingAt
(
mouseEvent
.
target
.
range
,
HoverStartMode
.
Delayed
,
false
);
}
else
if
(
targetType
===
MouseTargetType
.
GUTTER_GLYPH_MARGIN
)
{
this
.
contentWidget
.
hide
();
this
.
glyphWidget
.
startShowingAt
(
mouseEvent
.
target
.
position
.
lineNumber
);
...
...
@@ -174,8 +175,8 @@ export class ModesHoverController implements editorCommon.IEditorContribution {
this
.
_glyphWidget
=
new
ModesGlyphHoverWidget
(
this
.
_editor
,
renderer
);
}
public
showContentHover
(
range
:
Range
,
focus
:
boolean
):
void
{
this
.
contentWidget
.
startShowingAt
(
range
,
focus
);
public
showContentHover
(
range
:
Range
,
mode
:
HoverStartMode
,
focus
:
boolean
):
void
{
this
.
contentWidget
.
startShowingAt
(
range
,
mode
,
focus
);
}
public
getId
():
string
{
...
...
@@ -223,7 +224,7 @@ class ShowHoverAction extends EditorAction {
}
const
position
=
editor
.
getPosition
();
const
range
=
new
Range
(
position
.
lineNumber
,
position
.
column
,
position
.
lineNumber
,
position
.
column
);
controller
.
showContentHover
(
range
,
true
);
controller
.
showContentHover
(
range
,
HoverStartMode
.
Immediate
,
true
);
}
}
...
...
src/vs/editor/contrib/hover/hoverOperation.ts
浏览文件 @
a29f4923
...
...
@@ -46,6 +46,11 @@ const enum ComputeHoverOperationState {
WAITING_FOR_ASYNC_COMPUTATION
=
3
}
export
const
enum
HoverStartMode
{
Delayed
=
0
,
Immediate
=
1
}
export
class
HoverOperation
<
Result
>
{
static
HOVER_TIME
=
300
;
...
...
@@ -152,11 +157,25 @@ export class HoverOperation<Result> {
}
}
public
start
():
void
{
if
(
this
.
_state
===
ComputeHoverOperationState
.
IDLE
)
{
this
.
_state
=
ComputeHoverOperationState
.
FIRST_WAIT
;
this
.
_firstWaitScheduler
.
schedule
();
this
.
_loadingMessageScheduler
.
schedule
();
public
start
(
mode
:
HoverStartMode
):
void
{
if
(
mode
===
HoverStartMode
.
Delayed
)
{
if
(
this
.
_state
===
ComputeHoverOperationState
.
IDLE
)
{
this
.
_state
=
ComputeHoverOperationState
.
FIRST_WAIT
;
this
.
_firstWaitScheduler
.
schedule
();
this
.
_loadingMessageScheduler
.
schedule
();
}
}
else
{
switch
(
this
.
_state
)
{
case
ComputeHoverOperationState
.
IDLE
:
this
.
_triggerAsyncComputation
();
this
.
_secondWaitScheduler
.
cancel
();
this
.
_triggerSyncComputation
();
break
;
case
ComputeHoverOperationState
.
SECOND_WAIT
:
this
.
_secondWaitScheduler
.
cancel
();
this
.
_triggerSyncComputation
();
break
;
}
}
}
...
...
src/vs/editor/contrib/hover/modesContentHover.ts
浏览文件 @
a29f4923
...
...
@@ -12,7 +12,7 @@ import { Position } from 'vs/editor/common/core/position';
import
{
HoverProviderRegistry
,
Hover
,
IColor
,
DocumentColorProvider
}
from
'
vs/editor/common/modes
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
getHover
}
from
'
vs/editor/contrib/hover/getHover
'
;
import
{
HoverOperation
,
IHoverComputer
}
from
'
./hoverOperation
'
;
import
{
HoverOperation
,
IHoverComputer
,
HoverStartMode
}
from
'
./hoverOperation
'
;
import
{
ContentHoverWidget
}
from
'
./hoverWidgets
'
;
import
{
IMarkdownString
,
MarkdownString
,
isEmptyMarkdownString
,
markedStringsEquals
}
from
'
vs/base/common/htmlContent
'
;
import
{
MarkdownRenderer
}
from
'
vs/editor/contrib/markdown/markdownRenderer
'
;
...
...
@@ -220,12 +220,12 @@ export class ModesContentHoverWidget extends ContentHoverWidget {
this
.
_computer
.
clearResult
();
if
(
!
this
.
_colorPicker
)
{
// TODO@Michel ensure that displayed text for other decorations is computed even if color picker is in place
this
.
_hoverOperation
.
start
();
this
.
_hoverOperation
.
start
(
HoverStartMode
.
Delayed
);
}
}
}
startShowingAt
(
range
:
Range
,
focus
:
boolean
):
void
{
startShowingAt
(
range
:
Range
,
mode
:
HoverStartMode
,
focus
:
boolean
):
void
{
if
(
this
.
_lastRange
&&
this
.
_lastRange
.
equalsRange
(
range
))
{
// We have to show the widget at the exact same range as before, so no work is needed
return
;
...
...
@@ -262,7 +262,7 @@ export class ModesContentHoverWidget extends ContentHoverWidget {
this
.
_lastRange
=
range
;
this
.
_computer
.
setRange
(
range
);
this
.
_shouldFocus
=
focus
;
this
.
_hoverOperation
.
start
();
this
.
_hoverOperation
.
start
(
mode
);
}
hide
():
void
{
...
...
src/vs/editor/contrib/hover/modesGlyphHover.ts
浏览文件 @
a29f4923
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
HoverOperation
,
IHoverComputer
}
from
'
./hoverOperation
'
;
import
{
HoverOperation
,
IHoverComputer
,
HoverStartMode
}
from
'
./hoverOperation
'
;
import
{
GlyphHoverWidget
}
from
'
./hoverWidgets
'
;
import
{
$
}
from
'
vs/base/browser/dom
'
;
import
{
MarkdownRenderer
}
from
'
vs/editor/contrib/markdown/markdownRenderer
'
;
...
...
@@ -123,7 +123,7 @@ export class ModesGlyphHoverWidget extends GlyphHoverWidget {
// we need to recompute the displayed text
this
.
_hoverOperation
.
cancel
();
this
.
_computer
.
clearResult
();
this
.
_hoverOperation
.
start
();
this
.
_hoverOperation
.
start
(
HoverStartMode
.
Delayed
);
}
}
...
...
@@ -139,7 +139,7 @@ export class ModesGlyphHoverWidget extends GlyphHoverWidget {
this
.
_lastLineNumber
=
lineNumber
;
this
.
_computer
.
setLineNumber
(
lineNumber
);
this
.
_hoverOperation
.
start
();
this
.
_hoverOperation
.
start
(
HoverStartMode
.
Delayed
);
}
public
hide
():
void
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录