Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
470c743a
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,发现更多精彩内容 >>
提交
470c743a
编写于
3月 31, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt - reduce amount of work when file events occur
上级
ea284a1f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
56 addition
and
46 deletion
+56
-46
src/vs/workbench/parts/debug/electron-browser/debugService.ts
...vs/workbench/parts/debug/electron-browser/debugService.ts
+1
-1
src/vs/workbench/parts/files/electron-browser/views/explorerView.ts
...kbench/parts/files/electron-browser/views/explorerView.ts
+16
-19
src/vs/workbench/services/textfile/common/textFileEditorModel.ts
...workbench/services/textfile/common/textFileEditorModel.ts
+39
-26
未找到文件。
src/vs/workbench/parts/debug/electron-browser/debugService.ts
浏览文件 @
470c743a
...
...
@@ -1307,7 +1307,7 @@ export class DebugService implements debug.IDebugService {
if
(
this
.
breakpointsToSendOnResourceSaved
.
delete
(
event
.
resource
.
toString
()))
{
this
.
sendBreakpoints
(
event
.
resource
,
true
).
done
(
null
,
errors
.
onUnexpectedError
);
}
if
(
event
.
resource
.
toString
().
indexOf
(
'
.vscode/launch.json
'
)
>=
0
)
{
if
(
strings
.
endsWith
(
event
.
resource
.
toString
(),
'
.vscode/launch.json
'
)
)
{
this
.
launchJsonChanged
=
true
;
}
});
...
...
src/vs/workbench/parts/files/electron-browser/views/explorerView.ts
浏览文件 @
470c743a
...
...
@@ -611,24 +611,21 @@ export class ExplorerView extends TreeViewsViewletPanel implements IExplorerView
}
private
shouldRefreshFromEvent
(
e
:
FileChangesEvent
):
boolean
{
// Filter to the ones we care
e
=
this
.
filterFileEvents
(
e
);
if
(
!
this
.
isCreated
)
{
return
false
;
}
if
(
e
.
gotAdded
())
{
const
added
=
e
.
getAdded
();
// Filter to the ones we care
e
=
this
.
filterToViewRelevantEvents
(
e
);
// Handle added files/folders
const
added
=
e
.
getAdded
();
if
(
added
.
length
)
{
// Check added: Refresh if added file/folder is not part of resolved root and parent is part of it
const
ignoredPaths
:
{
[
resource
:
string
]:
boolean
}
=
<
{
[
resource
:
string
]:
boolean
}
>
{};
for
(
let
i
=
0
;
i
<
added
.
length
;
i
++
)
{
const
change
=
added
[
i
];
if
(
!
this
.
contextService
.
isInsideWorkspace
(
change
.
resource
))
{
continue
;
// out of workspace file
}
// Find parent
const
parent
=
resources
.
dirname
(
change
.
resource
);
...
...
@@ -651,15 +648,13 @@ export class ExplorerView extends TreeViewsViewletPanel implements IExplorerView
}
}
if
(
e
.
gotDeleted
())
{
const
deleted
=
e
.
getDeleted
();
// Handle deleted files/folders
const
deleted
=
e
.
getDeleted
();
if
(
deleted
.
length
)
{
// Check deleted: Refresh if deleted file/folder part of resolved root
for
(
let
j
=
0
;
j
<
deleted
.
length
;
j
++
)
{
const
del
=
deleted
[
j
];
if
(
!
this
.
contextService
.
isInsideWorkspace
(
del
.
resource
))
{
continue
;
// out of workspace file
}
if
(
this
.
model
.
findClosest
(
del
.
resource
))
{
return
true
;
...
...
@@ -667,15 +662,13 @@ export class ExplorerView extends TreeViewsViewletPanel implements IExplorerView
}
}
if
(
this
.
sortOrder
===
SortOrderConfiguration
.
MODIFIED
&&
e
.
gotUpdated
())
{
// Handle updated files/folders if we sort by modified
if
(
this
.
sortOrder
===
SortOrderConfiguration
.
MODIFIED
)
{
const
updated
=
e
.
getUpdated
();
// Check updated: Refresh if updated file/folder part of resolved root
for
(
let
j
=
0
;
j
<
updated
.
length
;
j
++
)
{
const
upd
=
updated
[
j
];
if
(
!
this
.
contextService
.
isInsideWorkspace
(
upd
.
resource
))
{
continue
;
// out of workspace file
}
if
(
this
.
model
.
findClosest
(
upd
.
resource
))
{
return
true
;
...
...
@@ -686,8 +679,12 @@ export class ExplorerView extends TreeViewsViewletPanel implements IExplorerView
return
false
;
}
private
filter
File
Events
(
e
:
FileChangesEvent
):
FileChangesEvent
{
private
filter
ToViewRelevant
Events
(
e
:
FileChangesEvent
):
FileChangesEvent
{
return
new
FileChangesEvent
(
e
.
changes
.
filter
(
change
=>
{
if
(
change
.
type
===
FileChangeType
.
UPDATED
&&
this
.
sortOrder
!==
SortOrderConfiguration
.
MODIFIED
)
{
return
false
;
// we only are about updated if we sort by modified time
}
if
(
!
this
.
contextService
.
isInsideWorkspace
(
change
.
resource
))
{
return
false
;
// exclude changes for resources outside of workspace
}
...
...
src/vs/workbench/services/textfile/common/textFileEditorModel.ts
浏览文件 @
470c743a
...
...
@@ -128,37 +128,50 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
}
private
onFileChanges
(
e
:
FileChangesEvent
):
void
{
let
fileEventImpactsModel
=
false
;
let
newInOrphanModeGuess
:
boolean
;
// If we are currently orphaned, we check if the model file was added back
if
(
this
.
inOrphanMode
)
{
const
modelFileAdded
=
e
.
contains
(
this
.
resource
,
FileChangeType
.
ADDED
);
if
(
modelFileAdded
)
{
newInOrphanModeGuess
=
false
;
fileEventImpactsModel
=
true
;
}
}
// Track ADD and DELETES for updates of this model to orphan-mode
const
modelFileDeleted
=
e
.
contains
(
this
.
resource
,
FileChangeType
.
DELETED
);
const
modelFileAdded
=
e
.
contains
(
this
.
resource
,
FileChangeType
.
ADDED
);
if
(
modelFileDeleted
||
modelFileAdded
)
{
const
newInOrphanModeGuess
=
modelFileDeleted
&&
!
modelFileAdded
;
if
(
this
.
inOrphanMode
!==
newInOrphanModeGuess
)
{
let
checkOrphanedPromise
:
TPromise
<
boolean
>
;
if
(
newInOrphanModeGuess
)
{
// We have received reports of users seeing delete events even though the file still
// exists (network shares issue: https://github.com/Microsoft/vscode/issues/13665).
// Since we do not want to mark the model as orphaned, we have to check if the
// file is really gone and not just a faulty file event.
checkOrphanedPromise
=
TPromise
.
timeout
(
100
).
then
(()
=>
{
if
(
this
.
disposed
)
{
return
true
;
}
return
this
.
fileService
.
existsFile
(
this
.
resource
).
then
(
exists
=>
!
exists
);
});
}
else
{
checkOrphanedPromise
=
TPromise
.
as
(
false
);
}
// Otherwise we check if the model file was deleted
else
{
const
modelFileDeleted
=
e
.
contains
(
this
.
resource
,
FileChangeType
.
DELETED
);
if
(
modelFileDeleted
)
{
newInOrphanModeGuess
=
true
;
fileEventImpactsModel
=
true
;
}
}
checkOrphanedPromise
.
done
(
newInOrphanModeValidated
=>
{
if
(
this
.
inOrphanMode
!==
newInOrphanModeValidated
&&
!
this
.
disposed
)
{
this
.
setOrphaned
(
newInOrphanModeValidated
);
if
(
fileEventImpactsModel
&&
this
.
inOrphanMode
!==
newInOrphanModeGuess
)
{
let
checkOrphanedPromise
:
TPromise
<
boolean
>
;
if
(
newInOrphanModeGuess
)
{
// We have received reports of users seeing delete events even though the file still
// exists (network shares issue: https://github.com/Microsoft/vscode/issues/13665).
// Since we do not want to mark the model as orphaned, we have to check if the
// file is really gone and not just a faulty file event.
checkOrphanedPromise
=
TPromise
.
timeout
(
100
).
then
(()
=>
{
if
(
this
.
disposed
)
{
return
true
;
}
return
this
.
fileService
.
existsFile
(
this
.
resource
).
then
(
exists
=>
!
exists
);
});
}
else
{
checkOrphanedPromise
=
TPromise
.
as
(
false
);
}
checkOrphanedPromise
.
done
(
newInOrphanModeValidated
=>
{
if
(
this
.
inOrphanMode
!==
newInOrphanModeValidated
&&
!
this
.
disposed
)
{
this
.
setOrphaned
(
newInOrphanModeValidated
);
}
});
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录