Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
7f3c4913
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,体验更适合开发者的 AI 搜索 >>
提交
7f3c4913
编写于
8月 14, 2020
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
notebook file watch re #104209.
上级
95b3a0a8
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
31 addition
and
1 deletion
+31
-1
src/vs/workbench/contrib/notebook/browser/notebookEditorInput.ts
...workbench/contrib/notebook/browser/notebookEditorInput.ts
+25
-1
src/vs/workbench/contrib/notebook/common/notebookCommon.ts
src/vs/workbench/contrib/notebook/common/notebookCommon.ts
+2
-0
src/vs/workbench/contrib/notebook/common/notebookEditorModel.ts
.../workbench/contrib/notebook/common/notebookEditorModel.ts
+4
-0
未找到文件。
src/vs/workbench/contrib/notebook/browser/notebookEditorInput.ts
浏览文件 @
7f3c4913
...
...
@@ -14,6 +14,7 @@ import { INotebookEditorModelResolverService } from 'vs/workbench/contrib/notebo
import
{
IReference
}
from
'
vs/base/common/lifecycle
'
;
import
{
INotebookEditorModel
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
IPathService
}
from
'
vs/workbench/services/path/common/pathService
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
interface
NotebookEditorInputOptions
{
startDirty
?:
boolean
;
...
...
@@ -39,10 +40,33 @@ export class NotebookEditorInput extends EditorInput {
@
IFilesConfigurationService
private
readonly
_filesConfigurationService
:
IFilesConfigurationService
,
@
IFileDialogService
private
readonly
_fileDialogService
:
IFileDialogService
,
@
IPathService
private
readonly
_pathService
:
IPathService
,
@
IInstantiationService
private
readonly
_instantiationService
:
IInstantiationService
@
IInstantiationService
private
readonly
_instantiationService
:
IInstantiationService
,
@
IFileService
private
readonly
fileService
:
IFileService
,
)
{
super
();
this
.
_defaultDirtyState
=
!!
options
.
startDirty
;
this
.
_register
(
this
.
fileService
.
watch
(
this
.
resource
));
this
.
setupListeners
();
}
async
setupListeners
()
{
this
.
_register
(
this
.
fileService
.
onDidFilesChange
(
async
e
=>
{
if
(
this
.
_textModel
&&
!
this
.
isDirty
()
&&
e
.
contains
(
this
.
resource
))
{
const
lastResolvedFileStat
=
this
.
_textModel
.
object
.
lastResolvedFileStat
;
if
(
!
lastResolvedFileStat
)
{
return
;
}
const
newStats
=
await
this
.
fileService
.
resolve
(
this
.
resource
,
{
resolveMetadata
:
true
});
if
(
lastResolvedFileStat
&&
newStats
&&
newStats
.
mtime
>
lastResolvedFileStat
.
mtime
)
{
console
.
log
(
newStats
);
await
this
.
_textModel
.
object
.
revert
();
}
}
}));
}
getTypeId
():
string
{
...
...
src/vs/workbench/contrib/notebook/common/notebookCommon.ts
浏览文件 @
7f3c4913
...
...
@@ -18,6 +18,7 @@ import { CancellationToken } from 'vs/base/common/cancellation';
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
IRevertOptions
}
from
'
vs/workbench/common/editor
'
;
import
{
basename
}
from
'
vs/base/common/path
'
;
import
{
IFileStatWithMetadata
}
from
'
vs/platform/files/common/files
'
;
export
enum
CellKind
{
Markdown
=
1
,
...
...
@@ -595,6 +596,7 @@ export interface INotebookEditorModel extends IEditorModel {
readonly
resource
:
URI
;
readonly
viewType
:
string
;
readonly
notebook
:
NotebookTextModel
;
readonly
lastResolvedFileStat
:
IFileStatWithMetadata
|
undefined
;
isDirty
():
boolean
;
isUntitled
():
boolean
;
save
():
Promise
<
boolean
>
;
...
...
src/vs/workbench/contrib/notebook/common/notebookEditorModel.ts
浏览文件 @
7f3c4913
...
...
@@ -44,6 +44,10 @@ export class NotebookEditorModel extends EditorModel implements IWorkingCopy, IN
private
_notebook
!
:
NotebookTextModel
;
private
_lastResolvedFileStat
:
IFileStatWithMetadata
|
undefined
;
get
lastResolvedFileStat
()
{
return
this
.
_lastResolvedFileStat
;
}
get
notebook
()
{
return
this
.
_notebook
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录