Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
f30de2dc
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,发现更多精彩内容 >>
提交
f30de2dc
编写于
9月 21, 2017
作者:
D
Dirk Baeumer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixes #34732: Tasks - Multiroot folder - no all detected tasks presented in quick pick
上级
42549722
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
71 addition
and
31 deletion
+71
-31
src/vs/workbench/parts/tasks/browser/quickOpen.ts
src/vs/workbench/parts/tasks/browser/quickOpen.ts
+8
-2
src/vs/workbench/parts/tasks/common/tasks.ts
src/vs/workbench/parts/tasks/common/tasks.ts
+43
-18
src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts
...rkbench/parts/tasks/electron-browser/task.contribution.ts
+19
-10
src/vs/workbench/parts/tasks/test/electron-browser/configuration.test.ts
...h/parts/tasks/test/electron-browser/configuration.test.ts
+1
-1
未找到文件。
src/vs/workbench/parts/tasks/browser/quickOpen.ts
浏览文件 @
f30de2dc
...
...
@@ -98,7 +98,12 @@ export abstract class QuickOpenHandler extends Quickopen.QuickOpenHandler {
let
configured
:
CustomTask
[]
=
[];
let
detected
:
ContributedTask
[]
=
[];
let
taskMap
:
IStringDictionary
<
CustomTask
|
ContributedTask
>
=
Object
.
create
(
null
);
tasks
.
forEach
(
task
=>
taskMap
[
Task
.
getKey
(
task
)]
=
task
);
tasks
.
forEach
(
task
=>
{
let
key
=
Task
.
getRecentlyUsedKey
(
task
);
if
(
key
)
{
taskMap
[
key
]
=
task
;
}
});
recentlyUsedTasks
.
keys
().
forEach
(
key
=>
{
let
task
=
taskMap
[
key
];
if
(
task
)
{
...
...
@@ -106,7 +111,8 @@ export abstract class QuickOpenHandler extends Quickopen.QuickOpenHandler {
}
});
for
(
let
task
of
tasks
)
{
if
(
!
recentlyUsedTasks
.
has
(
Task
.
getKey
(
task
)))
{
let
key
=
Task
.
getRecentlyUsedKey
(
task
);
if
(
!
key
||
!
recentlyUsedTasks
.
has
(
key
))
{
if
(
CustomTask
.
is
(
task
))
{
configured
.
push
(
task
);
}
else
{
...
...
src/vs/workbench/parts/tasks/common/tasks.ts
浏览文件 @
f30de2dc
...
...
@@ -227,7 +227,7 @@ export enum TaskScope {
export
namespace
TaskSourceKind
{
export
const
Workspace
:
'
workspace
'
=
'
workspace
'
;
export
const
Extension
:
'
extension
'
=
'
extension
'
;
export
const
Composite
:
'
composite
'
=
'
composite
'
;
export
const
InMemory
:
'
inMemory
'
=
'
inMemory
'
;
}
export
interface
TaskSourceConfigElement
{
...
...
@@ -256,12 +256,12 @@ export interface ExtensionTaskSourceTransfer {
__workspaceFolder
:
URI
;
}
export
interface
Composite
TaskSource
{
readonly
kind
:
'
composite
'
;
export
interface
InMemory
TaskSource
{
readonly
kind
:
'
inMemory
'
;
readonly
label
:
string
;
}
export
type
TaskSource
=
WorkspaceTaskSource
|
ExtensionTaskSource
|
Composite
TaskSource
;
export
type
TaskSource
=
WorkspaceTaskSource
|
ExtensionTaskSource
|
InMemory
TaskSource
;
export
interface
TaskIdentifier
{
_key
:
string
;
...
...
@@ -403,33 +403,58 @@ export namespace ContributedTask {
}
}
export
interface
Composite
Task
extends
CommonTask
,
ConfigurationProperties
{
export
interface
InMemory
Task
extends
CommonTask
,
ConfigurationProperties
{
/**
* Indicated the source of the task (e.g tasks.json or extension)
*/
_source
:
Composite
TaskSource
;
_source
:
InMemory
TaskSource
;
type
:
'
composite
'
;
type
:
'
inMemory
'
;
identifier
:
string
;
}
export
namespace
Composite
Task
{
export
function
is
(
value
:
any
):
value
is
Composite
Task
{
let
candidate
=
value
as
Composite
Task
;
return
candidate
&&
candidate
.
_source
&&
candidate
.
_source
.
kind
===
TaskSourceKind
.
Composite
;
export
namespace
InMemory
Task
{
export
function
is
(
value
:
any
):
value
is
InMemory
Task
{
let
candidate
=
value
as
InMemory
Task
;
return
candidate
&&
candidate
.
_source
&&
candidate
.
_source
.
kind
===
TaskSourceKind
.
InMemory
;
}
}
export
type
Task
=
CustomTask
|
ContributedTask
|
Composite
Task
;
export
type
Task
=
CustomTask
|
ContributedTask
|
InMemory
Task
;
export
namespace
Task
{
export
function
getKey
(
task
:
Task
):
string
{
if
(
CustomTask
.
is
(
task
)
||
CompositeTask
.
is
(
task
))
{
return
task
.
identifier
;
}
else
{
return
task
.
defines
.
_key
;
export
function
getRecentlyUsedKey
(
task
:
Task
):
string
|
undefined
{
interface
CustomKey
{
type
:
string
;
folder
:
string
;
id
:
string
;
}
interface
ContributedKey
{
type
:
string
;
scope
:
number
;
folder
?:
string
;
id
:
string
;
}
if
(
InMemoryTask
.
is
(
task
))
{
return
undefined
;
}
if
(
CustomTask
.
is
(
task
))
{
let
workspaceFolder
=
task
.
_source
.
config
.
workspaceFolder
;
if
(
!
workspaceFolder
)
{
return
undefined
;
}
let
key
:
CustomKey
=
{
type
:
'
custom
'
,
folder
:
workspaceFolder
.
uri
.
toString
(),
id
:
task
.
identifier
};
return
JSON
.
stringify
(
key
);
}
if
(
ContributedTask
.
is
(
task
))
{
let
key
:
ContributedKey
=
{
type
:
'
contributed
'
,
scope
:
task
.
_source
.
scope
,
id
:
task
.
defines
.
_key
};
if
(
task
.
_source
.
scope
===
TaskScope
.
Folder
&&
task
.
_source
.
workspaceFolder
)
{
key
.
folder
=
task
.
_source
.
workspaceFolder
.
uri
.
toString
();
}
return
JSON
.
stringify
(
key
);
}
return
undefined
;
}
export
function
getWorkspaceFolder
(
task
:
Task
):
IWorkspaceFolder
|
undefined
{
...
...
@@ -455,7 +480,7 @@ export namespace Task {
}
else
{
return
'
workspace
'
;
}
}
else
if
(
Composite
Task
.
is
(
task
))
{
}
else
if
(
InMemory
Task
.
is
(
task
))
{
return
'
composite
'
;
}
else
{
return
'
unknown
'
;
...
...
src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts
浏览文件 @
f30de2dc
...
...
@@ -73,7 +73,7 @@ import { Scope, IActionBarRegistry, Extensions as ActionBarExtensions } from 'vs
import
{
ITerminalService
}
from
'
vs/workbench/parts/terminal/common/terminal
'
;
import
{
ITaskSystem
,
ITaskResolver
,
ITaskSummary
,
ITaskExecuteResult
,
TaskExecuteKind
,
TaskError
,
TaskErrors
,
TaskSystemEvents
,
TaskTerminateResponse
}
from
'
vs/workbench/parts/tasks/common/taskSystem
'
;
import
{
Task
,
CustomTask
,
ConfiguringTask
,
ContributedTask
,
Composite
Task
,
TaskSet
,
TaskGroup
,
ExecutionEngine
,
JsonSchemaVersion
,
TaskSourceKind
,
TaskIdentifier
,
TaskSorter
}
from
'
vs/workbench/parts/tasks/common/tasks
'
;
import
{
Task
,
CustomTask
,
ConfiguringTask
,
ContributedTask
,
InMemory
Task
,
TaskSet
,
TaskGroup
,
ExecutionEngine
,
JsonSchemaVersion
,
TaskSourceKind
,
TaskIdentifier
,
TaskSorter
}
from
'
vs/workbench/parts/tasks/common/tasks
'
;
import
{
ITaskService
,
TaskServiceEvents
,
ITaskProvider
,
TaskEvent
,
RunOptions
,
CustomizationProperties
}
from
'
vs/workbench/parts/tasks/common/taskService
'
;
import
{
templates
as
taskTemplates
}
from
'
vs/workbench/parts/tasks/common/taskTemplates
'
;
...
...
@@ -849,7 +849,7 @@ class TaskService extends EventEmitter implements ITaskService {
throw
new
TaskError
(
Severity
.
Info
,
nls
.
localize
(
'
TaskServer.noTask
'
,
'
Requested task {0} to execute not found.
'
,
task
.
name
),
TaskErrors
.
TaskNotFound
);
}
else
{
let
resolver
=
this
.
createResolver
(
grouped
);
if
(
options
&&
options
.
attachProblemMatcher
&&
this
.
shouldAttachProblemMatcher
(
task
)
&&
!
Composite
Task
.
is
(
task
))
{
if
(
options
&&
options
.
attachProblemMatcher
&&
this
.
shouldAttachProblemMatcher
(
task
)
&&
!
InMemory
Task
.
is
(
task
))
{
return
this
.
attachProblemMatcher
(
task
).
then
((
toExecute
)
=>
{
if
(
toExecute
)
{
return
this
.
executeTask
(
toExecute
,
resolver
);
...
...
@@ -1164,11 +1164,11 @@ class TaskService extends EventEmitter implements ITaskService {
return
{
task
:
extensionTasks
[
0
],
resolver
};
}
else
{
let
id
:
string
=
UUID
.
generateUuid
();
let
task
:
Composite
Task
=
{
let
task
:
InMemory
Task
=
{
_id
:
id
,
_source
:
{
kind
:
TaskSourceKind
.
Composite
,
label
:
'
composite
'
},
_source
:
{
kind
:
TaskSourceKind
.
InMemory
,
label
:
'
inMemory
'
},
_label
:
id
,
type
:
'
composite
'
,
type
:
'
inMemory
'
,
name
:
id
,
identifier
:
id
,
dependsOn
:
extensionTasks
.
map
((
task
)
=>
{
return
{
workspaceFolder
:
Task
.
getWorkspaceFolder
(
task
),
task
:
task
.
_id
};
})
...
...
@@ -1213,7 +1213,10 @@ class TaskService extends EventEmitter implements ITaskService {
return
ProblemMatcherRegistry
.
onReady
().
then
(()
=>
{
return
this
.
textFileService
.
saveAll
().
then
((
value
)
=>
{
// make sure all dirty files are saved
let
executeResult
=
this
.
getTaskSystem
().
run
(
task
,
resolver
);
this
.
getRecentlyUsedTasks
().
set
(
Task
.
getKey
(
task
),
Task
.
getKey
(
task
),
Touch
.
First
);
let
key
=
Task
.
getRecentlyUsedKey
(
task
);
if
(
key
)
{
this
.
getRecentlyUsedTasks
().
set
(
key
,
key
,
Touch
.
First
);
}
if
(
executeResult
.
kind
===
TaskExecuteKind
.
Active
)
{
let
active
=
executeResult
.
active
;
if
(
active
.
same
)
{
...
...
@@ -1809,7 +1812,12 @@ class TaskService extends EventEmitter implements ITaskService {
let
configured
:
Task
[]
=
[];
let
detected
:
Task
[]
=
[];
let
taskMap
:
IStringDictionary
<
Task
>
=
Object
.
create
(
null
);
tasks
.
forEach
(
task
=>
taskMap
[
Task
.
getKey
(
task
)]
=
task
);
tasks
.
forEach
(
task
=>
{
let
key
=
Task
.
getRecentlyUsedKey
(
task
);
if
(
key
)
{
taskMap
[
key
]
=
task
;
}
});
recentlyUsedTasks
.
keys
().
forEach
(
key
=>
{
let
task
=
taskMap
[
key
];
if
(
task
)
{
...
...
@@ -1817,7 +1825,8 @@ class TaskService extends EventEmitter implements ITaskService {
}
});
for
(
let
task
of
tasks
)
{
if
(
!
recentlyUsedTasks
.
has
(
Task
.
getKey
(
task
)))
{
let
key
=
Task
.
getRecentlyUsedKey
(
task
);
if
(
!
key
||
!
recentlyUsedTasks
.
has
(
key
))
{
if
(
task
.
_source
.
kind
===
TaskSourceKind
.
Workspace
)
{
configured
.
push
(
task
);
}
else
{
...
...
@@ -2216,7 +2225,7 @@ class TaskService extends EventEmitter implements ITaskService {
if
(
task
===
defaultTask
&&
CustomTask
.
is
(
task
))
{
this
.
openConfig
(
task
);
}
if
(
!
Composite
Task
.
is
(
task
))
{
if
(
!
InMemory
Task
.
is
(
task
))
{
this
.
customize
(
task
,
{
group
:
{
kind
:
'
build
'
,
isDefault
:
true
}
},
true
);
}
});
...
...
@@ -2250,7 +2259,7 @@ class TaskService extends EventEmitter implements ITaskService {
if
(
!
task
)
{
return
;
}
if
(
!
Composite
Task
.
is
(
task
))
{
if
(
!
InMemory
Task
.
is
(
task
))
{
this
.
customize
(
task
,
{
group
:
{
kind
:
'
test
'
,
isDefault
:
true
}
},
true
);
}
});
...
...
src/vs/workbench/parts/tasks/test/electron-browser/configuration.test.ts
浏览文件 @
f30de2dc
...
...
@@ -458,7 +458,7 @@ function assertConfiguration(result: ParseResult, expected: Tasks.Task[]): void
function
assertTask
(
actual
:
Tasks
.
Task
,
expected
:
Tasks
.
Task
)
{
assert
.
ok
(
actual
.
_id
);
assert
.
strictEqual
(
actual
.
name
,
expected
.
name
,
'
name
'
);
if
(
!
Tasks
.
CompositeTask
.
is
(
actual
)
&&
!
Tasks
.
Composite
Task
.
is
(
expected
))
{
if
(
!
Tasks
.
InMemoryTask
.
is
(
actual
)
&&
!
Tasks
.
InMemory
Task
.
is
(
expected
))
{
assertCommandConfiguration
(
actual
.
command
,
expected
.
command
);
}
assert
.
strictEqual
(
actual
.
isBackground
,
expected
.
isBackground
,
'
isBackground
'
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录