Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
d3b643c8
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,发现更多精彩内容 >>
未验证
提交
d3b643c8
编写于
12月 31, 2020
作者:
A
Alexandru Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
💄
上级
923f34a8
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
25 deletion
+25
-25
src/vs/editor/contrib/hover/modesContentHover.ts
src/vs/editor/contrib/hover/modesContentHover.ts
+25
-25
未找到文件。
src/vs/editor/contrib/hover/modesContentHover.ts
浏览文件 @
d3b643c8
...
...
@@ -85,16 +85,16 @@ class ModesContentComputer implements IHoverComputer<HoverPartInfo[]> {
this
.
_range
=
null
;
}
setRange
(
range
:
Range
):
void
{
public
setRange
(
range
:
Range
):
void
{
this
.
_range
=
range
;
this
.
_result
=
[];
}
clearResult
():
void
{
public
clearResult
():
void
{
this
.
_result
=
[];
}
async
computeAsync
(
token
:
CancellationToken
):
Promise
<
HoverPartInfo
[]
>
{
public
async
computeAsync
(
token
:
CancellationToken
):
Promise
<
HoverPartInfo
[]
>
{
if
(
!
this
.
_editor
.
hasModel
()
||
!
this
.
_range
)
{
return
Promise
.
resolve
([]);
}
...
...
@@ -121,7 +121,7 @@ class ModesContentComputer implements IHoverComputer<HoverPartInfo[]> {
return
result
;
}
computeSync
():
HoverPartInfo
[]
{
public
computeSync
():
HoverPartInfo
[]
{
if
(
!
this
.
_editor
.
hasModel
()
||
!
this
.
_range
)
{
return
[];
}
...
...
@@ -173,7 +173,7 @@ class ModesContentComputer implements IHoverComputer<HoverPartInfo[]> {
return
coalesce
(
result
);
}
onResult
(
result
:
HoverPartInfo
[],
isFromSynchronousComputation
:
boolean
):
void
{
public
onResult
(
result
:
HoverPartInfo
[],
isFromSynchronousComputation
:
boolean
):
void
{
// Always put synchronous messages before asynchronous ones
if
(
isFromSynchronousComputation
)
{
this
.
_result
=
result
.
concat
(
this
.
_result
.
sort
((
a
,
b
)
=>
{
...
...
@@ -189,11 +189,11 @@ class ModesContentComputer implements IHoverComputer<HoverPartInfo[]> {
}
}
getResult
():
HoverPartInfo
[]
{
public
getResult
():
HoverPartInfo
[]
{
return
this
.
_result
.
slice
(
0
);
}
getResultWithLoadingMessage
():
HoverPartInfo
[]
{
public
getResultWithLoadingMessage
():
HoverPartInfo
[]
{
if
(
this
.
_range
)
{
const
loadingMessage
=
new
HoverPartInfo
(
this
.
_markdownHoverParticipant
,
true
,
this
.
_markdownHoverParticipant
.
createLoadingMessage
(
this
.
_range
));
return
this
.
_result
.
slice
(
0
).
concat
([
loadingMessage
]);
...
...
@@ -210,12 +210,12 @@ export class ModesContentHoverWidget extends Widget implements IContentWidget {
private
readonly
_markerHoverParticipant
:
IEditorHoverParticipant
<
MarkerHover
>
;
private
readonly
_markdownHoverParticipant
:
MarkdownHoverParticipant
;
pr
otected
readonly
_hover
:
HoverWidget
;
pr
ivate
readonly
_hover
:
HoverWidget
;
private
readonly
_id
:
string
;
pr
otected
_editor
:
ICodeEditor
;
pr
ivate
_editor
:
ICodeEditor
;
private
_isVisible
:
boolean
;
pr
otected
_showAtPosition
:
Position
|
null
;
pr
otected
_showAtRange
:
Range
|
null
;
pr
ivate
_showAtPosition
:
Position
|
null
;
pr
ivate
_showAtRange
:
Range
|
null
;
private
_stoleFocus
:
boolean
;
// IContentWidget.allowEditorOverflow
...
...
@@ -232,11 +232,11 @@ export class ModesContentHoverWidget extends Widget implements IContentWidget {
private
readonly
renderDisposable
=
this
.
_register
(
new
MutableDisposable
<
IDisposable
>
());
pr
otected
get
isVisible
():
boolean
{
pr
ivate
get
isVisible
():
boolean
{
return
this
.
_isVisible
;
}
pr
otected
set
isVisible
(
value
:
boolean
)
{
pr
ivate
set
isVisible
(
value
:
boolean
)
{
this
.
_isVisible
=
value
;
this
.
_hover
.
containerDomNode
.
classList
.
toggle
(
'
hidden
'
,
!
this
.
_isVisible
);
}
...
...
@@ -266,7 +266,7 @@ export class ModesContentHoverWidget extends Widget implements IContentWidget {
this
.
_register
(
this
.
_editor
.
onDidChangeConfiguration
((
e
:
ConfigurationChangedEvent
)
=>
{
if
(
e
.
hasChanged
(
EditorOption
.
fontInfo
))
{
this
.
updateFont
();
this
.
_
updateFont
();
}
}));
...
...
@@ -330,7 +330,7 @@ export class ModesContentHoverWidget extends Widget implements IContentWidget {
}));
}
dispose
():
void
{
public
dispose
():
void
{
this
.
_hoverOperation
.
cancel
();
this
.
_editor
.
removeContentWidget
(
this
);
super
.
dispose
();
...
...
@@ -375,15 +375,15 @@ export class ModesContentHoverWidget extends Widget implements IContentWidget {
return
null
;
}
private
updateFont
():
void
{
private
_
updateFont
():
void
{
const
codeClasses
:
HTMLElement
[]
=
Array
.
prototype
.
slice
.
call
(
this
.
_hover
.
contentsDomNode
.
getElementsByClassName
(
'
code
'
));
codeClasses
.
forEach
(
node
=>
this
.
_editor
.
applyFontInfo
(
node
));
}
pr
otected
updateContents
(
node
:
Node
):
void
{
pr
ivate
_
updateContents
(
node
:
Node
):
void
{
this
.
_hover
.
contentsDomNode
.
textContent
=
''
;
this
.
_hover
.
contentsDomNode
.
appendChild
(
node
);
this
.
updateFont
();
this
.
_
updateFont
();
this
.
_editor
.
layoutContentWidget
(
this
);
this
.
_hover
.
onContentsChanged
();
...
...
@@ -399,7 +399,7 @@ export class ModesContentHoverWidget extends Widget implements IContentWidget {
this
.
_hover
.
contentsDomNode
.
style
.
maxWidth
=
`
${
Math
.
max
(
this
.
_editor
.
getLayoutInfo
().
width
*
0.66
,
500
)}
px`
;
}
onModelDecorationsChanged
():
void
{
public
onModelDecorationsChanged
():
void
{
if
(
this
.
_isChangingDecorations
)
{
return
;
}
...
...
@@ -415,7 +415,7 @@ export class ModesContentHoverWidget extends Widget implements IContentWidget {
}
}
startShowingAt
(
range
:
Range
,
mode
:
HoverStartMode
,
focus
:
boolean
):
void
{
public
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
;
...
...
@@ -455,7 +455,7 @@ export class ModesContentHoverWidget extends Widget implements IContentWidget {
this
.
_hoverOperation
.
start
(
mode
);
}
hide
():
void
{
public
hide
():
void
{
this
.
_lastRange
=
null
;
this
.
_hoverOperation
.
cancel
();
...
...
@@ -481,14 +481,14 @@ export class ModesContentHoverWidget extends Widget implements IContentWidget {
this
.
_colorPicker
=
null
;
}
isColorPickerVisible
():
boolean
{
public
isColorPickerVisible
():
boolean
{
if
(
this
.
_colorPicker
)
{
return
true
;
}
return
false
;
}
onContentsChanged
():
void
{
public
onContentsChanged
():
void
{
this
.
_hover
.
onContentsChanged
();
}
...
...
@@ -604,7 +604,7 @@ export class ModesContentHoverWidget extends Widget implements IContentWidget {
this
.
_colorPicker
=
widget
;
this
.
showAt
(
range
.
getStartPosition
(),
range
,
this
.
_shouldFocus
);
this
.
updateContents
(
fragment
);
this
.
_
updateContents
(
fragment
);
this
.
_colorPicker
.
layout
();
this
.
renderDisposable
.
value
=
combinedDisposable
(
colorListener
,
colorChangeListener
,
widget
,
disposables
);
...
...
@@ -634,7 +634,7 @@ export class ModesContentHoverWidget extends Widget implements IContentWidget {
if
(
!
containColorPicker
&&
fragment
.
hasChildNodes
())
{
this
.
showAt
(
new
Position
(
renderRange
.
startLineNumber
,
renderColumn
),
highlightRange
,
this
.
_shouldFocus
);
this
.
updateContents
(
fragment
);
this
.
_
updateContents
(
fragment
);
}
this
.
_isChangingDecorations
=
true
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录