Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
b33b05ec
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,发现更多精彩内容 >>
未验证
提交
b33b05ec
编写于
4月 23, 2020
作者:
E
Edgar Cumbreras
提交者:
GitHub
4月 23, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Feat: #94285 Options on saving before running tasks (#94466)
fixes #94285 Co-authored-by:
N
Alex Ross
<
alros@microsoft.com
>
上级
ab42ffc4
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
62 addition
and
6 deletion
+62
-6
src/vs/platform/notification/common/notification.ts
src/vs/platform/notification/common/notification.ts
+4
-2
src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts
...vs/workbench/contrib/tasks/browser/abstractTaskService.ts
+43
-3
src/vs/workbench/contrib/tasks/browser/task.contribution.ts
src/vs/workbench/contrib/tasks/browser/task.contribution.ts
+15
-1
未找到文件。
src/vs/platform/notification/common/notification.ts
浏览文件 @
b33b05ec
...
...
@@ -320,8 +320,10 @@ export interface INotificationService {
* Shows a prompt in the notification area with the provided choices. The prompt
* is non-modal. If you want to show a modal dialog instead, use `IDialogService`.
*
* @param onCancel will be called if the user closed the notification without picking
* any of the provided choices.
* @param severity the severity of the notification. Either `Info`, `Warning` or `Error`.
* @param message the message to show as status.
* @param choices options to be choosen from.
* @param options provides some optional configuration options.
*
* @returns a handle on the notification to e.g. hide it or update message, buttons, etc.
*/
...
...
src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts
浏览文件 @
b33b05ec
...
...
@@ -1402,12 +1402,52 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
}
private
executeTask
(
task
:
Task
,
resolver
:
ITaskResolver
):
Promise
<
ITaskSummary
>
{
enum
SaveBeforeRunConfigOptions
{
Always
=
'
always
'
,
Never
=
'
never
'
,
Prompt
=
'
prompt
'
}
const
saveBeforeRunTaskConfig
:
SaveBeforeRunConfigOptions
=
this
.
configurationService
.
getValue
(
'
task.saveBeforeRun
'
);
const
execTask
=
async
(
task
:
Task
,
resolver
:
ITaskResolver
):
Promise
<
ITaskSummary
>
=>
{
return
ProblemMatcherRegistry
.
onReady
().
then
(()
=>
{
return
this
.
editorService
.
saveAll
().
then
(()
=>
{
// make sure all dirty editors are saved
let
executeResult
=
this
.
getTaskSystem
().
run
(
task
,
resolver
);
return
this
.
handleExecuteResult
(
executeResult
);
});
};
const
saveAllEditorsAndExecTask
=
async
(
task
:
Task
,
resolver
:
ITaskResolver
):
Promise
<
ITaskSummary
>
=>
{
return
this
.
editorService
.
saveAll
().
then
(()
=>
{
return
execTask
(
task
,
resolver
);
});
};
const
promptAsk
=
async
(
task
:
Task
,
resolver
:
ITaskResolver
):
Promise
<
ITaskSummary
>
=>
{
const
dialogOptions
=
await
this
.
dialogService
.
show
(
Severity
.
Info
,
nls
.
localize
(
'
TaskSystem.saveBeforeRun.prompt.title
'
,
'
Save all editors?
'
),
[
nls
.
localize
(
'
saveBeforeRun.save
'
,
'
Save
'
),
nls
.
localize
(
'
saveBeforeRun.dontSave
'
,
'
Don
\'
t save
'
)],
{
detail
:
nls
.
localize
(
'
detail
'
,
"
Do you want to save all editors before running the task?
"
),
cancelId
:
1
}
);
if
(
dialogOptions
.
choice
===
0
)
{
return
saveAllEditorsAndExecTask
(
task
,
resolver
);
}
else
{
return
execTask
(
task
,
resolver
);
}
};
if
(
saveBeforeRunTaskConfig
===
SaveBeforeRunConfigOptions
.
Never
)
{
return
execTask
(
task
,
resolver
);
}
else
if
(
saveBeforeRunTaskConfig
===
SaveBeforeRunConfigOptions
.
Prompt
)
{
return
promptAsk
(
task
,
resolver
);
}
else
{
return
saveAllEditorsAndExecTask
(
task
,
resolver
);
}
}
private
async
handleExecuteResult
(
executeResult
:
ITaskExecuteResult
):
Promise
<
ITaskSummary
>
{
...
...
src/vs/workbench/contrib/tasks/browser/task.contribution.ts
浏览文件 @
b33b05ec
...
...
@@ -376,6 +376,20 @@ configurationRegistry.registerConfiguration({
type
:
'
boolean
'
,
description
:
nls
.
localize
(
'
task.quickOpen.skip
'
,
"
Controls whether the task quick pick is skipped when there is only one task to pick from.
"
),
default
:
false
}
},
'
task.saveBeforeRun
'
:
{
markdownDescription
:
nls
.
localize
(
'
task.saveBeforeRun
'
,
'
Configures whether all editor will be saved before running a task.
'
),
type
:
'
string
'
,
enum
:
[
'
always
'
,
'
never
'
,
'
prompt
'
],
enumDescriptions
:
[
nls
.
localize
(
'
task.saveBeforeRun.always
'
,
'
Always saves all editors before running.
'
),
nls
.
localize
(
'
task.saveBeforeRun.never
'
,
'
Never saves editors before running.
'
),
nls
.
localize
(
'
task.SaveBeforeRun.prompt
'
,
'
Prompts whether to save editors before running.
'
),
],
default
:
'
always
'
,
},
}
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录