Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
d57b8538
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,发现更多精彩内容 >>
未验证
提交
d57b8538
编写于
12月 03, 2019
作者:
J
Johannes Rieken
提交者:
GitHub
12月 03, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #85830 from microsoft/joh/finalWill
Finalize onWill|DidCreate|Rename|DeleteFile apis
上级
56c6acd2
14a778c7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
236 addition
and
247 deletion
+236
-247
src/vs/vscode.d.ts
src/vs/vscode.d.ts
+236
-0
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+0
-241
src/vs/workbench/api/common/extHost.api.impl.ts
src/vs/workbench/api/common/extHost.api.impl.ts
+0
-6
未找到文件。
src/vs/vscode.d.ts
浏览文件 @
d57b8538
...
...
@@ -8084,6 +8084,172 @@ declare module 'vscode' {
waitUntil
(
thenable
:
Thenable
<
any
>
):
void
;
}
/**
* An event that is fired when files are going to be created.
*
* To make modifications to the workspace before the files are created,
* call the [`waitUntil](#FileWillCreateEvent.waitUntil)-function with a
* thenable that resolves to a [workspace edit](#WorkspaceEdit).
*/
export
interface
FileWillCreateEvent
{
/**
* The files that are going to be created.
*/
readonly
files
:
ReadonlyArray
<
Uri
>
;
/**
* Allows to pause the event and to apply a [workspace edit](#WorkspaceEdit).
*
* *Note:* This function can only be called during event dispatch and not
* in an asynchronous manner:
*
* ```ts
* workspace.onWillCreateFiles(event => {
* // async, will *throw* an error
* setTimeout(() => event.waitUntil(promise));
*
* // sync, OK
* event.waitUntil(promise);
* })
* ```
*
* @param thenable A thenable that delays saving.
*/
waitUntil
(
thenable
:
Thenable
<
WorkspaceEdit
>
):
void
;
/**
* Allows to pause the event until the provided thenable resolves.
*
* *Note:* This function can only be called during event dispatch.
*
* @param thenable A thenable that delays saving.
*/
waitUntil
(
thenable
:
Thenable
<
any
>
):
void
;
}
/**
* An event that is fired after files are created.
*/
export
interface
FileCreateEvent
{
/**
* The files that got created.
*/
readonly
files
:
ReadonlyArray
<
Uri
>
;
}
/**
* An event that is fired when files are going to be deleted.
*
* To make modifications to the workspace before the files are deleted,
* call the [`waitUntil](#FileWillCreateEvent.waitUntil)-function with a
* thenable that resolves to a [workspace edit](#WorkspaceEdit).
*/
export
interface
FileWillDeleteEvent
{
/**
* The files that are going to be deleted.
*/
readonly
files
:
ReadonlyArray
<
Uri
>
;
/**
* Allows to pause the event and to apply a [workspace edit](#WorkspaceEdit).
*
* *Note:* This function can only be called during event dispatch and not
* in an asynchronous manner:
*
* ```ts
* workspace.onWillCreateFiles(event => {
* // async, will *throw* an error
* setTimeout(() => event.waitUntil(promise));
*
* // sync, OK
* event.waitUntil(promise);
* })
* ```
*
* @param thenable A thenable that delays saving.
*/
waitUntil
(
thenable
:
Thenable
<
WorkspaceEdit
>
):
void
;
/**
* Allows to pause the event until the provided thenable resolves.
*
* *Note:* This function can only be called during event dispatch.
*
* @param thenable A thenable that delays saving.
*/
waitUntil
(
thenable
:
Thenable
<
any
>
):
void
;
}
/**
* An event that is fired after files are deleted.
*/
export
interface
FileDeleteEvent
{
/**
* The files that got deleted.
*/
readonly
files
:
ReadonlyArray
<
Uri
>
;
}
/**
* An event that is fired when files are going to be renamed.
*
* To make modifications to the workspace before the files are renamed,
* call the [`waitUntil](#FileWillCreateEvent.waitUntil)-function with a
* thenable that resolves to a [workspace edit](#WorkspaceEdit).
*/
export
interface
FileWillRenameEvent
{
/**
* The files that are going to be renamed.
*/
readonly
files
:
ReadonlyArray
<
{
oldUri
:
Uri
,
newUri
:
Uri
}
>
;
/**
* Allows to pause the event and to apply a [workspace edit](#WorkspaceEdit).
*
* *Note:* This function can only be called during event dispatch and not
* in an asynchronous manner:
*
* ```ts
* workspace.onWillCreateFiles(event => {
* // async, will *throw* an error
* setTimeout(() => event.waitUntil(promise));
*
* // sync, OK
* event.waitUntil(promise);
* })
* ```
*
* @param thenable A thenable that delays saving.
*/
waitUntil
(
thenable
:
Thenable
<
WorkspaceEdit
>
):
void
;
/**
* Allows to pause the event until the provided thenable resolves.
*
* *Note:* This function can only be called during event dispatch.
*
* @param thenable A thenable that delays saving.
*/
waitUntil
(
thenable
:
Thenable
<
any
>
):
void
;
}
/**
* An event that is fired after files are renamed.
*/
export
interface
FileRenameEvent
{
/**
* The files that got renamed.
*/
readonly
files
:
ReadonlyArray
<
{
oldUri
:
Uri
,
newUri
:
Uri
}
>
;
}
/**
* An event describing a change to the set of [workspace folders](#workspace.workspaceFolders).
*/
...
...
@@ -8433,6 +8599,76 @@ declare module 'vscode' {
*/
export
const
onDidSaveTextDocument
:
Event
<
TextDocument
>
;
/**
* An event that is emitted when files are being created.
*
* *Note 1:* This event is triggered by user gestures, like creating a file from the
* explorer, or from the [`workspace.applyEdit`](#workspace.applyEdit)-api. This event is *not* fired when
* files change on disk, e.g triggered by another application, or when using the
* [`workspace.fs`](#FileSystem)-api.
*
* *Note 2:* When this event is fired, edits to files thare are being created cannot be applied.
*/
export
const
onWillCreateFiles
:
Event
<
FileWillCreateEvent
>
;
/**
* An event that is emitted when files have been created.
*
* *Note:* This event is triggered by user gestures, like creating a file from the
* explorer, or from the [`workspace.applyEdit`](#workspace.applyEdit)-api, but this event is *not* fired when
* files change on disk, e.g triggered by another application, or when using the
* [`workspace.fs`](#FileSystem)-api.
*/
export
const
onDidCreateFiles
:
Event
<
FileCreateEvent
>
;
/**
* An event that is emitted when files are being deleted.
*
* *Note 1:* This event is triggered by user gestures, like deleting a file from the
* explorer, or from the [`workspace.applyEdit`](#workspace.applyEdit)-api, but this event is *not* fired when
* files change on disk, e.g triggered by another application, or when using the
* [`workspace.fs`](#FileSystem)-api.
*
* *Note 2:* When deleting a folder with children only one event is fired.
*/
export
const
onWillDeleteFiles
:
Event
<
FileWillDeleteEvent
>
;
/**
* An event that is emitted when files have been deleted.
*
* *Note 1:* This event is triggered by user gestures, like deleting a file from the
* explorer, or from the [`workspace.applyEdit`](#workspace.applyEdit)-api, but this event is *not* fired when
* files change on disk, e.g triggered by another application, or when using the
* [`workspace.fs`](#FileSystem)-api.
*
* *Note 2:* When deleting a folder with children only one event is fired.
*/
export
const
onDidDeleteFiles
:
Event
<
FileDeleteEvent
>
;
/**
* An event that is emitted when files are being renamed.
*
* *Note 1:* This event is triggered by user gestures, like renaming a file from the
* explorer, and from the [`workspace.applyEdit`](#workspace.applyEdit)-api, but this event is *not* fired when
* files change on disk, e.g triggered by another application, or when using the
* [`workspace.fs`](#FileSystem)-api.
*
* *Note 2:* When renaming a folder with children only one event is fired.
*/
export
const
onWillRenameFiles
:
Event
<
FileWillRenameEvent
>
;
/**
* An event that is emitted when files have been renamed.
*
* *Note 1:* This event is triggered by user gestures, like renaming a file from the
* explorer, and from the [`workspace.applyEdit`](#workspace.applyEdit)-api, but this event is *not* fired when
* files change on disk, e.g triggered by another application, or when using the
* [`workspace.fs`](#FileSystem)-api.
*
* *Note 2:* When renaming a folder with children only one event is fired.
*/
export
const
onDidRenameFiles
:
Event
<
FileRenameEvent
>
;
/**
* Get a workspace configuration object.
*
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
d57b8538
...
...
@@ -961,247 +961,6 @@ declare module 'vscode' {
//#endregion
//#region mjbvz,joh: https://github.com/Microsoft/vscode/issues/43768
/**
* An event that is fired when files are going to be created.
*
* To make modifications to the workspace before the files are created,
* call the [`waitUntil](#FileWillCreateEvent.waitUntil)-function with a
* thenable that resolves to a [workspace edit](#WorkspaceEdit).
*/
export
interface
FileWillCreateEvent
{
/**
* The files that are going to be created.
*/
readonly
files
:
ReadonlyArray
<
Uri
>
;
/**
* Allows to pause the event and to apply a [workspace edit](#WorkspaceEdit).
*
* *Note:* This function can only be called during event dispatch and not
* in an asynchronous manner:
*
* ```ts
* workspace.onWillCreateFiles(event => {
* // async, will *throw* an error
* setTimeout(() => event.waitUntil(promise));
*
* // sync, OK
* event.waitUntil(promise);
* })
* ```
*
* @param thenable A thenable that delays saving.
*/
waitUntil
(
thenable
:
Thenable
<
WorkspaceEdit
>
):
void
;
/**
* Allows to pause the event until the provided thenable resolves.
*
* *Note:* This function can only be called during event dispatch.
*
* @param thenable A thenable that delays saving.
*/
waitUntil
(
thenable
:
Thenable
<
any
>
):
void
;
}
/**
* An event that is fired after files are created.
*/
export
interface
FileCreateEvent
{
/**
* The files that got created.
*/
readonly
files
:
ReadonlyArray
<
Uri
>
;
}
/**
* An event that is fired when files are going to be deleted.
*
* To make modifications to the workspace before the files are deleted,
* call the [`waitUntil](#FileWillCreateEvent.waitUntil)-function with a
* thenable that resolves to a [workspace edit](#WorkspaceEdit).
*/
export
interface
FileWillDeleteEvent
{
/**
* The files that are going to be deleted.
*/
readonly
files
:
ReadonlyArray
<
Uri
>
;
/**
* Allows to pause the event and to apply a [workspace edit](#WorkspaceEdit).
*
* *Note:* This function can only be called during event dispatch and not
* in an asynchronous manner:
*
* ```ts
* workspace.onWillCreateFiles(event => {
* // async, will *throw* an error
* setTimeout(() => event.waitUntil(promise));
*
* // sync, OK
* event.waitUntil(promise);
* })
* ```
*
* @param thenable A thenable that delays saving.
*/
waitUntil
(
thenable
:
Thenable
<
WorkspaceEdit
>
):
void
;
/**
* Allows to pause the event until the provided thenable resolves.
*
* *Note:* This function can only be called during event dispatch.
*
* @param thenable A thenable that delays saving.
*/
waitUntil
(
thenable
:
Thenable
<
any
>
):
void
;
}
/**
* An event that is fired after files are deleted.
*/
export
interface
FileDeleteEvent
{
/**
* The files that got deleted.
*/
readonly
files
:
ReadonlyArray
<
Uri
>
;
}
/**
* An event that is fired when files are going to be renamed.
*
* To make modifications to the workspace before the files are renamed,
* call the [`waitUntil](#FileWillCreateEvent.waitUntil)-function with a
* thenable that resolves to a [workspace edit](#WorkspaceEdit).
*/
export
interface
FileWillRenameEvent
{
/**
* The files that are going to be renamed.
*/
readonly
files
:
ReadonlyArray
<
{
oldUri
:
Uri
,
newUri
:
Uri
}
>
;
/**
* Allows to pause the event and to apply a [workspace edit](#WorkspaceEdit).
*
* *Note:* This function can only be called during event dispatch and not
* in an asynchronous manner:
*
* ```ts
* workspace.onWillCreateFiles(event => {
* // async, will *throw* an error
* setTimeout(() => event.waitUntil(promise));
*
* // sync, OK
* event.waitUntil(promise);
* })
* ```
*
* @param thenable A thenable that delays saving.
*/
waitUntil
(
thenable
:
Thenable
<
WorkspaceEdit
>
):
void
;
/**
* Allows to pause the event until the provided thenable resolves.
*
* *Note:* This function can only be called during event dispatch.
*
* @param thenable A thenable that delays saving.
*/
waitUntil
(
thenable
:
Thenable
<
any
>
):
void
;
}
/**
* An event that is fired after files are renamed.
*/
export
interface
FileRenameEvent
{
/**
* The files that got renamed.
*/
readonly
files
:
ReadonlyArray
<
{
oldUri
:
Uri
,
newUri
:
Uri
}
>
;
}
export
namespace
workspace
{
/**
* An event that is emitted when files are being created.
*
* *Note 1:* This event is triggered by user gestures, like creating a file from the
* explorer, or from the [`workspace.applyEdit`](#workspace.applyEdit)-api. This event is *not* fired when
* files change on disk, e.g triggered by another application, or when using the
* [`workspace.fs`](#FileSystem)-api.
*
* *Note 2:* When this event is fired, edits to files thare are being created cannot be applied.
*/
export
const
onWillCreateFiles
:
Event
<
FileWillCreateEvent
>
;
/**
* An event that is emitted when files have been created.
*
* *Note:* This event is triggered by user gestures, like creating a file from the
* explorer, or from the [`workspace.applyEdit`](#workspace.applyEdit)-api, but this event is *not* fired when
* files change on disk, e.g triggered by another application, or when using the
* [`workspace.fs`](#FileSystem)-api.
*/
export
const
onDidCreateFiles
:
Event
<
FileCreateEvent
>
;
/**
* An event that is emitted when files are being deleted.
*
* *Note 1:* This event is triggered by user gestures, like deleting a file from the
* explorer, or from the [`workspace.applyEdit`](#workspace.applyEdit)-api, but this event is *not* fired when
* files change on disk, e.g triggered by another application, or when using the
* [`workspace.fs`](#FileSystem)-api.
*
* *Note 2:* When deleting a folder with children only one event is fired.
*/
export
const
onWillDeleteFiles
:
Event
<
FileWillDeleteEvent
>
;
/**
* An event that is emitted when files have been deleted.
*
* *Note 1:* This event is triggered by user gestures, like deleting a file from the
* explorer, or from the [`workspace.applyEdit`](#workspace.applyEdit)-api, but this event is *not* fired when
* files change on disk, e.g triggered by another application, or when using the
* [`workspace.fs`](#FileSystem)-api.
*
* *Note 2:* When deleting a folder with children only one event is fired.
*/
export
const
onDidDeleteFiles
:
Event
<
FileDeleteEvent
>
;
/**
* An event that is emitted when files are being renamed.
*
* *Note 1:* This event is triggered by user gestures, like renaming a file from the
* explorer, and from the [`workspace.applyEdit`](#workspace.applyEdit)-api, but this event is *not* fired when
* files change on disk, e.g triggered by another application, or when using the
* [`workspace.fs`](#FileSystem)-api.
*
* *Note 2:* When renaming a folder with children only one event is fired.
*/
export
const
onWillRenameFiles
:
Event
<
FileWillRenameEvent
>
;
/**
* An event that is emitted when files have been renamed.
*
* *Note 1:* This event is triggered by user gestures, like renaming a file from the
* explorer, and from the [`workspace.applyEdit`](#workspace.applyEdit)-api, but this event is *not* fired when
* files change on disk, e.g triggered by another application, or when using the
* [`workspace.fs`](#FileSystem)-api.
*
* *Note 2:* When renaming a folder with children only one event is fired.
*/
export
const
onDidRenameFiles
:
Event
<
FileRenameEvent
>
;
}
//#endregion
//#region Alex - OnEnter enhancement
export
interface
OnEnterRule
{
/**
...
...
src/vs/workbench/api/common/extHost.api.impl.ts
浏览文件 @
d57b8538
...
...
@@ -699,27 +699,21 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
return
extHostLabelService
.
$registerResourceLabelFormatter
(
formatter
);
},
onDidCreateFiles
:
(
listener
,
thisArg
,
disposables
)
=>
{
checkProposedApiEnabled
(
extension
);
return
extHostFileSystemEvent
.
onDidCreateFile
(
listener
,
thisArg
,
disposables
);
},
onDidDeleteFiles
:
(
listener
,
thisArg
,
disposables
)
=>
{
checkProposedApiEnabled
(
extension
);
return
extHostFileSystemEvent
.
onDidDeleteFile
(
listener
,
thisArg
,
disposables
);
},
onDidRenameFiles
:
(
listener
,
thisArg
,
disposables
)
=>
{
checkProposedApiEnabled
(
extension
);
return
extHostFileSystemEvent
.
onDidRenameFile
(
listener
,
thisArg
,
disposables
);
},
onWillCreateFiles
:
(
listener
:
(
e
:
vscode
.
FileWillCreateEvent
)
=>
any
,
thisArg
?:
any
,
disposables
?:
vscode
.
Disposable
[])
=>
{
checkProposedApiEnabled
(
extension
);
return
extHostFileSystemEvent
.
getOnWillCreateFileEvent
(
extension
)(
listener
,
thisArg
,
disposables
);
},
onWillDeleteFiles
:
(
listener
:
(
e
:
vscode
.
FileWillDeleteEvent
)
=>
any
,
thisArg
?:
any
,
disposables
?:
vscode
.
Disposable
[])
=>
{
checkProposedApiEnabled
(
extension
);
return
extHostFileSystemEvent
.
getOnWillDeleteFileEvent
(
extension
)(
listener
,
thisArg
,
disposables
);
},
onWillRenameFiles
:
(
listener
:
(
e
:
vscode
.
FileWillRenameEvent
)
=>
any
,
thisArg
?:
any
,
disposables
?:
vscode
.
Disposable
[])
=>
{
checkProposedApiEnabled
(
extension
);
return
extHostFileSystemEvent
.
getOnWillRenameFileEvent
(
extension
)(
listener
,
thisArg
,
disposables
);
}
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录