Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
17d779cf
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,发现更多精彩内容 >>
提交
17d779cf
编写于
9月 08, 2020
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
unified onDidChangeContent
上级
a98552c9
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
20 addition
and
20 deletion
+20
-20
src/vs/workbench/api/browser/mainThreadNotebook.ts
src/vs/workbench/api/browser/mainThreadNotebook.ts
+1
-1
src/vs/workbench/contrib/notebook/browser/contrib/scm/scm.ts
src/vs/workbench/contrib/notebook/browser/contrib/scm/scm.ts
+1
-1
src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModel.ts
...h/contrib/notebook/browser/viewModel/notebookViewModel.ts
+2
-2
src/vs/workbench/contrib/notebook/common/model/notebookTextModel.ts
...kbench/contrib/notebook/common/model/notebookTextModel.ts
+13
-13
src/vs/workbench/contrib/notebook/common/notebookEditorModel.ts
.../workbench/contrib/notebook/common/notebookEditorModel.ts
+1
-1
src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts
src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts
+2
-2
未找到文件。
src/vs/workbench/api/browser/mainThreadNotebook.ts
浏览文件 @
17d779cf
...
...
@@ -279,7 +279,7 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo
if
(
!
this
.
_editorEventListenersMapping
.
has
(
doc
.
toString
()))
{
const
disposableStore
=
new
DisposableStore
();
const
textModel
=
this
.
_notebookService
.
getNotebookTextModel
(
doc
);
disposableStore
.
add
(
textModel
!
.
onDid
ModelChangeProxy
(
e
=>
{
disposableStore
.
add
(
textModel
!
.
onDid
ChangeContent
(
e
=>
{
const
data
=
e
.
kind
===
NotebookCellsChangeType
.
ModelChange
||
e
.
kind
===
NotebookCellsChangeType
.
Initialize
?
{
...
...
src/vs/workbench/contrib/notebook/browser/contrib/scm/scm.ts
浏览文件 @
17d779cf
...
...
@@ -43,7 +43,7 @@ export class SCMController extends Disposable implements INotebookEditorContribu
this
.
update
();
if
(
this
.
_notebookEditor
.
textModel
)
{
this
.
_localDisposable
.
add
(
this
.
_notebookEditor
.
textModel
.
onDid
ModelChangeProxy
((
e
)
=>
{
this
.
_localDisposable
.
add
(
this
.
_notebookEditor
.
textModel
.
onDid
ChangeContent
((
e
)
=>
{
this
.
update
();
}));
}
...
...
src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModel.ts
浏览文件 @
17d779cf
...
...
@@ -308,7 +308,7 @@ export class NotebookViewModel extends Disposable implements EditorFoldingStateD
this
.
selectionHandles
=
endSelectionHandles
;
};
this
.
_register
(
this
.
_notebook
.
onDid
ModelChangeProxy
(
e
=>
{
this
.
_register
(
this
.
_notebook
.
onDid
ChangeContent
(
e
=>
{
let
changes
:
NotebookCellTextModelSplice
<
ICell
>
[]
=
[];
if
(
e
.
kind
===
NotebookCellsChangeType
.
ModelChange
||
e
.
kind
===
NotebookCellsChangeType
.
Initialize
)
{
...
...
@@ -323,7 +323,7 @@ export class NotebookViewModel extends Disposable implements EditorFoldingStateD
}
}));
this
.
_register
(
this
.
_notebook
.
onDid
ModelChangeProxy
(
e
=>
{
this
.
_register
(
this
.
_notebook
.
onDid
ChangeContent
(
e
=>
{
if
(
e
.
kind
===
NotebookCellsChangeType
.
ChangeDocumentMetadata
)
{
this
.
eventDispatcher
.
emit
([
new
NotebookMetadataChangedEvent
(
this
.
_notebook
.
metadata
)]);
}
...
...
src/vs/workbench/contrib/notebook/common/model/notebookTextModel.ts
浏览文件 @
17d779cf
...
...
@@ -149,8 +149,8 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
readonly
onDidChangeDirty
=
this
.
_onDidChangeDirty
.
event
;
private
readonly
_emitSelections
=
this
.
_register
(
new
Emitter
<
number
[]
>
());
get
emitSelections
()
{
return
this
.
_emitSelections
.
event
;
}
private
_onDid
ModelChangeProxy
=
this
.
_register
(
new
Emitter
<
NotebookTextModelChangedEvent
>
());
get
onDid
ModelChangeProxy
():
Event
<
NotebookTextModelChangedEvent
>
{
return
this
.
_onDidModelChangeProxy
.
event
;
}
private
_onDid
ChangeContent
=
this
.
_register
(
new
Emitter
<
NotebookTextModelChangedEvent
>
());
get
onDid
ChangeContent
():
Event
<
NotebookTextModelChangedEvent
>
{
return
this
.
_onDidChangeContent
.
event
;
}
private
_mapping
:
Map
<
number
,
NotebookCellTextModel
>
=
new
Map
();
private
_cellListeners
:
Map
<
number
,
IDisposable
>
=
new
Map
();
cells
:
NotebookCellTextModel
[];
...
...
@@ -195,7 +195,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
this
.
_operationManager
=
new
NotebookOperationManager
(
this
.
_undoService
,
uri
);
this
.
_eventEmitter
=
new
DelayedEmitter
(
this
.
_onDid
ModelChangeProxy
,
this
.
_onDid
ChangeContent
,
()
=>
{
this
.
_increaseVersionId
();
},
this
);
...
...
@@ -242,7 +242,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
this
.
setDirty
(
true
);
this
.
_increaseVersionId
();
// this._onDidChangeContent.fire(NotebookCellsChangeType.ChangeCellContent);
this
.
_onDid
ModelChangeProxy
.
fire
({
kind
:
NotebookCellsChangeType
.
ChangeCellContent
,
versionId
:
this
.
versionId
,
synchronous
:
true
});
this
.
_onDid
ChangeContent
.
fire
({
kind
:
NotebookCellsChangeType
.
ChangeCellContent
,
versionId
:
this
.
versionId
,
synchronous
:
true
});
});
this
.
_cellListeners
.
set
(
mainCells
[
i
].
handle
,
dirtyStateListener
);
...
...
@@ -333,7 +333,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
this
.
setDirty
(
true
);
this
.
_increaseVersionId
();
// this._onDidChangeContent.fire(NotebookCellsChangeType.ChangeCellContent);
this
.
_onDid
ModelChangeProxy
.
fire
({
kind
:
NotebookCellsChangeType
.
ChangeCellContent
,
versionId
:
this
.
versionId
,
synchronous
:
true
});
this
.
_onDid
ChangeContent
.
fire
({
kind
:
NotebookCellsChangeType
.
ChangeCellContent
,
versionId
:
this
.
versionId
,
synchronous
:
true
});
});
this
.
_cellListeners
.
set
(
cell
.
handle
,
dirtyStateListener
);
...
...
@@ -417,7 +417,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
updateNotebookMetadata
(
metadata
:
NotebookDocumentMetadata
)
{
this
.
metadata
=
metadata
;
// this._onDidChangeContent.fire(NotebookCellsChangeType.ChangeDocumentMetadata);
this
.
_onDid
ModelChangeProxy
.
fire
({
kind
:
NotebookCellsChangeType
.
ChangeDocumentMetadata
,
versionId
:
this
.
versionId
,
metadata
:
this
.
metadata
,
synchronous
:
true
});
this
.
_onDid
ChangeContent
.
fire
({
kind
:
NotebookCellsChangeType
.
ChangeDocumentMetadata
,
versionId
:
this
.
versionId
,
metadata
:
this
.
metadata
,
synchronous
:
true
});
}
...
...
@@ -435,7 +435,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
this
.
setDirty
(
true
);
this
.
_increaseVersionId
();
// this._onDidChangeContent.fire(NotebookCellsChangeType.ChangeCellContent);
this
.
_onDid
ModelChangeProxy
.
fire
({
kind
:
NotebookCellsChangeType
.
ChangeCellContent
,
versionId
:
this
.
versionId
,
synchronous
:
true
});
this
.
_onDid
ChangeContent
.
fire
({
kind
:
NotebookCellsChangeType
.
ChangeCellContent
,
versionId
:
this
.
versionId
,
synchronous
:
true
});
});
...
...
@@ -443,7 +443,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
this
.
setDirty
(
false
);
// this._onDidChangeContent.fire(NotebookCellsChangeType.ModelChange);
this
.
_onDid
ModelChangeProxy
.
fire
({
this
.
_onDid
ChangeContent
.
fire
({
kind
:
NotebookCellsChangeType
.
ModelChange
,
versionId
:
this
.
_versionId
,
changes
:
[[
...
...
@@ -466,7 +466,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
this
.
setDirty
(
true
);
this
.
_increaseVersionId
();
// this._onDidChangeContent.fire(NotebookCellsChangeType.ChangeCellContent);
this
.
_onDid
ModelChangeProxy
.
fire
({
kind
:
NotebookCellsChangeType
.
ChangeCellContent
,
versionId
:
this
.
versionId
,
synchronous
:
true
});
this
.
_onDid
ChangeContent
.
fire
({
kind
:
NotebookCellsChangeType
.
ChangeCellContent
,
versionId
:
this
.
versionId
,
synchronous
:
true
});
});
this
.
_cellListeners
.
set
(
cells
[
i
].
handle
,
dirtyStateListener
);
...
...
@@ -478,7 +478,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
this
.
_increaseVersionId
();
this
.
_onDid
ModelChangeProxy
.
fire
({
this
.
_onDid
ChangeContent
.
fire
({
kind
:
NotebookCellsChangeType
.
ModelChange
,
versionId
:
this
.
_versionId
,
changes
:
[[
...
...
@@ -505,7 +505,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
// this._onDidChangeContent.fire(NotebookCellsChangeType.ModelChange);
this
.
_increaseVersionId
();
this
.
_onDid
ModelChangeProxy
.
fire
({
kind
:
NotebookCellsChangeType
.
ModelChange
,
versionId
:
this
.
_versionId
,
changes
:
[[
index
,
count
,
[]]],
synchronous
});
this
.
_onDid
ChangeContent
.
fire
({
kind
:
NotebookCellsChangeType
.
ModelChange
,
versionId
:
this
.
_versionId
,
changes
:
[[
index
,
count
,
[]]],
synchronous
});
}
private
_isCellMetadataChanged
(
a
:
NotebookCellMetadata
,
b
:
NotebookCellMetadata
)
{
...
...
@@ -599,7 +599,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
cell
.
language
=
languageId
;
this
.
_increaseVersionId
();
this
.
_onDid
ModelChangeProxy
.
fire
({
kind
:
NotebookCellsChangeType
.
ChangeLanguage
,
versionId
:
this
.
_versionId
,
index
:
this
.
cells
.
indexOf
(
cell
),
language
:
languageId
,
synchronous
:
true
});
this
.
_onDid
ChangeContent
.
fire
({
kind
:
NotebookCellsChangeType
.
ChangeLanguage
,
versionId
:
this
.
_versionId
,
index
:
this
.
cells
.
indexOf
(
cell
),
language
:
languageId
,
synchronous
:
true
});
}
}
...
...
@@ -655,7 +655,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
// this._onDidChangeContent.fire(NotebookCellsChangeType.Move);
this
.
_increaseVersionId
();
this
.
_onDid
ModelChangeProxy
.
fire
({
kind
:
NotebookCellsChangeType
.
Move
,
versionId
:
this
.
_versionId
,
index
,
length
,
newIdx
,
cells
,
synchronous
});
this
.
_onDid
ChangeContent
.
fire
({
kind
:
NotebookCellsChangeType
.
Move
,
versionId
:
this
.
_versionId
,
index
,
length
,
newIdx
,
cells
,
synchronous
});
}
// todo, we can't emit this change as it will create a new view model and that will hold
...
...
src/vs/workbench/contrib/notebook/common/notebookEditorModel.ts
浏览文件 @
17d779cf
...
...
@@ -145,7 +145,7 @@ export class NotebookEditorModel extends EditorModel implements INotebookEditorM
this
.
_register
(
this
.
_notebook
);
this
.
_register
(
this
.
_notebook
.
onDid
ModelChangeProxy
(
e
=>
{
this
.
_register
(
this
.
_notebook
.
onDid
ChangeContent
(
e
=>
{
if
(
e
.
kind
!==
NotebookCellsChangeType
.
Initialize
)
{
this
.
_onDidChangeContent
.
fire
();
}
...
...
src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts
浏览文件 @
17d779cf
...
...
@@ -337,8 +337,8 @@ export class NotebookEditorTestModel extends EditorModel implements INotebookEdi
)
{
super
();
if
(
_notebook
&&
_notebook
.
onDid
ModelChangeProxy
)
{
this
.
_register
(
_notebook
.
onDid
ModelChangeProxy
(()
=>
{
if
(
_notebook
&&
_notebook
.
onDid
ChangeContent
)
{
this
.
_register
(
_notebook
.
onDid
ChangeContent
(()
=>
{
this
.
_dirty
=
true
;
this
.
_onDidChangeDirty
.
fire
();
this
.
_onDidChangeContent
.
fire
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录