Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
fa2d26a2
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,发现更多精彩内容 >>
提交
fa2d26a2
编写于
4月 19, 2020
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove event from new link tooltip callbacks
上级
fc34a5ef
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
44 addition
and
39 deletion
+44
-39
src/vs/workbench/contrib/terminal/browser/links/terminalLink.ts
.../workbench/contrib/terminal/browser/links/terminalLink.ts
+1
-2
src/vs/workbench/contrib/terminal/browser/links/terminalLinkManager.ts
...nch/contrib/terminal/browser/links/terminalLinkManager.ts
+40
-34
src/vs/workbench/contrib/terminal/browser/links/terminalValidatedLocalLinkProvider.ts
...minal/browser/links/terminalValidatedLocalLinkProvider.ts
+1
-1
src/vs/workbench/contrib/terminal/browser/links/terminalWebLinkProvider.ts
...contrib/terminal/browser/links/terminalWebLinkProvider.ts
+1
-1
src/vs/workbench/contrib/terminal/browser/links/terminalWordLinkProvider.ts
...ontrib/terminal/browser/links/terminalWordLinkProvider.ts
+1
-1
未找到文件。
src/vs/workbench/contrib/terminal/browser/links/terminalLink.ts
浏览文件 @
fa2d26a2
...
...
@@ -19,7 +19,7 @@ export class TerminalLink extends DisposableStore implements ILink {
public
readonly
text
:
string
,
private
readonly
_viewportY
:
number
,
private
readonly
_activateCallback
:
(
event
:
MouseEvent
,
uri
:
string
)
=>
void
,
private
readonly
_tooltipCallback
:
(
event
:
MouseEvent
,
uri
:
string
,
location
:
IViewportRange
,
modifierDownCallback
?:
()
=>
void
,
modifierUpCallback
?:
()
=>
void
)
=>
boolean
|
void
,
private
readonly
_tooltipCallback
:
(
uri
:
string
,
location
:
IViewportRange
,
modifierDownCallback
?:
()
=>
void
,
modifierUpCallback
?:
()
=>
void
)
=>
boolean
|
void
,
private
readonly
_isHighConfidenceLink
:
boolean
,
@
IConfigurationService
private
readonly
_configurationService
:
IConfigurationService
)
{
...
...
@@ -52,7 +52,6 @@ export class TerminalLink extends DisposableStore implements ILink {
const
timeout
=
this
.
_configurationService
.
getValue
<
number
>
(
'
editor.hover.delay
'
);
const
scheduler
=
new
RunOnceScheduler
(()
=>
{
this
.
_tooltipCallback
(
event
,
text
,
convertBufferRangeToViewport
(
this
.
range
,
this
.
_viewportY
),
this
.
_isHighConfidenceLink
?
()
=>
this
.
_enableDecorations
()
:
undefined
,
...
...
src/vs/workbench/contrib/terminal/browser/links/terminalLinkManager.ts
浏览文件 @
fa2d26a2
...
...
@@ -89,7 +89,6 @@ export class TerminalLinkManager extends DisposableStore {
private
_processCwd
:
string
|
undefined
;
private
_gitDiffPreImagePattern
:
RegExp
;
private
_gitDiffPostImagePattern
:
RegExp
;
private
readonly
_tooltipCallback
:
(
uri
:
string
,
location
:
IViewportRange
,
linkHandler
:
(
url
:
string
)
=>
void
,
modifierDownCallback
?:
()
=>
void
,
modifierUpCallback
?:
()
=>
void
)
=>
boolean
|
void
;
private
_linkMatchers
:
number
[]
=
[];
private
_webLinksAddon
:
ITerminalAddon
|
undefined
;
private
_linkProviders
:
IDisposable
[]
=
[];
...
...
@@ -134,24 +133,6 @@ export class TerminalLinkManager extends DisposableStore {
// Matches '+++ b/src/file1', capturing 'src/file1' in group 1
this
.
_gitDiffPostImagePattern
=
/^
\+\+\+
b
\/(\S
*
)
/
;
this
.
_tooltipCallback
=
(
uri
:
string
,
viewportRange
:
IViewportRange
,
linkHandler
:
(
url
:
string
)
=>
void
,
modifierDownCallback
?:
()
=>
void
,
modifierUpCallback
?:
()
=>
void
)
=>
{
if
(
!
this
.
_widgetManager
)
{
return
;
}
const
core
=
(
this
.
_xterm
as
any
).
_core
as
XTermCore
;
const
cellDimensions
=
{
width
:
core
.
_renderService
.
dimensions
.
actualCellWidth
,
height
:
core
.
_renderService
.
dimensions
.
actualCellHeight
};
const
terminalDimensions
=
{
width
:
this
.
_xterm
.
cols
,
height
:
this
.
_xterm
.
rows
};
this
.
_showHover
({
viewportRange
,
cellDimensions
,
terminalDimensions
,
modifierDownCallback
,
modifierUpCallback
},
this
.
_getLinkHoverString
(
uri
),
linkHandler
);
};
if
(
this
.
_configHelper
.
config
.
experimentalLinkProvider
)
{
this
.
registerLinkProvider
();
}
else
{
...
...
@@ -172,6 +153,30 @@ export class TerminalLinkManager extends DisposableStore {
});
}
private
_tooltipCallback
(
linkText
:
string
,
viewportRange
:
IViewportRange
,
linkHandler
:
(
url
:
string
)
=>
void
,
modifierDownCallback
?:
()
=>
void
,
modifierUpCallback
?:
()
=>
void
)
{
if
(
!
this
.
_widgetManager
)
{
return
;
}
const
core
=
(
this
.
_xterm
as
any
).
_core
as
XTermCore
;
const
cellDimensions
=
{
width
:
core
.
_renderService
.
dimensions
.
actualCellWidth
,
height
:
core
.
_renderService
.
dimensions
.
actualCellHeight
};
const
terminalDimensions
=
{
width
:
this
.
_xterm
.
cols
,
height
:
this
.
_xterm
.
rows
};
this
.
_showHover
({
viewportRange
,
cellDimensions
,
terminalDimensions
,
modifierDownCallback
,
modifierUpCallback
},
this
.
_getLinkHoverString
(
linkText
),
linkHandler
);
}
private
_showHover
(
targetOptions
:
ILinkHoverTargetOptions
,
text
:
IMarkdownString
,
...
...
@@ -210,8 +215,8 @@ export class TerminalLinkManager extends DisposableStore {
}
public
registerCustomLinkHandler
(
regex
:
RegExp
,
handler
:
(
uri
:
string
)
=>
void
,
matchIndex
?:
number
,
validationCallback
?:
XtermLinkMatcherValidationCallback
):
number
{
const
tooltipCallback
=
(
event
:
MouseEvent
,
uri
:
string
,
location
:
IViewportRange
)
=>
{
this
.
_tooltipCallback
(
uri
,
location
,
handler
);
const
tooltipCallback
=
(
event
:
MouseEvent
,
linkText
:
string
,
location
:
IViewportRange
)
=>
{
this
.
_tooltipCallback
(
linkText
,
location
,
handler
);
};
const
options
:
ILinkMatcherOptions
=
{
matchIndex
,
...
...
@@ -233,8 +238,8 @@ export class TerminalLinkManager extends DisposableStore {
const
wrappedHandler
=
this
.
_wrapLinkHandler
(
link
=>
{
this
.
_handleHypertextLink
(
link
);
});
const
tooltipCallback
=
(
event
:
MouseEvent
,
uri
:
string
,
location
:
IViewportRange
)
=>
{
this
.
_tooltipCallback
(
uri
,
location
,
this
.
_handleHypertextLink
.
bind
(
this
));
const
tooltipCallback
=
(
event
:
MouseEvent
,
linkText
:
string
,
location
:
IViewportRange
)
=>
{
this
.
_tooltipCallback
(
linkText
,
location
,
this
.
_handleHypertextLink
.
bind
(
this
));
};
this
.
_webLinksAddon
=
new
WebLinksAddon
(
wrappedHandler
,
{
validationCallback
:
(
uri
:
string
,
callback
:
(
isValid
:
boolean
)
=>
void
)
=>
this
.
_validateWebLink
(
callback
),
...
...
@@ -249,8 +254,8 @@ export class TerminalLinkManager extends DisposableStore {
const
wrappedHandler
=
this
.
_wrapLinkHandler
(
url
=>
{
this
.
_handleLocalLink
(
url
);
});
const
tooltipCallback
=
(
event
:
MouseEvent
,
uri
:
string
,
location
:
IViewportRange
)
=>
{
this
.
_tooltipCallback
(
uri
,
location
,
this
.
_handleLocalLink
.
bind
(
this
));
const
tooltipCallback
=
(
event
:
MouseEvent
,
linkText
:
string
,
location
:
IViewportRange
)
=>
{
this
.
_tooltipCallback
(
linkText
,
location
,
this
.
_handleLocalLink
.
bind
(
this
));
};
this
.
_linkMatchers
.
push
(
this
.
_xterm
.
registerLinkMatcher
(
this
.
_localLinkRegex
,
wrappedHandler
,
{
validationCallback
:
(
uri
:
string
,
callback
:
(
isValid
:
boolean
)
=>
void
)
=>
this
.
_validateLocalLink
(
uri
,
callback
),
...
...
@@ -264,8 +269,8 @@ export class TerminalLinkManager extends DisposableStore {
const
wrappedHandler
=
this
.
_wrapLinkHandler
(
url
=>
{
this
.
_handleLocalLink
(
url
);
});
const
tooltipCallback
=
(
event
:
MouseEvent
,
uri
:
string
,
location
:
IViewportRange
)
=>
{
this
.
_tooltipCallback
(
uri
,
location
,
this
.
_handleLocalLink
.
bind
(
this
));
const
tooltipCallback
=
(
event
:
MouseEvent
,
linkText
:
string
,
location
:
IViewportRange
)
=>
{
this
.
_tooltipCallback
(
linkText
,
location
,
this
.
_handleLocalLink
.
bind
(
this
));
};
const
options
=
{
matchIndex
:
1
,
...
...
@@ -280,8 +285,8 @@ export class TerminalLinkManager extends DisposableStore {
public
registerLinkProvider
():
void
{
// Web links
const
tooltipWebCallback
=
(
event
:
MouseEvent
,
link
:
string
,
location
:
IViewportRange
)
=>
{
this
.
_tooltipCallback
(
link
,
location
,
this
.
_handleProtocolLink
.
bind
(
this
,
link
));
const
tooltipWebCallback
=
(
linkText
:
string
,
location
:
IViewportRange
)
=>
{
this
.
_tooltipCallback
(
link
Text
,
location
,
this
.
_handleProtocolLink
.
bind
(
this
,
linkText
));
};
const
wrappedActivateCallback
=
this
.
_wrapLinkHandler
(
this
.
_handleProtocolLink
.
bind
(
this
));
this
.
_linkProviders
.
push
(
this
.
_xterm
.
registerLinkProvider
(
...
...
@@ -289,14 +294,15 @@ export class TerminalLinkManager extends DisposableStore {
));
// Validated local links
const
tooltipValidatedLocalCallback
=
(
event
:
MouseEvent
,
link
:
string
,
location
:
IViewportRange
)
=>
{
this
.
_tooltipCallback
(
link
,
location
,
this
.
_handleLocalLink
.
bind
(
this
,
link
));
const
tooltipValidatedLocalCallback
=
(
linkText
:
string
,
location
:
IViewportRange
)
=>
{
this
.
_tooltipCallback
(
link
Text
,
location
,
this
.
_handleLocalLink
.
bind
(
this
,
linkText
));
};
const
wrappedTextLinkActivateCallback
=
this
.
_wrapLinkHandler
(
this
.
_handleLocalLink
.
bind
(
this
));
const
wrappedDirectoryLinkActivateCallback
=
this
.
_wrapLinkHandler2
(
this
.
_handleLocalFolderLink
.
bind
(
this
));
this
.
_linkProviders
.
push
(
this
.
_xterm
.
registerLinkProvider
(
this
.
_instantiationService
.
createInstance
(
TerminalValidatedLocalLinkProvider
,
this
.
_xterm
,
this
.
_processManager
.
os
||
OS
,
this
.
_xterm
,
this
.
_processManager
.
os
||
OS
,
wrappedTextLinkActivateCallback
,
wrappedDirectoryLinkActivateCallback
,
tooltipValidatedLocalCallback
,
...
...
@@ -322,8 +328,8 @@ export class TerminalLinkManager extends DisposableStore {
// Fallback to searching quick access
this
.
_quickInputService
.
quickAccess
.
show
(
link
);
};
const
tooltipWordCallback
=
(
event
:
MouseEvent
,
link
:
string
,
location
:
IViewportRange
,
modifierDownCallback
?:
()
=>
void
,
modifierUpCallback
?:
()
=>
void
)
=>
{
this
.
_tooltipCallback
(
link
,
location
,
wordHandler
,
modifierDownCallback
,
modifierUpCallback
);
const
tooltipWordCallback
=
(
linkText
:
string
,
location
:
IViewportRange
,
modifierDownCallback
?:
()
=>
void
,
modifierUpCallback
?:
()
=>
void
)
=>
{
this
.
_tooltipCallback
(
link
Text
,
location
,
wordHandler
,
modifierDownCallback
,
modifierUpCallback
);
};
const
wrappedWordActivateCallback
=
this
.
_wrapLinkHandler
(
wordHandler
);
this
.
_linkProviders
.
push
(
this
.
_xterm
.
registerLinkProvider
(
...
...
src/vs/workbench/contrib/terminal/browser/links/terminalValidatedLocalLinkProvider.ts
浏览文件 @
fa2d26a2
...
...
@@ -42,7 +42,7 @@ export class TerminalValidatedLocalLinkProvider implements ILinkProvider {
private
readonly
_processOperatingSystem
:
OperatingSystem
,
private
readonly
_activateFileCallback
:
(
event
:
MouseEvent
,
link
:
string
)
=>
void
,
private
readonly
_activateDirectoryCallback
:
(
event
:
MouseEvent
,
link
:
string
,
uri
:
URI
)
=>
void
,
private
readonly
_tooltipCallback
:
(
event
:
MouseEvent
,
link
:
string
,
location
:
IViewportRange
)
=>
boolean
|
void
,
private
readonly
_tooltipCallback
:
(
link
:
string
,
location
:
IViewportRange
)
=>
boolean
|
void
,
private
readonly
_validationCallback
:
(
link
:
string
,
callback
:
(
result
:
{
uri
:
URI
,
isDirectory
:
boolean
}
|
undefined
)
=>
void
)
=>
void
,
@
IInstantiationService
private
readonly
_instantiationService
:
IInstantiationService
)
{
...
...
src/vs/workbench/contrib/terminal/browser/links/terminalWebLinkProvider.ts
浏览文件 @
fa2d26a2
...
...
@@ -15,7 +15,7 @@ export class TerminalWebLinkProvider implements ILinkProvider {
constructor
(
private
readonly
_xterm
:
Terminal
,
private
readonly
_activateCallback
:
(
event
:
MouseEvent
,
uri
:
string
)
=>
void
,
private
readonly
_tooltipCallback
:
(
event
:
MouseEvent
,
uri
:
string
,
location
:
IViewportRange
)
=>
boolean
|
void
,
private
readonly
_tooltipCallback
:
(
uri
:
string
,
location
:
IViewportRange
)
=>
boolean
|
void
,
@
IInstantiationService
private
readonly
_instantiationService
:
IInstantiationService
)
{
}
...
...
src/vs/workbench/contrib/terminal/browser/links/terminalWordLinkProvider.ts
浏览文件 @
fa2d26a2
...
...
@@ -12,7 +12,7 @@ export class TerminalWordLinkProvider implements ILinkProvider {
constructor
(
private
readonly
_xterm
:
Terminal
,
private
readonly
_activateCallback
:
(
event
:
MouseEvent
,
uri
:
string
)
=>
void
,
private
readonly
_tooltipCallback
:
(
event
:
MouseEvent
,
uri
:
string
,
location
:
IViewportRange
,
modifierDownCallback
?:
()
=>
void
,
modifierUpCallback
?:
()
=>
void
)
=>
boolean
|
void
,
private
readonly
_tooltipCallback
:
(
uri
:
string
,
location
:
IViewportRange
,
modifierDownCallback
?:
()
=>
void
,
modifierUpCallback
?:
()
=>
void
)
=>
boolean
|
void
,
@
IConfigurationService
private
readonly
_configurationService
:
IConfigurationService
)
{
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录