Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
772defa0
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,发现更多精彩内容 >>
提交
772defa0
编写于
2月 26, 2019
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#69388 Let hovers create the marker renderers
上级
2e173fab
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
22 addition
and
16 deletion
+22
-16
src/vs/editor/contrib/hover/hover.ts
src/vs/editor/contrib/hover/hover.ts
+2
-4
src/vs/editor/contrib/hover/modesContentHover.ts
src/vs/editor/contrib/hover/modesContentHover.ts
+12
-10
src/vs/editor/contrib/hover/modesGlyphHover.ts
src/vs/editor/contrib/hover/modesGlyphHover.ts
+8
-2
未找到文件。
src/vs/editor/contrib/hover/hover.ts
浏览文件 @
772defa0
...
...
@@ -19,7 +19,6 @@ import { IModeService } from 'vs/editor/common/services/modeService';
import
{
HoverStartMode
}
from
'
vs/editor/contrib/hover/hoverOperation
'
;
import
{
ModesContentHoverWidget
}
from
'
vs/editor/contrib/hover/modesContentHover
'
;
import
{
ModesGlyphHoverWidget
}
from
'
vs/editor/contrib/hover/modesGlyphHover
'
;
import
{
MarkdownRenderer
}
from
'
vs/editor/contrib/markdown/markdownRenderer
'
;
import
{
KeybindingWeight
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
IOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
import
{
editorHoverBackground
,
editorHoverBorder
,
editorHoverHighlight
,
textCodeBlockBackground
,
textLinkForeground
,
editorHoverStatusBarBackground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
...
...
@@ -214,9 +213,8 @@ export class ModesHoverController implements IEditorContribution {
}
private
_createHoverWidget
()
{
const
renderer
=
new
MarkdownRenderer
(
this
.
_editor
,
this
.
_modeService
,
this
.
_openerService
);
this
.
_contentWidget
=
new
ModesContentHoverWidget
(
this
.
_editor
,
renderer
,
this
.
_markerDecorationsService
,
this
.
_themeService
,
this
.
_keybindingService
,
this
.
_contextMenuService
,
this
.
_bulkEditService
,
this
.
_commandService
,
this
.
_openerService
);
this
.
_glyphWidget
=
new
ModesGlyphHoverWidget
(
this
.
_editor
,
renderer
);
this
.
_contentWidget
=
new
ModesContentHoverWidget
(
this
.
_editor
,
this
.
_markerDecorationsService
,
this
.
_themeService
,
this
.
_keybindingService
,
this
.
_contextMenuService
,
this
.
_bulkEditService
,
this
.
_commandService
,
this
.
_modeService
,
this
.
_openerService
);
this
.
_glyphWidget
=
new
ModesGlyphHoverWidget
(
this
.
_editor
,
this
.
_modeService
,
this
.
_openerService
);
}
public
showContentHover
(
range
:
Range
,
mode
:
HoverStartMode
,
focus
:
boolean
):
void
{
...
...
src/vs/editor/contrib/hover/modesContentHover.ts
浏览文件 @
772defa0
...
...
@@ -39,6 +39,7 @@ import { getCodeActions } from 'vs/editor/contrib/codeAction/codeAction';
import
{
applyCodeAction
,
QuickFixAction
}
from
'
vs/editor/contrib/codeAction/codeActionCommands
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
CodeActionKind
}
from
'
vs/editor/contrib/codeAction/codeActionTrigger
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
const
$
=
dom
.
$
;
...
...
@@ -205,7 +206,6 @@ export class ModesContentHoverWidget extends ContentHoverWidget {
private
_hoverOperation
:
HoverOperation
<
HoverPart
[]
>
;
private
_highlightDecorations
:
string
[];
private
_isChangingDecorations
:
boolean
;
private
_markdownRenderer
:
MarkdownRenderer
;
private
_shouldFocus
:
boolean
;
private
_colorPicker
:
ColorPickerWidget
|
null
;
...
...
@@ -213,13 +213,13 @@ export class ModesContentHoverWidget extends ContentHoverWidget {
constructor
(
editor
:
ICodeEditor
,
markdownRenderer
:
MarkdownRenderer
,
markerDecorationsService
:
IMarkerDecorationsService
,
private
readonly
_themeService
:
IThemeService
,
private
readonly
_keybindingService
:
IKeybindingService
,
private
readonly
_contextMenuService
:
IContextMenuService
,
private
readonly
_bulkEditService
:
IBulkEditService
,
private
readonly
_commandService
:
ICommandService
,
private
readonly
_modeService
:
IModeService
,
private
readonly
_openerService
:
IOpenerService
|
null
=
NullOpenerService
,
)
{
super
(
ModesContentHoverWidget
.
ID
,
editor
);
...
...
@@ -230,9 +230,6 @@ export class ModesContentHoverWidget extends ContentHoverWidget {
this
.
_highlightDecorations
=
[];
this
.
_isChangingDecorations
=
false
;
this
.
_markdownRenderer
=
markdownRenderer
;
this
.
_register
(
markdownRenderer
.
onDidRenderCodeBlock
(
this
.
onContentsChange
,
this
));
this
.
_hoverOperation
=
new
HoverOperation
(
this
.
_computer
,
result
=>
this
.
_withResult
(
result
,
true
),
...
...
@@ -357,7 +354,7 @@ export class ModesContentHoverWidget extends ContentHoverWidget {
let
isEmptyHoverContent
=
true
;
let
containColorPicker
=
false
;
let
markdownDisposeable
:
IDisposable
;
let
markdownDisposeable
s
:
IDisposable
[]
=
[]
;
const
markerMessages
:
MarkerHover
[]
=
[];
messages
.
forEach
((
msg
)
=>
{
if
(
!
msg
.
range
)
{
...
...
@@ -448,7 +445,7 @@ export class ModesContentHoverWidget extends ContentHoverWidget {
this
.
updateContents
(
fragment
);
this
.
_colorPicker
.
layout
();
this
.
renderDisposable
=
combinedDisposable
([
colorListener
,
colorChangeListener
,
widget
,
markdownDisposeable
]);
this
.
renderDisposable
=
combinedDisposable
([
colorListener
,
colorChangeListener
,
widget
,
...
markdownDisposeables
]);
});
}
else
{
if
(
msg
instanceof
MarkerHover
)
{
...
...
@@ -458,9 +455,14 @@ export class ModesContentHoverWidget extends ContentHoverWidget {
msg
.
contents
.
filter
(
contents
=>
!
isEmptyMarkdownString
(
contents
))
.
forEach
(
contents
=>
{
const
renderedContents
=
this
.
_markdownRenderer
.
render
(
contents
);
markdownDisposeable
=
renderedContents
;
fragment
.
appendChild
(
$
(
'
div.hover-row.hover-contents
'
,
undefined
,
renderedContents
.
element
));
const
markdownHoverElement
=
$
(
'
div.hover-row.markdown-hover
'
);
const
hoverContentsElement
=
dom
.
append
(
markdownHoverElement
,
$
(
'
div.hover-contents
'
));
const
renderer
=
new
MarkdownRenderer
(
this
.
_editor
,
this
.
_modeService
,
this
.
_openerService
);
markdownDisposeables
.
push
(
renderer
.
onDidRenderCodeBlock
(()
=>
this
.
onContentsChange
()));
const
renderedContents
=
renderer
.
render
(
contents
);
hoverContentsElement
.
appendChild
(
renderedContents
.
element
);
fragment
.
appendChild
(
markdownHoverElement
);
markdownDisposeables
.
push
(
renderedContents
);
isEmptyHoverContent
=
false
;
});
}
...
...
src/vs/editor/contrib/hover/modesGlyphHover.ts
浏览文件 @
772defa0
...
...
@@ -10,6 +10,8 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import
{
HoverOperation
,
HoverStartMode
,
IHoverComputer
}
from
'
vs/editor/contrib/hover/hoverOperation
'
;
import
{
GlyphHoverWidget
}
from
'
vs/editor/contrib/hover/hoverWidgets
'
;
import
{
MarkdownRenderer
}
from
'
vs/editor/contrib/markdown/markdownRenderer
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
IOpenerService
,
NullOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
export
interface
IHoverMessage
{
value
:
IMarkdownString
;
...
...
@@ -94,12 +96,16 @@ export class ModesGlyphHoverWidget extends GlyphHoverWidget {
private
_hoverOperation
:
HoverOperation
<
IHoverMessage
[]
>
;
private
_renderDisposeables
:
IDisposable
[];
constructor
(
editor
:
ICodeEditor
,
markdownRenderer
:
MarkdownRenderer
)
{
constructor
(
editor
:
ICodeEditor
,
modeService
:
IModeService
,
openerService
:
IOpenerService
|
null
=
NullOpenerService
,
)
{
super
(
ModesGlyphHoverWidget
.
ID
,
editor
);
this
.
_lastLineNumber
=
-
1
;
this
.
_markdownRenderer
=
markdownRenderer
;
this
.
_markdownRenderer
=
new
MarkdownRenderer
(
this
.
_editor
,
modeService
,
openerService
)
;
this
.
_computer
=
new
MarginComputer
(
this
.
_editor
);
this
.
_hoverOperation
=
new
HoverOperation
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录