Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
4b0855f2
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,发现更多精彩内容 >>
提交
4b0855f2
编写于
11月 06, 2020
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve the dynamic launch config UI
fixes #110009
上级
f63d6952
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
77 addition
and
35 deletion
+77
-35
src/vs/workbench/contrib/debug/browser/debugActionViewItems.ts
...s/workbench/contrib/debug/browser/debugActionViewItems.ts
+20
-13
src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts
...kbench/contrib/debug/browser/debugConfigurationManager.ts
+34
-20
src/vs/workbench/contrib/debug/browser/debugQuickAccess.ts
src/vs/workbench/contrib/debug/browser/debugQuickAccess.ts
+20
-1
src/vs/workbench/contrib/debug/common/debug.ts
src/vs/workbench/contrib/debug/common/debug.ts
+3
-1
未找到文件。
src/vs/workbench/contrib/debug/browser/debugActionViewItems.ts
浏览文件 @
4b0855f2
...
...
@@ -188,23 +188,35 @@ export class StartDebugActionViewItem implements IActionViewItem {
});
});
// Only take 3 elements from the recent dynamic configurations to not clutter the dropdown
manager
.
getRecentDynamicConfigurations
().
slice
(
0
,
3
).
forEach
(({
name
,
type
})
=>
{
if
(
type
===
manager
.
selectedConfiguration
.
type
&&
manager
.
selectedConfiguration
.
name
===
name
)
{
this
.
selected
=
this
.
options
.
length
;
}
this
.
options
.
push
({
label
:
name
,
handler
:
async
()
=>
{
await
manager
.
selectConfiguration
(
undefined
,
name
,
undefined
,
{
type
});
return
true
;
}
});
});
if
(
this
.
options
.
length
===
0
)
{
this
.
options
.
push
({
label
:
nls
.
localize
(
'
noConfigurations
'
,
"
No Configurations
"
),
handler
:
async
()
=>
false
});
}
else
{
this
.
options
.
push
({
label
:
StartDebugActionViewItem
.
SEPARATOR
,
handler
:
()
=>
Promise
.
resolve
(
false
)
});
disabledIdxs
.
push
(
this
.
options
.
length
-
1
);
}
this
.
options
.
push
({
label
:
StartDebugActionViewItem
.
SEPARATOR
,
handler
:
()
=>
Promise
.
resolve
(
false
)
});
disabledIdxs
.
push
(
this
.
options
.
length
-
1
);
this
.
providers
.
forEach
(
p
=>
{
if
(
p
.
type
===
manager
.
selectedConfiguration
.
type
)
{
this
.
selected
=
this
.
options
.
length
;
}
this
.
options
.
push
({
label
:
`
${
p
.
label
}
...`
,
handler
:
async
()
=>
{
label
:
`
${
p
.
label
}
...`
,
handler
:
async
()
=>
{
const
picked
=
await
p
.
pick
();
if
(
picked
)
{
await
manager
.
selectConfiguration
(
picked
.
launch
,
picked
.
config
.
name
,
picked
.
config
,
p
.
type
);
await
manager
.
selectConfiguration
(
picked
.
launch
,
picked
.
config
.
name
,
picked
.
config
,
{
type
:
p
.
type
}
);
return
true
;
}
return
false
;
...
...
@@ -212,11 +224,6 @@ export class StartDebugActionViewItem implements IActionViewItem {
});
});
if
(
this
.
providers
.
length
>
0
)
{
this
.
options
.
push
({
label
:
StartDebugActionViewItem
.
SEPARATOR
,
handler
:
()
=>
Promise
.
resolve
(
false
)
});
disabledIdxs
.
push
(
this
.
options
.
length
-
1
);
}
manager
.
getLaunches
().
filter
(
l
=>
!
l
.
hidden
).
forEach
(
l
=>
{
const
label
=
inWorkspace
?
nls
.
localize
(
"
addConfigTo
"
,
"
Add Config ({0})...
"
,
l
.
name
)
:
nls
.
localize
(
'
addConfiguration
'
,
"
Add Configuration...
"
);
this
.
options
.
push
({
...
...
src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts
浏览文件 @
4b0855f2
...
...
@@ -37,7 +37,7 @@ import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cance
import
{
withUndefinedAsNull
}
from
'
vs/base/common/types
'
;
import
{
sequence
}
from
'
vs/base/common/async
'
;
import
{
IHistoryService
}
from
'
vs/workbench/services/history/common/history
'
;
import
{
flatten
}
from
'
vs/base/common/arrays
'
;
import
{
flatten
,
distinct
}
from
'
vs/base/common/arrays
'
;
import
{
getVisibleAndSorted
}
from
'
vs/workbench/contrib/debug/common/debugUtils
'
;
import
{
DebugConfigurationProviderTriggerKind
}
from
'
vs/workbench/api/common/extHostTypes
'
;
import
{
IUriIdentityService
}
from
'
vs/workbench/services/uriIdentity/common/uriIdentity
'
;
...
...
@@ -49,6 +49,7 @@ const DEBUG_SELECTED_CONFIG_NAME_KEY = 'debug.selectedconfigname';
const
DEBUG_SELECTED_ROOT
=
'
debug.selectedroot
'
;
// Debug type is only stored if a dynamic configuration is used for better restore
const
DEBUG_SELECTED_TYPE
=
'
debug.selectedtype
'
;
const
DEBUG_RECENT_DYNAMIC_CONFIGURATIONS
=
'
debug.recentdynamicconfigurations
'
;
interface
IDynamicPickItem
{
label
:
string
,
launch
:
ILaunch
,
config
:
IConfig
}
...
...
@@ -95,9 +96,9 @@ export class ConfigurationManager implements IConfigurationManager {
this
.
debugConfigurationTypeContext
=
CONTEXT_DEBUG_CONFIGURATION_TYPE
.
bindTo
(
contextKeyService
);
this
.
debuggersAvailable
=
CONTEXT_DEBUGGERS_AVAILABLE
.
bindTo
(
contextKeyService
);
if
(
previousSelectedLaunch
&&
previousSelectedLaunch
.
getConfigurationNames
().
length
)
{
this
.
selectConfiguration
(
previousSelectedLaunch
,
previousSelectedName
,
undefined
,
previousSelectedType
);
this
.
selectConfiguration
(
previousSelectedLaunch
,
previousSelectedName
,
undefined
,
{
type
:
previousSelectedType
}
);
}
else
if
(
this
.
launches
.
length
>
0
)
{
this
.
selectConfiguration
(
undefined
,
previousSelectedName
,
undefined
,
previousSelectedType
);
this
.
selectConfiguration
(
undefined
,
previousSelectedName
,
undefined
,
{
type
:
previousSelectedType
}
);
}
}
...
...
@@ -387,6 +388,10 @@ export class ConfigurationManager implements IConfigurationManager {
return
getVisibleAndSorted
(
all
);
}
getRecentDynamicConfigurations
():
{
name
:
string
,
type
:
string
}[]
{
return
JSON
.
parse
(
this
.
storageService
.
get
(
DEBUG_RECENT_DYNAMIC_CONFIGURATIONS
,
StorageScope
.
WORKSPACE
,
'
[]
'
));
}
private
registerListeners
():
void
{
debuggersExtPoint
.
setHandler
((
extensions
,
delta
)
=>
{
delta
.
added
.
forEach
(
added
=>
{
...
...
@@ -522,7 +527,7 @@ export class ConfigurationManager implements IConfigurationManager {
return
undefined
;
}
async
selectConfiguration
(
launch
:
ILaunch
|
undefined
,
name
?:
string
,
config
?:
IConfig
,
type
?:
string
):
Promise
<
void
>
{
async
selectConfiguration
(
launch
:
ILaunch
|
undefined
,
name
?:
string
,
config
?:
IConfig
,
dynamicConfig
?:
{
type
?:
string
}
):
Promise
<
void
>
{
if
(
typeof
launch
===
'
undefined
'
)
{
const
rootUri
=
this
.
historyService
.
getLastActiveWorkspaceRoot
();
launch
=
this
.
getLaunch
(
rootUri
);
...
...
@@ -542,30 +547,39 @@ export class ConfigurationManager implements IConfigurationManager {
}
const
names
=
launch
?
launch
.
getConfigurationNames
()
:
[];
if
(
(
name
&&
names
.
indexOf
(
name
)
>=
0
)
||
config
)
{
if
(
name
&&
names
.
indexOf
(
name
)
>=
0
)
{
this
.
setSelectedLaunchName
(
name
);
}
else
if
(
!
this
.
selectedName
||
names
.
indexOf
(
this
.
selectedName
)
===
-
1
)
{
// We could not find the previously used name. We should get all dynamic configurations from providers
}
else
if
(
dynamicConfig
)
{
// We could not find the previously used name
and config is not passed
. We should get all dynamic configurations from providers
// And potentially auto select the previously used dynamic configuration #96293
const
providers
=
(
await
this
.
getDynamicProviders
()).
filter
(
p
=>
p
.
type
===
type
);
const
activatedProviders
=
await
Promise
.
all
(
providers
.
map
(
p
=>
p
.
getProvider
()));
const
provider
=
activatedProviders
.
find
(
p
=>
p
&&
p
.
type
===
type
);
let
nameToSet
=
names
.
length
?
names
[
0
]
:
undefined
;
if
(
provider
&&
launch
&&
launch
.
workspace
)
{
const
token
=
new
CancellationTokenSource
();
const
dynamicConfigs
=
await
provider
.
provideDebugConfigurations
!
(
launch
.
workspace
.
uri
,
token
.
token
);
const
dynamicConfig
=
dynamicConfigs
.
find
(
c
=>
c
.
name
===
name
);
if
(
dynamicConfig
)
{
config
=
dynamicConfig
;
nameToSet
=
name
;
let
nameToSet
=
config
?
config
.
name
:
names
.
length
?
names
[
0
]
:
undefined
;
if
(
!
config
)
{
const
providers
=
(
await
this
.
getDynamicProviders
()).
filter
(
p
=>
p
.
type
===
dynamicConfig
.
type
);
const
activatedProviders
=
await
Promise
.
all
(
providers
.
map
(
p
=>
p
.
getProvider
()));
const
provider
=
activatedProviders
.
find
(
p
=>
p
&&
p
.
type
===
dynamicConfig
.
type
);
if
(
provider
&&
launch
&&
launch
.
workspace
)
{
const
token
=
new
CancellationTokenSource
();
const
dynamicConfigs
=
await
provider
.
provideDebugConfigurations
!
(
launch
.
workspace
.
uri
,
token
.
token
);
const
dynamicConfig
=
dynamicConfigs
.
find
(
c
=>
c
.
name
===
name
);
if
(
dynamicConfig
)
{
config
=
dynamicConfig
;
nameToSet
=
name
;
}
}
}
this
.
setSelectedLaunchName
(
nameToSet
);
let
recentDynamicProviders
=
this
.
getRecentDynamicConfigurations
();
if
(
name
&&
dynamicConfig
.
type
)
{
// We need to store the recently used dynamic configurations to be able to show them in UI #110009
recentDynamicProviders
.
unshift
({
name
,
type
:
dynamicConfig
.
type
});
recentDynamicProviders
=
distinct
(
recentDynamicProviders
,
t
=>
`
${
t
.
name
}
:
${
t
.
type
}
`
);
this
.
storageService
.
store2
(
DEBUG_RECENT_DYNAMIC_CONFIGURATIONS
,
JSON
.
stringify
(
recentDynamicProviders
),
StorageScope
.
WORKSPACE
,
StorageTarget
.
USER
);
}
}
this
.
selectedConfig
=
config
;
this
.
selectedType
=
type
||
this
.
selectedConfig
?.
type
;
this
.
selectedType
=
dynamicConfig
?.
type
||
this
.
selectedConfig
?.
type
;
this
.
storageService
.
store2
(
DEBUG_SELECTED_TYPE
,
this
.
selectedType
,
StorageScope
.
WORKSPACE
,
StorageTarget
.
MACHINE
);
const
configForType
=
this
.
selectedConfig
||
(
this
.
selectedLaunch
&&
this
.
selectedName
?
this
.
selectedLaunch
.
getConfiguration
(
this
.
selectedName
)
:
undefined
);
if
(
configForType
)
{
...
...
src/vs/workbench/contrib/debug/browser/debugQuickAccess.ts
浏览文件 @
4b0855f2
...
...
@@ -64,7 +64,7 @@ export class StartDebugQuickAccessProvider extends PickerQuickAccessProvider<IPi
return
TriggerAction
.
CLOSE_PICKER
;
},
accept
:
async
()
=>
{
await
this
.
debugService
.
getConfigurationManager
()
.
selectConfiguration
(
config
.
launch
,
config
.
name
);
await
configManager
.
selectConfiguration
(
config
.
launch
,
config
.
name
);
try
{
await
this
.
debugService
.
startDebugging
(
config
.
launch
);
}
catch
(
error
)
{
...
...
@@ -86,6 +86,24 @@ export class StartDebugQuickAccessProvider extends PickerQuickAccessProvider<IPi
});
}
configManager
.
getRecentDynamicConfigurations
().
forEach
(({
name
,
type
})
=>
{
const
highlights
=
matchesFuzzy
(
filter
,
name
,
true
);
if
(
highlights
)
{
picks
.
push
({
label
:
name
,
highlights
:
{
label
:
highlights
},
accept
:
async
()
=>
{
await
configManager
.
selectConfiguration
(
undefined
,
name
,
undefined
,
{
type
});
try
{
await
this
.
debugService
.
startDebugging
(
configManager
.
selectedConfiguration
.
launch
,
configManager
.
selectedConfiguration
.
config
);
}
catch
(
error
)
{
this
.
notificationService
.
error
(
error
);
}
}
});
}
});
dynamicProviders
.
forEach
(
provider
=>
{
picks
.
push
({
label
:
`$(folder)
${
provider
.
label
}
...`
,
...
...
@@ -93,6 +111,7 @@ export class StartDebugQuickAccessProvider extends PickerQuickAccessProvider<IPi
accept
:
async
()
=>
{
const
pick
=
await
provider
.
pick
();
if
(
pick
)
{
await
configManager
.
selectConfiguration
(
pick
.
launch
,
pick
.
config
.
name
,
pick
.
config
,
{
type
:
pick
.
config
.
type
});
this
.
debugService
.
startDebugging
(
pick
.
launch
,
pick
.
config
);
}
}
...
...
src/vs/workbench/contrib/debug/common/debug.ts
浏览文件 @
4b0855f2
...
...
@@ -677,7 +677,7 @@ export interface IConfigurationManager {
type
:
string
|
undefined
;
};
selectConfiguration
(
launch
:
ILaunch
|
undefined
,
name
?:
string
,
config
?:
IConfig
,
type
?:
string
):
Promise
<
void
>
;
selectConfiguration
(
launch
:
ILaunch
|
undefined
,
name
?:
string
,
config
?:
IConfig
,
dynamicConfigOptions
?:
{
type
?:
string
}
):
Promise
<
void
>
;
getLaunches
():
ReadonlyArray
<
ILaunch
>
;
...
...
@@ -687,6 +687,8 @@ export interface IConfigurationManager {
getAllConfigurations
():
{
launch
:
ILaunch
,
name
:
string
,
presentation
?:
IConfigPresentation
}[];
getRecentDynamicConfigurations
():
{
name
:
string
,
type
:
string
}[];
/**
* Allows to register on change of selected debug configuration.
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录