Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
d84fda67
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,体验更适合开发者的 AI 搜索 >>
提交
d84fda67
编写于
9月 14, 2016
作者:
A
Andre Weinand
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
first cut of supporting PowerShell in integrated terminal
上级
2b5a956c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
50 addition
and
21 deletion
+50
-21
src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts
...workbench/parts/debug/electron-browser/rawDebugSession.ts
+4
-2
src/vs/workbench/parts/debug/electron-browser/terminalSupport.ts
...workbench/parts/debug/electron-browser/terminalSupport.ts
+46
-19
未找到文件。
src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts
浏览文件 @
d84fda67
...
...
@@ -25,6 +25,7 @@ import v8 = require('vs/workbench/parts/debug/node/v8Protocol');
import
{
IOutputService
}
from
'
vs/workbench/parts/output/common/output
'
;
import
{
ExtensionsChannelId
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
TerminalSupport
}
from
'
vs/workbench/parts/debug/electron-browser/terminalSupport
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
shell
}
from
'
electron
'
;
...
...
@@ -75,7 +76,8 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes
@
ITelemetryService
private
telemetryService
:
ITelemetryService
,
@
IOutputService
private
outputService
:
IOutputService
,
@
ITerminalService
private
terminalService
:
ITerminalService
,
@
IExternalTerminalService
private
nativeTerminalService
:
IExternalTerminalService
@
IExternalTerminalService
private
nativeTerminalService
:
IExternalTerminalService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
)
{
super
();
this
.
emittedStopped
=
false
;
...
...
@@ -348,7 +350,7 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes
if
(
request
.
command
===
'
runInTerminal
'
)
{
TerminalSupport
.
runInTerminal
(
this
.
terminalService
,
this
.
nativeTerminalService
,
<
DebugProtocol
.
RunInTerminalRequestArguments
>
request
.
arguments
,
<
DebugProtocol
.
RunInTerminalResponse
>
response
).
then
(()
=>
{
TerminalSupport
.
runInTerminal
(
this
.
terminalService
,
this
.
nativeTerminalService
,
this
.
configurationService
,
<
DebugProtocol
.
RunInTerminalRequestArguments
>
request
.
arguments
,
<
DebugProtocol
.
RunInTerminalResponse
>
response
).
then
(()
=>
{
this
.
sendResponse
(
response
);
},
e
=>
{
response
.
success
=
false
;
...
...
src/vs/workbench/parts/debug/electron-browser/terminalSupport.ts
浏览文件 @
d84fda67
...
...
@@ -8,33 +8,40 @@ import platform = require('vs/base/common/platform');
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
ITerminalService
,
ITerminalInstance
}
from
'
vs/workbench/parts/terminal/electron-browser/terminal
'
;
import
{
ITerminalService
as
IExternalTerminalService
}
from
'
vs/workbench/parts/execution/common/execution
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
export
interface
IIntegratedTerminalConfiguration
{
terminal
:
{
integrated
:
{
shell
:
{
windows
:
string
}
}
};
}
export
class
TerminalSupport
{
private
static
integratedTerminalInstance
:
ITerminalInstance
;
public
static
runInTerminal
(
terminalService
:
ITerminalService
,
nativeTerminalService
:
IExternalTerminalService
,
args
:
DebugProtocol
.
RunInTerminalRequestArguments
,
response
:
DebugProtocol
.
RunInTerminalResponse
):
TPromise
<
void
>
{
public
static
runInTerminal
(
terminalService
:
ITerminalService
,
nativeTerminalService
:
IExternalTerminalService
,
configurationService
:
IConfigurationService
,
args
:
DebugProtocol
.
RunInTerminalRequestArguments
,
response
:
DebugProtocol
.
RunInTerminalResponse
):
TPromise
<
void
>
{
if
(
args
.
kind
===
'
external
'
)
{
return
nativeTerminalService
.
runInTerminal
(
args
.
title
,
args
.
cwd
,
args
.
args
,
args
.
env
);
}
return
this
.
runInIntegratedTerminal
(
terminalService
,
args
);
}
private
static
runInIntegratedTerminal
(
terminalService
:
ITerminalService
,
args
:
DebugProtocol
.
RunInTerminalRequestArguments
):
TPromise
<
void
>
{
if
(
!
TerminalSupport
.
integratedTerminalInstance
)
{
TerminalSupport
.
integratedTerminalInstance
=
terminalService
.
createInstance
(
args
.
title
||
nls
.
localize
(
'
debuggee
'
,
"
debuggee
"
));
}
terminalService
.
setActiveInstance
(
TerminalSupport
.
integratedTerminalInstance
);
terminalService
.
showPanel
(
true
);
const
command
=
this
.
prepareCommand
(
args
);
const
command
=
this
.
prepareCommand
(
args
,
configurationService
);
TerminalSupport
.
integratedTerminalInstance
.
sendText
(
command
,
true
);
return
TPromise
.
as
(
void
0
);
}
private
static
prepareCommand
(
args
:
DebugProtocol
.
RunInTerminalRequestArguments
):
string
{
private
static
prepareCommand
(
args
:
DebugProtocol
.
RunInTerminalRequestArguments
,
configurationService
:
IConfigurationService
):
string
{
let
command
=
''
;
if
(
platform
.
isWindows
)
{
...
...
@@ -44,21 +51,41 @@ export class TerminalSupport {
return
(
s
.
indexOf
(
'
'
)
>=
0
||
s
.
indexOf
(
'
"
'
)
>=
0
)
?
`"
${
s
}
"`
:
s
;
};
if
(
args
.
cwd
)
{
command
+=
`cd
${
quote
(
args
.
cwd
)}
&& `
;
const
conf
=
configurationService
.
getConfiguration
<
IIntegratedTerminalConfiguration
>
();
let
isPowerShell
=
false
;
if
(
conf
.
terminal
&&
conf
.
terminal
.
integrated
&&
conf
.
terminal
.
integrated
.
shell
&&
conf
.
terminal
.
integrated
.
shell
.
windows
)
{
isPowerShell
=
conf
.
terminal
.
integrated
.
shell
.
windows
.
indexOf
(
'
PowerShell
'
)
>=
0
;
}
if
(
args
.
env
)
{
command
+=
'
cmd /C "
'
;
for
(
let
key
in
args
.
env
)
{
command
+=
`set "
${
key
}
=
${
args
.
env
[
key
]}
" && `
;
if
(
isPowerShell
)
{
if
(
args
.
cwd
)
{
command
+=
`cd
${
quote
(
args
.
cwd
)}
; `
;
}
for
(
let
a
of
args
.
args
)
{
command
+=
`
${
quote
(
a
)}
`
;
}
}
else
{
if
(
args
.
cwd
)
{
command
+=
`cd
${
quote
(
args
.
cwd
)}
&& `
;
}
if
(
args
.
env
)
{
command
+=
'
cmd /C "
'
;
for
(
let
key
in
args
.
env
)
{
command
+=
`set "
${
key
}
=
${
args
.
env
[
key
]}
" && `
;
}
}
for
(
let
a
of
args
.
args
)
{
command
+=
`
${
quote
(
a
)}
`
;
}
if
(
args
.
env
)
{
command
+=
'
"
'
;
}
}
for
(
let
a
of
args
.
args
)
{
command
+=
`
${
quote
(
a
)}
`
;
}
if
(
args
.
env
)
{
command
+=
'
"
'
;
}
}
else
{
const
quote
=
(
s
:
string
)
=>
{
s
=
s
.
replace
(
/
\"
/g
,
'
\\
"
'
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录