Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
be713f75
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,发现更多精彩内容 >>
提交
be713f75
编写于
9月 16, 2018
作者:
A
Andre Weinand
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support env vars when creating a DA; fixes #56646
上级
3193667f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
64 addition
and
23 deletion
+64
-23
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+19
-2
src/vs/workbench/api/node/extHostDebugService.ts
src/vs/workbench/api/node/extHostDebugService.ts
+2
-2
src/vs/workbench/api/node/extHostTypes.ts
src/vs/workbench/api/node/extHostTypes.ts
+8
-2
src/vs/workbench/parts/debug/common/debug.ts
src/vs/workbench/parts/debug/common/debug.ts
+3
-0
src/vs/workbench/parts/debug/node/debugAdapter.ts
src/vs/workbench/parts/debug/node/debugAdapter.ts
+30
-15
src/vs/workbench/parts/debug/node/debugger.ts
src/vs/workbench/parts/debug/node/debugger.ts
+2
-2
未找到文件。
src/vs/vscode.proposed.d.ts
浏览文件 @
be713f75
...
...
@@ -452,10 +452,22 @@ declare module 'vscode' {
*/
readonly
args
:
string
[];
/**
* The additional environment of the executed program or shell. If omitted
* the parent process' environment is used. If provided it is merged with
* the parent process' environment.
*/
readonly
env
?:
{
[
key
:
string
]:
string
};
/**
* The working directory for the debug adapter.
*/
readonly
cwd
?:
string
;
/**
* Create a new debug adapter specification.
*/
constructor
(
command
:
string
,
args
?:
string
[]);
constructor
(
command
:
string
,
args
?:
string
[]
,
env
?:
{
[
key
:
string
]:
string
},
cwd
?:
string
);
}
export
class
DebugAdapterServer
{
...
...
@@ -467,10 +479,15 @@ declare module 'vscode' {
*/
readonly
port
:
number
;
/**
* The host.
*/
readonly
host
?:
string
;
/**
* Create a new debug adapter specification.
*/
constructor
(
port
:
number
);
constructor
(
port
:
number
,
host
?:
string
);
}
export
type
DebugAdapterDescriptor
=
DebugAdapterExecutable
|
DebugAdapterServer
;
...
...
src/vs/workbench/api/node/extHostDebugService.ts
浏览文件 @
be713f75
...
...
@@ -347,7 +347,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
mythis
.
_debugServiceProxy
.
$acceptDAMessage
(
handle
,
message
);
}
}(
adapter
.
port
);
}(
adapter
);
break
;
case
'
executable
'
:
...
...
@@ -363,7 +363,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
mythis
.
_debugServiceProxy
.
$acceptDAMessage
(
handle
,
message
);
}
}(
config
.
type
,
adapter
);
}(
adapter
,
config
.
type
);
break
;
default
:
...
...
src/vs/workbench/api/node/extHostTypes.ts
浏览文件 @
be713f75
...
...
@@ -1892,19 +1892,25 @@ export class DebugAdapterExecutable implements vscode.DebugAdapterExecutable {
readonly
type
=
'
executable
'
;
readonly
command
:
string
;
readonly
args
:
string
[];
readonly
env
?:
{
[
key
:
string
]:
string
};
readonly
cwd
?:
string
;
constructor
(
command
:
string
,
args
?:
string
[])
{
constructor
(
command
:
string
,
args
?:
string
[]
,
env
?:
{
[
key
:
string
]:
string
},
cwd
?:
string
)
{
this
.
command
=
command
;
this
.
args
=
args
;
this
.
env
=
env
;
this
.
cwd
=
cwd
;
}
}
export
class
DebugAdapterServer
implements
vscode
.
DebugAdapterServer
{
readonly
type
=
'
server
'
;
readonly
port
:
number
;
readonly
host
:
string
;
constructor
(
port
:
number
)
{
constructor
(
port
:
number
,
host
?:
string
)
{
this
.
port
=
port
;
this
.
host
=
host
;
}
}
...
...
src/vs/workbench/parts/debug/common/debug.ts
浏览文件 @
be713f75
...
...
@@ -460,11 +460,14 @@ export interface IAdapterExecutable {
readonly
type
:
'
executable
'
;
readonly
command
:
string
;
readonly
args
:
string
[];
readonly
cwd
?:
string
;
readonly
env
?:
{
[
key
:
string
]:
string
};
}
export
interface
IAdapterServer
{
readonly
type
:
'
server
'
;
readonly
port
:
number
;
readonly
host
?:
string
;
}
export
type
IAdapterDescriptor
=
IAdapterExecutable
|
IAdapterServer
;
...
...
src/vs/workbench/parts/debug/node/debugAdapter.ts
浏览文件 @
be713f75
...
...
@@ -17,7 +17,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
import
{
ExtensionsChannelId
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
IExtensionDescription
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
IOutputService
}
from
'
vs/workbench/parts/output/common/output
'
;
import
{
IDebugAdapter
,
IAdapterExecutable
,
IDebuggerContribution
,
IPlatformSpecificAdapterContribution
}
from
'
vs/workbench/parts/debug/common/debug
'
;
import
{
IDebugAdapter
,
IAdapterExecutable
,
IDebuggerContribution
,
IPlatformSpecificAdapterContribution
,
IAdapterServer
}
from
'
vs/workbench/parts/debug/common/debug
'
;
/**
* Abstract implementation of the low level API for a debug adapter.
...
...
@@ -245,14 +245,14 @@ export class SocketDebugAdapter extends StreamDebugAdapter {
private
socket
:
net
.
Socket
;
constructor
(
private
port
:
number
,
private
host
=
'
127.0.0.1
'
)
{
constructor
(
private
adapterServer
:
IAdapterServer
)
{
super
();
}
startSession
():
TPromise
<
void
>
{
return
new
TPromise
<
void
>
((
resolve
,
reject
)
=>
{
let
connected
=
false
;
this
.
socket
=
net
.
createConnection
(
this
.
port
,
this
.
host
,
()
=>
{
this
.
socket
=
net
.
createConnection
(
this
.
adapterServer
.
port
,
this
.
adapterServer
.
host
||
'
127.0.0.1
'
,
()
=>
{
this
.
connect
(
this
.
socket
,
this
.
socket
);
resolve
(
null
);
connected
=
true
;
...
...
@@ -294,19 +294,19 @@ export class DebugAdapter extends StreamDebugAdapter {
private
serverProcess
:
cp
.
ChildProcess
;
constructor
(
private
debugType
:
string
,
private
adapterExecutable
:
IAdapterExecutable
,
private
outputService
?:
IOutputService
)
{
constructor
(
private
adapterExecutable
:
IAdapterExecutable
,
private
debugType
:
string
,
private
outputService
?:
IOutputService
)
{
super
();
}
startSession
():
TPromise
<
void
>
{
return
new
TPromise
<
void
>
((
c
,
e
)
=>
{
return
new
TPromise
<
void
>
((
resolve
,
reject
)
=>
{
// verify executables
if
(
this
.
adapterExecutable
.
command
)
{
if
(
paths
.
isAbsolute
(
this
.
adapterExecutable
.
command
))
{
if
(
!
fs
.
existsSync
(
this
.
adapterExecutable
.
command
))
{
e
(
new
Error
(
nls
.
localize
(
'
debugAdapterBinNotFound
'
,
"
Debug adapter executable '{0}' does not exist.
"
,
this
.
adapterExecutable
.
command
)));
reject
(
new
Error
(
nls
.
localize
(
'
debugAdapterBinNotFound
'
,
"
Debug adapter executable '{0}' does not exist.
"
,
this
.
adapterExecutable
.
command
)));
}
}
else
{
// relative path
...
...
@@ -316,28 +316,43 @@ export class DebugAdapter extends StreamDebugAdapter {
}
}
}
else
{
e
(
new
Error
(
nls
.
localize
({
key
:
'
debugAdapterCannotDetermineExecutable
'
,
comment
:
[
'
Adapter executable file not found
'
]
},
reject
(
new
Error
(
nls
.
localize
({
key
:
'
debugAdapterCannotDetermineExecutable
'
,
comment
:
[
'
Adapter executable file not found
'
]
},
"
Cannot determine executable for debug adapter '{0}'.
"
,
this
.
debugType
)));
}
if
(
this
.
adapterExecutable
.
command
===
'
node
'
)
{
if
(
Array
.
isArray
(
this
.
adapterExecutable
.
args
)
&&
this
.
adapterExecutable
.
args
.
length
>
0
)
{
const
isElectron
=
process
.
env
[
'
ELECTRON_RUN_AS_NODE
'
]
||
process
.
versions
[
'
electron
'
];
const
child
=
cp
.
fork
(
this
.
adapterExecutable
.
args
[
0
],
this
.
adapterExecutable
.
args
.
slice
(
1
),
{
const
isElectron
=
!!
process
.
env
[
'
ELECTRON_RUN_AS_NODE
'
]
||
!!
process
.
versions
[
'
electron
'
];
const
options
:
cp
.
ForkOptions
=
{
env
:
this
.
adapterExecutable
.
env
?
objects
.
mixin
(
objects
.
mixin
({},
process
.
env
),
this
.
adapterExecutable
.
env
)
:
process
.
env
,
execArgv
:
isElectron
?
[
'
-e
'
,
'
delete process.env.ELECTRON_RUN_AS_NODE;require(process.argv[1])
'
]
:
[],
silent
:
true
});
};
if
(
this
.
adapterExecutable
.
cwd
)
{
options
.
cwd
=
this
.
adapterExecutable
.
cwd
;
}
const
child
=
cp
.
fork
(
this
.
adapterExecutable
.
args
[
0
],
this
.
adapterExecutable
.
args
.
slice
(
1
),
options
);
if
(
!
child
.
pid
)
{
e
(
new
Error
(
nls
.
localize
(
'
unableToLaunchDebugAdapter
'
,
"
Unable to launch debug adapter from '{0}'.
"
,
this
.
adapterExecutable
.
args
[
0
])));
reject
(
new
Error
(
nls
.
localize
(
'
unableToLaunchDebugAdapter
'
,
"
Unable to launch debug adapter from '{0}'.
"
,
this
.
adapterExecutable
.
args
[
0
])));
}
this
.
serverProcess
=
child
;
c
(
null
);
resolve
(
null
);
}
else
{
e
(
new
Error
(
nls
.
localize
(
'
unableToLaunchDebugAdapterNoArgs
'
,
"
Unable to launch debug adapter.
"
)));
reject
(
new
Error
(
nls
.
localize
(
'
unableToLaunchDebugAdapterNoArgs
'
,
"
Unable to launch debug adapter.
"
)));
}
}
else
{
this
.
serverProcess
=
cp
.
spawn
(
this
.
adapterExecutable
.
command
,
this
.
adapterExecutable
.
args
);
c
(
null
);
const
options
:
cp
.
SpawnOptions
=
{
env
:
this
.
adapterExecutable
.
env
?
objects
.
mixin
(
objects
.
mixin
({},
process
.
env
),
this
.
adapterExecutable
.
env
)
:
process
.
env
};
if
(
this
.
adapterExecutable
.
cwd
)
{
options
.
cwd
=
this
.
adapterExecutable
.
cwd
;
}
this
.
serverProcess
=
cp
.
spawn
(
this
.
adapterExecutable
.
command
,
this
.
adapterExecutable
.
args
,
options
);
resolve
(
null
);
}
}).
then
(
_
=>
{
this
.
serverProcess
.
on
(
'
error
'
,
err
=>
{
...
...
src/vs/workbench/parts/debug/node/debugger.ts
浏览文件 @
be713f75
...
...
@@ -46,9 +46,9 @@ export class Debugger implements IDebugger {
return
this
.
getAdapterDescriptor
(
session
,
root
,
config
).
then
(
adapterDescriptor
=>
{
switch
(
adapterDescriptor
.
type
)
{
case
'
server
'
:
return
new
SocketDebugAdapter
(
adapterDescriptor
.
port
);
return
new
SocketDebugAdapter
(
adapterDescriptor
);
case
'
executable
'
:
return
new
DebugAdapter
(
this
.
type
,
adapterDescriptor
,
outputService
);
return
new
DebugAdapter
(
adapterDescriptor
,
this
.
type
,
outputService
);
default
:
return
undefined
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录