Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
cacac16d
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
未验证
提交
cacac16d
编写于
12月 07, 2018
作者:
K
Kai Maetzel
提交者:
GitHub
12月 07, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow users to enable/disable automatic tasks (#64615)
add allow/disallow tasks
上级
5e3a8ca9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
46 addition
and
3 deletion
+46
-3
src/vs/workbench/parts/tasks/electron-browser/runAutomaticTasks.ts
...rkbench/parts/tasks/electron-browser/runAutomaticTasks.ts
+38
-1
src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts
...rkbench/parts/tasks/electron-browser/task.contribution.ts
+8
-2
未找到文件。
src/vs/workbench/parts/tasks/electron-browser/runAutomaticTasks.ts
浏览文件 @
cacac16d
...
...
@@ -11,6 +11,7 @@ import { forEach } from 'vs/base/common/collections';
import
{
RunOnOptions
,
Task
,
TaskRunSource
}
from
'
vs/workbench/parts/tasks/common/tasks
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
INotificationService
,
Severity
}
from
'
vs/platform/notification/common/notification
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
const
ARE_AUTOMATIC_TASKS_ALLOWED_IN_WORKSPACE
=
'
tasks.run.allowAutomatic
'
;
...
...
@@ -121,4 +122,40 @@ export class RunAutomaticTasks extends Disposable implements IWorkbenchContribut
});
}
}
\ No newline at end of file
}
export
class
AllowAutomaticTaskRunning
extends
Action
{
public
static
readonly
ID
=
'
workbench.action.tasks.allowAutomaticRunning
'
;
public
static
readonly
LABEL
=
nls
.
localize
(
'
workbench.action.tasks.allowAutomaticRunning
'
,
"
Allow Automatic Tasks in Folder
"
);
constructor
(
id
:
string
,
label
:
string
,
@
IStorageService
private
storageService
:
IStorageService
)
{
super
(
id
,
label
);
}
public
run
(
event
?:
any
):
Promise
<
any
>
{
this
.
storageService
.
store
(
ARE_AUTOMATIC_TASKS_ALLOWED_IN_WORKSPACE
,
true
,
StorageScope
.
WORKSPACE
);
return
Promise
.
resolve
(
void
0
);
}
}
export
class
DisallowAutomaticTaskRunning
extends
Action
{
public
static
readonly
ID
=
'
workbench.action.tasks.disallowAutomaticRunning
'
;
public
static
readonly
LABEL
=
nls
.
localize
(
'
workbench.action.tasks.disallowAutomaticRunning
'
,
"
Disallow Automatic Tasks in Folder
"
);
constructor
(
id
:
string
,
label
:
string
,
@
IStorageService
private
storageService
:
IStorageService
)
{
super
(
id
,
label
);
}
public
run
(
event
?:
any
):
Promise
<
any
>
{
this
.
storageService
.
store
(
ARE_AUTOMATIC_TASKS_ALLOWED_IN_WORKSPACE
,
false
,
StorageScope
.
WORKSPACE
);
return
Promise
.
resolve
(
void
0
);
}
}
src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts
浏览文件 @
cacac16d
...
...
@@ -30,7 +30,7 @@ import { OcticonLabel } from 'vs/base/browser/ui/octiconLabel/octiconLabel';
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
ILifecycleService
,
LifecyclePhase
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
MenuRegistry
,
MenuId
}
from
'
vs/platform/actions/common/actions
'
;
import
{
MenuRegistry
,
MenuId
,
SyncActionDescriptor
}
from
'
vs/platform/actions/common/actions
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
IMarkerService
,
MarkerStatistics
}
from
'
vs/platform/markers/common/markers
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
...
...
@@ -94,13 +94,19 @@ import { IQuickInputService, IQuickPickItem, QuickPickInput } from 'vs/platform/
import
{
TaskDefinitionRegistry
}
from
'
vs/workbench/parts/tasks/common/taskDefinitionRegistry
'
;
import
{
IContextKey
,
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
Extensions
as
WorkbenchExtensions
,
IWorkbenchContributionsRegistry
}
from
'
vs/workbench/common/contributions
'
;
import
{
RunAutomaticTasks
}
from
'
vs/workbench/parts/tasks/electron-browser/runAutomaticTasks
'
;
import
{
IWorkbenchActionRegistry
,
Extensions
as
ActionExtensions
}
from
'
vs/workbench/common/actions
'
;
import
{
RunAutomaticTasks
,
AllowAutomaticTaskRunning
,
DisallowAutomaticTaskRunning
}
from
'
vs/workbench/parts/tasks/electron-browser/runAutomaticTasks
'
;
let
tasksCategory
=
nls
.
localize
(
'
tasksCategory
'
,
"
Tasks
"
);
const
workbenchRegistry
=
Registry
.
as
<
IWorkbenchContributionsRegistry
>
(
WorkbenchExtensions
.
Workbench
);
workbenchRegistry
.
registerWorkbenchContribution
(
RunAutomaticTasks
,
LifecyclePhase
.
Eventually
);
const
actionRegistry
=
Registry
.
as
<
IWorkbenchActionRegistry
>
(
ActionExtensions
.
WorkbenchActions
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
AllowAutomaticTaskRunning
,
AllowAutomaticTaskRunning
.
ID
,
AllowAutomaticTaskRunning
.
LABEL
),
'
Tasks: Allow Automatic Tasks in Folder
'
,
tasksCategory
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
DisallowAutomaticTaskRunning
,
DisallowAutomaticTaskRunning
.
ID
,
DisallowAutomaticTaskRunning
.
LABEL
),
'
Tasks: Disallow Automatic Tasks in Folder
'
,
tasksCategory
);
namespace
ConfigureTaskAction
{
export
const
ID
=
'
workbench.action.tasks.configureTaskRunner
'
;
export
const
TEXT
=
nls
.
localize
(
'
ConfigureTaskRunnerAction.label
'
,
"
Configure Task
"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录