Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
62c66c72
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,发现更多精彩内容 >>
提交
62c66c72
编写于
3月 02, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Investigate to reduce working files watcher to only the ones opened (fixes #3617)
上级
49ed473d
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
26 addition
and
25 deletion
+26
-25
src/vs/workbench/parts/files/electron-browser/electronFileTracker.ts
...bench/parts/files/electron-browser/electronFileTracker.ts
+26
-25
未找到文件。
src/vs/workbench/parts/files/electron-browser/electronFileTracker.ts
浏览文件 @
62c66c72
...
@@ -6,11 +6,13 @@
...
@@ -6,11 +6,13 @@
'
use strict
'
;
'
use strict
'
;
import
{
IWorkbenchContribution
}
from
'
vs/workbench/common/contributions
'
;
import
{
IWorkbenchContribution
}
from
'
vs/workbench/common/contributions
'
;
import
{
LocalFileChangeEvent
,
IWorkingFileModelChangeEvent
,
EventType
as
FileEventType
,
ITextFileService
,
AutoSaveMode
}
from
'
vs/workbench/parts/files/common/files
'
;
import
{
LocalFileChangeEvent
,
EventType
as
FileEventType
,
ITextFileService
,
AutoSaveMode
}
from
'
vs/workbench/parts/files/common/files
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
OpenResourcesAction
}
from
'
vs/workbench/parts/files/browser/fileActions
'
;
import
{
OpenResourcesAction
}
from
'
vs/workbench/parts/files/browser/fileActions
'
;
import
plat
=
require
(
'
vs/base/common/platform
'
);
import
plat
=
require
(
'
vs/base/common/platform
'
);
import
{
asFileEditorInput
}
from
'
vs/workbench/common/editor
'
;
import
errors
=
require
(
'
vs/base/common/errors
'
);
import
errors
=
require
(
'
vs/base/common/errors
'
);
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
EventType
as
WorkbenchEventType
}
from
'
vs/workbench/common/events
'
;
import
{
EventType
as
WorkbenchEventType
}
from
'
vs/workbench/common/events
'
;
import
{
IUntitledEditorService
}
from
'
vs/workbench/services/untitled/common/untitledEditorService
'
;
import
{
IUntitledEditorService
}
from
'
vs/workbench/services/untitled/common/untitledEditorService
'
;
...
@@ -46,6 +48,7 @@ export class FileTracker implements IWorkbenchContribution {
...
@@ -46,6 +48,7 @@ export class FileTracker implements IWorkbenchContribution {
@
IPartService
private
partService
:
IPartService
,
@
IPartService
private
partService
:
IPartService
,
@
IFileService
private
fileService
:
IFileService
,
@
IFileService
private
fileService
:
IFileService
,
@
ITextFileService
private
textFileService
:
ITextFileService
,
@
ITextFileService
private
textFileService
:
ITextFileService
,
@
IWorkbenchEditorService
private
editorService
:
IWorkbenchEditorService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
IUntitledEditorService
private
untitledEditorService
:
IUntitledEditorService
,
@
IUntitledEditorService
private
untitledEditorService
:
IUntitledEditorService
,
@
ILifecycleService
private
lifecycleService
:
ILifecycleService
@
ILifecycleService
private
lifecycleService
:
ILifecycleService
...
@@ -61,9 +64,6 @@ export class FileTracker implements IWorkbenchContribution {
...
@@ -61,9 +64,6 @@ export class FileTracker implements IWorkbenchContribution {
}
}
this
.
registerListeners
();
this
.
registerListeners
();
// Listen to out of workspace file changes
this
.
updateOutOfWorkspaceFileListeners
({
added
:
this
.
textFileService
.
getWorkingFilesModel
().
getEntries
()
});
}
}
private
registerListeners
():
void
{
private
registerListeners
():
void
{
...
@@ -76,10 +76,6 @@ export class FileTracker implements IWorkbenchContribution {
...
@@ -76,10 +76,6 @@ export class FileTracker implements IWorkbenchContribution {
this
.
toUnbind
.
push
(
this
.
eventService
.
addListener
(
FileEventType
.
FILE_SAVE_ERROR
,
(
e
:
LocalFileChangeEvent
)
=>
this
.
onTextFileSaveError
(
e
)));
this
.
toUnbind
.
push
(
this
.
eventService
.
addListener
(
FileEventType
.
FILE_SAVE_ERROR
,
(
e
:
LocalFileChangeEvent
)
=>
this
.
onTextFileSaveError
(
e
)));
this
.
toUnbind
.
push
(
this
.
eventService
.
addListener
(
FileEventType
.
FILE_REVERTED
,
(
e
:
LocalFileChangeEvent
)
=>
this
.
onTextFileReverted
(
e
)));
this
.
toUnbind
.
push
(
this
.
eventService
.
addListener
(
FileEventType
.
FILE_REVERTED
,
(
e
:
LocalFileChangeEvent
)
=>
this
.
onTextFileReverted
(
e
)));
// Working Files Model Change
const
disposable
=
this
.
textFileService
.
getWorkingFilesModel
().
onModelChange
(
this
.
onWorkingFilesModelChange
,
this
);
this
.
toUnbind
.
push
(()
=>
disposable
.
dispose
());
// Support openFiles event for existing and new files
// Support openFiles event for existing and new files
ipc
.
on
(
'
vscode:openFiles
'
,
(
event
,
request
:
IOpenFileRequest
)
=>
{
ipc
.
on
(
'
vscode:openFiles
'
,
(
event
,
request
:
IOpenFileRequest
)
=>
{
let
inputs
:
IResourceInput
[]
=
[];
let
inputs
:
IResourceInput
[]
=
[];
...
@@ -99,6 +95,10 @@ export class FileTracker implements IWorkbenchContribution {
...
@@ -99,6 +95,10 @@ export class FileTracker implements IWorkbenchContribution {
}
}
});
});
// Editor input changes
this
.
toUnbind
.
push
(
this
.
eventService
.
addListener
(
WorkbenchEventType
.
EDITOR_INPUT_CHANGED
,
()
=>
this
.
onEditorInputChanged
()));
// Lifecycle
this
.
lifecycleService
.
onShutdown
(
this
.
dispose
,
this
);
this
.
lifecycleService
.
onShutdown
(
this
.
dispose
,
this
);
}
}
...
@@ -121,31 +121,32 @@ export class FileTracker implements IWorkbenchContribution {
...
@@ -121,31 +121,32 @@ export class FileTracker implements IWorkbenchContribution {
});
});
}
}
private
updateOutOfWorkspaceFileListeners
(
event
:
IWorkingFileModelChangeEvent
):
void
{
private
onEditorInputChanged
():
void
{
let
added
=
event
.
added
?
event
.
added
.
map
((
e
)
=>
e
.
resource
).
filter
((
r
)
=>
r
.
scheme
===
'
file
'
&&
!
this
.
contextService
.
isInsideWorkspace
(
r
))
:
[];
let
visibleOutOfWorkspaceResources
=
this
.
editorService
.
getVisibleEditors
().
map
((
editor
)
=>
{
let
removed
=
event
.
removed
?
event
.
removed
.
map
((
e
)
=>
e
.
resource
).
filter
((
r
)
=>
r
.
scheme
===
'
file
'
&&
!
this
.
contextService
.
isInsideWorkspace
(
r
))
:
[];
return
asFileEditorInput
(
editor
.
input
,
true
);
}).
filter
((
input
)
=>
{
return
!!
input
&&
!
this
.
contextService
.
isInsideWorkspace
(
input
.
getResource
());
}).
map
((
input
)
=>
{
return
input
.
getResource
().
toString
();
});
// Handle
added
// Handle
no longer visible out of workspace resources
added
.
forEach
((
r
esource
)
=>
{
Object
.
keys
(
this
.
activeOutOfWorkspaceWatchers
).
forEach
((
watchedR
esource
)
=>
{
if
(
!
this
.
activeOutOfWorkspaceWatchers
[
resource
.
toString
()]
)
{
if
(
visibleOutOfWorkspaceResources
.
indexOf
(
watchedResource
)
<
0
)
{
this
.
fileService
.
watchFileChanges
(
r
esource
);
this
.
fileService
.
unwatchFileChanges
(
watchedR
esource
);
this
.
activeOutOfWorkspaceWatchers
[
resource
.
toString
()]
=
true
;
delete
this
.
activeOutOfWorkspaceWatchers
[
watchedResource
]
;
}
}
});
});
// Handle
removed
// Handle
newly visible out of workspace resources
removed
.
forEach
((
resource
)
=>
{
visibleOutOfWorkspaceResources
.
forEach
((
resourceToWatch
)
=>
{
if
(
this
.
activeOutOfWorkspaceWatchers
[
resource
.
toString
()
])
{
if
(
!
this
.
activeOutOfWorkspaceWatchers
[
resourceToWatch
])
{
this
.
fileService
.
unwatchFileChanges
(
resource
);
this
.
fileService
.
watchFileChanges
(
URI
.
parse
(
resourceToWatch
)
);
delete
this
.
activeOutOfWorkspaceWatchers
[
resource
.
toString
()]
;
this
.
activeOutOfWorkspaceWatchers
[
resourceToWatch
]
=
true
;
}
}
});
});
}
}
private
onWorkingFilesModelChange
(
event
:
IWorkingFileModelChangeEvent
):
void
{
this
.
updateOutOfWorkspaceFileListeners
(
event
);
}
private
onUntitledDirtyEvent
():
void
{
private
onUntitledDirtyEvent
():
void
{
if
(
!
this
.
isDocumentedEdited
)
{
if
(
!
this
.
isDocumentedEdited
)
{
this
.
updateDocumentEdited
();
this
.
updateDocumentEdited
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录