Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
954d03fd
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,发现更多精彩内容 >>
提交
954d03fd
编写于
2月 18, 2020
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
files - rename events to follow conventions
上级
92df7a03
变更
35
显示空白变更内容
内联
并排
Showing
35 changed file
with
114 addition
and
127 deletion
+114
-127
src/vs/platform/configuration/common/configurationModels.ts
src/vs/platform/configuration/common/configurationModels.ts
+1
-1
src/vs/platform/files/common/fileService.ts
src/vs/platform/files/common/fileService.ts
+12
-12
src/vs/platform/files/common/files.ts
src/vs/platform/files/common/files.ts
+6
-14
src/vs/platform/files/node/watcher/nodejs/watcherService.ts
src/vs/platform/files/node/watcher/nodejs/watcherService.ts
+2
-2
src/vs/platform/files/node/watcher/nsfw/watcherService.ts
src/vs/platform/files/node/watcher/nsfw/watcherService.ts
+2
-2
src/vs/platform/files/node/watcher/unix/watcherService.ts
src/vs/platform/files/node/watcher/unix/watcherService.ts
+2
-2
src/vs/platform/files/node/watcher/win32/watcherService.ts
src/vs/platform/files/node/watcher/win32/watcherService.ts
+3
-3
src/vs/platform/files/test/node/diskFileService.test.ts
src/vs/platform/files/test/node/diskFileService.test.ts
+24
-24
src/vs/platform/files/test/node/normalizer.test.ts
src/vs/platform/files/test/node/normalizer.test.ts
+11
-11
src/vs/platform/storage/browser/storageService.ts
src/vs/platform/storage/browser/storageService.ts
+1
-1
src/vs/platform/userDataSync/common/abstractSynchronizer.ts
src/vs/platform/userDataSync/common/abstractSynchronizer.ts
+1
-1
src/vs/platform/userDataSync/common/globalStateSync.ts
src/vs/platform/userDataSync/common/globalStateSync.ts
+1
-1
src/vs/workbench/api/browser/mainThreadFileSystemEventService.ts
...workbench/api/browser/mainThreadFileSystemEventService.ts
+1
-1
src/vs/workbench/contrib/bulkEdit/test/browser/bulkEditPreview.test.ts
...nch/contrib/bulkEdit/test/browser/bulkEditPreview.test.ts
+1
-1
src/vs/workbench/contrib/customEditor/browser/customEditors.ts
...s/workbench/contrib/customEditor/browser/customEditors.ts
+1
-1
src/vs/workbench/contrib/debug/browser/debugService.ts
src/vs/workbench/contrib/debug/browser/debugService.ts
+1
-1
src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts
...kbench/contrib/files/browser/editors/fileEditorTracker.ts
+3
-3
src/vs/workbench/contrib/files/browser/editors/textFileEditor.ts
...workbench/contrib/files/browser/editors/textFileEditor.ts
+1
-1
src/vs/workbench/contrib/files/common/explorerService.ts
src/vs/workbench/contrib/files/common/explorerService.ts
+4
-4
src/vs/workbench/contrib/files/common/files.ts
src/vs/workbench/contrib/files/common/files.ts
+1
-1
src/vs/workbench/contrib/logs/common/logs.contribution.ts
src/vs/workbench/contrib/logs/common/logs.contribution.ts
+1
-1
src/vs/workbench/contrib/search/browser/searchView.ts
src/vs/workbench/contrib/search/browser/searchView.ts
+1
-1
src/vs/workbench/contrib/snippets/browser/snippetsService.ts
src/vs/workbench/contrib/snippets/browser/snippetsService.ts
+2
-2
src/vs/workbench/services/bulkEdit/browser/conflicts.ts
src/vs/workbench/services/bulkEdit/browser/conflicts.ts
+1
-1
src/vs/workbench/services/configuration/browser/configuration.ts
...workbench/services/configuration/browser/configuration.ts
+3
-3
src/vs/workbench/services/history/browser/history.ts
src/vs/workbench/services/history/browser/history.ts
+2
-2
src/vs/workbench/services/keybinding/browser/keybindingService.ts
...orkbench/services/keybinding/browser/keybindingService.ts
+1
-1
src/vs/workbench/services/keybinding/browser/keymapService.ts
...vs/workbench/services/keybinding/browser/keymapService.ts
+1
-1
src/vs/workbench/services/output/electron-browser/outputChannelModelService.ts
...ices/output/electron-browser/outputChannelModelService.ts
+1
-1
src/vs/workbench/services/textfile/common/textFileEditorModel.ts
...workbench/services/textfile/common/textFileEditorModel.ts
+2
-2
src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts
...ch/services/textfile/common/textFileEditorModelManager.ts
+2
-2
src/vs/workbench/services/themes/browser/workbenchThemeService.ts
...orkbench/services/themes/browser/workbenchThemeService.ts
+1
-1
src/vs/workbench/services/userData/test/electron-browser/fileUserDataProvider.test.ts
...erData/test/electron-browser/fileUserDataProvider.test.ts
+10
-10
src/vs/workbench/test/browser/api/mainThreadDocumentsAndEditors.test.ts
...ch/test/browser/api/mainThreadDocumentsAndEditors.test.ts
+1
-1
src/vs/workbench/test/browser/workbenchTestServices.ts
src/vs/workbench/test/browser/workbenchTestServices.ts
+6
-11
未找到文件。
src/vs/platform/configuration/common/configurationModels.ts
浏览文件 @
954d03fd
...
@@ -352,7 +352,7 @@ export class UserSettings extends Disposable {
...
@@ -352,7 +352,7 @@ export class UserSettings extends Disposable {
super
();
super
();
this
.
parser
=
new
ConfigurationModelParser
(
this
.
userSettingsResource
.
toString
(),
this
.
scopes
);
this
.
parser
=
new
ConfigurationModelParser
(
this
.
userSettingsResource
.
toString
(),
this
.
scopes
);
this
.
_register
(
this
.
fileService
.
watch
(
dirname
(
this
.
userSettingsResource
)));
this
.
_register
(
this
.
fileService
.
watch
(
dirname
(
this
.
userSettingsResource
)));
this
.
_register
(
Event
.
filter
(
this
.
fileService
.
on
FileChanges
,
e
=>
e
.
contains
(
this
.
userSettingsResource
))(()
=>
this
.
_onDidChange
.
fire
()));
this
.
_register
(
Event
.
filter
(
this
.
fileService
.
on
DidFilesChange
,
e
=>
e
.
contains
(
this
.
userSettingsResource
))(()
=>
this
.
_onDidChange
.
fire
()));
}
}
async
loadConfiguration
():
Promise
<
ConfigurationModel
>
{
async
loadConfiguration
():
Promise
<
ConfigurationModel
>
{
...
...
src/vs/platform/files/common/fileService.ts
浏览文件 @
954d03fd
...
@@ -55,7 +55,7 @@ export class FileService extends Disposable implements IFileService {
...
@@ -55,7 +55,7 @@ export class FileService extends Disposable implements IFileService {
// Forward events from provider
// Forward events from provider
const
providerDisposables
=
new
DisposableStore
();
const
providerDisposables
=
new
DisposableStore
();
providerDisposables
.
add
(
provider
.
onDidChangeFile
(
changes
=>
this
.
_on
FileChanges
.
fire
(
new
FileChangesEvent
(
changes
))));
providerDisposables
.
add
(
provider
.
onDidChangeFile
(
changes
=>
this
.
_on
DidFilesChange
.
fire
(
new
FileChangesEvent
(
changes
))));
providerDisposables
.
add
(
provider
.
onDidChangeCapabilities
(()
=>
this
.
_onDidChangeFileSystemProviderCapabilities
.
fire
({
provider
,
scheme
})));
providerDisposables
.
add
(
provider
.
onDidChangeCapabilities
(()
=>
this
.
_onDidChangeFileSystemProviderCapabilities
.
fire
({
provider
,
scheme
})));
if
(
typeof
provider
.
onDidErrorOccur
===
'
function
'
)
{
if
(
typeof
provider
.
onDidErrorOccur
===
'
function
'
)
{
providerDisposables
.
add
(
provider
.
onDidErrorOccur
(
error
=>
this
.
_onError
.
fire
(
new
Error
(
error
))));
providerDisposables
.
add
(
provider
.
onDidErrorOccur
(
error
=>
this
.
_onError
.
fire
(
new
Error
(
error
))));
...
@@ -147,11 +147,11 @@ export class FileService extends Disposable implements IFileService {
...
@@ -147,11 +147,11 @@ export class FileService extends Disposable implements IFileService {
//#endregion
//#endregion
private
_on
AfterOperation
:
Emitter
<
FileOperationEvent
>
=
this
.
_register
(
new
Emitter
<
FileOperationEvent
>
());
private
_on
DidRunOperation
=
this
.
_register
(
new
Emitter
<
FileOperationEvent
>
());
readonly
on
AfterOperation
:
Event
<
FileOperationEvent
>
=
this
.
_onAfter
Operation
.
event
;
readonly
on
DidRunOperation
=
this
.
_onDidRun
Operation
.
event
;
private
_onError
:
Emitter
<
Error
>
=
this
.
_register
(
new
Emitter
<
Error
>
());
private
_onError
=
this
.
_register
(
new
Emitter
<
Error
>
());
readonly
onError
:
Event
<
Error
>
=
this
.
_onError
.
event
;
readonly
onError
=
this
.
_onError
.
event
;
//#region File Metadata Resolving
//#region File Metadata Resolving
...
@@ -299,7 +299,7 @@ export class FileService extends Disposable implements IFileService {
...
@@ -299,7 +299,7 @@ export class FileService extends Disposable implements IFileService {
const
fileStat
=
await
this
.
writeFile
(
resource
,
bufferOrReadableOrStream
);
const
fileStat
=
await
this
.
writeFile
(
resource
,
bufferOrReadableOrStream
);
// events
// events
this
.
_on
After
Operation
.
fire
(
new
FileOperationEvent
(
resource
,
FileOperation
.
CREATE
,
fileStat
));
this
.
_on
DidRun
Operation
.
fire
(
new
FileOperationEvent
(
resource
,
FileOperation
.
CREATE
,
fileStat
));
return
fileStat
;
return
fileStat
;
}
}
...
@@ -549,7 +549,7 @@ export class FileService extends Disposable implements IFileService {
...
@@ -549,7 +549,7 @@ export class FileService extends Disposable implements IFileService {
// resolve and send events
// resolve and send events
const
fileStat
=
await
this
.
resolve
(
target
,
{
resolveMetadata
:
true
});
const
fileStat
=
await
this
.
resolve
(
target
,
{
resolveMetadata
:
true
});
this
.
_on
After
Operation
.
fire
(
new
FileOperationEvent
(
source
,
mode
===
'
move
'
?
FileOperation
.
MOVE
:
FileOperation
.
COPY
,
fileStat
));
this
.
_on
DidRun
Operation
.
fire
(
new
FileOperationEvent
(
source
,
mode
===
'
move
'
?
FileOperation
.
MOVE
:
FileOperation
.
COPY
,
fileStat
));
return
fileStat
;
return
fileStat
;
}
}
...
@@ -563,7 +563,7 @@ export class FileService extends Disposable implements IFileService {
...
@@ -563,7 +563,7 @@ export class FileService extends Disposable implements IFileService {
// resolve and send events
// resolve and send events
const
fileStat
=
await
this
.
resolve
(
target
,
{
resolveMetadata
:
true
});
const
fileStat
=
await
this
.
resolve
(
target
,
{
resolveMetadata
:
true
});
this
.
_on
After
Operation
.
fire
(
new
FileOperationEvent
(
source
,
mode
===
'
copy
'
?
FileOperation
.
COPY
:
FileOperation
.
MOVE
,
fileStat
));
this
.
_on
DidRun
Operation
.
fire
(
new
FileOperationEvent
(
source
,
mode
===
'
copy
'
?
FileOperation
.
COPY
:
FileOperation
.
MOVE
,
fileStat
));
return
fileStat
;
return
fileStat
;
}
}
...
@@ -717,7 +717,7 @@ export class FileService extends Disposable implements IFileService {
...
@@ -717,7 +717,7 @@ export class FileService extends Disposable implements IFileService {
// events
// events
const
fileStat
=
await
this
.
resolve
(
resource
,
{
resolveMetadata
:
true
});
const
fileStat
=
await
this
.
resolve
(
resource
,
{
resolveMetadata
:
true
});
this
.
_on
After
Operation
.
fire
(
new
FileOperationEvent
(
resource
,
FileOperation
.
CREATE
,
fileStat
));
this
.
_on
DidRun
Operation
.
fire
(
new
FileOperationEvent
(
resource
,
FileOperation
.
CREATE
,
fileStat
));
return
fileStat
;
return
fileStat
;
}
}
...
@@ -799,15 +799,15 @@ export class FileService extends Disposable implements IFileService {
...
@@ -799,15 +799,15 @@ export class FileService extends Disposable implements IFileService {
await
provider
.
delete
(
resource
,
{
recursive
,
useTrash
});
await
provider
.
delete
(
resource
,
{
recursive
,
useTrash
});
// Events
// Events
this
.
_on
After
Operation
.
fire
(
new
FileOperationEvent
(
resource
,
FileOperation
.
DELETE
));
this
.
_on
DidRun
Operation
.
fire
(
new
FileOperationEvent
(
resource
,
FileOperation
.
DELETE
));
}
}
//#endregion
//#endregion
//#region File Watching
//#region File Watching
private
_on
FileChanges
:
Emitter
<
FileChangesEvent
>
=
this
.
_register
(
new
Emitter
<
FileChangesEvent
>
());
private
_on
DidFilesChange
=
this
.
_register
(
new
Emitter
<
FileChangesEvent
>
());
readonly
on
FileChanges
:
Event
<
FileChangesEvent
>
=
this
.
_onFileChanges
.
event
;
readonly
on
DidFilesChange
=
this
.
_onDidFilesChange
.
event
;
private
activeWatchers
=
new
Map
<
string
,
{
disposable
:
IDisposable
,
count
:
number
}
>
();
private
activeWatchers
=
new
Map
<
string
,
{
disposable
:
IDisposable
,
count
:
number
}
>
();
...
...
src/vs/platform/files/common/files.ts
浏览文件 @
954d03fd
...
@@ -63,12 +63,12 @@ export interface IFileService {
...
@@ -63,12 +63,12 @@ export interface IFileService {
* Allows to listen for file changes. The event will fire for every file within the opened workspace
* Allows to listen for file changes. The event will fire for every file within the opened workspace
* (if any) as well as all files that have been watched explicitly using the #watch() API.
* (if any) as well as all files that have been watched explicitly using the #watch() API.
*/
*/
readonly
on
FileChanges
:
Event
<
FileChangesEvent
>
;
readonly
on
DidFilesChange
:
Event
<
FileChangesEvent
>
;
/**
/**
* An event that is fired upon successful completion of a certain file operation.
* An event that is fired upon successful completion of a certain file operation.
*/
*/
readonly
on
After
Operation
:
Event
<
FileOperationEvent
>
;
readonly
on
DidRun
Operation
:
Event
<
FileOperationEvent
>
;
/**
/**
* Resolve the properties of a file/folder identified by the resource.
* Resolve the properties of a file/folder identified by the resource.
...
@@ -471,15 +471,7 @@ export interface IFileChange {
...
@@ -471,15 +471,7 @@ export interface IFileChange {
export
class
FileChangesEvent
{
export
class
FileChangesEvent
{
private
readonly
_changes
:
readonly
IFileChange
[];
constructor
(
public
readonly
changes
:
readonly
IFileChange
[])
{
}
constructor
(
changes
:
readonly
IFileChange
[])
{
this
.
_changes
=
changes
;
}
get
changes
()
{
return
this
.
_changes
;
}
/**
/**
* Returns true if this change event contains the provided file with the given change type (if provided). In case of
* Returns true if this change event contains the provided file with the given change type (if provided). In case of
...
@@ -493,7 +485,7 @@ export class FileChangesEvent {
...
@@ -493,7 +485,7 @@ export class FileChangesEvent {
const
checkForChangeType
=
!
isUndefinedOrNull
(
type
);
const
checkForChangeType
=
!
isUndefinedOrNull
(
type
);
return
this
.
_
changes
.
some
(
change
=>
{
return
this
.
changes
.
some
(
change
=>
{
if
(
checkForChangeType
&&
change
.
type
!==
type
)
{
if
(
checkForChangeType
&&
change
.
type
!==
type
)
{
return
false
;
return
false
;
}
}
...
@@ -550,11 +542,11 @@ export class FileChangesEvent {
...
@@ -550,11 +542,11 @@ export class FileChangesEvent {
}
}
private
getOfType
(
type
:
FileChangeType
):
IFileChange
[]
{
private
getOfType
(
type
:
FileChangeType
):
IFileChange
[]
{
return
this
.
_
changes
.
filter
(
change
=>
change
.
type
===
type
);
return
this
.
changes
.
filter
(
change
=>
change
.
type
===
type
);
}
}
private
hasType
(
type
:
FileChangeType
):
boolean
{
private
hasType
(
type
:
FileChangeType
):
boolean
{
return
this
.
_
changes
.
some
(
change
=>
{
return
this
.
changes
.
some
(
change
=>
{
return
change
.
type
===
type
;
return
change
.
type
===
type
;
});
});
}
}
...
...
src/vs/platform/files/node/watcher/nodejs/watcherService.ts
浏览文件 @
954d03fd
...
@@ -20,7 +20,7 @@ export class FileWatcher extends Disposable {
...
@@ -20,7 +20,7 @@ export class FileWatcher extends Disposable {
constructor
(
constructor
(
private
path
:
string
,
private
path
:
string
,
private
on
FileChanges
:
(
changes
:
IDiskFileChange
[])
=>
void
,
private
on
DidFilesChange
:
(
changes
:
IDiskFileChange
[])
=>
void
,
private
onLogMessage
:
(
msg
:
ILogMessage
)
=>
void
,
private
onLogMessage
:
(
msg
:
ILogMessage
)
=>
void
,
private
verboseLogging
:
boolean
private
verboseLogging
:
boolean
)
{
)
{
...
@@ -101,7 +101,7 @@ export class FileWatcher extends Disposable {
...
@@ -101,7 +101,7 @@ export class FileWatcher extends Disposable {
// Fire
// Fire
if
(
normalizedFileChanges
.
length
>
0
)
{
if
(
normalizedFileChanges
.
length
>
0
)
{
this
.
on
FileChanges
(
normalizedFileChanges
);
this
.
on
DidFilesChange
(
normalizedFileChanges
);
}
}
return
Promise
.
resolve
();
return
Promise
.
resolve
();
...
...
src/vs/platform/files/node/watcher/nsfw/watcherService.ts
浏览文件 @
954d03fd
...
@@ -21,7 +21,7 @@ export class FileWatcher extends Disposable {
...
@@ -21,7 +21,7 @@ export class FileWatcher extends Disposable {
constructor
(
constructor
(
private
folders
:
IWatcherRequest
[],
private
folders
:
IWatcherRequest
[],
private
on
FileChanges
:
(
changes
:
IDiskFileChange
[])
=>
void
,
private
on
DidFilesChange
:
(
changes
:
IDiskFileChange
[])
=>
void
,
private
onLogMessage
:
(
msg
:
ILogMessage
)
=>
void
,
private
onLogMessage
:
(
msg
:
ILogMessage
)
=>
void
,
private
verboseLogging
:
boolean
,
private
verboseLogging
:
boolean
,
)
{
)
{
...
@@ -68,7 +68,7 @@ export class FileWatcher extends Disposable {
...
@@ -68,7 +68,7 @@ export class FileWatcher extends Disposable {
this
.
service
.
setVerboseLogging
(
this
.
verboseLogging
);
this
.
service
.
setVerboseLogging
(
this
.
verboseLogging
);
const
options
=
{};
const
options
=
{};
this
.
_register
(
this
.
service
.
watch
(
options
)(
e
=>
!
this
.
isDisposed
&&
this
.
on
FileChanges
(
e
)));
this
.
_register
(
this
.
service
.
watch
(
options
)(
e
=>
!
this
.
isDisposed
&&
this
.
on
DidFilesChange
(
e
)));
this
.
_register
(
this
.
service
.
onLogMessage
(
m
=>
this
.
onLogMessage
(
m
)));
this
.
_register
(
this
.
service
.
onLogMessage
(
m
=>
this
.
onLogMessage
(
m
)));
...
...
src/vs/platform/files/node/watcher/unix/watcherService.ts
浏览文件 @
954d03fd
...
@@ -20,7 +20,7 @@ export class FileWatcher extends Disposable {
...
@@ -20,7 +20,7 @@ export class FileWatcher extends Disposable {
constructor
(
constructor
(
private
folders
:
IWatcherRequest
[],
private
folders
:
IWatcherRequest
[],
private
on
FileChanges
:
(
changes
:
IDiskFileChange
[])
=>
void
,
private
on
DidFilesChange
:
(
changes
:
IDiskFileChange
[])
=>
void
,
private
onLogMessage
:
(
msg
:
ILogMessage
)
=>
void
,
private
onLogMessage
:
(
msg
:
ILogMessage
)
=>
void
,
private
verboseLogging
:
boolean
,
private
verboseLogging
:
boolean
,
private
watcherOptions
:
IWatcherOptions
=
{}
private
watcherOptions
:
IWatcherOptions
=
{}
...
@@ -67,7 +67,7 @@ export class FileWatcher extends Disposable {
...
@@ -67,7 +67,7 @@ export class FileWatcher extends Disposable {
this
.
service
.
setVerboseLogging
(
this
.
verboseLogging
);
this
.
service
.
setVerboseLogging
(
this
.
verboseLogging
);
this
.
_register
(
this
.
service
.
watch
(
this
.
watcherOptions
)(
e
=>
!
this
.
isDisposed
&&
this
.
on
FileChanges
(
e
)));
this
.
_register
(
this
.
service
.
watch
(
this
.
watcherOptions
)(
e
=>
!
this
.
isDisposed
&&
this
.
on
DidFilesChange
(
e
)));
this
.
_register
(
this
.
service
.
onLogMessage
(
m
=>
this
.
onLogMessage
(
m
)));
this
.
_register
(
this
.
service
.
onLogMessage
(
m
=>
this
.
onLogMessage
(
m
)));
...
...
src/vs/platform/files/node/watcher/win32/watcherService.ts
浏览文件 @
954d03fd
...
@@ -16,7 +16,7 @@ export class FileWatcher implements IDisposable {
...
@@ -16,7 +16,7 @@ export class FileWatcher implements IDisposable {
constructor
(
constructor
(
folders
:
{
path
:
string
,
excludes
:
string
[]
}[],
folders
:
{
path
:
string
,
excludes
:
string
[]
}[],
private
on
FileChanges
:
(
changes
:
IDiskFileChange
[])
=>
void
,
private
on
DidFilesChange
:
(
changes
:
IDiskFileChange
[])
=>
void
,
private
onLogMessage
:
(
msg
:
ILogMessage
)
=>
void
,
private
onLogMessage
:
(
msg
:
ILogMessage
)
=>
void
,
private
verboseLogging
:
boolean
private
verboseLogging
:
boolean
)
{
)
{
...
@@ -62,7 +62,7 @@ export class FileWatcher implements IDisposable {
...
@@ -62,7 +62,7 @@ export class FileWatcher implements IDisposable {
// Emit through event emitter
// Emit through event emitter
if
(
events
.
length
>
0
)
{
if
(
events
.
length
>
0
)
{
this
.
on
FileChanges
(
events
);
this
.
on
DidFilesChange
(
events
);
}
}
}
}
...
...
src/vs/platform/files/test/node/diskFileService.test.ts
浏览文件 @
954d03fd
...
@@ -165,7 +165,7 @@ suite('Disk File Service', function () {
...
@@ -165,7 +165,7 @@ suite('Disk File Service', function () {
test
(
'
createFolder
'
,
async
()
=>
{
test
(
'
createFolder
'
,
async
()
=>
{
let
event
:
FileOperationEvent
|
undefined
;
let
event
:
FileOperationEvent
|
undefined
;
disposables
.
add
(
service
.
on
After
Operation
(
e
=>
event
=
e
));
disposables
.
add
(
service
.
on
DidRun
Operation
(
e
=>
event
=
e
));
const
parent
=
await
service
.
resolve
(
URI
.
file
(
testDir
));
const
parent
=
await
service
.
resolve
(
URI
.
file
(
testDir
));
...
@@ -185,7 +185,7 @@ suite('Disk File Service', function () {
...
@@ -185,7 +185,7 @@ suite('Disk File Service', function () {
test
(
'
createFolder: creating multiple folders at once
'
,
async
()
=>
{
test
(
'
createFolder: creating multiple folders at once
'
,
async
()
=>
{
let
event
:
FileOperationEvent
;
let
event
:
FileOperationEvent
;
disposables
.
add
(
service
.
on
After
Operation
(
e
=>
event
=
e
));
disposables
.
add
(
service
.
on
DidRun
Operation
(
e
=>
event
=
e
));
const
multiFolderPaths
=
[
'
a
'
,
'
couple
'
,
'
of
'
,
'
folders
'
];
const
multiFolderPaths
=
[
'
a
'
,
'
couple
'
,
'
of
'
,
'
folders
'
];
const
parent
=
await
service
.
resolve
(
URI
.
file
(
testDir
));
const
parent
=
await
service
.
resolve
(
URI
.
file
(
testDir
));
...
@@ -460,7 +460,7 @@ suite('Disk File Service', function () {
...
@@ -460,7 +460,7 @@ suite('Disk File Service', function () {
test
(
'
deleteFile
'
,
async
()
=>
{
test
(
'
deleteFile
'
,
async
()
=>
{
let
event
:
FileOperationEvent
;
let
event
:
FileOperationEvent
;
disposables
.
add
(
service
.
on
After
Operation
(
e
=>
event
=
e
));
disposables
.
add
(
service
.
on
DidRun
Operation
(
e
=>
event
=
e
));
const
resource
=
URI
.
file
(
join
(
testDir
,
'
deep
'
,
'
conway.js
'
));
const
resource
=
URI
.
file
(
join
(
testDir
,
'
deep
'
,
'
conway.js
'
));
const
source
=
await
service
.
resolve
(
resource
);
const
source
=
await
service
.
resolve
(
resource
);
...
@@ -496,7 +496,7 @@ suite('Disk File Service', function () {
...
@@ -496,7 +496,7 @@ suite('Disk File Service', function () {
const
source
=
await
service
.
resolve
(
link
);
const
source
=
await
service
.
resolve
(
link
);
let
event
:
FileOperationEvent
;
let
event
:
FileOperationEvent
;
disposables
.
add
(
service
.
on
After
Operation
(
e
=>
event
=
e
));
disposables
.
add
(
service
.
on
DidRun
Operation
(
e
=>
event
=
e
));
await
service
.
del
(
source
.
resource
);
await
service
.
del
(
source
.
resource
);
...
@@ -519,7 +519,7 @@ suite('Disk File Service', function () {
...
@@ -519,7 +519,7 @@ suite('Disk File Service', function () {
await
symlink
(
target
.
fsPath
,
link
.
fsPath
);
await
symlink
(
target
.
fsPath
,
link
.
fsPath
);
let
event
:
FileOperationEvent
;
let
event
:
FileOperationEvent
;
disposables
.
add
(
service
.
on
After
Operation
(
e
=>
event
=
e
));
disposables
.
add
(
service
.
on
DidRun
Operation
(
e
=>
event
=
e
));
await
service
.
del
(
link
);
await
service
.
del
(
link
);
...
@@ -532,7 +532,7 @@ suite('Disk File Service', function () {
...
@@ -532,7 +532,7 @@ suite('Disk File Service', function () {
test
(
'
deleteFolder (recursive)
'
,
async
()
=>
{
test
(
'
deleteFolder (recursive)
'
,
async
()
=>
{
let
event
:
FileOperationEvent
;
let
event
:
FileOperationEvent
;
disposables
.
add
(
service
.
on
After
Operation
(
e
=>
event
=
e
));
disposables
.
add
(
service
.
on
DidRun
Operation
(
e
=>
event
=
e
));
const
resource
=
URI
.
file
(
join
(
testDir
,
'
deep
'
));
const
resource
=
URI
.
file
(
join
(
testDir
,
'
deep
'
));
const
source
=
await
service
.
resolve
(
resource
);
const
source
=
await
service
.
resolve
(
resource
);
...
@@ -561,7 +561,7 @@ suite('Disk File Service', function () {
...
@@ -561,7 +561,7 @@ suite('Disk File Service', function () {
test
(
'
move
'
,
async
()
=>
{
test
(
'
move
'
,
async
()
=>
{
let
event
:
FileOperationEvent
;
let
event
:
FileOperationEvent
;
disposables
.
add
(
service
.
on
After
Operation
(
e
=>
event
=
e
));
disposables
.
add
(
service
.
on
DidRun
Operation
(
e
=>
event
=
e
));
const
source
=
URI
.
file
(
join
(
testDir
,
'
index.html
'
));
const
source
=
URI
.
file
(
join
(
testDir
,
'
index.html
'
));
const
sourceContents
=
readFileSync
(
source
.
fsPath
);
const
sourceContents
=
readFileSync
(
source
.
fsPath
);
...
@@ -641,7 +641,7 @@ suite('Disk File Service', function () {
...
@@ -641,7 +641,7 @@ suite('Disk File Service', function () {
async
function
testMoveAcrossProviders
(
sourceFile
=
'
index.html
'
):
Promise
<
void
>
{
async
function
testMoveAcrossProviders
(
sourceFile
=
'
index.html
'
):
Promise
<
void
>
{
let
event
:
FileOperationEvent
;
let
event
:
FileOperationEvent
;
disposables
.
add
(
service
.
on
After
Operation
(
e
=>
event
=
e
));
disposables
.
add
(
service
.
on
DidRun
Operation
(
e
=>
event
=
e
));
const
source
=
URI
.
file
(
join
(
testDir
,
sourceFile
));
const
source
=
URI
.
file
(
join
(
testDir
,
sourceFile
));
const
sourceContents
=
readFileSync
(
source
.
fsPath
);
const
sourceContents
=
readFileSync
(
source
.
fsPath
);
...
@@ -665,7 +665,7 @@ suite('Disk File Service', function () {
...
@@ -665,7 +665,7 @@ suite('Disk File Service', function () {
test
(
'
move - multi folder
'
,
async
()
=>
{
test
(
'
move - multi folder
'
,
async
()
=>
{
let
event
:
FileOperationEvent
;
let
event
:
FileOperationEvent
;
disposables
.
add
(
service
.
on
After
Operation
(
e
=>
event
=
e
));
disposables
.
add
(
service
.
on
DidRun
Operation
(
e
=>
event
=
e
));
const
multiFolderPaths
=
[
'
a
'
,
'
couple
'
,
'
of
'
,
'
folders
'
];
const
multiFolderPaths
=
[
'
a
'
,
'
couple
'
,
'
of
'
,
'
folders
'
];
const
renameToPath
=
join
(...
multiFolderPaths
,
'
other.html
'
);
const
renameToPath
=
join
(...
multiFolderPaths
,
'
other.html
'
);
...
@@ -684,7 +684,7 @@ suite('Disk File Service', function () {
...
@@ -684,7 +684,7 @@ suite('Disk File Service', function () {
test
(
'
move - directory
'
,
async
()
=>
{
test
(
'
move - directory
'
,
async
()
=>
{
let
event
:
FileOperationEvent
;
let
event
:
FileOperationEvent
;
disposables
.
add
(
service
.
on
After
Operation
(
e
=>
event
=
e
));
disposables
.
add
(
service
.
on
DidRun
Operation
(
e
=>
event
=
e
));
const
source
=
URI
.
file
(
join
(
testDir
,
'
deep
'
));
const
source
=
URI
.
file
(
join
(
testDir
,
'
deep
'
));
...
@@ -728,7 +728,7 @@ suite('Disk File Service', function () {
...
@@ -728,7 +728,7 @@ suite('Disk File Service', function () {
async
function
testMoveFolderAcrossProviders
():
Promise
<
void
>
{
async
function
testMoveFolderAcrossProviders
():
Promise
<
void
>
{
let
event
:
FileOperationEvent
;
let
event
:
FileOperationEvent
;
disposables
.
add
(
service
.
on
After
Operation
(
e
=>
event
=
e
));
disposables
.
add
(
service
.
on
DidRun
Operation
(
e
=>
event
=
e
));
const
source
=
URI
.
file
(
join
(
testDir
,
'
deep
'
));
const
source
=
URI
.
file
(
join
(
testDir
,
'
deep
'
));
const
sourceChildren
=
readdirSync
(
source
.
fsPath
);
const
sourceChildren
=
readdirSync
(
source
.
fsPath
);
...
@@ -753,7 +753,7 @@ suite('Disk File Service', function () {
...
@@ -753,7 +753,7 @@ suite('Disk File Service', function () {
test
(
'
move - MIX CASE
'
,
async
()
=>
{
test
(
'
move - MIX CASE
'
,
async
()
=>
{
let
event
:
FileOperationEvent
;
let
event
:
FileOperationEvent
;
disposables
.
add
(
service
.
on
After
Operation
(
e
=>
event
=
e
));
disposables
.
add
(
service
.
on
DidRun
Operation
(
e
=>
event
=
e
));
const
source
=
await
service
.
resolve
(
URI
.
file
(
join
(
testDir
,
'
index.html
'
)),
{
resolveMetadata
:
true
});
const
source
=
await
service
.
resolve
(
URI
.
file
(
join
(
testDir
,
'
index.html
'
)),
{
resolveMetadata
:
true
});
assert
.
ok
(
source
.
size
>
0
);
assert
.
ok
(
source
.
size
>
0
);
...
@@ -774,7 +774,7 @@ suite('Disk File Service', function () {
...
@@ -774,7 +774,7 @@ suite('Disk File Service', function () {
test
(
'
move - same file
'
,
async
()
=>
{
test
(
'
move - same file
'
,
async
()
=>
{
let
event
:
FileOperationEvent
;
let
event
:
FileOperationEvent
;
disposables
.
add
(
service
.
on
After
Operation
(
e
=>
event
=
e
));
disposables
.
add
(
service
.
on
DidRun
Operation
(
e
=>
event
=
e
));
const
source
=
await
service
.
resolve
(
URI
.
file
(
join
(
testDir
,
'
index.html
'
)),
{
resolveMetadata
:
true
});
const
source
=
await
service
.
resolve
(
URI
.
file
(
join
(
testDir
,
'
index.html
'
)),
{
resolveMetadata
:
true
});
assert
.
ok
(
source
.
size
>
0
);
assert
.
ok
(
source
.
size
>
0
);
...
@@ -794,7 +794,7 @@ suite('Disk File Service', function () {
...
@@ -794,7 +794,7 @@ suite('Disk File Service', function () {
test
(
'
move - same file #2
'
,
async
()
=>
{
test
(
'
move - same file #2
'
,
async
()
=>
{
let
event
:
FileOperationEvent
;
let
event
:
FileOperationEvent
;
disposables
.
add
(
service
.
on
After
Operation
(
e
=>
event
=
e
));
disposables
.
add
(
service
.
on
DidRun
Operation
(
e
=>
event
=
e
));
const
source
=
await
service
.
resolve
(
URI
.
file
(
join
(
testDir
,
'
index.html
'
)),
{
resolveMetadata
:
true
});
const
source
=
await
service
.
resolve
(
URI
.
file
(
join
(
testDir
,
'
index.html
'
)),
{
resolveMetadata
:
true
});
assert
.
ok
(
source
.
size
>
0
);
assert
.
ok
(
source
.
size
>
0
);
...
@@ -817,7 +817,7 @@ suite('Disk File Service', function () {
...
@@ -817,7 +817,7 @@ suite('Disk File Service', function () {
test
(
'
move - source parent of target
'
,
async
()
=>
{
test
(
'
move - source parent of target
'
,
async
()
=>
{
let
event
:
FileOperationEvent
;
let
event
:
FileOperationEvent
;
disposables
.
add
(
service
.
on
After
Operation
(
e
=>
event
=
e
));
disposables
.
add
(
service
.
on
DidRun
Operation
(
e
=>
event
=
e
));
let
source
=
await
service
.
resolve
(
URI
.
file
(
join
(
testDir
,
'
index.html
'
)),
{
resolveMetadata
:
true
});
let
source
=
await
service
.
resolve
(
URI
.
file
(
join
(
testDir
,
'
index.html
'
)),
{
resolveMetadata
:
true
});
const
originalSize
=
source
.
size
;
const
originalSize
=
source
.
size
;
...
@@ -839,7 +839,7 @@ suite('Disk File Service', function () {
...
@@ -839,7 +839,7 @@ suite('Disk File Service', function () {
test
(
'
move - FILE_MOVE_CONFLICT
'
,
async
()
=>
{
test
(
'
move - FILE_MOVE_CONFLICT
'
,
async
()
=>
{
let
event
:
FileOperationEvent
;
let
event
:
FileOperationEvent
;
disposables
.
add
(
service
.
on
After
Operation
(
e
=>
event
=
e
));
disposables
.
add
(
service
.
on
DidRun
Operation
(
e
=>
event
=
e
));
let
source
=
await
service
.
resolve
(
URI
.
file
(
join
(
testDir
,
'
index.html
'
)),
{
resolveMetadata
:
true
});
let
source
=
await
service
.
resolve
(
URI
.
file
(
join
(
testDir
,
'
index.html
'
)),
{
resolveMetadata
:
true
});
const
originalSize
=
source
.
size
;
const
originalSize
=
source
.
size
;
...
@@ -863,7 +863,7 @@ suite('Disk File Service', function () {
...
@@ -863,7 +863,7 @@ suite('Disk File Service', function () {
let
createEvent
:
FileOperationEvent
;
let
createEvent
:
FileOperationEvent
;
let
moveEvent
:
FileOperationEvent
;
let
moveEvent
:
FileOperationEvent
;
let
deleteEvent
:
FileOperationEvent
;
let
deleteEvent
:
FileOperationEvent
;
disposables
.
add
(
service
.
on
After
Operation
(
e
=>
{
disposables
.
add
(
service
.
on
DidRun
Operation
(
e
=>
{
if
(
e
.
operation
===
FileOperation
.
CREATE
)
{
if
(
e
.
operation
===
FileOperation
.
CREATE
)
{
createEvent
=
e
;
createEvent
=
e
;
}
else
if
(
e
.
operation
===
FileOperation
.
DELETE
)
{
}
else
if
(
e
.
operation
===
FileOperation
.
DELETE
)
{
...
@@ -927,7 +927,7 @@ suite('Disk File Service', function () {
...
@@ -927,7 +927,7 @@ suite('Disk File Service', function () {
async
function
doTestCopy
(
sourceName
:
string
=
'
index.html
'
)
{
async
function
doTestCopy
(
sourceName
:
string
=
'
index.html
'
)
{
let
event
:
FileOperationEvent
;
let
event
:
FileOperationEvent
;
disposables
.
add
(
service
.
on
After
Operation
(
e
=>
event
=
e
));
disposables
.
add
(
service
.
on
DidRun
Operation
(
e
=>
event
=
e
));
const
source
=
await
service
.
resolve
(
URI
.
file
(
join
(
testDir
,
sourceName
)));
const
source
=
await
service
.
resolve
(
URI
.
file
(
join
(
testDir
,
sourceName
)));
const
target
=
URI
.
file
(
join
(
testDir
,
'
other.html
'
));
const
target
=
URI
.
file
(
join
(
testDir
,
'
other.html
'
));
...
@@ -952,7 +952,7 @@ suite('Disk File Service', function () {
...
@@ -952,7 +952,7 @@ suite('Disk File Service', function () {
let
createEvent
:
FileOperationEvent
;
let
createEvent
:
FileOperationEvent
;
let
copyEvent
:
FileOperationEvent
;
let
copyEvent
:
FileOperationEvent
;
let
deleteEvent
:
FileOperationEvent
;
let
deleteEvent
:
FileOperationEvent
;
disposables
.
add
(
service
.
on
After
Operation
(
e
=>
{
disposables
.
add
(
service
.
on
DidRun
Operation
(
e
=>
{
if
(
e
.
operation
===
FileOperation
.
CREATE
)
{
if
(
e
.
operation
===
FileOperation
.
CREATE
)
{
createEvent
=
e
;
createEvent
=
e
;
}
else
if
(
e
.
operation
===
FileOperation
.
DELETE
)
{
}
else
if
(
e
.
operation
===
FileOperation
.
DELETE
)
{
...
@@ -1057,7 +1057,7 @@ suite('Disk File Service', function () {
...
@@ -1057,7 +1057,7 @@ suite('Disk File Service', function () {
test
(
'
copy - same file
'
,
async
()
=>
{
test
(
'
copy - same file
'
,
async
()
=>
{
let
event
:
FileOperationEvent
;
let
event
:
FileOperationEvent
;
disposables
.
add
(
service
.
on
After
Operation
(
e
=>
event
=
e
));
disposables
.
add
(
service
.
on
DidRun
Operation
(
e
=>
event
=
e
));
const
source
=
await
service
.
resolve
(
URI
.
file
(
join
(
testDir
,
'
index.html
'
)),
{
resolveMetadata
:
true
});
const
source
=
await
service
.
resolve
(
URI
.
file
(
join
(
testDir
,
'
index.html
'
)),
{
resolveMetadata
:
true
});
assert
.
ok
(
source
.
size
>
0
);
assert
.
ok
(
source
.
size
>
0
);
...
@@ -1077,7 +1077,7 @@ suite('Disk File Service', function () {
...
@@ -1077,7 +1077,7 @@ suite('Disk File Service', function () {
test
(
'
copy - same file #2
'
,
async
()
=>
{
test
(
'
copy - same file #2
'
,
async
()
=>
{
let
event
:
FileOperationEvent
;
let
event
:
FileOperationEvent
;
disposables
.
add
(
service
.
on
After
Operation
(
e
=>
event
=
e
));
disposables
.
add
(
service
.
on
DidRun
Operation
(
e
=>
event
=
e
));
const
source
=
await
service
.
resolve
(
URI
.
file
(
join
(
testDir
,
'
index.html
'
)),
{
resolveMetadata
:
true
});
const
source
=
await
service
.
resolve
(
URI
.
file
(
join
(
testDir
,
'
index.html
'
)),
{
resolveMetadata
:
true
});
assert
.
ok
(
source
.
size
>
0
);
assert
.
ok
(
source
.
size
>
0
);
...
@@ -1567,7 +1567,7 @@ suite('Disk File Service', function () {
...
@@ -1567,7 +1567,7 @@ suite('Disk File Service', function () {
async
function
assertCreateFile
(
converter
:
(
content
:
string
)
=>
VSBuffer
|
VSBufferReadable
|
VSBufferReadableStream
):
Promise
<
void
>
{
async
function
assertCreateFile
(
converter
:
(
content
:
string
)
=>
VSBuffer
|
VSBufferReadable
|
VSBufferReadableStream
):
Promise
<
void
>
{
let
event
:
FileOperationEvent
;
let
event
:
FileOperationEvent
;
disposables
.
add
(
service
.
on
After
Operation
(
e
=>
event
=
e
));
disposables
.
add
(
service
.
on
DidRun
Operation
(
e
=>
event
=
e
));
const
contents
=
'
Hello World
'
;
const
contents
=
'
Hello World
'
;
const
resource
=
URI
.
file
(
join
(
testDir
,
'
test.txt
'
));
const
resource
=
URI
.
file
(
join
(
testDir
,
'
test.txt
'
));
...
@@ -1600,7 +1600,7 @@ suite('Disk File Service', function () {
...
@@ -1600,7 +1600,7 @@ suite('Disk File Service', function () {
test
(
'
createFile (allows to overwrite existing)
'
,
async
()
=>
{
test
(
'
createFile (allows to overwrite existing)
'
,
async
()
=>
{
let
event
:
FileOperationEvent
;
let
event
:
FileOperationEvent
;
disposables
.
add
(
service
.
on
After
Operation
(
e
=>
event
=
e
));
disposables
.
add
(
service
.
on
DidRun
Operation
(
e
=>
event
=
e
));
const
contents
=
'
Hello World
'
;
const
contents
=
'
Hello World
'
;
const
resource
=
URI
.
file
(
join
(
testDir
,
'
test.txt
'
));
const
resource
=
URI
.
file
(
join
(
testDir
,
'
test.txt
'
));
...
@@ -2152,7 +2152,7 @@ suite('Disk File Service', function () {
...
@@ -2152,7 +2152,7 @@ suite('Disk File Service', function () {
return
event
.
changes
.
map
(
change
=>
`Change: type
${
toString
(
change
.
type
)}
path
${
change
.
resource
.
toString
()}
`
).
join
(
'
\n
'
);
return
event
.
changes
.
map
(
change
=>
`Change: type
${
toString
(
change
.
type
)}
path
${
change
.
resource
.
toString
()}
`
).
join
(
'
\n
'
);
}
}
const
listenerDisposable
=
service
.
on
FileChanges
(
event
=>
{
const
listenerDisposable
=
service
.
on
DidFilesChange
(
event
=>
{
watcherDisposable
.
dispose
();
watcherDisposable
.
dispose
();
listenerDisposable
.
dispose
();
listenerDisposable
.
dispose
();
...
...
src/vs/platform/files/test/node/normalizer.test.ts
浏览文件 @
954d03fd
...
@@ -15,14 +15,14 @@ function toFileChangesEvent(changes: IDiskFileChange[]): FileChangesEvent {
...
@@ -15,14 +15,14 @@ function toFileChangesEvent(changes: IDiskFileChange[]): FileChangesEvent {
}
}
class
TestFileWatcher
{
class
TestFileWatcher
{
private
readonly
_on
FileChanges
:
Emitter
<
FileChangesEvent
>
;
private
readonly
_on
DidFilesChange
:
Emitter
<
FileChangesEvent
>
;
constructor
()
{
constructor
()
{
this
.
_on
FileChanges
=
new
Emitter
<
FileChangesEvent
>
();
this
.
_on
DidFilesChange
=
new
Emitter
<
FileChangesEvent
>
();
}
}
get
on
FileChanges
():
Event
<
FileChangesEvent
>
{
get
on
DidFilesChange
():
Event
<
FileChangesEvent
>
{
return
this
.
_on
FileChanges
.
event
;
return
this
.
_on
DidFilesChange
.
event
;
}
}
report
(
changes
:
IDiskFileChange
[]):
void
{
report
(
changes
:
IDiskFileChange
[]):
void
{
...
@@ -36,7 +36,7 @@ class TestFileWatcher {
...
@@ -36,7 +36,7 @@ class TestFileWatcher {
// Emit through event emitter
// Emit through event emitter
if
(
normalizedEvents
.
length
>
0
)
{
if
(
normalizedEvents
.
length
>
0
)
{
this
.
_on
FileChanges
.
fire
(
toFileChangesEvent
(
normalizedEvents
));
this
.
_on
DidFilesChange
.
fire
(
toFileChangesEvent
(
normalizedEvents
));
}
}
}
}
}
}
...
@@ -62,7 +62,7 @@ suite('Normalizer', () => {
...
@@ -62,7 +62,7 @@ suite('Normalizer', () => {
{
path
:
deleted
.
fsPath
,
type
:
FileChangeType
.
DELETED
},
{
path
:
deleted
.
fsPath
,
type
:
FileChangeType
.
DELETED
},
];
];
watch
.
on
FileChanges
(
e
=>
{
watch
.
on
DidFilesChange
(
e
=>
{
assert
.
ok
(
e
);
assert
.
ok
(
e
);
assert
.
equal
(
e
.
changes
.
length
,
3
);
assert
.
equal
(
e
.
changes
.
length
,
3
);
assert
.
ok
(
e
.
contains
(
added
,
FileChangeType
.
ADDED
));
assert
.
ok
(
e
.
contains
(
added
,
FileChangeType
.
ADDED
));
...
@@ -101,7 +101,7 @@ suite('Normalizer', () => {
...
@@ -101,7 +101,7 @@ suite('Normalizer', () => {
{
path
:
updatedFile
.
fsPath
,
type
:
FileChangeType
.
UPDATED
}
{
path
:
updatedFile
.
fsPath
,
type
:
FileChangeType
.
UPDATED
}
];
];
watch
.
on
FileChanges
(
e
=>
{
watch
.
on
DidFilesChange
(
e
=>
{
assert
.
ok
(
e
);
assert
.
ok
(
e
);
assert
.
equal
(
e
.
changes
.
length
,
5
);
assert
.
equal
(
e
.
changes
.
length
,
5
);
...
@@ -131,7 +131,7 @@ suite('Normalizer', () => {
...
@@ -131,7 +131,7 @@ suite('Normalizer', () => {
{
path
:
unrelated
.
fsPath
,
type
:
FileChangeType
.
UPDATED
},
{
path
:
unrelated
.
fsPath
,
type
:
FileChangeType
.
UPDATED
},
];
];
watch
.
on
FileChanges
(
e
=>
{
watch
.
on
DidFilesChange
(
e
=>
{
assert
.
ok
(
e
);
assert
.
ok
(
e
);
assert
.
equal
(
e
.
changes
.
length
,
1
);
assert
.
equal
(
e
.
changes
.
length
,
1
);
...
@@ -156,7 +156,7 @@ suite('Normalizer', () => {
...
@@ -156,7 +156,7 @@ suite('Normalizer', () => {
{
path
:
unrelated
.
fsPath
,
type
:
FileChangeType
.
UPDATED
},
{
path
:
unrelated
.
fsPath
,
type
:
FileChangeType
.
UPDATED
},
];
];
watch
.
on
FileChanges
(
e
=>
{
watch
.
on
DidFilesChange
(
e
=>
{
assert
.
ok
(
e
);
assert
.
ok
(
e
);
assert
.
equal
(
e
.
changes
.
length
,
2
);
assert
.
equal
(
e
.
changes
.
length
,
2
);
...
@@ -182,7 +182,7 @@ suite('Normalizer', () => {
...
@@ -182,7 +182,7 @@ suite('Normalizer', () => {
{
path
:
unrelated
.
fsPath
,
type
:
FileChangeType
.
UPDATED
},
{
path
:
unrelated
.
fsPath
,
type
:
FileChangeType
.
UPDATED
},
];
];
watch
.
on
FileChanges
(
e
=>
{
watch
.
on
DidFilesChange
(
e
=>
{
assert
.
ok
(
e
);
assert
.
ok
(
e
);
assert
.
equal
(
e
.
changes
.
length
,
2
);
assert
.
equal
(
e
.
changes
.
length
,
2
);
...
@@ -211,7 +211,7 @@ suite('Normalizer', () => {
...
@@ -211,7 +211,7 @@ suite('Normalizer', () => {
{
path
:
updated
.
fsPath
,
type
:
FileChangeType
.
DELETED
}
{
path
:
updated
.
fsPath
,
type
:
FileChangeType
.
DELETED
}
];
];
watch
.
on
FileChanges
(
e
=>
{
watch
.
on
DidFilesChange
(
e
=>
{
assert
.
ok
(
e
);
assert
.
ok
(
e
);
assert
.
equal
(
e
.
changes
.
length
,
2
);
assert
.
equal
(
e
.
changes
.
length
,
2
);
...
...
src/vs/platform/storage/browser/storageService.ts
浏览文件 @
954d03fd
...
@@ -224,7 +224,7 @@ export class FileStorageDatabase extends Disposable implements IStorageDatabase
...
@@ -224,7 +224,7 @@ export class FileStorageDatabase extends Disposable implements IStorageDatabase
this
.
isWatching
=
true
;
this
.
isWatching
=
true
;
this
.
_register
(
this
.
fileService
.
watch
(
this
.
file
));
this
.
_register
(
this
.
fileService
.
watch
(
this
.
file
));
this
.
_register
(
this
.
fileService
.
on
FileChanges
(
e
=>
{
this
.
_register
(
this
.
fileService
.
on
DidFilesChange
(
e
=>
{
if
(
document
.
hasFocus
())
{
if
(
document
.
hasFocus
())
{
return
;
// optimization: ignore changes from ourselves by checking for focus
return
;
// optimization: ignore changes from ourselves by checking for focus
}
}
...
...
src/vs/platform/userDataSync/common/abstractSynchronizer.ts
浏览文件 @
954d03fd
...
@@ -174,7 +174,7 @@ export abstract class AbstractFileSynchroniser extends AbstractSynchroniser {
...
@@ -174,7 +174,7 @@ export abstract class AbstractFileSynchroniser extends AbstractSynchroniser {
)
{
)
{
super
(
source
,
fileService
,
environmentService
,
userDataSyncStoreService
,
userDataSyncEnablementService
,
telemetryService
,
logService
);
super
(
source
,
fileService
,
environmentService
,
userDataSyncStoreService
,
userDataSyncEnablementService
,
telemetryService
,
logService
);
this
.
_register
(
this
.
fileService
.
watch
(
dirname
(
file
)));
this
.
_register
(
this
.
fileService
.
watch
(
dirname
(
file
)));
this
.
_register
(
this
.
fileService
.
on
FileChanges
(
e
=>
this
.
onFileChanges
(
e
)));
this
.
_register
(
this
.
fileService
.
on
DidFilesChange
(
e
=>
this
.
onFileChanges
(
e
)));
}
}
async
stop
():
Promise
<
void
>
{
async
stop
():
Promise
<
void
>
{
...
...
src/vs/platform/userDataSync/common/globalStateSync.ts
浏览文件 @
954d03fd
...
@@ -39,7 +39,7 @@ export class GlobalStateSynchroniser extends AbstractSynchroniser implements IUs
...
@@ -39,7 +39,7 @@ export class GlobalStateSynchroniser extends AbstractSynchroniser implements IUs
)
{
)
{
super
(
SyncSource
.
GlobalState
,
fileService
,
environmentService
,
userDataSyncStoreService
,
userDataSyncEnablementService
,
telemetryService
,
logService
);
super
(
SyncSource
.
GlobalState
,
fileService
,
environmentService
,
userDataSyncStoreService
,
userDataSyncEnablementService
,
telemetryService
,
logService
);
this
.
_register
(
this
.
fileService
.
watch
(
dirname
(
this
.
environmentService
.
argvResource
)));
this
.
_register
(
this
.
fileService
.
watch
(
dirname
(
this
.
environmentService
.
argvResource
)));
this
.
_register
(
Event
.
filter
(
this
.
fileService
.
on
FileChanges
,
e
=>
e
.
contains
(
this
.
environmentService
.
argvResource
))(()
=>
this
.
_onDidChangeLocal
.
fire
()));
this
.
_register
(
Event
.
filter
(
this
.
fileService
.
on
DidFilesChange
,
e
=>
e
.
contains
(
this
.
environmentService
.
argvResource
))(()
=>
this
.
_onDidChangeLocal
.
fire
()));
}
}
async
pull
():
Promise
<
void
>
{
async
pull
():
Promise
<
void
>
{
...
...
src/vs/workbench/api/browser/mainThreadFileSystemEventService.ts
浏览文件 @
954d03fd
...
@@ -42,7 +42,7 @@ export class MainThreadFileSystemEventService {
...
@@ -42,7 +42,7 @@ export class MainThreadFileSystemEventService {
changed
:
[],
changed
:
[],
deleted
:
[]
deleted
:
[]
};
};
this
.
_listener
.
add
(
fileService
.
on
FileChanges
(
event
=>
{
this
.
_listener
.
add
(
fileService
.
on
DidFilesChange
(
event
=>
{
for
(
let
change
of
event
.
changes
)
{
for
(
let
change
of
event
.
changes
)
{
switch
(
change
.
type
)
{
switch
(
change
.
type
)
{
case
FileChangeType
.
ADDED
:
case
FileChangeType
.
ADDED
:
...
...
src/vs/workbench/contrib/bulkEdit/test/browser/bulkEditPreview.test.ts
浏览文件 @
954d03fd
...
@@ -24,7 +24,7 @@ suite('BulkEditPreview', function () {
...
@@ -24,7 +24,7 @@ suite('BulkEditPreview', function () {
setup
(
function
()
{
setup
(
function
()
{
const
fileService
:
IFileService
=
new
class
extends
mock
<
IFileService
>
()
{
const
fileService
:
IFileService
=
new
class
extends
mock
<
IFileService
>
()
{
on
FileChanges
=
Event
.
None
;
on
DidFilesChange
=
Event
.
None
;
async
exists
()
{
async
exists
()
{
return
true
;
return
true
;
}
}
...
...
src/vs/workbench/contrib/customEditor/browser/customEditors.ts
浏览文件 @
954d03fd
...
@@ -125,7 +125,7 @@ export class CustomEditorService extends Disposable implements ICustomEditorServ
...
@@ -125,7 +125,7 @@ export class CustomEditorService extends Disposable implements ICustomEditorServ
this
.
_register
(
this
.
_editorInfoStore
.
onChange
(()
=>
this
.
updateContexts
()));
this
.
_register
(
this
.
_editorInfoStore
.
onChange
(()
=>
this
.
updateContexts
()));
this
.
_register
(
this
.
editorService
.
onDidActiveEditorChange
(()
=>
this
.
updateContexts
()));
this
.
_register
(
this
.
editorService
.
onDidActiveEditorChange
(()
=>
this
.
updateContexts
()));
this
.
_register
(
fileService
.
on
After
Operation
(
e
=>
{
this
.
_register
(
fileService
.
on
DidRun
Operation
(
e
=>
{
if
(
e
.
isOperation
(
FileOperation
.
MOVE
))
{
if
(
e
.
isOperation
(
FileOperation
.
MOVE
))
{
this
.
handleMovedFileInOpenedFileEditors
(
e
.
resource
,
e
.
target
.
resource
);
this
.
handleMovedFileInOpenedFileEditors
(
e
.
resource
,
e
.
target
.
resource
);
}
}
...
...
src/vs/workbench/contrib/debug/browser/debugService.ts
浏览文件 @
954d03fd
...
@@ -124,7 +124,7 @@ export class DebugService implements IDebugService {
...
@@ -124,7 +124,7 @@ export class DebugService implements IDebugService {
this
.
viewModel
=
new
ViewModel
(
contextKeyService
);
this
.
viewModel
=
new
ViewModel
(
contextKeyService
);
this
.
taskRunner
=
this
.
instantiationService
.
createInstance
(
DebugTaskRunner
);
this
.
taskRunner
=
this
.
instantiationService
.
createInstance
(
DebugTaskRunner
);
this
.
toDispose
.
push
(
this
.
fileService
.
on
FileChanges
(
e
=>
this
.
onFileChanges
(
e
)));
this
.
toDispose
.
push
(
this
.
fileService
.
on
DidFilesChange
(
e
=>
this
.
onFileChanges
(
e
)));
this
.
toDispose
.
push
(
this
.
lifecycleService
.
onShutdown
(
this
.
dispose
,
this
));
this
.
toDispose
.
push
(
this
.
lifecycleService
.
onShutdown
(
this
.
dispose
,
this
));
this
.
toDispose
.
push
(
this
.
extensionHostDebugService
.
onAttachSession
(
event
=>
{
this
.
toDispose
.
push
(
this
.
extensionHostDebugService
.
onAttachSession
(
event
=>
{
...
...
src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts
浏览文件 @
954d03fd
...
@@ -53,10 +53,10 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut
...
@@ -53,10 +53,10 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut
private
registerListeners
():
void
{
private
registerListeners
():
void
{
// Update editors from operation changes
// Update editors from operation changes
this
.
_register
(
this
.
fileService
.
on
After
Operation
(
e
=>
this
.
onFileOperation
(
e
)));
this
.
_register
(
this
.
fileService
.
on
DidRun
Operation
(
e
=>
this
.
onFileOperation
(
e
)));
// Update editors from disk changes
// Update editors from disk changes
this
.
_register
(
this
.
fileService
.
on
FileChanges
(
e
=>
this
.
onFileChanges
(
e
)));
this
.
_register
(
this
.
fileService
.
on
DidFilesChange
(
e
=>
this
.
onDidFilesChange
(
e
)));
// Ensure dirty text file and untitled models are always opened as editors
// Ensure dirty text file and untitled models are always opened as editors
this
.
_register
(
this
.
textFileService
.
files
.
onDidChangeDirty
(
m
=>
this
.
ensureDirtyFilesAreOpenedWorker
.
work
(
m
.
resource
)));
this
.
_register
(
this
.
textFileService
.
files
.
onDidChangeDirty
(
m
=>
this
.
ensureDirtyFilesAreOpenedWorker
.
work
(
m
.
resource
)));
...
@@ -187,7 +187,7 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut
...
@@ -187,7 +187,7 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut
}
}
}
}
private
on
FileChanges
(
e
:
FileChangesEvent
):
void
{
private
on
DidFilesChange
(
e
:
FileChangesEvent
):
void
{
if
(
e
.
gotDeleted
())
{
if
(
e
.
gotDeleted
())
{
this
.
handleDeletes
(
e
,
true
);
this
.
handleDeletes
(
e
,
true
);
}
}
...
...
src/vs/workbench/contrib/files/browser/editors/textFileEditor.ts
浏览文件 @
954d03fd
...
@@ -61,7 +61,7 @@ export class TextFileEditor extends BaseTextEditor {
...
@@ -61,7 +61,7 @@ export class TextFileEditor extends BaseTextEditor {
this
.
updateRestoreViewStateConfiguration
();
this
.
updateRestoreViewStateConfiguration
();
// Clear view state for deleted files
// Clear view state for deleted files
this
.
_register
(
this
.
fileService
.
on
FileChanges
(
e
=>
this
.
onFilesChanged
(
e
)));
this
.
_register
(
this
.
fileService
.
on
DidFilesChange
(
e
=>
this
.
onFilesChanged
(
e
)));
}
}
private
onFilesChanged
(
e
:
FileChangesEvent
):
void
{
private
onFilesChanged
(
e
:
FileChangesEvent
):
void
{
...
...
src/vs/workbench/contrib/files/common/explorerService.ts
浏览文件 @
954d03fd
...
@@ -56,8 +56,8 @@ export class ExplorerService implements IExplorerService {
...
@@ -56,8 +56,8 @@ export class ExplorerService implements IExplorerService {
this
.
model
=
new
ExplorerModel
(
this
.
contextService
,
this
.
fileService
);
this
.
model
=
new
ExplorerModel
(
this
.
contextService
,
this
.
fileService
);
this
.
disposables
.
add
(
this
.
model
);
this
.
disposables
.
add
(
this
.
model
);
this
.
disposables
.
add
(
this
.
fileService
.
on
AfterOperation
(
e
=>
this
.
onFile
Operation
(
e
)));
this
.
disposables
.
add
(
this
.
fileService
.
on
DidRunOperation
(
e
=>
this
.
onDidRun
Operation
(
e
)));
this
.
disposables
.
add
(
this
.
fileService
.
on
FileChanges
(
e
=>
this
.
onFileChanges
(
e
)));
this
.
disposables
.
add
(
this
.
fileService
.
on
DidFilesChange
(
e
=>
this
.
onDidFilesChange
(
e
)));
this
.
disposables
.
add
(
this
.
configurationService
.
onDidChangeConfiguration
(
e
=>
this
.
onConfigurationUpdated
(
this
.
configurationService
.
getValue
<
IFilesConfiguration
>
())));
this
.
disposables
.
add
(
this
.
configurationService
.
onDidChangeConfiguration
(
e
=>
this
.
onConfigurationUpdated
(
this
.
configurationService
.
getValue
<
IFilesConfiguration
>
())));
this
.
disposables
.
add
(
Event
.
any
<
{
scheme
:
string
}
>
(
this
.
fileService
.
onDidChangeFileSystemProviderRegistrations
,
this
.
fileService
.
onDidChangeFileSystemProviderCapabilities
)(
e
=>
{
this
.
disposables
.
add
(
Event
.
any
<
{
scheme
:
string
}
>
(
this
.
fileService
.
onDidChangeFileSystemProviderRegistrations
,
this
.
fileService
.
onDidChangeFileSystemProviderCapabilities
)(
e
=>
{
let
affected
=
false
;
let
affected
=
false
;
...
@@ -214,7 +214,7 @@ export class ExplorerService implements IExplorerService {
...
@@ -214,7 +214,7 @@ export class ExplorerService implements IExplorerService {
// File events
// File events
private
on
File
Operation
(
e
:
FileOperationEvent
):
void
{
private
on
DidRun
Operation
(
e
:
FileOperationEvent
):
void
{
// Add
// Add
if
(
e
.
isOperation
(
FileOperation
.
CREATE
)
||
e
.
isOperation
(
FileOperation
.
COPY
))
{
if
(
e
.
isOperation
(
FileOperation
.
CREATE
)
||
e
.
isOperation
(
FileOperation
.
COPY
))
{
const
addedElement
=
e
.
target
;
const
addedElement
=
e
.
target
;
...
@@ -294,7 +294,7 @@ export class ExplorerService implements IExplorerService {
...
@@ -294,7 +294,7 @@ export class ExplorerService implements IExplorerService {
}
}
}
}
private
on
FileChanges
(
e
:
FileChangesEvent
):
void
{
private
on
DidFilesChange
(
e
:
FileChangesEvent
):
void
{
// Check if an explorer refresh is necessary (delayed to give internal events a chance to react first)
// Check if an explorer refresh is necessary (delayed to give internal events a chance to react first)
// Note: there is no guarantee when the internal events are fired vs real ones. Code has to deal with the fact that one might
// Note: there is no guarantee when the internal events are fired vs real ones. Code has to deal with the fact that one might
// be fired first over the other or not at all.
// be fired first over the other or not at all.
...
...
src/vs/workbench/contrib/files/common/files.ts
浏览文件 @
954d03fd
...
@@ -171,7 +171,7 @@ export class TextFileContentProvider extends Disposable implements ITextModelCon
...
@@ -171,7 +171,7 @@ export class TextFileContentProvider extends Disposable implements ITextModelCon
// Make sure to keep contents up to date when it changes
// Make sure to keep contents up to date when it changes
if
(
!
this
.
fileWatcherDisposable
.
value
)
{
if
(
!
this
.
fileWatcherDisposable
.
value
)
{
this
.
fileWatcherDisposable
.
value
=
this
.
fileService
.
on
FileChanges
(
changes
=>
{
this
.
fileWatcherDisposable
.
value
=
this
.
fileService
.
on
DidFilesChange
(
changes
=>
{
if
(
changes
.
contains
(
savedFileResource
,
FileChangeType
.
UPDATED
))
{
if
(
changes
.
contains
(
savedFileResource
,
FileChangeType
.
UPDATED
))
{
this
.
resolveEditorModel
(
resource
,
false
/* do not create if missing */
);
// update model when resource changes
this
.
resolveEditorModel
(
resource
,
false
/* do not create if missing */
);
// update model when resource changes
}
}
...
...
src/vs/workbench/contrib/logs/common/logs.contribution.ts
浏览文件 @
954d03fd
...
@@ -80,7 +80,7 @@ class LogOutputChannels extends Disposable implements IWorkbenchContribution {
...
@@ -80,7 +80,7 @@ class LogOutputChannels extends Disposable implements IWorkbenchContribution {
}
}
const
watcher
=
this
.
fileService
.
watch
(
dirname
(
file
));
const
watcher
=
this
.
fileService
.
watch
(
dirname
(
file
));
const
disposable
=
this
.
fileService
.
on
FileChanges
(
e
=>
{
const
disposable
=
this
.
fileService
.
on
DidFilesChange
(
e
=>
{
if
(
e
.
contains
(
file
,
FileChangeType
.
ADDED
)
||
e
.
contains
(
file
,
FileChangeType
.
UPDATED
))
{
if
(
e
.
contains
(
file
,
FileChangeType
.
ADDED
)
||
e
.
contains
(
file
,
FileChangeType
.
UPDATED
))
{
watcher
.
dispose
();
watcher
.
dispose
();
disposable
.
dispose
();
disposable
.
dispose
();
...
...
src/vs/workbench/contrib/search/browser/searchView.ts
浏览文件 @
954d03fd
...
@@ -212,7 +212,7 @@ export class SearchView extends ViewPane {
...
@@ -212,7 +212,7 @@ export class SearchView extends ViewPane {
this
.
memento
=
new
Memento
(
this
.
id
,
storageService
);
this
.
memento
=
new
Memento
(
this
.
id
,
storageService
);
this
.
viewletState
=
this
.
memento
.
getMemento
(
StorageScope
.
WORKSPACE
);
this
.
viewletState
=
this
.
memento
.
getMemento
(
StorageScope
.
WORKSPACE
);
this
.
_register
(
this
.
fileService
.
on
FileChanges
(
e
=>
this
.
onFilesChanged
(
e
)));
this
.
_register
(
this
.
fileService
.
on
DidFilesChange
(
e
=>
this
.
onFilesChanged
(
e
)));
this
.
_register
(
this
.
textFileService
.
untitled
.
onDidDisposeModel
(
e
=>
this
.
onUntitledDidDispose
(
e
)));
this
.
_register
(
this
.
textFileService
.
untitled
.
onDidDisposeModel
(
e
=>
this
.
onUntitledDidDispose
(
e
)));
this
.
_register
(
this
.
contextService
.
onDidChangeWorkbenchState
(()
=>
this
.
onDidChangeWorkbenchState
()));
this
.
_register
(
this
.
contextService
.
onDidChangeWorkbenchState
(()
=>
this
.
onDidChangeWorkbenchState
()));
this
.
_register
(
this
.
searchHistoryService
.
onDidClearHistory
(()
=>
this
.
clearHistory
()));
this
.
_register
(
this
.
searchHistoryService
.
onDidClearHistory
(()
=>
this
.
clearHistory
()));
...
...
src/vs/workbench/contrib/snippets/browser/snippetsService.ts
浏览文件 @
954d03fd
...
@@ -116,7 +116,7 @@ namespace snippetExt {
...
@@ -116,7 +116,7 @@ namespace snippetExt {
function
watch
(
service
:
IFileService
,
resource
:
URI
,
callback
:
(
type
:
FileChangeType
,
resource
:
URI
)
=>
any
):
IDisposable
{
function
watch
(
service
:
IFileService
,
resource
:
URI
,
callback
:
(
type
:
FileChangeType
,
resource
:
URI
)
=>
any
):
IDisposable
{
return
combinedDisposable
(
return
combinedDisposable
(
service
.
watch
(
resource
),
service
.
watch
(
resource
),
service
.
on
FileChanges
(
e
=>
{
service
.
on
DidFilesChange
(
e
=>
{
for
(
const
change
of
e
.
changes
)
{
for
(
const
change
of
e
.
changes
)
{
if
(
resources
.
isEqualOrParent
(
change
.
resource
,
resource
))
{
if
(
resources
.
isEqualOrParent
(
change
.
resource
,
resource
))
{
callback
(
change
.
type
,
change
.
resource
);
callback
(
change
.
type
,
change
.
resource
);
...
@@ -277,7 +277,7 @@ class SnippetsService implements ISnippetsService {
...
@@ -277,7 +277,7 @@ class SnippetsService implements ISnippetsService {
this
.
_initFolderSnippets
(
SnippetSource
.
Workspace
,
snippetFolder
,
bucket
);
this
.
_initFolderSnippets
(
SnippetSource
.
Workspace
,
snippetFolder
,
bucket
);
}
else
{
}
else
{
// watch
// watch
bucket
.
add
(
this
.
_fileService
.
on
FileChanges
(
e
=>
{
bucket
.
add
(
this
.
_fileService
.
on
DidFilesChange
(
e
=>
{
if
(
e
.
contains
(
snippetFolder
,
FileChangeType
.
ADDED
))
{
if
(
e
.
contains
(
snippetFolder
,
FileChangeType
.
ADDED
))
{
this
.
_initFolderSnippets
(
SnippetSource
.
Workspace
,
snippetFolder
,
bucket
);
this
.
_initFolderSnippets
(
SnippetSource
.
Workspace
,
snippetFolder
,
bucket
);
}
}
...
...
src/vs/workbench/services/bulkEdit/browser/conflicts.ts
浏览文件 @
954d03fd
...
@@ -50,7 +50,7 @@ export class ConflictDetector {
...
@@ -50,7 +50,7 @@ export class ConflictDetector {
}
}
// listen to file changes
// listen to file changes
this
.
_disposables
.
add
(
fileService
.
on
FileChanges
(
e
=>
{
this
.
_disposables
.
add
(
fileService
.
on
DidFilesChange
(
e
=>
{
for
(
let
change
of
e
.
changes
)
{
for
(
let
change
of
e
.
changes
)
{
if
(
modelService
.
getModel
(
change
.
resource
))
{
if
(
modelService
.
getModel
(
change
.
resource
))
{
...
...
src/vs/workbench/services/configuration/browser/configuration.ts
浏览文件 @
954d03fd
...
@@ -86,7 +86,7 @@ class FileServiceBasedConfigurationWithNames extends Disposable {
...
@@ -86,7 +86,7 @@ class FileServiceBasedConfigurationWithNames extends Disposable {
this
.
_cache
=
new
ConfigurationModel
();
this
.
_cache
=
new
ConfigurationModel
();
this
.
changeEventTriggerScheduler
=
this
.
_register
(
new
RunOnceScheduler
(()
=>
this
.
_onDidChange
.
fire
(),
50
));
this
.
changeEventTriggerScheduler
=
this
.
_register
(
new
RunOnceScheduler
(()
=>
this
.
_onDidChange
.
fire
(),
50
));
this
.
_register
(
this
.
fileService
.
on
FileChanges
((
e
)
=>
this
.
handleFileEvents
(
e
)));
this
.
_register
(
this
.
fileService
.
on
DidFilesChange
((
e
)
=>
this
.
handleFileEvents
(
e
)));
}
}
async
loadConfiguration
():
Promise
<
ConfigurationModel
>
{
async
loadConfiguration
():
Promise
<
ConfigurationModel
>
{
...
@@ -268,7 +268,7 @@ class FileServiceBasedRemoteUserConfiguration extends Disposable {
...
@@ -268,7 +268,7 @@ class FileServiceBasedRemoteUserConfiguration extends Disposable {
super
();
super
();
this
.
parser
=
new
ConfigurationModelParser
(
this
.
configurationResource
.
toString
(),
this
.
scopes
);
this
.
parser
=
new
ConfigurationModelParser
(
this
.
configurationResource
.
toString
(),
this
.
scopes
);
this
.
_register
(
fileService
.
on
FileChanges
(
e
=>
this
.
handleFileEvents
(
e
)));
this
.
_register
(
fileService
.
on
DidFilesChange
(
e
=>
this
.
handleFileEvents
(
e
)));
this
.
reloadConfigurationScheduler
=
this
.
_register
(
new
RunOnceScheduler
(()
=>
this
.
reload
().
then
(
configurationModel
=>
this
.
_onDidChangeConfiguration
.
fire
(
configurationModel
)),
50
));
this
.
reloadConfigurationScheduler
=
this
.
_register
(
new
RunOnceScheduler
(()
=>
this
.
reload
().
then
(
configurationModel
=>
this
.
_onDidChangeConfiguration
.
fire
(
configurationModel
)),
50
));
this
.
_register
(
toDisposable
(()
=>
{
this
.
_register
(
toDisposable
(()
=>
{
this
.
stopWatchingResource
();
this
.
stopWatchingResource
();
...
@@ -523,7 +523,7 @@ class FileServiceBasedWorkspaceConfiguration extends Disposable implements IWork
...
@@ -523,7 +523,7 @@ class FileServiceBasedWorkspaceConfiguration extends Disposable implements IWork
this
.
workspaceConfigurationModelParser
=
new
WorkspaceConfigurationModelParser
(
''
);
this
.
workspaceConfigurationModelParser
=
new
WorkspaceConfigurationModelParser
(
''
);
this
.
workspaceSettings
=
new
ConfigurationModel
();
this
.
workspaceSettings
=
new
ConfigurationModel
();
this
.
_register
(
fileService
.
on
FileChanges
(
e
=>
this
.
handleWorkspaceFileEvents
(
e
)));
this
.
_register
(
fileService
.
on
DidFilesChange
(
e
=>
this
.
handleWorkspaceFileEvents
(
e
)));
this
.
reloadConfigurationScheduler
=
this
.
_register
(
new
RunOnceScheduler
(()
=>
this
.
_onDidChange
.
fire
(),
50
));
this
.
reloadConfigurationScheduler
=
this
.
_register
(
new
RunOnceScheduler
(()
=>
this
.
_onDidChange
.
fire
(),
50
));
this
.
workspaceConfigWatcher
=
this
.
_register
(
this
.
watchWorkspaceConfigurationFile
());
this
.
workspaceConfigWatcher
=
this
.
_register
(
this
.
watchWorkspaceConfigurationFile
());
}
}
...
...
src/vs/workbench/services/history/browser/history.ts
浏览文件 @
954d03fd
...
@@ -125,7 +125,7 @@ export class HistoryService extends Disposable implements IHistoryService {
...
@@ -125,7 +125,7 @@ export class HistoryService extends Disposable implements IHistoryService {
this
.
_register
(
this
.
editorService
.
onDidOpenEditorFail
(
event
=>
this
.
remove
(
event
.
editor
)));
this
.
_register
(
this
.
editorService
.
onDidOpenEditorFail
(
event
=>
this
.
remove
(
event
.
editor
)));
this
.
_register
(
this
.
editorService
.
onDidCloseEditor
(
event
=>
this
.
onEditorClosed
(
event
)));
this
.
_register
(
this
.
editorService
.
onDidCloseEditor
(
event
=>
this
.
onEditorClosed
(
event
)));
this
.
_register
(
this
.
storageService
.
onWillSaveState
(()
=>
this
.
saveState
()));
this
.
_register
(
this
.
storageService
.
onWillSaveState
(()
=>
this
.
saveState
()));
this
.
_register
(
this
.
fileService
.
on
FileChanges
(
event
=>
this
.
onFileChanges
(
event
)));
this
.
_register
(
this
.
fileService
.
on
DidFilesChange
(
event
=>
this
.
onDidFilesChange
(
event
)));
this
.
_register
(
this
.
resourceFilter
.
onExpressionChange
(()
=>
this
.
removeExcludedFromHistory
()));
this
.
_register
(
this
.
resourceFilter
.
onExpressionChange
(()
=>
this
.
removeExcludedFromHistory
()));
this
.
_register
(
this
.
editorService
.
onDidMostRecentlyActiveEditorsChange
(()
=>
this
.
handleEditorEventInRecentEditorsStack
()));
this
.
_register
(
this
.
editorService
.
onDidMostRecentlyActiveEditorsChange
(()
=>
this
.
handleEditorEventInRecentEditorsStack
()));
...
@@ -220,7 +220,7 @@ export class HistoryService extends Disposable implements IHistoryService {
...
@@ -220,7 +220,7 @@ export class HistoryService extends Disposable implements IHistoryService {
return
identifier
.
editor
.
matches
(
editor
.
input
);
return
identifier
.
editor
.
matches
(
editor
.
input
);
}
}
private
on
FileChanges
(
e
:
FileChangesEvent
):
void
{
private
on
DidFilesChange
(
e
:
FileChangesEvent
):
void
{
if
(
e
.
gotDeleted
())
{
if
(
e
.
gotDeleted
())
{
this
.
remove
(
e
);
// remove from history files that got deleted or moved
this
.
remove
(
e
);
// remove from history files that got deleted or moved
}
}
...
...
src/vs/workbench/services/keybinding/browser/keybindingService.ts
浏览文件 @
954d03fd
...
@@ -635,7 +635,7 @@ class UserKeybindings extends Disposable {
...
@@ -635,7 +635,7 @@ class UserKeybindings extends Disposable {
this
.
_onDidChange
.
fire
();
this
.
_onDidChange
.
fire
();
}
}
}),
50
));
}),
50
));
this
.
_register
(
Event
.
filter
(
this
.
fileService
.
on
FileChanges
,
e
=>
e
.
contains
(
this
.
keybindingsResource
))(()
=>
this
.
reloadConfigurationScheduler
.
schedule
()));
this
.
_register
(
Event
.
filter
(
this
.
fileService
.
on
DidFilesChange
,
e
=>
e
.
contains
(
this
.
keybindingsResource
))(()
=>
this
.
reloadConfigurationScheduler
.
schedule
()));
}
}
async
initialize
():
Promise
<
void
>
{
async
initialize
():
Promise
<
void
>
{
...
...
src/vs/workbench/services/keybinding/browser/keymapService.ts
浏览文件 @
954d03fd
...
@@ -474,7 +474,7 @@ class UserKeyboardLayout extends Disposable {
...
@@ -474,7 +474,7 @@ class UserKeyboardLayout extends Disposable {
}
}
}),
50
));
}),
50
));
this
.
_register
(
Event
.
filter
(
this
.
fileService
.
on
FileChanges
,
e
=>
e
.
contains
(
this
.
keyboardLayoutResource
))(()
=>
this
.
reloadConfigurationScheduler
.
schedule
()));
this
.
_register
(
Event
.
filter
(
this
.
fileService
.
on
DidFilesChange
,
e
=>
e
.
contains
(
this
.
keyboardLayoutResource
))(()
=>
this
.
reloadConfigurationScheduler
.
schedule
()));
}
}
async
initialize
():
Promise
<
void
>
{
async
initialize
():
Promise
<
void
>
{
...
...
src/vs/workbench/services/output/electron-browser/outputChannelModelService.ts
浏览文件 @
954d03fd
...
@@ -52,7 +52,7 @@ class OutputChannelBackedByFile extends AbstractFileOutputChannelModel implement
...
@@ -52,7 +52,7 @@ class OutputChannelBackedByFile extends AbstractFileOutputChannelModel implement
this
.
rotatingFilePath
=
resources
.
joinPath
(
rotatingFilePathDirectory
,
`
${
id
}
.1.log`
);
this
.
rotatingFilePath
=
resources
.
joinPath
(
rotatingFilePathDirectory
,
`
${
id
}
.1.log`
);
this
.
_register
(
fileService
.
watch
(
rotatingFilePathDirectory
));
this
.
_register
(
fileService
.
watch
(
rotatingFilePathDirectory
));
this
.
_register
(
fileService
.
on
FileChanges
(
e
=>
{
this
.
_register
(
fileService
.
on
DidFilesChange
(
e
=>
{
if
(
e
.
contains
(
this
.
rotatingFilePath
))
{
if
(
e
.
contains
(
this
.
rotatingFilePath
))
{
this
.
resettingDelayer
.
trigger
(()
=>
this
.
resetModel
());
this
.
resettingDelayer
.
trigger
(()
=>
this
.
resetModel
());
}
}
...
...
src/vs/workbench/services/textfile/common/textFileEditorModel.ts
浏览文件 @
954d03fd
...
@@ -110,11 +110,11 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
...
@@ -110,11 +110,11 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
}
}
private
registerListeners
():
void
{
private
registerListeners
():
void
{
this
.
_register
(
this
.
fileService
.
on
FileChanges
(
e
=>
this
.
onFileChanges
(
e
)));
this
.
_register
(
this
.
fileService
.
on
DidFilesChange
(
e
=>
this
.
onDidFilesChange
(
e
)));
this
.
_register
(
this
.
filesConfigurationService
.
onFilesAssociationChange
(
e
=>
this
.
onFilesAssociationChange
()));
this
.
_register
(
this
.
filesConfigurationService
.
onFilesAssociationChange
(
e
=>
this
.
onFilesAssociationChange
()));
}
}
private
async
on
FileChanges
(
e
:
FileChangesEvent
):
Promise
<
void
>
{
private
async
on
DidFilesChange
(
e
:
FileChangesEvent
):
Promise
<
void
>
{
let
fileEventImpactsModel
=
false
;
let
fileEventImpactsModel
=
false
;
let
newInOrphanModeGuess
:
boolean
|
undefined
;
let
newInOrphanModeGuess
:
boolean
|
undefined
;
...
...
src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts
浏览文件 @
954d03fd
...
@@ -83,7 +83,7 @@ export class TextFileEditorModelManager extends Disposable implements ITextFileE
...
@@ -83,7 +83,7 @@ export class TextFileEditorModelManager extends Disposable implements ITextFileE
private
registerListeners
():
void
{
private
registerListeners
():
void
{
// Update models from file change events
// Update models from file change events
this
.
_register
(
this
.
fileService
.
on
FileChanges
(
e
=>
this
.
onFileChanges
(
e
)));
this
.
_register
(
this
.
fileService
.
on
DidFilesChange
(
e
=>
this
.
onDidFilesChange
(
e
)));
// Working copy operations
// Working copy operations
this
.
_register
(
this
.
workingCopyFileService
.
onWillRunWorkingCopyFileOperation
(
e
=>
this
.
onWillRunWorkingCopyFileOperation
(
e
)));
this
.
_register
(
this
.
workingCopyFileService
.
onWillRunWorkingCopyFileOperation
(
e
=>
this
.
onWillRunWorkingCopyFileOperation
(
e
)));
...
@@ -94,7 +94,7 @@ export class TextFileEditorModelManager extends Disposable implements ITextFileE
...
@@ -94,7 +94,7 @@ export class TextFileEditorModelManager extends Disposable implements ITextFileE
this
.
lifecycleService
.
onShutdown
(
this
.
dispose
,
this
);
this
.
lifecycleService
.
onShutdown
(
this
.
dispose
,
this
);
}
}
private
on
FileChanges
(
e
:
FileChangesEvent
):
void
{
private
on
DidFilesChange
(
e
:
FileChangesEvent
):
void
{
// Collect distinct (saved) models to update.
// Collect distinct (saved) models to update.
//
//
...
...
src/vs/workbench/services/themes/browser/workbenchThemeService.ts
浏览文件 @
954d03fd
...
@@ -252,7 +252,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
...
@@ -252,7 +252,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
}
}
});
});
this
.
fileService
.
on
FileChanges
(
async
e
=>
{
this
.
fileService
.
on
DidFilesChange
(
async
e
=>
{
if
(
this
.
watchedColorThemeLocation
&&
this
.
currentColorTheme
&&
e
.
contains
(
this
.
watchedColorThemeLocation
,
FileChangeType
.
UPDATED
))
{
if
(
this
.
watchedColorThemeLocation
&&
this
.
currentColorTheme
&&
e
.
contains
(
this
.
watchedColorThemeLocation
,
FileChangeType
.
UPDATED
))
{
this
.
reloadCurrentColorTheme
();
this
.
reloadCurrentColorTheme
();
}
}
...
...
src/vs/workbench/services/userData/test/electron-browser/fileUserDataProvider.test.ts
浏览文件 @
954d03fd
...
@@ -348,7 +348,7 @@ suite('FileUserDataProvider - Watching', () => {
...
@@ -348,7 +348,7 @@ suite('FileUserDataProvider - Watching', () => {
test
(
'
file added change event
'
,
done
=>
{
test
(
'
file added change event
'
,
done
=>
{
const
expected
=
joinPath
(
userDataResource
,
'
settings.json
'
);
const
expected
=
joinPath
(
userDataResource
,
'
settings.json
'
);
const
target
=
joinPath
(
localUserDataResource
,
'
settings.json
'
);
const
target
=
joinPath
(
localUserDataResource
,
'
settings.json
'
);
testObject
.
on
FileChanges
(
e
=>
{
testObject
.
on
DidFilesChange
(
e
=>
{
if
(
e
.
contains
(
expected
,
FileChangeType
.
ADDED
))
{
if
(
e
.
contains
(
expected
,
FileChangeType
.
ADDED
))
{
done
();
done
();
}
}
...
@@ -362,7 +362,7 @@ suite('FileUserDataProvider - Watching', () => {
...
@@ -362,7 +362,7 @@ suite('FileUserDataProvider - Watching', () => {
test
(
'
file updated change event
'
,
done
=>
{
test
(
'
file updated change event
'
,
done
=>
{
const
expected
=
joinPath
(
userDataResource
,
'
settings.json
'
);
const
expected
=
joinPath
(
userDataResource
,
'
settings.json
'
);
const
target
=
joinPath
(
localUserDataResource
,
'
settings.json
'
);
const
target
=
joinPath
(
localUserDataResource
,
'
settings.json
'
);
testObject
.
on
FileChanges
(
e
=>
{
testObject
.
on
DidFilesChange
(
e
=>
{
if
(
e
.
contains
(
expected
,
FileChangeType
.
UPDATED
))
{
if
(
e
.
contains
(
expected
,
FileChangeType
.
UPDATED
))
{
done
();
done
();
}
}
...
@@ -376,7 +376,7 @@ suite('FileUserDataProvider - Watching', () => {
...
@@ -376,7 +376,7 @@ suite('FileUserDataProvider - Watching', () => {
test
(
'
file deleted change event
'
,
done
=>
{
test
(
'
file deleted change event
'
,
done
=>
{
const
expected
=
joinPath
(
userDataResource
,
'
settings.json
'
);
const
expected
=
joinPath
(
userDataResource
,
'
settings.json
'
);
const
target
=
joinPath
(
localUserDataResource
,
'
settings.json
'
);
const
target
=
joinPath
(
localUserDataResource
,
'
settings.json
'
);
testObject
.
on
FileChanges
(
e
=>
{
testObject
.
on
DidFilesChange
(
e
=>
{
if
(
e
.
contains
(
expected
,
FileChangeType
.
DELETED
))
{
if
(
e
.
contains
(
expected
,
FileChangeType
.
DELETED
))
{
done
();
done
();
}
}
...
@@ -390,7 +390,7 @@ suite('FileUserDataProvider - Watching', () => {
...
@@ -390,7 +390,7 @@ suite('FileUserDataProvider - Watching', () => {
test
(
'
file under folder created change event
'
,
done
=>
{
test
(
'
file under folder created change event
'
,
done
=>
{
const
expected
=
joinPath
(
userDataResource
,
'
snippets
'
,
'
settings.json
'
);
const
expected
=
joinPath
(
userDataResource
,
'
snippets
'
,
'
settings.json
'
);
const
target
=
joinPath
(
localUserDataResource
,
'
snippets
'
,
'
settings.json
'
);
const
target
=
joinPath
(
localUserDataResource
,
'
snippets
'
,
'
settings.json
'
);
testObject
.
on
FileChanges
(
e
=>
{
testObject
.
on
DidFilesChange
(
e
=>
{
if
(
e
.
contains
(
expected
,
FileChangeType
.
ADDED
))
{
if
(
e
.
contains
(
expected
,
FileChangeType
.
ADDED
))
{
done
();
done
();
}
}
...
@@ -404,7 +404,7 @@ suite('FileUserDataProvider - Watching', () => {
...
@@ -404,7 +404,7 @@ suite('FileUserDataProvider - Watching', () => {
test
(
'
file under folder updated change event
'
,
done
=>
{
test
(
'
file under folder updated change event
'
,
done
=>
{
const
expected
=
joinPath
(
userDataResource
,
'
snippets
'
,
'
settings.json
'
);
const
expected
=
joinPath
(
userDataResource
,
'
snippets
'
,
'
settings.json
'
);
const
target
=
joinPath
(
localUserDataResource
,
'
snippets
'
,
'
settings.json
'
);
const
target
=
joinPath
(
localUserDataResource
,
'
snippets
'
,
'
settings.json
'
);
testObject
.
on
FileChanges
(
e
=>
{
testObject
.
on
DidFilesChange
(
e
=>
{
if
(
e
.
contains
(
expected
,
FileChangeType
.
UPDATED
))
{
if
(
e
.
contains
(
expected
,
FileChangeType
.
UPDATED
))
{
done
();
done
();
}
}
...
@@ -418,7 +418,7 @@ suite('FileUserDataProvider - Watching', () => {
...
@@ -418,7 +418,7 @@ suite('FileUserDataProvider - Watching', () => {
test
(
'
file under folder deleted change event
'
,
done
=>
{
test
(
'
file under folder deleted change event
'
,
done
=>
{
const
expected
=
joinPath
(
userDataResource
,
'
snippets
'
,
'
settings.json
'
);
const
expected
=
joinPath
(
userDataResource
,
'
snippets
'
,
'
settings.json
'
);
const
target
=
joinPath
(
localUserDataResource
,
'
snippets
'
,
'
settings.json
'
);
const
target
=
joinPath
(
localUserDataResource
,
'
snippets
'
,
'
settings.json
'
);
testObject
.
on
FileChanges
(
e
=>
{
testObject
.
on
DidFilesChange
(
e
=>
{
if
(
e
.
contains
(
expected
,
FileChangeType
.
DELETED
))
{
if
(
e
.
contains
(
expected
,
FileChangeType
.
DELETED
))
{
done
();
done
();
}
}
...
@@ -432,7 +432,7 @@ suite('FileUserDataProvider - Watching', () => {
...
@@ -432,7 +432,7 @@ suite('FileUserDataProvider - Watching', () => {
test
(
'
event is not triggered if file is not under user data
'
,
async
()
=>
{
test
(
'
event is not triggered if file is not under user data
'
,
async
()
=>
{
const
target
=
joinPath
(
dirname
(
localUserDataResource
),
'
settings.json
'
);
const
target
=
joinPath
(
dirname
(
localUserDataResource
),
'
settings.json
'
);
let
triggered
=
false
;
let
triggered
=
false
;
testObject
.
on
FileChanges
(()
=>
triggered
=
true
);
testObject
.
on
DidFilesChange
(()
=>
triggered
=
true
);
fileEventEmitter
.
fire
([{
fileEventEmitter
.
fire
([{
resource
:
target
,
resource
:
target
,
type
:
FileChangeType
.
DELETED
type
:
FileChangeType
.
DELETED
...
@@ -446,7 +446,7 @@ suite('FileUserDataProvider - Watching', () => {
...
@@ -446,7 +446,7 @@ suite('FileUserDataProvider - Watching', () => {
test
(
'
backup file created change event
'
,
done
=>
{
test
(
'
backup file created change event
'
,
done
=>
{
const
expected
=
joinPath
(
userDataResource
,
BACKUPS
,
'
settings.json
'
);
const
expected
=
joinPath
(
userDataResource
,
BACKUPS
,
'
settings.json
'
);
const
target
=
joinPath
(
localBackupsResource
,
'
settings.json
'
);
const
target
=
joinPath
(
localBackupsResource
,
'
settings.json
'
);
testObject
.
on
FileChanges
(
e
=>
{
testObject
.
on
DidFilesChange
(
e
=>
{
if
(
e
.
contains
(
expected
,
FileChangeType
.
ADDED
))
{
if
(
e
.
contains
(
expected
,
FileChangeType
.
ADDED
))
{
done
();
done
();
}
}
...
@@ -460,7 +460,7 @@ suite('FileUserDataProvider - Watching', () => {
...
@@ -460,7 +460,7 @@ suite('FileUserDataProvider - Watching', () => {
test
(
'
backup file update change event
'
,
done
=>
{
test
(
'
backup file update change event
'
,
done
=>
{
const
expected
=
joinPath
(
userDataResource
,
BACKUPS
,
'
settings.json
'
);
const
expected
=
joinPath
(
userDataResource
,
BACKUPS
,
'
settings.json
'
);
const
target
=
joinPath
(
localBackupsResource
,
'
settings.json
'
);
const
target
=
joinPath
(
localBackupsResource
,
'
settings.json
'
);
testObject
.
on
FileChanges
(
e
=>
{
testObject
.
on
DidFilesChange
(
e
=>
{
if
(
e
.
contains
(
expected
,
FileChangeType
.
UPDATED
))
{
if
(
e
.
contains
(
expected
,
FileChangeType
.
UPDATED
))
{
done
();
done
();
}
}
...
@@ -474,7 +474,7 @@ suite('FileUserDataProvider - Watching', () => {
...
@@ -474,7 +474,7 @@ suite('FileUserDataProvider - Watching', () => {
test
(
'
backup file delete change event
'
,
done
=>
{
test
(
'
backup file delete change event
'
,
done
=>
{
const
expected
=
joinPath
(
userDataResource
,
BACKUPS
,
'
settings.json
'
);
const
expected
=
joinPath
(
userDataResource
,
BACKUPS
,
'
settings.json
'
);
const
target
=
joinPath
(
localBackupsResource
,
'
settings.json
'
);
const
target
=
joinPath
(
localBackupsResource
,
'
settings.json
'
);
testObject
.
on
FileChanges
(
e
=>
{
testObject
.
on
DidFilesChange
(
e
=>
{
if
(
e
.
contains
(
expected
,
FileChangeType
.
DELETED
))
{
if
(
e
.
contains
(
expected
,
FileChangeType
.
DELETED
))
{
done
();
done
();
}
}
...
...
src/vs/workbench/test/browser/api/mainThreadDocumentsAndEditors.test.ts
浏览文件 @
954d03fd
...
@@ -58,7 +58,7 @@ suite('MainThreadDocumentsAndEditors', () => {
...
@@ -58,7 +58,7 @@ suite('MainThreadDocumentsAndEditors', () => {
const
editorGroupService
=
new
TestEditorGroupsService
();
const
editorGroupService
=
new
TestEditorGroupsService
();
const
fileService
=
new
class
extends
mock
<
IFileService
>
()
{
const
fileService
=
new
class
extends
mock
<
IFileService
>
()
{
on
After
Operation
=
Event
.
None
;
on
DidRun
Operation
=
Event
.
None
;
};
};
new
MainThreadDocumentsAndEditors
(
new
MainThreadDocumentsAndEditors
(
...
...
src/vs/workbench/test/browser/workbenchTestServices.ts
浏览文件 @
954d03fd
...
@@ -603,8 +603,8 @@ export class TestFileService implements IFileService {
...
@@ -603,8 +603,8 @@ export class TestFileService implements IFileService {
_serviceBrand
:
undefined
;
_serviceBrand
:
undefined
;
private
readonly
_on
FileChanges
:
Emitter
<
FileChangesEvent
>
;
private
readonly
_on
DidFilesChange
=
new
Emitter
<
FileChangesEvent
>
()
;
private
readonly
_on
AfterOperation
:
Emitter
<
FileOperationEvent
>
;
private
readonly
_on
DidRunOperation
=
new
Emitter
<
FileOperationEvent
>
()
;
readonly
onWillActivateFileSystemProvider
=
Event
.
None
;
readonly
onWillActivateFileSystemProvider
=
Event
.
None
;
readonly
onDidChangeFileSystemProviderCapabilities
=
Event
.
None
;
readonly
onDidChangeFileSystemProviderCapabilities
=
Event
.
None
;
...
@@ -613,18 +613,13 @@ export class TestFileService implements IFileService {
...
@@ -613,18 +613,13 @@ export class TestFileService implements IFileService {
private
content
=
'
Hello Html
'
;
private
content
=
'
Hello Html
'
;
private
lastReadFileUri
!
:
URI
;
private
lastReadFileUri
!
:
URI
;
constructor
()
{
this
.
_onFileChanges
=
new
Emitter
<
FileChangesEvent
>
();
this
.
_onAfterOperation
=
new
Emitter
<
FileOperationEvent
>
();
}
setContent
(
content
:
string
):
void
{
this
.
content
=
content
;
}
setContent
(
content
:
string
):
void
{
this
.
content
=
content
;
}
getContent
():
string
{
return
this
.
content
;
}
getContent
():
string
{
return
this
.
content
;
}
getLastReadFileUri
():
URI
{
return
this
.
lastReadFileUri
;
}
getLastReadFileUri
():
URI
{
return
this
.
lastReadFileUri
;
}
get
on
FileChanges
():
Event
<
FileChangesEvent
>
{
return
this
.
_onFileChanges
.
event
;
}
get
on
DidFilesChange
():
Event
<
FileChangesEvent
>
{
return
this
.
_onDidFilesChange
.
event
;
}
fireFileChanges
(
event
:
FileChangesEvent
):
void
{
this
.
_on
FileChanges
.
fire
(
event
);
}
fireFileChanges
(
event
:
FileChangesEvent
):
void
{
this
.
_on
DidFilesChange
.
fire
(
event
);
}
get
on
AfterOperation
():
Event
<
FileOperationEvent
>
{
return
this
.
_onAfter
Operation
.
event
;
}
get
on
DidRunOperation
():
Event
<
FileOperationEvent
>
{
return
this
.
_onDidRun
Operation
.
event
;
}
fireAfterOperation
(
event
:
FileOperationEvent
):
void
{
this
.
_on
After
Operation
.
fire
(
event
);
}
fireAfterOperation
(
event
:
FileOperationEvent
):
void
{
this
.
_on
DidRun
Operation
.
fire
(
event
);
}
resolve
(
resource
:
URI
,
_options
?:
IResolveFileOptions
):
Promise
<
IFileStat
>
;
resolve
(
resource
:
URI
,
_options
?:
IResolveFileOptions
):
Promise
<
IFileStat
>
;
resolve
(
resource
:
URI
,
_options
:
IResolveMetadataFileOptions
):
Promise
<
IFileStatWithMetadata
>
;
resolve
(
resource
:
URI
,
_options
:
IResolveMetadataFileOptions
):
Promise
<
IFileStatWithMetadata
>
;
resolve
(
resource
:
URI
,
_options
?:
IResolveFileOptions
):
Promise
<
IFileStat
>
{
resolve
(
resource
:
URI
,
_options
?:
IResolveFileOptions
):
Promise
<
IFileStat
>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录