Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
10192366
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,发现更多精彩内容 >>
提交
10192366
编写于
6月 19, 2018
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
move onDidRename to filesystem-events things, #43768
上级
3f25a1b7
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
49 addition
and
47 deletion
+49
-47
extensions/typescript-language-features/src/features/updatePathsOnRename.ts
...ipt-language-features/src/features/updatePathsOnRename.ts
+2
-2
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+4
-4
src/vs/workbench/api/electron-browser/mainThreadDocuments.ts
src/vs/workbench/api/electron-browser/mainThreadDocuments.ts
+1
-7
src/vs/workbench/api/electron-browser/mainThreadFileSystemEventService.ts
.../api/electron-browser/mainThreadFileSystemEventService.ts
+16
-6
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+2
-2
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+1
-1
src/vs/workbench/api/node/extHostDocuments.ts
src/vs/workbench/api/node/extHostDocuments.ts
+0
-9
src/vs/workbench/api/node/extHostFileSystemEventService.ts
src/vs/workbench/api/node/extHostFileSystemEventService.ts
+23
-16
未找到文件。
extensions/typescript-language-features/src/features/updatePathsOnRename.ts
浏览文件 @
10192366
...
...
@@ -34,8 +34,8 @@ export class UpdateImportsOnFileRenameHandler {
private
readonly
fileConfigurationManager
:
FileConfigurationManager
,
private
readonly
_handles
:
(
uri
:
vscode
.
Uri
)
=>
Promise
<
boolean
>
,
)
{
this
.
_onDidRenameSub
=
vscode
.
workspace
.
onDidRename
Resourc
e
(
e
=>
{
this
.
doRename
(
e
.
old
Resource
,
e
.
newResource
);
this
.
_onDidRenameSub
=
vscode
.
workspace
.
onDidRename
Fil
e
(
e
=>
{
this
.
doRename
(
e
.
old
Uri
,
e
.
newUri
);
});
}
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
10192366
...
...
@@ -629,13 +629,13 @@ declare module 'vscode' {
//#endregion
//#region mjbvz: File rename events
export
interface
ResourceRenamed
Event
{
readonly
old
Resource
:
Uri
;
readonly
new
Resource
:
Uri
;
export
interface
FileRename
Event
{
readonly
old
Uri
:
Uri
;
readonly
new
Uri
:
Uri
;
}
export
namespace
workspace
{
export
const
onDidRename
Resource
:
Event
<
ResourceRenamed
Event
>
;
export
const
onDidRename
File
:
Event
<
FileRename
Event
>
;
}
//#endregion
...
...
src/vs/workbench/api/electron-browser/mainThreadDocuments.ts
浏览文件 @
10192366
...
...
@@ -10,7 +10,7 @@ import { IModelService, shouldSynchronizeModel } from 'vs/editor/common/services
import
{
IDisposable
,
dispose
,
IReference
}
from
'
vs/base/common/lifecycle
'
;
import
{
TextFileModelChangeEvent
,
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IFileService
,
FileOperation
}
from
'
vs/platform/files/common/files
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
IUntitledEditorService
}
from
'
vs/workbench/services/untitled/common/untitledEditorService
'
;
import
{
ExtHostContext
,
MainThreadDocumentsShape
,
ExtHostDocumentsShape
,
IExtHostContext
}
from
'
../node/extHost.protocol
'
;
...
...
@@ -119,12 +119,6 @@ export class MainThreadDocuments implements MainThreadDocumentsShape {
}
}));
this
.
_toDispose
.
push
(
fileService
.
onAfterOperation
(
e
=>
{
if
(
e
.
operation
===
FileOperation
.
MOVE
)
{
this
.
_proxy
.
$onDidRename
(
e
.
resource
,
e
.
target
.
resource
);
}
}));
this
.
_modelToDisposeMap
=
Object
.
create
(
null
);
}
...
...
src/vs/workbench/api/electron-browser/mainThreadFileSystemEventService.ts
浏览文件 @
10192366
...
...
@@ -4,15 +4,16 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
FileChangeType
,
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
ExtHostContext
,
ExtHostFileSystemEventServiceShape
,
FileSystemEvents
,
IExtHostContext
}
from
'
../node/extHost.protocol
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
FileChangeType
,
IFileService
,
FileOperation
}
from
'
vs/platform/files/common/files
'
;
import
{
extHostCustomer
}
from
'
vs/workbench/api/electron-browser/extHostCustomers
'
;
import
{
ExtHostContext
,
ExtHostFileSystemEventServiceShape
,
FileSystemEvents
,
IExtHostContext
}
from
'
../node/extHost.protocol
'
;
@
extHostCustomer
export
class
MainThreadFileSystemEventService
{
private
readonly
_listener
:
IDisposable
;
private
readonly
_fileEventListener
:
IDisposable
;
private
readonly
_fileOperationListener
:
IDisposable
;
constructor
(
extHostContext
:
IExtHostContext
,
...
...
@@ -20,13 +21,14 @@ export class MainThreadFileSystemEventService {
)
{
const
proxy
:
ExtHostFileSystemEventServiceShape
=
extHostContext
.
getProxy
(
ExtHostContext
.
ExtHostFileSystemEventService
);
// file system events - (changes the editor and other make)
const
events
:
FileSystemEvents
=
{
created
:
[],
changed
:
[],
deleted
:
[]
};
this
.
_listener
=
fileService
.
onFileChanges
(
event
=>
{
this
.
_fileEventListener
=
fileService
.
onFileChanges
(
event
=>
{
for
(
let
change
of
event
.
changes
)
{
switch
(
change
.
type
)
{
case
FileChangeType
.
ADDED
:
...
...
@@ -46,9 +48,17 @@ export class MainThreadFileSystemEventService {
events
.
changed
.
length
=
0
;
events
.
deleted
.
length
=
0
;
});
// file operation events - (changes the editor makes)
this
.
_fileOperationListener
=
fileService
.
onAfterOperation
(
e
=>
{
if
(
e
.
operation
===
FileOperation
.
MOVE
)
{
proxy
.
$onFileRename
(
e
.
resource
,
e
.
target
.
resource
);
}
});
}
dispose
():
void
{
this
.
_listener
.
dispose
();
this
.
_fileEventListener
.
dispose
();
this
.
_fileOperationListener
.
dispose
();
}
}
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
10192366
...
...
@@ -576,8 +576,8 @@ export function createApiFactory(
registerWorkspaceCommentProvider
:
proposedApiFunction
(
extension
,
(
provider
:
vscode
.
WorkspaceCommentProvider
)
=>
{
return
exthostCommentProviders
.
registerWorkspaceCommentProvider
(
provider
);
}),
onDidRename
Resourc
e
:
proposedApiFunction
(
extension
,
(
listener
,
thisArg
?,
disposables
?)
=>
{
return
extHost
Documents
.
onDidRenameResourc
e
(
listener
,
thisArg
,
disposables
);
onDidRename
Fil
e
:
proposedApiFunction
(
extension
,
(
listener
,
thisArg
?,
disposables
?)
=>
{
return
extHost
FileSystemEvent
.
onDidRenameFil
e
(
listener
,
thisArg
,
disposables
);
})
};
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
10192366
...
...
@@ -614,7 +614,6 @@ export interface ExtHostDocumentsShape {
$acceptModelSaved
(
strURL
:
UriComponents
):
void
;
$acceptDirtyStateChanged
(
strURL
:
UriComponents
,
isDirty
:
boolean
):
void
;
$acceptModelChanged
(
strURL
:
UriComponents
,
e
:
IModelChangedEvent
,
isDirty
:
boolean
):
void
;
$onDidRename
(
oldURL
:
UriComponents
,
newURL
:
UriComponents
):
void
;
}
export
interface
ExtHostDocumentSaveParticipantShape
{
...
...
@@ -698,6 +697,7 @@ export interface FileSystemEvents {
}
export
interface
ExtHostFileSystemEventServiceShape
{
$onFileEvent
(
events
:
FileSystemEvents
):
void
;
$onFileRename
(
oldUri
:
UriComponents
,
newUri
:
UriComponents
):
void
;
}
export
interface
ObjectIdentifier
{
...
...
src/vs/workbench/api/node/extHostDocuments.ts
浏览文件 @
10192366
...
...
@@ -21,13 +21,11 @@ export class ExtHostDocuments implements ExtHostDocumentsShape {
private
_onDidRemoveDocument
=
new
Emitter
<
vscode
.
TextDocument
>
();
private
_onDidChangeDocument
=
new
Emitter
<
vscode
.
TextDocumentChangeEvent
>
();
private
_onDidSaveDocument
=
new
Emitter
<
vscode
.
TextDocument
>
();
private
_onDidRenameResource
=
new
Emitter
<
vscode
.
ResourceRenamedEvent
>
();
readonly
onDidAddDocument
:
Event
<
vscode
.
TextDocument
>
=
this
.
_onDidAddDocument
.
event
;
readonly
onDidRemoveDocument
:
Event
<
vscode
.
TextDocument
>
=
this
.
_onDidRemoveDocument
.
event
;
readonly
onDidChangeDocument
:
Event
<
vscode
.
TextDocumentChangeEvent
>
=
this
.
_onDidChangeDocument
.
event
;
readonly
onDidSaveDocument
:
Event
<
vscode
.
TextDocument
>
=
this
.
_onDidSaveDocument
.
event
;
readonly
onDidRenameResource
:
Event
<
vscode
.
ResourceRenamedEvent
>
=
this
.
_onDidRenameResource
.
event
;
private
_toDispose
:
IDisposable
[];
private
_proxy
:
MainThreadDocumentsShape
;
...
...
@@ -150,11 +148,4 @@ export class ExtHostDocuments implements ExtHostDocumentsShape {
public
setWordDefinitionFor
(
modeId
:
string
,
wordDefinition
:
RegExp
):
void
{
setWordDefinitionFor
(
modeId
,
wordDefinition
);
}
public
$onDidRename
(
oldURL
:
UriComponents
,
newURL
:
UriComponents
):
void
{
const
oldResource
=
URI
.
revive
(
oldURL
);
const
newResource
=
URI
.
revive
(
newURL
);
this
.
_onDidRenameResource
.
fire
({
oldResource
,
newResource
});
}
}
src/vs/workbench/api/node/extHostFileSystemEventService.ts
浏览文件 @
10192366
...
...
@@ -4,18 +4,18 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
IRelativePattern
,
parse
}
from
'
vs/base/common/glob
'
;
import
URI
,
{
UriComponents
}
from
'
vs/base/common/uri
'
;
import
*
as
vscode
from
'
vscode
'
;
import
{
ExtHostFileSystemEventServiceShape
,
FileSystemEvents
}
from
'
./extHost.protocol
'
;
import
{
Disposable
}
from
'
./extHostTypes
'
;
import
{
parse
,
IRelativePattern
}
from
'
vs/base/common/glob
'
;
import
{
Uri
,
FileSystemWatcher
as
_FileSystemWatcher
}
from
'
vscode
'
;
import
{
FileSystemEvents
,
ExtHostFileSystemEventServiceShape
}
from
'
./extHost.protocol
'
;
import
URI
from
'
vs/base/common/uri
'
;
class
FileSystemWatcher
implements
_
FileSystemWatcher
{
class
FileSystemWatcher
implements
vscode
.
FileSystemWatcher
{
private
_onDidCreate
=
new
Emitter
<
Uri
>
();
private
_onDidChange
=
new
Emitter
<
Uri
>
();
private
_onDidDelete
=
new
Emitter
<
Uri
>
();
private
_onDidCreate
=
new
Emitter
<
vscode
.
Uri
>
();
private
_onDidChange
=
new
Emitter
<
vscode
.
Uri
>
();
private
_onDidDelete
=
new
Emitter
<
vscode
.
Uri
>
();
private
_disposable
:
Disposable
;
private
_config
:
number
;
...
...
@@ -80,31 +80,38 @@ class FileSystemWatcher implements _FileSystemWatcher {
this
.
_disposable
.
dispose
();
}
get
onDidCreate
():
Event
<
Uri
>
{
get
onDidCreate
():
Event
<
vscode
.
Uri
>
{
return
this
.
_onDidCreate
.
event
;
}
get
onDidChange
():
Event
<
Uri
>
{
get
onDidChange
():
Event
<
vscode
.
Uri
>
{
return
this
.
_onDidChange
.
event
;
}
get
onDidDelete
():
Event
<
Uri
>
{
get
onDidDelete
():
Event
<
vscode
.
Uri
>
{
return
this
.
_onDidDelete
.
event
;
}
}
export
class
ExtHostFileSystemEventService
implements
ExtHostFileSystemEventServiceShape
{
private
_emitter
=
new
Emitter
<
FileSystemEvents
>
();
private
_onFileEvent
=
new
Emitter
<
FileSystemEvents
>
();
private
_onDidRenameFile
=
new
Emitter
<
vscode
.
FileRenameEvent
>
();
readonly
onDidRenameFile
:
Event
<
vscode
.
FileRenameEvent
>
=
this
.
_onDidRenameFile
.
event
;
constructor
()
{
}
public
createFileSystemWatcher
(
globPattern
:
string
|
IRelativePattern
,
ignoreCreateEvents
?:
boolean
,
ignoreChangeEvents
?:
boolean
,
ignoreDeleteEvents
?:
boolean
):
_
FileSystemWatcher
{
return
new
FileSystemWatcher
(
this
.
_
emitter
.
event
,
globPattern
,
ignoreCreateEvents
,
ignoreChangeEvents
,
ignoreDeleteEvents
);
public
createFileSystemWatcher
(
globPattern
:
string
|
IRelativePattern
,
ignoreCreateEvents
?:
boolean
,
ignoreChangeEvents
?:
boolean
,
ignoreDeleteEvents
?:
boolean
):
vscode
.
FileSystemWatcher
{
return
new
FileSystemWatcher
(
this
.
_
onFileEvent
.
event
,
globPattern
,
ignoreCreateEvents
,
ignoreChangeEvents
,
ignoreDeleteEvents
);
}
$onFileEvent
(
events
:
FileSystemEvents
)
{
this
.
_emitter
.
fire
(
events
);
this
.
_onFileEvent
.
fire
(
events
);
}
$onFileRename
(
oldUri
:
UriComponents
,
newUri
:
UriComponents
)
{
this
.
_onDidRenameFile
.
fire
(
Object
.
freeze
({
oldUri
:
URI
.
revive
(
oldUri
),
newUri
:
URI
.
revive
(
newUri
)
}));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录