Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
6c6bd52b
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,发现更多精彩内容 >>
提交
6c6bd52b
编写于
9月 26, 2018
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debug: clean up activation events
fixes #37929
上级
bca9ef43
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
43 addition
and
45 deletion
+43
-45
src/vs/workbench/parts/debug/electron-browser/debugConfigurationManager.ts
...parts/debug/electron-browser/debugConfigurationManager.ts
+43
-45
未找到文件。
src/vs/workbench/parts/debug/electron-browser/debugConfigurationManager.ts
浏览文件 @
6c6bd52b
...
...
@@ -103,7 +103,7 @@ export class ConfigurationManager implements IConfigurationManager {
}
public
resolveConfigurationByProviders
(
folderUri
:
uri
|
undefined
,
type
:
string
|
undefined
,
debugConfiguration
:
IConfig
):
TPromise
<
IConfig
>
{
return
this
.
extensionService
.
activateByEvent
(
`onDebugResolve:
${
type
}
`
).
then
(()
=>
{
return
this
.
activateDebuggers
(
`onDebugResolve:
${
type
}
`
).
then
(()
=>
{
// pipe the config through the promises sequentially. append at the end the '*' types
const
providers
=
this
.
providers
.
filter
(
p
=>
p
.
type
===
type
&&
p
.
resolveDebugConfiguration
)
.
concat
(
this
.
providers
.
filter
(
p
=>
p
.
type
===
'
*
'
&&
p
.
resolveDebugConfiguration
));
...
...
@@ -121,8 +121,9 @@ export class ConfigurationManager implements IConfigurationManager {
}
public
provideDebugConfigurations
(
folderUri
:
uri
|
undefined
,
type
:
string
):
TPromise
<
any
[]
>
{
return
TPromise
.
join
(
this
.
providers
.
filter
(
p
=>
p
.
type
===
type
&&
p
.
provideDebugConfigurations
).
map
(
p
=>
p
.
provideDebugConfigurations
(
folderUri
)))
.
then
(
results
=>
results
.
reduce
((
first
,
second
)
=>
first
.
concat
(
second
),
[]));
return
this
.
activateDebuggers
(
'
onDebugInitialConfigurations
'
)
.
then
(()
=>
TPromise
.
join
(
this
.
providers
.
filter
(
p
=>
p
.
type
===
type
&&
p
.
provideDebugConfigurations
).
map
(
p
=>
p
.
provideDebugConfigurations
(
folderUri
)))
.
then
(
results
=>
results
.
reduce
((
first
,
second
)
=>
first
.
concat
(
second
),
[])));
}
public
provideDebugAdapter
(
session
:
IDebugSession
,
folderUri
:
uri
|
undefined
,
config
:
IConfig
):
TPromise
<
IAdapterDescriptor
|
undefined
>
{
...
...
@@ -329,33 +330,32 @@ export class ConfigurationManager implements IConfigurationManager {
}
public
guessDebugger
(
type
?:
string
):
TPromise
<
Debugger
>
{
return
this
.
activateDebuggers
().
then
(()
=>
{
if
(
type
)
{
const
adapter
=
this
.
getDebugger
(
type
);
return
TPromise
.
as
(
adapter
);
}
if
(
type
)
{
const
adapter
=
this
.
getDebugger
(
type
);
return
TPromise
.
as
(
adapter
);
const
activeTextEditorWidget
=
this
.
editorService
.
activeTextEditorWidget
;
let
candidates
:
TPromise
<
Debugger
[]
>
;
if
(
isCodeEditor
(
activeTextEditorWidget
))
{
const
model
=
activeTextEditorWidget
.
getModel
();
const
language
=
model
?
model
.
getLanguageIdentifier
().
language
:
undefined
;
const
adapters
=
this
.
debuggers
.
filter
(
a
=>
a
.
languages
&&
a
.
languages
.
indexOf
(
language
)
>=
0
);
if
(
adapters
.
length
===
1
)
{
return
TPromise
.
as
(
adapters
[
0
]);
}
const
activeTextEditorWidget
=
this
.
editorService
.
activeTextEditorWidget
;
let
candidates
:
Debugger
[];
if
(
isCodeEditor
(
activeTextEditorWidget
))
{
const
model
=
activeTextEditorWidget
.
getModel
();
const
language
=
model
?
model
.
getLanguageIdentifier
().
language
:
undefined
;
const
adapters
=
this
.
debuggers
.
filter
(
a
=>
a
.
languages
&&
a
.
languages
.
indexOf
(
language
)
>=
0
);
if
(
adapters
.
length
===
1
)
{
return
TPromise
.
as
(
adapters
[
0
]);
}
if
(
adapters
.
length
>
1
)
{
candidates
=
adapters
;
}
if
(
adapters
.
length
>
1
)
{
candidates
=
TPromise
.
as
(
adapters
);
}
}
if
(
!
candidates
)
{
candidates
=
this
.
debuggers
.
filter
(
a
=>
a
.
hasInitialConfiguration
()
||
a
.
hasConfigurationProvider
);
}
if
(
!
candidates
)
{
candidates
=
this
.
activateDebuggers
(
'
onDebugInitialConfigurations
'
).
then
(()
=>
this
.
debuggers
.
filter
(
a
=>
a
.
hasInitialConfiguration
()
||
a
.
hasConfigurationProvider
)
);
}
candidates
=
candidates
.
sort
((
first
,
second
)
=>
first
.
label
.
localeCompare
(
second
.
label
));
const
picks
=
candidates
.
map
(
c
=>
({
label
:
c
.
label
,
debugger
:
c
}));
return
candidates
.
then
(
debuggers
=>
{
debuggers
.
sort
((
first
,
second
)
=>
first
.
label
.
localeCompare
(
second
.
label
));
const
picks
=
debuggers
.
map
(
c
=>
({
label
:
c
.
label
,
debugger
:
c
}));
return
this
.
quickInputService
.
pick
<
(
typeof
picks
)[
0
]
>
([...
picks
,
{
type
:
'
separator
'
},
{
label
:
'
More...
'
,
debugger
:
undefined
}],
{
placeHolder
:
nls
.
localize
(
'
selectDebug
'
,
"
Select Environment
"
)
})
.
then
(
picked
=>
{
if
(
picked
&&
picked
.
debugger
)
{
...
...
@@ -369,8 +369,8 @@ export class ConfigurationManager implements IConfigurationManager {
});
}
p
ublic
activateDebuggers
(
):
TPromise
<
void
>
{
return
this
.
extensionService
.
activateByEvent
(
'
onDebugInitialConfigurations
'
).
then
(()
=>
this
.
extensionService
.
activateByEvent
(
'
onDebug
'
));
p
rivate
activateDebuggers
(
activationEvent
:
string
):
TPromise
<
void
>
{
return
this
.
extensionService
.
activateByEvent
(
activationEvent
).
then
(()
=>
this
.
extensionService
.
activateByEvent
(
'
onDebug
'
));
}
private
store
():
void
{
...
...
@@ -456,26 +456,24 @@ class Launch implements ILaunch {
return
this
.
fileService
.
resolveContent
(
resource
).
then
(
content
=>
content
.
value
,
err
=>
{
// launch.json not found: create one by collecting launch configs from debugConfigProviders
return
this
.
configurationManager
.
activateDebuggers
().
then
(()
=>
{
return
this
.
configurationManager
.
guessDebugger
(
type
).
then
(
adapter
=>
{
if
(
adapter
)
{
return
this
.
configurationManager
.
provideDebugConfigurations
(
this
.
workspace
.
uri
,
adapter
.
type
).
then
(
initialConfigs
=>
{
return
adapter
.
getInitialConfigurationContent
(
initialConfigs
);
});
}
else
{
return
undefined
;
}
}).
then
(
content
=>
{
return
this
.
configurationManager
.
guessDebugger
(
type
).
then
(
adapter
=>
{
if
(
adapter
)
{
return
this
.
configurationManager
.
provideDebugConfigurations
(
this
.
workspace
.
uri
,
adapter
.
type
).
then
(
initialConfigs
=>
{
return
adapter
.
getInitialConfigurationContent
(
initialConfigs
);
});
}
else
{
return
undefined
;
}
}).
then
(
content
=>
{
if
(
!
content
)
{
return
undefined
;
}
if
(
!
content
)
{
return
undefined
;
}
created
=
true
;
// pin only if config file is created #8727
return
this
.
fileService
.
updateContent
(
resource
,
content
).
then
(()
=>
{
// convert string into IContent; see #32135
return
content
;
});
created
=
true
;
// pin only if config file is created #8727
return
this
.
fileService
.
updateContent
(
resource
,
content
).
then
(()
=>
{
// convert string into IContent; see #32135
return
content
;
});
});
}).
then
(
content
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录