Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
0e470e09
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0e470e09
编写于
10月 11, 2016
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debug: allow adapters to provide full launch.json content
上级
4ef0081b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
33 addition
and
34 deletion
+33
-34
src/vs/workbench/parts/debug/node/debugAdapter.ts
src/vs/workbench/parts/debug/node/debugAdapter.ts
+22
-5
src/vs/workbench/parts/debug/node/debugConfigurationManager.ts
...s/workbench/parts/debug/node/debugConfigurationManager.ts
+10
-28
src/vs/workbench/parts/debug/test/node/debugAdapter.test.ts
src/vs/workbench/parts/debug/test/node/debugAdapter.test.ts
+1
-1
未找到文件。
src/vs/workbench/parts/debug/node/debugAdapter.ts
浏览文件 @
0e470e09
...
...
@@ -5,12 +5,14 @@
import
nls
=
require
(
'
vs/nls
'
);
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
strings
=
require
(
'
vs/base/common/strings
'
);
import
objects
=
require
(
'
vs/base/common/objects
'
);
import
paths
=
require
(
'
vs/base/common/paths
'
);
import
platform
=
require
(
'
vs/base/common/platform
'
);
import
debug
=
require
(
'
vs/workbench/parts/debug/common/debug
'
);
import
{
IExtensionDescription
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
IConfigurationResolverService
}
from
'
vs/workbench/services/configurationResolver/common/configurationResolver
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
export
class
Adapter
{
...
...
@@ -29,6 +31,7 @@ export class Adapter {
constructor
(
public
rawAdapter
:
debug
.
IRawAdapter
,
public
extensionDescription
:
IExtensionDescription
,
@
IConfigurationResolverService
configurationResolverService
:
IConfigurationResolverService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
@
ICommandService
private
commandService
:
ICommandService
)
{
if
(
rawAdapter
.
windows
)
{
...
...
@@ -80,15 +83,29 @@ export class Adapter {
this
.
aiKey
=
rawAdapter
.
aiKey
;
}
public
getInitialConfigurations
():
TPromise
<
string
|
any
[]
>
{
public
getInitialConfigFileContent
():
TPromise
<
string
>
{
const
editorConfig
=
this
.
configurationService
.
getConfiguration
<
any
>
();
if
(
typeof
this
.
initialConfigurations
===
'
string
'
)
{
// Contributed initialConfigurations is a command that needs to be invoked
// Debug adapter will dynamically provide the initial conifguraiton
return
this
.
commandService
.
executeCommand
<
string
>
(
<
string
>
this
.
initialConfigurations
)
.
then
(
result
=>
JSON
.
parse
(
result
));
// Debug adapter will dynamically provide the full launch.json
return
this
.
commandService
.
executeCommand
<
string
>
(
<
string
>
this
.
initialConfigurations
).
then
(
content
=>
{
// Debug adapter returned the full content of the launch.json - return it after format
if
(
editorConfig
.
editor
.
insertSpaces
)
{
content
=
content
.
replace
(
new
RegExp
(
'
\t
'
,
'
g
'
),
strings
.
repeat
(
'
'
,
editorConfig
.
editor
.
tabSize
));
}
return
content
;
});
}
return
TPromise
.
as
(
this
.
initialConfigurations
);
return
TPromise
.
as
(
JSON
.
stringify
(
{
version
:
'
0.2.0
'
,
configurations
:
this
.
initialConfigurations
||
[]
},
null
,
editorConfig
.
editor
.
insertSpaces
?
strings
.
repeat
(
'
'
,
editorConfig
.
editor
.
tabSize
)
:
'
\t
'
));
};
public
get
label
()
{
...
...
src/vs/workbench/parts/debug/node/debugConfigurationManager.ts
浏览文件 @
0e470e09
...
...
@@ -311,15 +311,17 @@ export class ConfigurationManager implements debug.IConfigurationManager {
let
configFileCreated
=
false
;
return
this
.
fileService
.
resolveContent
(
resource
).
then
(
content
=>
true
,
err
=>
this
.
getInitialConfigFileContent
().
then
(
content
=>
{
if
(
!
content
)
{
return
false
;
}
this
.
quickOpenService
.
pick
(
this
.
adapters
,
{
placeHolder
:
nls
.
localize
(
'
selectDebug
'
,
"
Select Environment
"
)
})
.
then
(
adapter
=>
adapter
?
adapter
.
getInitialConfigFileContent
()
:
null
)
.
then
(
content
=>
{
if
(
!
content
)
{
return
false
;
}
configFileCreated
=
true
;
return
this
.
fileService
.
updateContent
(
resource
,
content
).
then
(()
=>
true
);
}
))
.
then
(
errorFree
=>
{
configFileCreated
=
true
;
return
this
.
fileService
.
updateContent
(
resource
,
content
).
then
(()
=>
true
);
}))
.
then
(
errorFree
=>
{
if
(
!
errorFree
)
{
return
false
;
}
...
...
@@ -337,26 +339,6 @@ export class ConfigurationManager implements debug.IConfigurationManager {
});
}
private
getInitialConfigFileContent
():
TPromise
<
string
>
{
return
this
.
quickOpenService
.
pick
(
this
.
adapters
,
{
placeHolder
:
nls
.
localize
(
'
selectDebug
'
,
"
Select Environment
"
)
})
.
then
(
adapter
=>
{
if
(
!
adapter
)
{
return
null
;
}
return
adapter
.
getInitialConfigurations
().
then
(
configurations
=>
{
let
editorConfig
=
this
.
configurationService
.
getConfiguration
<
any
>
();
return
JSON
.
stringify
(
{
version
:
'
0.2.0
'
,
configurations
:
configurations
||
[]
},
null
,
editorConfig
.
editor
.
insertSpaces
?
strings
.
repeat
(
'
'
,
editorConfig
.
editor
.
tabSize
)
:
'
\t
'
);
});
});
}
public
canSetBreakpointsIn
(
model
:
editor
.
IModel
):
boolean
{
if
(
model
.
uri
.
scheme
===
Schemas
.
inMemory
)
{
return
false
;
...
...
src/vs/workbench/parts/debug/test/node/debugAdapter.test.ts
浏览文件 @
0e470e09
...
...
@@ -49,7 +49,7 @@ suite('Debug - Adapter', () => {
};
setup
(()
=>
{
adapter
=
new
Adapter
(
rawAdapter
,
{
extensionFolderPath
,
id
:
'
adapter
'
,
name
:
'
myAdapter
'
,
version
:
'
1.0.0
'
,
publisher
:
'
vscode
'
,
isBuiltin
:
false
,
engines
:
null
},
null
,
null
);
adapter
=
new
Adapter
(
rawAdapter
,
{
extensionFolderPath
,
id
:
'
adapter
'
,
name
:
'
myAdapter
'
,
version
:
'
1.0.0
'
,
publisher
:
'
vscode
'
,
isBuiltin
:
false
,
engines
:
null
},
null
,
null
,
null
);
});
teardown
(()
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录