Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
79134b57
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
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,发现更多精彩内容 >>
提交
79134b57
编写于
10月 28, 2016
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debug: polish and simplify debugConfigurationManager
上级
8236d1e9
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
54 addition
and
74 deletion
+54
-74
src/vs/workbench/parts/debug/browser/debugActionItems.ts
src/vs/workbench/parts/debug/browser/debugActionItems.ts
+15
-17
src/vs/workbench/parts/debug/common/debug.ts
src/vs/workbench/parts/debug/common/debug.ts
+0
-4
src/vs/workbench/parts/debug/node/debugConfigurationManager.ts
...s/workbench/parts/debug/node/debugConfigurationManager.ts
+39
-53
未找到文件。
src/vs/workbench/parts/debug/browser/debugActionItems.ts
浏览文件 @
79134b57
...
...
@@ -9,14 +9,14 @@ import { TPromise } from 'vs/base/common/winjs.base';
import
{
IAction
}
from
'
vs/base/common/actions
'
;
import
{
SelectActionItem
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IDebugService
,
State
}
from
'
vs/workbench/parts/debug/common/debug
'
;
import
{
IDebugService
,
State
,
IGlobalConfig
}
from
'
vs/workbench/parts/debug/common/debug
'
;
export
class
DebugSelectActionItem
extends
SelectActionItem
{
constructor
(
action
:
IAction
,
@
IDebugService
private
debugService
:
IDebugService
,
@
IConfigurationService
configurationService
:
IConfigurationService
@
IConfigurationService
private
configurationService
:
IConfigurationService
)
{
super
(
null
,
action
,
[],
-
1
);
...
...
@@ -38,20 +38,18 @@ export class DebugSelectActionItem extends SelectActionItem {
}
private
updateOptions
(
changeDebugConfiguration
:
boolean
):
TPromise
<
any
>
{
const
configurationManager
=
this
.
debugService
.
getConfigurationManager
();
return
configurationManager
.
loadLaunchConfig
().
then
(
config
=>
{
if
(
!
config
||
!
config
.
configurations
||
config
.
configurations
.
length
===
0
)
{
this
.
setOptions
([
nls
.
localize
(
'
noConfigurations
'
,
"
No Configurations
"
)],
0
);
return
changeDebugConfiguration
?
this
.
actionRunner
.
run
(
this
.
_action
,
null
)
:
null
;
}
const
configurationNames
=
config
.
configurations
.
filter
(
cfg
=>
!!
cfg
.
name
).
map
(
cfg
=>
cfg
.
name
);
const
selected
=
configurationNames
.
indexOf
(
this
.
debugService
.
getViewModel
().
selectedConfigurationName
);
this
.
setOptions
(
configurationNames
,
selected
);
if
(
changeDebugConfiguration
)
{
return
this
.
actionRunner
.
run
(
this
.
_action
,
this
.
getSelected
());
}
});
const
config
=
this
.
configurationService
.
getConfiguration
<
IGlobalConfig
>
(
'
launch
'
);
if
(
!
config
||
!
config
.
configurations
||
config
.
configurations
.
length
===
0
)
{
this
.
setOptions
([
nls
.
localize
(
'
noConfigurations
'
,
"
No Configurations
"
)],
0
);
return
changeDebugConfiguration
?
this
.
actionRunner
.
run
(
this
.
_action
,
null
)
:
TPromise
.
as
(
null
);
}
const
configurationNames
=
config
.
configurations
.
filter
(
cfg
=>
!!
cfg
.
name
).
map
(
cfg
=>
cfg
.
name
);
const
selected
=
configurationNames
.
indexOf
(
this
.
debugService
.
getViewModel
().
selectedConfigurationName
);
this
.
setOptions
(
configurationNames
,
selected
);
if
(
changeDebugConfiguration
)
{
return
this
.
actionRunner
.
run
(
this
.
_action
,
this
.
getSelected
());
}
}
}
src/vs/workbench/parts/debug/common/debug.ts
浏览文件 @
79134b57
...
...
@@ -72,7 +72,6 @@ export enum SessionRequestType {
}
export
interface
ISession
{
// TODO@Isidor consider removing this - feels ugly
requestType
:
SessionRequestType
;
stackTrace
(
args
:
DebugProtocol
.
StackTraceArguments
):
TPromise
<
DebugProtocol
.
StackTraceResponse
>
;
scopes
(
args
:
DebugProtocol
.
ScopesArguments
):
TPromise
<
DebugProtocol
.
ScopesResponse
>
;
...
...
@@ -350,9 +349,6 @@ export interface IConfigurationManager {
*/
openConfigFile
(
sideBySide
:
boolean
):
TPromise
<
boolean
>
;
// TODO@Isidor remove this from the interface
loadLaunchConfig
():
TPromise
<
IGlobalConfig
>
;
/**
* Returns true if breakpoints can be set for a given editor model. Depends on mode.
*/
...
...
src/vs/workbench/parts/debug/node/debugConfigurationManager.ts
浏览文件 @
79134b57
...
...
@@ -8,7 +8,6 @@ import { TPromise } from 'vs/base/common/winjs.base';
import
strings
=
require
(
'
vs/base/common/strings
'
);
import
types
=
require
(
'
vs/base/common/types
'
);
import
{
isLinux
,
isMacintosh
,
isWindows
}
from
'
vs/base/common/platform
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
objects
=
require
(
'
vs/base/common/objects
'
);
import
uri
from
'
vs/base/common/uri
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
...
...
@@ -169,7 +168,6 @@ jsonRegistry.registerSchema(schemaId, schema);
export
class
ConfigurationManager
implements
debug
.
IConfigurationManager
{
private
adapters
:
Adapter
[];
private
allModeIdsForBreakpoints
:
{
[
key
:
string
]:
boolean
};
private
_onDidConfigurationChange
:
Emitter
<
debug
.
IConfig
>
;
constructor
(
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
,
...
...
@@ -181,7 +179,6 @@ export class ConfigurationManager implements debug.IConfigurationManager {
@
IConfigurationResolverService
private
configurationResolverService
:
IConfigurationResolverService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
)
{
this
.
_onDidConfigurationChange
=
new
Emitter
<
debug
.
IConfig
>
();
this
.
adapters
=
[];
this
.
registerListeners
();
this
.
allModeIdsForBreakpoints
=
{};
...
...
@@ -243,63 +240,56 @@ export class ConfigurationManager implements debug.IConfigurationManager {
});
}
public
get
onDidConfigurationChange
():
Event
<
debug
.
IConfig
>
{
return
this
.
_onDidConfigurationChange
.
event
;
}
public
getAdapter
(
type
:
string
):
Adapter
{
return
this
.
adapters
.
filter
(
adapter
=>
strings
.
equalsIgnoreCase
(
adapter
.
type
,
type
)).
pop
();
}
public
getConfiguration
(
nameOrConfig
:
string
|
debug
.
IConfig
):
TPromise
<
debug
.
IConfig
>
{
return
this
.
loadLaunchConfig
().
then
(
config
=>
{
let
result
:
debug
.
IConfig
=
null
;
if
(
types
.
isObject
(
nameOrConfig
))
{
result
=
objects
.
deepClone
(
nameOrConfig
)
as
debug
.
IConfig
;
}
else
{
if
(
!
config
||
!
config
.
configurations
)
{
return
result
;
}
// if the configuration name is not set yet, take the first launch config (can happen if debug viewlet has not been opened yet).
const
filtered
=
config
.
configurations
.
filter
(
cfg
=>
cfg
.
name
===
nameOrConfig
);
const
config
=
this
.
configurationService
.
getConfiguration
<
debug
.
IGlobalConfig
>
(
'
launch
'
);
result
=
filtered
.
length
===
1
?
filtered
[
0
]
:
config
.
configurations
[
0
];
result
=
objects
.
deepClone
(
result
);
if
(
config
&&
result
)
{
result
.
debugServer
=
config
.
debugServer
;
}
let
result
:
debug
.
IConfig
=
null
;
if
(
types
.
isObject
(
nameOrConfig
))
{
result
=
objects
.
deepClone
(
nameOrConfig
)
as
debug
.
IConfig
;
}
else
{
if
(
!
config
||
!
config
.
configurations
)
{
return
TPromise
.
as
(
null
);
}
// if the configuration name is not set yet, take the first launch config (can happen if debug viewlet has not been opened yet).
const
filtered
=
config
.
configurations
.
filter
(
cfg
=>
cfg
.
name
===
nameOrConfig
);
if
(
result
)
{
// Set operating system specific properties #1873
if
(
isWindows
&&
result
.
windows
)
{
Object
.
keys
(
result
.
windows
).
forEach
(
key
=>
{
result
[
key
]
=
result
.
windows
[
key
];
});
}
if
(
isMacintosh
&&
result
.
osx
)
{
Object
.
keys
(
result
.
osx
).
forEach
(
key
=>
{
result
[
key
]
=
result
.
osx
[
key
];
});
}
if
(
isLinux
&&
result
.
linux
)
{
Object
.
keys
(
result
.
linux
).
forEach
(
key
=>
{
result
[
key
]
=
result
.
linux
[
key
];
});
}
result
=
filtered
.
length
===
1
?
filtered
[
0
]
:
config
.
configurations
[
0
];
result
=
objects
.
deepClone
(
result
);
if
(
config
&&
result
)
{
result
.
debugServer
=
config
.
debugServer
;
}
}
// massage configuration attributes - append workspace path to relatvie paths, substitute variables in paths.
Object
.
keys
(
result
).
forEach
(
key
=>
{
result
[
key
]
=
this
.
configurationResolverService
.
resolveAny
(
result
[
key
]);
if
(
result
)
{
// Set operating system specific properties #1873
if
(
isWindows
&&
result
.
windows
)
{
Object
.
keys
(
result
.
windows
).
forEach
(
key
=>
{
result
[
key
]
=
result
.
windows
[
key
];
});
const
adapter
=
this
.
getAdapter
(
result
.
type
);
return
this
.
configurationResolverService
.
resolveInteractiveVariables
(
result
,
adapter
?
adapter
.
variables
:
null
);
}
}).
then
(
result
=>
{
this
.
_onDidConfigurationChange
.
fire
(
result
);
return
result
;
});
if
(
isMacintosh
&&
result
.
osx
)
{
Object
.
keys
(
result
.
osx
).
forEach
(
key
=>
{
result
[
key
]
=
result
.
osx
[
key
];
});
}
if
(
isLinux
&&
result
.
linux
)
{
Object
.
keys
(
result
.
linux
).
forEach
(
key
=>
{
result
[
key
]
=
result
.
linux
[
key
];
});
}
// massage configuration attributes - append workspace path to relatvie paths, substitute variables in paths.
Object
.
keys
(
result
).
forEach
(
key
=>
{
result
[
key
]
=
this
.
configurationResolverService
.
resolveAny
(
result
[
key
]);
});
const
adapter
=
this
.
getAdapter
(
result
.
type
);
return
this
.
configurationResolverService
.
resolveInteractiveVariables
(
result
,
adapter
?
adapter
.
variables
:
null
);
}
}
public
openConfigFile
(
sideBySide
:
boolean
):
TPromise
<
boolean
>
{
...
...
@@ -348,8 +338,4 @@ export class ConfigurationManager implements debug.IConfigurationManager {
return
!!
this
.
allModeIdsForBreakpoints
[
modeId
];
}
public
loadLaunchConfig
():
TPromise
<
debug
.
IGlobalConfig
>
{
return
TPromise
.
as
(
this
.
configurationService
.
getConfiguration
<
debug
.
IGlobalConfig
>
(
'
launch
'
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录