Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
bbdb2167
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,发现更多精彩内容 >>
未验证
提交
bbdb2167
编写于
6月 17, 2019
作者:
D
Daniel Imms
提交者:
GitHub
6月 17, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #75457 from microsoft/tyriar/r136_windows_remote_links
Evaluate links based on process manager OS, not host platform
上级
e12dff9f
a7412fbb
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
27 addition
and
27 deletion
+27
-27
src/vs/workbench/api/browser/mainThreadTerminalService.ts
src/vs/workbench/api/browser/mainThreadTerminalService.ts
+2
-2
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+1
-1
src/vs/workbench/api/node/extHostTerminalService.ts
src/vs/workbench/api/node/extHostTerminalService.ts
+1
-1
src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
...vs/workbench/contrib/terminal/browser/terminalInstance.ts
+2
-2
src/vs/workbench/contrib/terminal/browser/terminalLinkHandler.ts
...workbench/contrib/terminal/browser/terminalLinkHandler.ts
+11
-11
src/vs/workbench/contrib/terminal/common/terminal.ts
src/vs/workbench/contrib/terminal/common/terminal.ts
+1
-1
src/vs/workbench/contrib/terminal/common/terminalProcessExtHostProxy.ts
...ch/contrib/terminal/common/terminalProcessExtHostProxy.ts
+2
-2
src/vs/workbench/contrib/terminal/test/electron-browser/terminalLinkHandler.test.ts
...erminal/test/electron-browser/terminalLinkHandler.test.ts
+7
-7
未找到文件。
src/vs/workbench/api/browser/mainThreadTerminalService.ts
浏览文件 @
bbdb2167
...
...
@@ -247,8 +247,8 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
this
.
_terminalProcesses
[
terminalId
].
emitData
(
data
);
}
public
$sendProcess
Pid
(
terminalId
:
number
,
pid
:
number
):
void
{
this
.
_terminalProcesses
[
terminalId
].
emit
Pid
(
pi
d
);
public
$sendProcess
Ready
(
terminalId
:
number
,
pid
:
number
,
cwd
:
string
):
void
{
this
.
_terminalProcesses
[
terminalId
].
emit
Ready
(
pid
,
cw
d
);
}
public
$sendProcessExit
(
terminalId
:
number
,
exitCode
:
number
):
void
{
...
...
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
bbdb2167
...
...
@@ -400,7 +400,7 @@ export interface MainThreadTerminalServiceShape extends IDisposable {
// Process
$sendProcessTitle
(
terminalId
:
number
,
title
:
string
):
void
;
$sendProcessData
(
terminalId
:
number
,
data
:
string
):
void
;
$sendProcess
Pid
(
terminalId
:
number
,
pid
:
number
):
void
;
$sendProcess
Ready
(
terminalId
:
number
,
pid
:
number
,
cwd
:
string
):
void
;
$sendProcessExit
(
terminalId
:
number
,
exitCode
:
number
):
void
;
$sendProcessInitialCwd
(
terminalId
:
number
,
cwd
:
string
):
void
;
$sendProcessCwd
(
terminalId
:
number
,
initialCwd
:
string
):
void
;
...
...
src/vs/workbench/api/node/extHostTerminalService.ts
浏览文件 @
bbdb2167
...
...
@@ -535,7 +535,7 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
// Fork the process and listen for messages
this
.
_logService
.
debug
(
`Terminal process launching on ext host`
,
shellLaunchConfig
,
initialCwd
,
cols
,
rows
,
env
);
const
p
=
new
TerminalProcess
(
shellLaunchConfig
,
initialCwd
,
cols
,
rows
,
env
,
terminalConfig
.
get
(
'
windowsEnableConpty
'
)
as
boolean
,
this
.
_logService
);
p
.
onProcessReady
((
e
:
{
pid
:
number
,
cwd
:
string
})
=>
this
.
_proxy
.
$sendProcess
Pid
(
id
,
e
.
pi
d
));
p
.
onProcessReady
((
e
:
{
pid
:
number
,
cwd
:
string
})
=>
this
.
_proxy
.
$sendProcess
Ready
(
id
,
e
.
pid
,
e
.
cw
d
));
p
.
onProcessTitleChanged
(
title
=>
this
.
_proxy
.
$sendProcessTitle
(
id
,
title
));
p
.
onProcessData
(
data
=>
this
.
_proxy
.
$sendProcessData
(
id
,
data
));
p
.
onProcessExit
(
exitCode
=>
this
.
_onProcessExit
(
id
,
exitCode
));
...
...
src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
浏览文件 @
bbdb2167
...
...
@@ -468,10 +468,10 @@ export class TerminalInstance implements ITerminalInstance {
return
false
;
});
}
this
.
_linkHandler
=
this
.
_instantiationService
.
createInstance
(
TerminalLinkHandler
,
this
.
_xterm
,
platform
.
platform
,
this
.
_processManager
);
this
.
_linkHandler
=
this
.
_instantiationService
.
createInstance
(
TerminalLinkHandler
,
this
.
_xterm
,
this
.
_processManager
);
});
}
else
if
(
this
.
shellLaunchConfig
.
isRendererOnly
)
{
this
.
_linkHandler
=
this
.
_instantiationService
.
createInstance
(
TerminalLinkHandler
,
this
.
_xterm
,
undefined
,
undefined
);
this
.
_linkHandler
=
this
.
_instantiationService
.
createInstance
(
TerminalLinkHandler
,
this
.
_xterm
,
undefined
);
}
// Register listener to trigger the onInput ext API if the terminal is a renderer only
...
...
src/vs/workbench/contrib/terminal/browser/terminalLinkHandler.ts
浏览文件 @
bbdb2167
...
...
@@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
import
*
as
nls
from
'
vs/nls
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
dispose
,
IDisposable
,
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
IOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
...
...
@@ -18,6 +17,7 @@ import { ILinkMatcherOptions } from 'xterm';
import
{
REMOTE_HOST_SCHEME
}
from
'
vs/platform/remote/common/remoteHosts
'
;
import
{
posix
,
win32
}
from
'
vs/base/common/path
'
;
import
{
ITerminalInstanceService
}
from
'
vs/workbench/contrib/terminal/browser/terminal
'
;
import
{
OperatingSystem
,
isMacintosh
}
from
'
vs/base/common/platform
'
;
const
pathPrefix
=
'
(
\\
.
\\
.?|
\\
~)
'
;
const
pathSeparatorClause
=
'
\\
/
'
;
...
...
@@ -76,7 +76,6 @@ export class TerminalLinkHandler {
constructor
(
private
_xterm
:
any
,
private
_platform
:
platform
.
Platform
|
undefined
,
private
readonly
_processManager
:
ITerminalProcessManager
|
undefined
,
@
IOpenerService
private
readonly
_openerService
:
IOpenerService
,
@
IEditorService
private
readonly
_editorService
:
IEditorService
,
...
...
@@ -108,7 +107,7 @@ export class TerminalLinkHandler {
};
this
.
registerWebLinkHandler
();
if
(
this
.
_p
latform
)
{
if
(
this
.
_p
rocessManager
)
{
this
.
registerLocalLinkHandler
();
this
.
registerGitDiffLinkHandlers
();
}
...
...
@@ -205,7 +204,7 @@ export class TerminalLinkHandler {
if
(
!
this
.
_processManager
)
{
throw
new
Error
(
'
Process manager is required
'
);
}
const
baseLocalLinkClause
=
this
.
_processManager
.
os
===
platform
.
OperatingSystem
.
Windows
?
winLocalLinkClause
:
unixLocalLinkClause
;
const
baseLocalLinkClause
=
this
.
_processManager
.
os
===
OperatingSystem
.
Windows
?
winLocalLinkClause
:
unixLocalLinkClause
;
// Append line and column number regex
return
new
RegExp
(
`
${
baseLocalLinkClause
}
(
${
lineAndColumnClause
}
)`
);
}
...
...
@@ -250,19 +249,19 @@ export class TerminalLinkHandler {
if
(
editorConf
.
multiCursorModifier
===
'
ctrlCmd
'
)
{
return
!!
event
.
altKey
;
}
return
platform
.
isMacintosh
?
event
.
metaKey
:
event
.
ctrlKey
;
return
isMacintosh
?
event
.
metaKey
:
event
.
ctrlKey
;
}
private
_getLinkHoverString
():
string
{
const
editorConf
=
this
.
_configurationService
.
getValue
<
{
multiCursorModifier
:
'
ctrlCmd
'
|
'
alt
'
}
>
(
'
editor
'
);
if
(
editorConf
.
multiCursorModifier
===
'
ctrlCmd
'
)
{
if
(
platform
.
isMacintosh
)
{
if
(
isMacintosh
)
{
return
nls
.
localize
(
'
terminalLinkHandler.followLinkAlt.mac
'
,
"
Option + click to follow link
"
);
}
else
{
return
nls
.
localize
(
'
terminalLinkHandler.followLinkAlt
'
,
"
Alt + click to follow link
"
);
}
}
if
(
platform
.
isMacintosh
)
{
if
(
isMacintosh
)
{
return
nls
.
localize
(
'
terminalLinkHandler.followLinkCmd
'
,
"
Cmd + click to follow link
"
);
}
return
nls
.
localize
(
'
terminalLinkHandler.followLinkCtrl
'
,
"
Ctrl + click to follow link
"
);
...
...
@@ -272,7 +271,7 @@ export class TerminalLinkHandler {
if
(
!
this
.
_processManager
)
{
throw
new
Error
(
'
Process manager is required
'
);
}
if
(
this
.
_processManager
.
os
===
platform
.
OperatingSystem
.
Windows
)
{
if
(
this
.
_processManager
.
os
===
OperatingSystem
.
Windows
)
{
return
win32
;
}
return
posix
;
...
...
@@ -290,7 +289,7 @@ export class TerminalLinkHandler {
link
=
this
.
osPath
.
join
(
this
.
_processManager
.
userHome
,
link
.
substring
(
1
));
}
else
if
(
link
.
charAt
(
0
)
!==
'
/
'
&&
link
.
charAt
(
0
)
!==
'
~
'
)
{
// Resolve workspace path . | .. | <relative_path> -> <path>/. | <path>/.. | <path>/<relative_path>
if
(
this
.
_processManager
.
os
===
platform
.
OperatingSystem
.
Windows
)
{
if
(
this
.
_processManager
.
os
===
OperatingSystem
.
Windows
)
{
if
(
!
link
.
match
(
'
^
'
+
winDrivePrefix
))
{
if
(
!
this
.
_processCwd
)
{
// Abort if no workspace is open
...
...
@@ -359,17 +358,18 @@ export class TerminalLinkHandler {
* @param link Url link which may contain line and column number.
*/
public
extractLineColumnInfo
(
link
:
string
):
LineColumnInfo
{
const
matches
:
string
[]
|
null
=
this
.
_localLinkRegex
.
exec
(
link
);
const
lineColumnInfo
:
LineColumnInfo
=
{
lineNumber
:
1
,
columnNumber
:
1
};
if
(
!
matches
)
{
if
(
!
matches
||
!
this
.
_processManager
)
{
return
lineColumnInfo
;
}
const
lineAndColumnMatchIndex
=
this
.
_p
latform
===
platform
.
Platfor
m
.
Windows
?
winLineAndColumnMatchIndex
:
unixLineAndColumnMatchIndex
;
const
lineAndColumnMatchIndex
=
this
.
_p
rocessManager
.
os
===
OperatingSyste
m
.
Windows
?
winLineAndColumnMatchIndex
:
unixLineAndColumnMatchIndex
;
for
(
let
i
=
0
;
i
<
lineAndColumnClause
.
length
;
i
++
)
{
const
lineMatchIndex
=
lineAndColumnMatchIndex
+
(
lineAndColumnClauseGroupCount
*
i
);
const
rowNumber
=
matches
[
lineMatchIndex
];
...
...
src/vs/workbench/contrib/terminal/common/terminal.ts
浏览文件 @
bbdb2167
...
...
@@ -723,7 +723,7 @@ export interface ITerminalProcessExtHostProxy extends IDisposable {
emitData
(
data
:
string
):
void
;
emitTitle
(
title
:
string
):
void
;
emit
Pid
(
pid
:
number
):
void
;
emit
Ready
(
pid
:
number
,
cwd
:
string
):
void
;
emitExit
(
exitCode
:
number
):
void
;
emitInitialCwd
(
initialCwd
:
string
):
void
;
emitCwd
(
cwd
:
string
):
void
;
...
...
src/vs/workbench/contrib/terminal/common/terminalProcessExtHostProxy.ts
浏览文件 @
bbdb2167
...
...
@@ -71,8 +71,8 @@ export class TerminalProcessExtHostProxy extends Disposable implements ITerminal
this
.
_onProcessTitleChanged
.
fire
(
title
);
}
public
emit
Pid
(
pid
:
number
):
void
{
this
.
_onProcessReady
.
fire
({
pid
,
cwd
:
''
});
public
emit
Ready
(
pid
:
number
,
cwd
:
string
):
void
{
this
.
_onProcessReady
.
fire
({
pid
,
cwd
});
}
public
emitExit
(
exitCode
:
number
):
void
{
...
...
src/vs/workbench/contrib/terminal/test/electron-browser/terminalLinkHandler.test.ts
浏览文件 @
bbdb2167
...
...
@@ -66,7 +66,7 @@ interface LinkFormatInfo {
suite
(
'
Workbench - TerminalLinkHandler
'
,
()
=>
{
suite
(
'
localLinkRegex
'
,
()
=>
{
test
(
'
Windows
'
,
()
=>
{
const
terminalLinkHandler
=
new
TestTerminalLinkHandler
(
new
TestXterm
(),
Platform
.
Windows
,
{
const
terminalLinkHandler
=
new
TestTerminalLinkHandler
(
new
TestXterm
(),
{
os
:
OperatingSystem
.
Windows
,
userHome
:
''
}
as
any
,
null
!
,
null
!
,
null
!
,
null
!
,
new
MockTerminalInstanceService
(),
null
!
);
...
...
@@ -141,7 +141,7 @@ suite('Workbench - TerminalLinkHandler', () => {
});
test
(
'
Linux
'
,
()
=>
{
const
terminalLinkHandler
=
new
TestTerminalLinkHandler
(
new
TestXterm
(),
Platform
.
Linux
,
{
const
terminalLinkHandler
=
new
TestTerminalLinkHandler
(
new
TestXterm
(),
{
os
:
OperatingSystem
.
Linux
,
userHome
:
''
}
as
any
,
null
!
,
null
!
,
null
!
,
null
!
,
new
MockTerminalInstanceService
(),
null
!
);
...
...
@@ -208,7 +208,7 @@ suite('Workbench - TerminalLinkHandler', () => {
suite
(
'
preprocessPath
'
,
()
=>
{
test
(
'
Windows
'
,
()
=>
{
const
linkHandler
=
new
TestTerminalLinkHandler
(
new
TestXterm
(),
Platform
.
Windows
,
{
const
linkHandler
=
new
TestTerminalLinkHandler
(
new
TestXterm
(),
{
os
:
OperatingSystem
.
Windows
,
userHome
:
'
C:
\\
Users
\\
Me
'
}
as
any
,
null
!
,
null
!
,
null
!
,
null
!
,
new
MockTerminalInstanceService
(),
null
!
);
...
...
@@ -221,7 +221,7 @@ suite('Workbench - TerminalLinkHandler', () => {
assert
.
equal
(
linkHandler
.
preprocessPath
(
'
C:
\\
absolute
\\
path
\\
file5
'
),
'
C:
\\
absolute
\\
path
\\
file5
'
);
});
test
(
'
Windows - spaces
'
,
()
=>
{
const
linkHandler
=
new
TestTerminalLinkHandler
(
new
TestXterm
(),
Platform
.
Windows
,
{
const
linkHandler
=
new
TestTerminalLinkHandler
(
new
TestXterm
(),
{
os
:
OperatingSystem
.
Windows
,
userHome
:
'
C:
\\
Users
\\
M e
'
}
as
any
,
null
!
,
null
!
,
null
!
,
null
!
,
new
MockTerminalInstanceService
(),
null
!
);
...
...
@@ -235,7 +235,7 @@ suite('Workbench - TerminalLinkHandler', () => {
});
test
(
'
Linux
'
,
()
=>
{
const
linkHandler
=
new
TestTerminalLinkHandler
(
new
TestXterm
(),
Platform
.
Linux
,
{
const
linkHandler
=
new
TestTerminalLinkHandler
(
new
TestXterm
(),
{
os
:
OperatingSystem
.
Linux
,
userHome
:
'
/home/me
'
}
as
any
,
null
!
,
null
!
,
null
!
,
null
!
,
new
MockTerminalInstanceService
(),
null
!
);
...
...
@@ -248,7 +248,7 @@ suite('Workbench - TerminalLinkHandler', () => {
});
test
(
'
No Workspace
'
,
()
=>
{
const
linkHandler
=
new
TestTerminalLinkHandler
(
new
TestXterm
(),
Platform
.
Linux
,
{
const
linkHandler
=
new
TestTerminalLinkHandler
(
new
TestXterm
(),
{
os
:
OperatingSystem
.
Linux
,
userHome
:
'
/home/me
'
}
as
any
,
null
!
,
null
!
,
null
!
,
null
!
,
new
MockTerminalInstanceService
(),
null
!
);
...
...
@@ -262,7 +262,7 @@ suite('Workbench - TerminalLinkHandler', () => {
test
(
'
gitDiffLinkRegex
'
,
()
=>
{
// The platform is irrelevant because the links generated by Git are the same format regardless of platform
const
linkHandler
=
new
TestTerminalLinkHandler
(
new
TestXterm
(),
Platform
.
Linux
,
{
const
linkHandler
=
new
TestTerminalLinkHandler
(
new
TestXterm
(),
{
os
:
OperatingSystem
.
Linux
,
userHome
:
''
}
as
any
,
null
!
,
null
!
,
null
!
,
null
!
,
new
MockTerminalInstanceService
(),
null
!
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录