Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
5c96e9fe
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,发现更多精彩内容 >>
提交
5c96e9fe
编写于
4月 23, 2018
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixes #47660: Trigger hover even when the mouse is very close to the content text
上级
12e96793
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
27 addition
and
6 deletion
+27
-6
src/vs/editor/browser/controller/mouseTarget.ts
src/vs/editor/browser/controller/mouseTarget.ts
+15
-4
src/vs/editor/contrib/hover/hover.ts
src/vs/editor/contrib/hover/hover.ts
+12
-2
未找到文件。
src/vs/editor/browser/controller/mouseTarget.ts
浏览文件 @
5c96e9fe
...
@@ -35,6 +35,7 @@ export interface IMarginData {
...
@@ -35,6 +35,7 @@ export interface IMarginData {
export
interface
IEmptyContentData
{
export
interface
IEmptyContentData
{
isAfterLines
:
boolean
;
isAfterLines
:
boolean
;
horizontalDistanceToText
?:
number
;
}
}
interface
IETextRange
{
interface
IETextRange
{
...
@@ -415,7 +416,13 @@ class HitTestRequest extends BareHitTestRequest {
...
@@ -415,7 +416,13 @@ class HitTestRequest extends BareHitTestRequest {
}
}
const
EMPTY_CONTENT_AFTER_LINES
:
IEmptyContentData
=
{
isAfterLines
:
true
};
const
EMPTY_CONTENT_AFTER_LINES
:
IEmptyContentData
=
{
isAfterLines
:
true
};
const
EMPTY_CONTENT_IN_LINES
:
IEmptyContentData
=
{
isAfterLines
:
false
};
function
createEmptyContentDataInLines
(
horizontalDistanceToText
:
number
):
IEmptyContentData
{
return
{
isAfterLines
:
false
,
horizontalDistanceToText
:
horizontalDistanceToText
};
}
export
class
MouseTargetFactory
{
export
class
MouseTargetFactory
{
...
@@ -639,7 +646,9 @@ export class MouseTargetFactory {
...
@@ -639,7 +646,9 @@ export class MouseTargetFactory {
if
(
ElementPath
.
isStrictChildOfViewLines
(
request
.
targetPath
))
{
if
(
ElementPath
.
isStrictChildOfViewLines
(
request
.
targetPath
))
{
const
lineNumber
=
ctx
.
getLineNumberAtVerticalOffset
(
request
.
mouseVerticalOffset
);
const
lineNumber
=
ctx
.
getLineNumberAtVerticalOffset
(
request
.
mouseVerticalOffset
);
if
(
ctx
.
model
.
getLineLength
(
lineNumber
)
===
0
)
{
if
(
ctx
.
model
.
getLineLength
(
lineNumber
)
===
0
)
{
return
request
.
fulfill
(
MouseTargetType
.
CONTENT_EMPTY
,
new
Position
(
lineNumber
,
1
),
void
0
,
EMPTY_CONTENT_IN_LINES
);
const
lineWidth
=
ctx
.
getLineWidth
(
lineNumber
);
const
detail
=
createEmptyContentDataInLines
(
request
.
mouseContentHorizontalOffset
-
lineWidth
);
return
request
.
fulfill
(
MouseTargetType
.
CONTENT_EMPTY
,
new
Position
(
lineNumber
,
1
),
void
0
,
detail
);
}
}
}
}
...
@@ -713,9 +722,11 @@ export class MouseTargetFactory {
...
@@ -713,9 +722,11 @@ export class MouseTargetFactory {
if
(
request
.
mouseContentHorizontalOffset
>
lineWidth
)
{
if
(
request
.
mouseContentHorizontalOffset
>
lineWidth
)
{
if
(
browser
.
isEdge
&&
pos
.
column
===
1
)
{
if
(
browser
.
isEdge
&&
pos
.
column
===
1
)
{
// See https://github.com/Microsoft/vscode/issues/10875
// See https://github.com/Microsoft/vscode/issues/10875
return
request
.
fulfill
(
MouseTargetType
.
CONTENT_EMPTY
,
new
Position
(
lineNumber
,
ctx
.
model
.
getLineMaxColumn
(
lineNumber
)),
void
0
,
EMPTY_CONTENT_IN_LINES
);
const
detail
=
createEmptyContentDataInLines
(
request
.
mouseContentHorizontalOffset
-
lineWidth
);
return
request
.
fulfill
(
MouseTargetType
.
CONTENT_EMPTY
,
new
Position
(
lineNumber
,
ctx
.
model
.
getLineMaxColumn
(
lineNumber
)),
void
0
,
detail
);
}
}
return
request
.
fulfill
(
MouseTargetType
.
CONTENT_EMPTY
,
pos
,
void
0
,
EMPTY_CONTENT_IN_LINES
);
const
detail
=
createEmptyContentDataInLines
(
request
.
mouseContentHorizontalOffset
-
lineWidth
);
return
request
.
fulfill
(
MouseTargetType
.
CONTENT_EMPTY
,
pos
,
void
0
,
detail
);
}
}
const
visibleRange
=
ctx
.
visibleRangeForPosition2
(
lineNumber
,
column
);
const
visibleRange
=
ctx
.
visibleRangeForPosition2
(
lineNumber
,
column
);
...
...
src/vs/editor/contrib/hover/hover.ts
浏览文件 @
5c96e9fe
...
@@ -23,6 +23,7 @@ import { registerThemingParticipant, IThemeService } from 'vs/platform/theme/com
...
@@ -23,6 +23,7 @@ import { registerThemingParticipant, IThemeService } from 'vs/platform/theme/com
import
{
editorHoverHighlight
,
editorHoverBackground
,
editorHoverBorder
,
textLinkForeground
,
textCodeBlockBackground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
editorHoverHighlight
,
editorHoverBackground
,
editorHoverBorder
,
textLinkForeground
,
textCodeBlockBackground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
EditorContextKeys
}
from
'
vs/editor/common/editorContextKeys
'
;
import
{
EditorContextKeys
}
from
'
vs/editor/common/editorContextKeys
'
;
import
{
MarkdownRenderer
}
from
'
vs/editor/contrib/markdown/markdownRenderer
'
;
import
{
MarkdownRenderer
}
from
'
vs/editor/contrib/markdown/markdownRenderer
'
;
import
{
IEmptyContentData
}
from
'
vs/editor/browser/controller/mouseTarget
'
;
export
class
ModesHoverController
implements
editorCommon
.
IEditorContribution
{
export
class
ModesHoverController
implements
editorCommon
.
IEditorContribution
{
...
@@ -114,8 +115,8 @@ export class ModesHoverController implements editorCommon.IEditorContribution {
...
@@ -114,8 +115,8 @@ export class ModesHoverController implements editorCommon.IEditorContribution {
}
}
private
_onEditorMouseMove
(
mouseEvent
:
IEditorMouseEvent
):
void
{
private
_onEditorMouseMove
(
mouseEvent
:
IEditorMouseEvent
):
void
{
var
targetType
=
mouseEvent
.
target
.
type
;
let
targetType
=
mouseEvent
.
target
.
type
;
var
stopKey
=
platform
.
isMacintosh
?
'
metaKey
'
:
'
ctrlKey
'
;
let
stopKey
=
platform
.
isMacintosh
?
'
metaKey
'
:
'
ctrlKey
'
;
if
(
this
.
_isMouseDown
&&
this
.
_hoverClicked
&&
this
.
contentWidget
.
isColorPickerVisible
())
{
if
(
this
.
_isMouseDown
&&
this
.
_hoverClicked
&&
this
.
contentWidget
.
isColorPickerVisible
())
{
return
;
return
;
...
@@ -131,6 +132,15 @@ export class ModesHoverController implements editorCommon.IEditorContribution {
...
@@ -131,6 +132,15 @@ export class ModesHoverController implements editorCommon.IEditorContribution {
return
;
return
;
}
}
if
(
targetType
===
MouseTargetType
.
CONTENT_EMPTY
)
{
const
epsilon
=
this
.
_editor
.
getConfiguration
().
fontInfo
.
typicalHalfwidthCharacterWidth
/
2
;
const
data
=
<
IEmptyContentData
>
mouseEvent
.
target
.
detail
;
if
(
data
&&
!
data
.
isAfterLines
&&
typeof
data
.
horizontalDistanceToText
===
'
number
'
&&
data
.
horizontalDistanceToText
<
epsilon
)
{
// Let hover kick in even when the mouse is technically in the empty area after a line, given the distance is small enough
targetType
=
MouseTargetType
.
CONTENT_TEXT
;
}
}
if
(
this
.
_editor
.
getConfiguration
().
contribInfo
.
hover
&&
targetType
===
MouseTargetType
.
CONTENT_TEXT
)
{
if
(
this
.
_editor
.
getConfiguration
().
contribInfo
.
hover
&&
targetType
===
MouseTargetType
.
CONTENT_TEXT
)
{
this
.
glyphWidget
.
hide
();
this
.
glyphWidget
.
hide
();
this
.
contentWidget
.
startShowingAt
(
mouseEvent
.
target
.
range
,
false
);
this
.
contentWidget
.
startShowingAt
(
mouseEvent
.
target
.
range
,
false
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录