Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
8f7eecc2
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,发现更多精彩内容 >>
提交
8f7eecc2
编写于
5月 13, 2020
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Show quickpick when selecting dynamic debug configuration container
fixes #96778 fixes #96293
上级
124a368e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
43 addition
and
39 deletion
+43
-39
src/vs/workbench/contrib/debug/browser/debugActionViewItems.ts
...s/workbench/contrib/debug/browser/debugActionViewItems.ts
+21
-15
src/vs/workbench/contrib/debug/browser/debugActions.ts
src/vs/workbench/contrib/debug/browser/debugActions.ts
+3
-12
src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts
...kbench/contrib/debug/browser/debugConfigurationManager.ts
+17
-11
src/vs/workbench/contrib/debug/common/debug.ts
src/vs/workbench/contrib/debug/common/debug.ts
+2
-1
未找到文件。
src/vs/workbench/contrib/debug/browser/debugActionViewItems.ts
浏览文件 @
8f7eecc2
...
...
@@ -20,7 +20,6 @@ import { IContextViewService } from 'vs/platform/contextview/browser/contextView
import
{
IWorkspaceContextService
,
WorkbenchState
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
ADD_CONFIGURATION_ID
}
from
'
vs/workbench/contrib/debug/browser/debugCommands
'
;
import
{
StartAction
}
from
'
vs/workbench/contrib/debug/browser/debugActions
'
;
const
$
=
dom
.
$
;
...
...
@@ -32,7 +31,7 @@ export class StartDebugActionViewItem implements IActionViewItem {
private
container
!
:
HTMLElement
;
private
start
!
:
HTMLElement
;
private
selectBox
:
SelectBox
;
private
options
:
{
label
:
string
,
handler
?:
(()
=>
boolean
)
}[]
=
[];
private
options
:
{
label
:
string
,
handler
:
(()
=>
Promise
<
boolean
>
)
}[]
=
[];
private
toDispose
:
IDisposable
[];
private
selected
=
0
;
private
providers
:
{
label
:
string
,
pick
:
()
=>
Promise
<
{
launch
:
ILaunch
,
config
:
IConfig
}
|
undefined
>
}[]
=
[];
...
...
@@ -101,9 +100,9 @@ export class StartDebugActionViewItem implements IActionViewItem {
event
.
stopPropagation
();
}
}));
this
.
toDispose
.
push
(
this
.
selectBox
.
onDidSelect
(
e
=>
{
this
.
toDispose
.
push
(
this
.
selectBox
.
onDidSelect
(
async
e
=>
{
const
target
=
this
.
options
[
e
.
index
];
const
shouldBeSelected
=
target
.
handler
?
target
.
handler
()
:
false
;
const
shouldBeSelected
=
target
.
handler
?
await
target
.
handler
()
:
false
;
if
(
shouldBeSelected
)
{
this
.
selected
=
e
.
index
;
}
else
{
...
...
@@ -173,7 +172,7 @@ export class StartDebugActionViewItem implements IActionViewItem {
if
(
lastGroup
!==
presentation
?.
group
)
{
lastGroup
=
presentation
?.
group
;
if
(
this
.
options
.
length
)
{
this
.
options
.
push
({
label
:
StartDebugActionViewItem
.
SEPARATOR
,
handler
:
undefined
});
this
.
options
.
push
({
label
:
StartDebugActionViewItem
.
SEPARATOR
,
handler
:
()
=>
Promise
.
resolve
(
false
)
});
disabledIdxs
.
push
(
this
.
options
.
length
-
1
);
}
}
...
...
@@ -183,8 +182,7 @@ export class StartDebugActionViewItem implements IActionViewItem {
const
label
=
inWorkspace
?
`
${
name
}
(
${
launch
.
name
}
)`
:
name
;
this
.
options
.
push
({
label
,
handler
:
()
=>
{
StartAction
.
GET_CONFIG_AND_LAUNCH
=
undefined
;
label
,
handler
:
async
()
=>
{
manager
.
selectConfiguration
(
launch
,
name
);
return
true
;
}
...
...
@@ -192,31 +190,39 @@ export class StartDebugActionViewItem implements IActionViewItem {
});
if
(
this
.
options
.
length
===
0
)
{
this
.
options
.
push
({
label
:
nls
.
localize
(
'
noConfigurations
'
,
"
No Configurations
"
),
handler
:
()
=>
false
});
this
.
options
.
push
({
label
:
nls
.
localize
(
'
noConfigurations
'
,
"
No Configurations
"
),
handler
:
async
()
=>
false
});
}
else
{
this
.
options
.
push
({
label
:
StartDebugActionViewItem
.
SEPARATOR
,
handler
:
undefined
});
this
.
options
.
push
({
label
:
StartDebugActionViewItem
.
SEPARATOR
,
handler
:
()
=>
Promise
.
resolve
(
false
)
});
disabledIdxs
.
push
(
this
.
options
.
length
-
1
);
}
this
.
providers
.
forEach
(
p
=>
{
if
(
p
.
label
===
manager
.
selectedConfiguration
.
name
)
{
this
.
selected
=
this
.
options
.
length
;
}
this
.
options
.
push
({
label
:
`
${
p
.
label
}
...`
,
handler
:
()
=>
{
StartAction
.
GET_CONFIG_AND_LAUNCH
=
p
.
pick
;
return
true
;
label
:
`
${
p
.
label
}
...`
,
handler
:
async
()
=>
{
const
picked
=
await
p
.
pick
();
if
(
picked
)
{
manager
.
selectConfiguration
(
picked
.
launch
,
p
.
label
,
picked
.
config
);
return
true
;
}
return
false
;
}
});
});
if
(
this
.
providers
.
length
>
0
)
{
this
.
options
.
push
({
label
:
StartDebugActionViewItem
.
SEPARATOR
,
handler
:
undefined
});
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
({
label
,
handler
:
()
=>
{
this
.
commandService
.
executeCommand
(
ADD_CONFIGURATION_ID
,
l
.
uri
.
toString
());
label
,
handler
:
async
()
=>
{
await
this
.
commandService
.
executeCommand
(
ADD_CONFIGURATION_ID
,
l
.
uri
.
toString
());
return
false
;
}
});
...
...
src/vs/workbench/contrib/debug/browser/debugActions.ts
浏览文件 @
8f7eecc2
...
...
@@ -7,7 +7,7 @@ import * as nls from 'vs/nls';
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IWorkspaceContextService
,
WorkbenchState
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IDebugService
,
State
,
IEnablement
,
IBreakpoint
,
IDebugSession
,
ILaunch
,
IConfig
}
from
'
vs/workbench/contrib/debug/common/debug
'
;
import
{
IDebugService
,
State
,
IEnablement
,
IBreakpoint
,
IDebugSession
,
ILaunch
}
from
'
vs/workbench/contrib/debug/common/debug
'
;
import
{
Variable
,
Breakpoint
,
FunctionBreakpoint
}
from
'
vs/workbench/contrib/debug/common/debugModel
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
...
...
@@ -113,7 +113,6 @@ export class ConfigureAction extends AbstractDebugAction {
export
class
StartAction
extends
AbstractDebugAction
{
static
ID
=
'
workbench.action.debug.start
'
;
static
LABEL
=
nls
.
localize
(
'
startDebug
'
,
"
Start Debugging
"
);
static
GET_CONFIG_AND_LAUNCH
:
(()
=>
Promise
<
{
config
:
IConfig
,
launch
:
ILaunch
}
|
undefined
>
)
|
undefined
;
constructor
(
id
:
string
,
label
:
string
,
@
IDebugService
debugService
:
IDebugService
,
...
...
@@ -129,16 +128,8 @@ export class StartAction extends AbstractDebugAction {
}
async
run
():
Promise
<
boolean
>
{
if
(
StartAction
.
GET_CONFIG_AND_LAUNCH
)
{
const
picked
=
await
StartAction
.
GET_CONFIG_AND_LAUNCH
();
if
(
picked
)
{
return
this
.
debugService
.
startDebugging
(
picked
.
launch
,
picked
.
config
,
{
noDebug
:
this
.
isNoDebug
()
});
}
return
Promise
.
resolve
(
false
);
}
else
{
let
{
launch
,
name
}
=
this
.
debugService
.
getConfigurationManager
().
selectedConfiguration
;
return
this
.
debugService
.
startDebugging
(
launch
,
name
,
{
noDebug
:
this
.
isNoDebug
()
});
}
let
{
launch
,
name
,
config
}
=
this
.
debugService
.
getConfigurationManager
().
selectedConfiguration
;
return
this
.
debugService
.
startDebugging
(
launch
,
config
||
name
,
{
noDebug
:
this
.
isNoDebug
()
});
}
protected
isNoDebug
():
boolean
{
...
...
src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts
浏览文件 @
8f7eecc2
...
...
@@ -46,6 +46,7 @@ jsonRegistry.registerSchema(launchSchemaId, launchSchema);
const
DEBUG_SELECTED_CONFIG_NAME_KEY
=
'
debug.selectedconfigname
'
;
const
DEBUG_SELECTED_ROOT
=
'
debug.selectedroot
'
;
const
DEBUG_SELECTED_CONFIG
=
'
debug.selectedconfig
'
;
export
class
ConfigurationManager
implements
IConfigurationManager
{
private
debuggers
:
Debugger
[];
...
...
@@ -53,6 +54,7 @@ export class ConfigurationManager implements IConfigurationManager {
private
launches
!
:
ILaunch
[];
private
selectedName
:
string
|
undefined
;
private
selectedLaunch
:
ILaunch
|
undefined
;
private
selectedConfig
:
IConfig
|
undefined
;
private
toDispose
:
IDisposable
[];
private
readonly
_onDidSelectConfigurationName
=
new
Emitter
<
void
>
();
private
configProviders
:
IDebugConfigurationProvider
[];
...
...
@@ -82,10 +84,12 @@ export class ConfigurationManager implements IConfigurationManager {
const
previousSelectedRoot
=
this
.
storageService
.
get
(
DEBUG_SELECTED_ROOT
,
StorageScope
.
WORKSPACE
);
const
previousSelectedLaunch
=
this
.
launches
.
find
(
l
=>
l
.
uri
.
toString
()
===
previousSelectedRoot
);
this
.
debugConfigurationTypeContext
=
CONTEXT_DEBUG_CONFIGURATION_TYPE
.
bindTo
(
contextKeyService
);
const
storedConfig
=
this
.
storageService
.
get
(
DEBUG_SELECTED_CONFIG
,
StorageScope
.
WORKSPACE
);
const
selectedConfig
=
typeof
storedConfig
===
'
string
'
?
JSON
.
parse
(
storedConfig
)
:
undefined
;
if
(
previousSelectedLaunch
&&
previousSelectedLaunch
.
getConfigurationNames
().
length
)
{
this
.
selectConfiguration
(
previousSelectedLaunch
,
this
.
storageService
.
get
(
DEBUG_SELECTED_CONFIG_NAME_KEY
,
StorageScope
.
WORKSPACE
));
this
.
selectConfiguration
(
previousSelectedLaunch
,
this
.
storageService
.
get
(
DEBUG_SELECTED_CONFIG_NAME_KEY
,
StorageScope
.
WORKSPACE
)
,
selectedConfig
);
}
else
if
(
this
.
launches
.
length
>
0
)
{
this
.
selectConfiguration
(
undefined
);
this
.
selectConfiguration
(
undefined
,
selectedConfig
?
selectedConfig
.
name
:
undefined
,
selectedConfig
);
}
}
...
...
@@ -434,10 +438,11 @@ export class ConfigurationManager implements IConfigurationManager {
return
this
.
launches
.
find
(
l
=>
l
.
workspace
&&
l
.
workspace
.
uri
.
toString
()
===
workspaceUri
.
toString
());
}
get
selectedConfiguration
():
{
launch
:
ILaunch
|
undefined
,
name
:
string
|
undefined
}
{
get
selectedConfiguration
():
{
launch
:
ILaunch
|
undefined
,
name
:
string
|
undefined
,
config
:
IConfig
|
undefined
}
{
return
{
launch
:
this
.
selectedLaunch
,
name
:
this
.
selectedName
name
:
this
.
selectedName
,
config
:
this
.
selectedConfig
};
}
...
...
@@ -453,7 +458,7 @@ export class ConfigurationManager implements IConfigurationManager {
return
undefined
;
}
selectConfiguration
(
launch
:
ILaunch
|
undefined
,
name
?:
string
):
void
{
selectConfiguration
(
launch
:
ILaunch
|
undefined
,
name
?:
string
,
config
?:
IConfig
):
void
{
if
(
typeof
launch
===
'
undefined
'
)
{
const
rootUri
=
this
.
historyService
.
getLastActiveWorkspaceRoot
();
launch
=
this
.
getLaunch
(
rootUri
);
...
...
@@ -472,18 +477,19 @@ export class ConfigurationManager implements IConfigurationManager {
this
.
storageService
.
remove
(
DEBUG_SELECTED_ROOT
,
StorageScope
.
WORKSPACE
);
}
const
names
=
launch
?
launch
.
getConfigurationNames
()
:
[];
if
(
name
&&
names
.
indexOf
(
name
)
>=
0
)
{
if
(
(
name
&&
names
.
indexOf
(
name
)
>=
0
)
||
config
)
{
this
.
setSelectedLaunchName
(
name
);
}
if
(
!
this
.
selectedName
||
names
.
indexOf
(
this
.
selectedName
)
===
-
1
)
{
}
else
if
(
!
this
.
selectedName
||
names
.
indexOf
(
this
.
selectedName
)
===
-
1
)
{
this
.
setSelectedLaunchName
(
names
.
length
?
names
[
0
]
:
undefined
);
}
const
configuration
=
this
.
selectedLaunch
&&
this
.
selectedName
?
this
.
selectedLaunch
.
getConfiguration
(
this
.
selectedName
)
:
undefined
;
if
(
configuration
)
{
this
.
debugConfigurationTypeContext
.
set
(
configuration
.
type
);
this
.
selectedConfig
=
config
||
(
this
.
selectedLaunch
&&
this
.
selectedName
?
this
.
selectedLaunch
.
getConfiguration
(
this
.
selectedName
)
:
undefined
);
if
(
this
.
selectedConfig
)
{
this
.
debugConfigurationTypeContext
.
set
(
this
.
selectedConfig
.
type
);
this
.
storageService
.
store
(
DEBUG_SELECTED_CONFIG
,
JSON
.
stringify
(
this
.
selectedConfig
),
StorageScope
.
WORKSPACE
);
}
else
{
this
.
debugConfigurationTypeContext
.
reset
();
this
.
storageService
.
remove
(
DEBUG_SELECTED_CONFIG
,
StorageScope
.
WORKSPACE
);
}
if
(
this
.
selectedLaunch
!==
previousLaunch
||
this
.
selectedName
!==
previousName
)
{
...
...
src/vs/workbench/contrib/debug/common/debug.ts
浏览文件 @
8f7eecc2
...
...
@@ -633,10 +633,11 @@ export interface IConfigurationManager {
*/
readonly
selectedConfiguration
:
{
launch
:
ILaunch
|
undefined
;
config
:
IConfig
|
undefined
;
name
:
string
|
undefined
;
};
selectConfiguration
(
launch
:
ILaunch
|
undefined
,
name
?:
string
,
debugStarted
?:
boolean
):
void
;
selectConfiguration
(
launch
:
ILaunch
|
undefined
,
name
?:
string
,
config
?:
IConfig
):
void
;
getLaunches
():
ReadonlyArray
<
ILaunch
>
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录