Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
e0a433b8
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,发现更多精彩内容 >>
未验证
提交
e0a433b8
编写于
10月 23, 2020
作者:
A
Andre Weinand
提交者:
GitHub
10月 23, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #97440 from bzarco/launch-input-variables
Fix launch configuration input variable resolution.
上级
88113c5d
0fd157a9
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
52 addition
and
8 deletion
+52
-8
src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts
...kbench/contrib/debug/browser/debugConfigurationManager.ts
+11
-2
src/vs/workbench/contrib/debug/common/debug.ts
src/vs/workbench/contrib/debug/common/debug.ts
+2
-1
src/vs/workbench/contrib/debug/common/debugger.ts
src/vs/workbench/contrib/debug/common/debugger.ts
+1
-1
src/vs/workbench/services/configurationResolver/browser/configurationResolverService.ts
...igurationResolver/browser/configurationResolverService.ts
+5
-4
src/vs/workbench/services/configurationResolver/test/electron-browser/configurationResolverService.test.ts
...est/electron-browser/configurationResolverService.test.ts
+33
-0
未找到文件。
src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts
浏览文件 @
e0a433b8
...
...
@@ -699,8 +699,17 @@ abstract class AbstractLaunch {
if
(
!
config
||
!
config
.
configurations
)
{
return
undefined
;
}
return
config
.
configurations
.
find
(
config
=>
config
&&
config
.
name
===
name
);
const
configuration
=
config
.
configurations
.
find
(
config
=>
config
&&
config
.
name
===
name
);
if
(
configuration
)
{
if
(
this
instanceof
UserLaunch
)
{
configuration
.
__configurationTarget
=
ConfigurationTarget
.
USER
;
}
else
if
(
this
instanceof
WorkspaceLaunch
)
{
configuration
.
__configurationTarget
=
ConfigurationTarget
.
WORKSPACE
;
}
else
{
configuration
.
__configurationTarget
=
ConfigurationTarget
.
WORKSPACE_FOLDER
;
}
}
return
configuration
;
}
async
getInitialConfigurationContent
(
folderUri
?:
uri
,
type
?:
string
,
token
?:
CancellationToken
):
Promise
<
string
>
{
...
...
src/vs/workbench/contrib/debug/common/debug.ts
浏览文件 @
e0a433b8
...
...
@@ -21,7 +21,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
TaskIdentifier
}
from
'
vs/workbench/contrib/tasks/common/tasks
'
;
import
{
TelemetryService
}
from
'
vs/platform/telemetry/common/telemetryService
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IConfigurationService
,
ConfigurationTarget
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
DebugConfigurationProviderTriggerKind
}
from
'
vs/workbench/api/common/extHostTypes
'
;
import
{
DebugCompoundRoot
}
from
'
vs/workbench/contrib/debug/common/debugCompoundRoot
'
;
...
...
@@ -538,6 +538,7 @@ export interface IConfig extends IEnvConfig {
linux
?:
IEnvConfig
;
// internals
__configurationTarget
?:
ConfigurationTarget
;
__sessionId
?:
string
;
__restart
?:
any
;
__autoAttach
?:
boolean
;
...
...
src/vs/workbench/contrib/debug/common/debugger.ts
浏览文件 @
e0a433b8
...
...
@@ -108,7 +108,7 @@ export class Debugger implements IDebugger {
substituteVariables
(
folder
:
IWorkspaceFolder
|
undefined
,
config
:
IConfig
):
Promise
<
IConfig
>
{
return
this
.
configurationManager
.
substituteVariables
(
this
.
type
,
folder
,
config
).
then
(
config
=>
{
return
this
.
configurationResolverService
.
resolveWithInteractionReplace
(
folder
,
config
,
'
launch
'
,
this
.
variables
);
return
this
.
configurationResolverService
.
resolveWithInteractionReplace
(
folder
,
config
,
'
launch
'
,
this
.
variables
,
config
.
__configurationTarget
);
});
}
...
...
src/vs/workbench/services/configurationResolver/browser/configurationResolverService.ts
浏览文件 @
e0a433b8
...
...
@@ -10,7 +10,7 @@ import { Schemas } from 'vs/base/common/network';
import
{
SideBySideEditor
,
EditorResourceAccessor
}
from
'
vs/workbench/common/editor
'
;
import
{
IStringDictionary
,
forEach
,
fromMap
}
from
'
vs/base/common/collections
'
;
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
import
{
IConfigurationService
,
ConfigurationTarget
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IConfigurationService
,
IConfigurationOverrides
,
ConfigurationTarget
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
IWorkspaceFolder
,
IWorkspaceContextService
,
WorkbenchState
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
...
...
@@ -146,8 +146,9 @@ export abstract class BaseConfigurationResolverService extends AbstractVariableR
// get all "inputs"
let
inputs
:
ConfiguredInput
[]
=
[];
if
(
folder
&&
this
.
workspaceContextService
.
getWorkbenchState
()
!==
WorkbenchState
.
EMPTY
&&
section
)
{
let
result
=
this
.
configurationService
.
inspect
(
section
,
{
resource
:
folder
.
uri
});
if
(
this
.
workspaceContextService
.
getWorkbenchState
()
!==
WorkbenchState
.
EMPTY
&&
section
)
{
const
overrides
:
IConfigurationOverrides
=
folder
?
{
resource
:
folder
.
uri
}
:
{};
let
result
=
this
.
configurationService
.
inspect
(
section
,
overrides
);
if
(
result
&&
(
result
.
userValue
||
result
.
workspaceValue
||
result
.
workspaceFolderValue
))
{
switch
(
target
)
{
case
ConfigurationTarget
.
USER
:
inputs
=
(
<
any
>
result
.
userValue
)?.
inputs
;
break
;
...
...
@@ -155,7 +156,7 @@ export abstract class BaseConfigurationResolverService extends AbstractVariableR
default
:
inputs
=
(
<
any
>
result
.
workspaceFolderValue
)?.
inputs
;
}
}
else
{
const
valueResult
=
this
.
configurationService
.
getValue
<
any
>
(
section
,
{
resource
:
folder
.
uri
}
);
const
valueResult
=
this
.
configurationService
.
getValue
<
any
>
(
section
,
overrides
);
if
(
valueResult
)
{
inputs
=
valueResult
.
inputs
;
}
...
...
src/vs/workbench/services/configurationResolver/test/electron-browser/configurationResolverService.test.ts
浏览文件 @
e0a433b8
...
...
@@ -448,6 +448,7 @@ suite('Configuration Resolver Service', () => {
assert
.
equal
(
1
,
mockCommandService
.
callCount
);
});
});
test
(
'
a single prompt input variable
'
,
()
=>
{
const
configuration
=
{
...
...
@@ -475,6 +476,7 @@ suite('Configuration Resolver Service', () => {
assert
.
equal
(
0
,
mockCommandService
.
callCount
);
});
});
test
(
'
a single pick input variable
'
,
()
=>
{
const
configuration
=
{
...
...
@@ -502,6 +504,7 @@ suite('Configuration Resolver Service', () => {
assert
.
equal
(
0
,
mockCommandService
.
callCount
);
});
});
test
(
'
a single command input variable
'
,
()
=>
{
const
configuration
=
{
...
...
@@ -529,6 +532,7 @@ suite('Configuration Resolver Service', () => {
assert
.
equal
(
1
,
mockCommandService
.
callCount
);
});
});
test
(
'
several input variables and command
'
,
()
=>
{
const
configuration
=
{
...
...
@@ -558,6 +562,35 @@ suite('Configuration Resolver Service', () => {
assert
.
equal
(
2
,
mockCommandService
.
callCount
);
});
});
test
(
'
input variable with undefined workspace folder
'
,
()
=>
{
const
configuration
=
{
'
name
'
:
'
Attach to Process
'
,
'
type
'
:
'
node
'
,
'
request
'
:
'
attach
'
,
'
processId
'
:
'
${input:input1}
'
,
'
port
'
:
5858
,
'
sourceMaps
'
:
false
,
'
outDir
'
:
null
};
return
configurationResolverService
!
.
resolveWithInteractionReplace
(
undefined
,
configuration
,
'
tasks
'
).
then
(
result
=>
{
assert
.
deepEqual
(
result
,
{
'
name
'
:
'
Attach to Process
'
,
'
type
'
:
'
node
'
,
'
request
'
:
'
attach
'
,
'
processId
'
:
'
resolvedEnterinput1
'
,
'
port
'
:
5858
,
'
sourceMaps
'
:
false
,
'
outDir
'
:
null
});
assert
.
equal
(
0
,
mockCommandService
.
callCount
);
});
});
test
(
'
contributed variable
'
,
()
=>
{
const
buildTask
=
'
npm: compile
'
;
const
variable
=
'
defaultBuildTask
'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录