Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
a98552c9
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,发现更多精彩内容 >>
提交
a98552c9
编写于
9月 08, 2020
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
deprecate onDidChangeContent
上级
8ebad589
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
30 addition
and
37 deletion
+30
-37
src/vs/workbench/contrib/notebook/browser/contrib/scm/scm.ts
src/vs/workbench/contrib/notebook/browser/contrib/scm/scm.ts
+1
-8
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
+18
-21
src/vs/workbench/contrib/notebook/common/notebookCommon.ts
src/vs/workbench/contrib/notebook/common/notebookCommon.ts
+1
-1
src/vs/workbench/contrib/notebook/common/notebookEditorModel.ts
.../workbench/contrib/notebook/common/notebookEditorModel.ts
+6
-3
src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts
src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts
+2
-2
未找到文件。
src/vs/workbench/contrib/notebook/browser/contrib/scm/scm.ts
浏览文件 @
a98552c9
...
...
@@ -14,7 +14,6 @@ import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/no
import
{
FileService
}
from
'
vs/platform/files/common/fileService
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
NotebookCellsChangeType
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
export
class
SCMController
extends
Disposable
implements
INotebookEditorContribution
{
static
id
:
string
=
'
workbench.notebook.findController
'
;
...
...
@@ -44,14 +43,8 @@ export class SCMController extends Disposable implements INotebookEditorContribu
this
.
update
();
if
(
this
.
_notebookEditor
.
textModel
)
{
this
.
_localDisposable
.
add
(
this
.
_notebookEditor
.
textModel
.
onDidChangeContent
(()
=>
{
this
.
update
();
}));
this
.
_localDisposable
.
add
(
this
.
_notebookEditor
.
textModel
.
onDidModelChangeProxy
((
e
)
=>
{
if
(
e
.
kind
===
NotebookCellsChangeType
.
ModelChange
)
{
this
.
update
();
}
this
.
update
();
}));
}
}));
...
...
src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModel.ts
浏览文件 @
a98552c9
...
...
@@ -323,8 +323,8 @@ export class NotebookViewModel extends Disposable implements EditorFoldingStateD
}
}));
this
.
_register
(
this
.
_notebook
.
onDid
ChangeContent
(
e
=>
{
if
(
e
===
NotebookCellsChangeType
.
ChangeDocumentMetadata
)
{
this
.
_register
(
this
.
_notebook
.
onDid
ModelChangeProxy
(
e
=>
{
if
(
e
.
kind
===
NotebookCellsChangeType
.
ChangeDocumentMetadata
)
{
this
.
eventDispatcher
.
emit
([
new
NotebookMetadataChangedEvent
(
this
.
_notebook
.
metadata
)]);
}
}));
...
...
src/vs/workbench/contrib/notebook/common/model/notebookTextModel.ts
浏览文件 @
a98552c9
...
...
@@ -108,7 +108,6 @@ export class NotebookOperationManager {
class
DelayedEmitter
{
constructor
(
private
readonly
_onDidChangeContentEmitter
:
Emitter
<
NotebookCellsChangeType
|
undefined
>
,
private
readonly
_onDidModelChangeProxy
:
Emitter
<
NotebookTextModelChangedEvent
>
,
private
readonly
_increaseVersion
:
()
=>
void
,
private
readonly
_textModel
:
NotebookTextModel
...
...
@@ -119,7 +118,6 @@ class DelayedEmitter {
emit
(
data
:
{
triggerDirty
:
{
value
:
boolean
}
|
undefined
,
contentChange
:
{
value
:
NotebookCellsChangeType
|
undefined
}
|
undefined
,
cellsChange
:
{
value
:
{
synchronous
:
boolean
,
splices
:
NotebookCellTextModelSplice
<
NotebookCellTextModel
>
[]
}
}
|
undefined
,
modelProxyChange
:
{
value
:
NotebookTextModelChangedEvent
}
|
undefined
,
})
{
...
...
@@ -129,10 +127,6 @@ class DelayedEmitter {
this
.
_textModel
.
setDirty
(
true
);
}
if
(
data
.
contentChange
)
{
this
.
_onDidChangeContentEmitter
.
fire
(
data
.
contentChange
.
value
);
}
if
(
data
.
modelProxyChange
)
{
this
.
_onDidModelChangeProxy
.
fire
(
{
...
...
@@ -157,8 +151,6 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
get
emitSelections
()
{
return
this
.
_emitSelections
.
event
;
}
private
_onDidModelChangeProxy
=
this
.
_register
(
new
Emitter
<
NotebookTextModelChangedEvent
>
());
get
onDidModelChangeProxy
():
Event
<
NotebookTextModelChangedEvent
>
{
return
this
.
_onDidModelChangeProxy
.
event
;
}
private
_onDidChangeContent
=
this
.
_register
(
new
Emitter
<
NotebookCellsChangeType
|
undefined
>
());
onDidChangeContent
:
Event
<
NotebookCellsChangeType
|
undefined
>
=
this
.
_onDidChangeContent
.
event
;
private
_mapping
:
Map
<
number
,
NotebookCellTextModel
>
=
new
Map
();
private
_cellListeners
:
Map
<
number
,
IDisposable
>
=
new
Map
();
cells
:
NotebookCellTextModel
[];
...
...
@@ -203,7 +195,6 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
this
.
_operationManager
=
new
NotebookOperationManager
(
this
.
_undoService
,
uri
);
this
.
_eventEmitter
=
new
DelayedEmitter
(
this
.
_onDidChangeContent
,
this
.
_onDidModelChangeProxy
,
()
=>
{
this
.
_increaseVersionId
();
},
this
...
...
@@ -250,7 +241,8 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
const
dirtyStateListener
=
mainCells
[
i
].
onDidChangeContent
(()
=>
{
this
.
setDirty
(
true
);
this
.
_increaseVersionId
();
this
.
_onDidChangeContent
.
fire
(
NotebookCellsChangeType
.
ChangeCellContent
);
// this._onDidChangeContent.fire(NotebookCellsChangeType.ChangeCellContent);
this
.
_onDidModelChangeProxy
.
fire
({
kind
:
NotebookCellsChangeType
.
ChangeCellContent
,
versionId
:
this
.
versionId
,
synchronous
:
true
});
});
this
.
_cellListeners
.
set
(
mainCells
[
i
].
handle
,
dirtyStateListener
);
...
...
@@ -340,7 +332,9 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
const
dirtyStateListener
=
cell
.
onDidChangeContent
(()
=>
{
this
.
setDirty
(
true
);
this
.
_increaseVersionId
();
this
.
_onDidChangeContent
.
fire
(
NotebookCellsChangeType
.
ChangeCellContent
);
// this._onDidChangeContent.fire(NotebookCellsChangeType.ChangeCellContent);
this
.
_onDidModelChangeProxy
.
fire
({
kind
:
NotebookCellsChangeType
.
ChangeCellContent
,
versionId
:
this
.
versionId
,
synchronous
:
true
});
});
this
.
_cellListeners
.
set
(
cell
.
handle
,
dirtyStateListener
);
this
.
_mapping
.
set
(
cell
.
handle
,
cell
);
...
...
@@ -370,7 +364,6 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
// should be deferred
this
.
_eventEmitter
.
emit
({
triggerDirty
:
{
value
:
true
},
contentChange
:
{
value
:
NotebookCellsChangeType
.
ModelChange
},
cellsChange
:
{
value
:
{
synchronous
:
synchronous
,
splices
:
diffs
}
},
modelProxyChange
:
{
value
:
{
...
...
@@ -423,7 +416,9 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
updateNotebookMetadata
(
metadata
:
NotebookDocumentMetadata
)
{
this
.
metadata
=
metadata
;
this
.
_onDidChangeContent
.
fire
(
NotebookCellsChangeType
.
ChangeDocumentMetadata
);
// this._onDidChangeContent.fire(NotebookCellsChangeType.ChangeDocumentMetadata);
this
.
_onDidModelChangeProxy
.
fire
({
kind
:
NotebookCellsChangeType
.
ChangeDocumentMetadata
,
versionId
:
this
.
versionId
,
metadata
:
this
.
metadata
,
synchronous
:
true
});
}
insertTemplateCell
(
cell
:
NotebookCellTextModel
)
{
...
...
@@ -439,12 +434,14 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
this
.
_isUntitled
=
false
;
this
.
setDirty
(
true
);
this
.
_increaseVersionId
();
this
.
_onDidChangeContent
.
fire
(
NotebookCellsChangeType
.
ChangeCellContent
);
// this._onDidChangeContent.fire(NotebookCellsChangeType.ChangeCellContent);
this
.
_onDidModelChangeProxy
.
fire
({
kind
:
NotebookCellsChangeType
.
ChangeCellContent
,
versionId
:
this
.
versionId
,
synchronous
:
true
});
});
this
.
_cellListeners
.
set
(
cell
.
handle
,
dirtyStateListener
);
this
.
setDirty
(
false
);
this
.
_onDidChangeContent
.
fire
(
NotebookCellsChangeType
.
ModelChange
);
//
this._onDidChangeContent.fire(NotebookCellsChangeType.ModelChange);
this
.
_onDidModelChangeProxy
.
fire
({
kind
:
NotebookCellsChangeType
.
ModelChange
,
...
...
@@ -468,7 +465,8 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
const
dirtyStateListener
=
cells
[
i
].
onDidChangeContent
(()
=>
{
this
.
setDirty
(
true
);
this
.
_increaseVersionId
();
this
.
_onDidChangeContent
.
fire
(
NotebookCellsChangeType
.
ChangeCellContent
);
// this._onDidChangeContent.fire(NotebookCellsChangeType.ChangeCellContent);
this
.
_onDidModelChangeProxy
.
fire
({
kind
:
NotebookCellsChangeType
.
ChangeCellContent
,
versionId
:
this
.
versionId
,
synchronous
:
true
});
});
this
.
_cellListeners
.
set
(
cells
[
i
].
handle
,
dirtyStateListener
);
...
...
@@ -476,7 +474,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
this
.
cells
.
splice
(
index
,
0
,
...
cells
);
this
.
setDirty
(
true
);
this
.
_onDidChangeContent
.
fire
(
NotebookCellsChangeType
.
ModelChange
);
//
this._onDidChangeContent.fire(NotebookCellsChangeType.ModelChange);
this
.
_increaseVersionId
();
...
...
@@ -504,7 +502,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
}
this
.
cells
.
splice
(
index
,
count
);
this
.
setDirty
(
true
);
this
.
_onDidChangeContent
.
fire
(
NotebookCellsChangeType
.
ModelChange
);
//
this._onDidChangeContent.fire(NotebookCellsChangeType.ModelChange);
this
.
_increaseVersionId
();
this
.
_onDidModelChangeProxy
.
fire
({
kind
:
NotebookCellsChangeType
.
ModelChange
,
versionId
:
this
.
_versionId
,
changes
:
[[
index
,
count
,
[]]],
synchronous
});
...
...
@@ -556,7 +554,6 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
this
.
_eventEmitter
.
emit
({
triggerDirty
:
{
value
:
triggerDirtyChange
},
contentChange
:
{
value
:
NotebookCellsChangeType
.
ChangeCellMetadata
},
cellsChange
:
undefined
,
modelProxyChange
:
{
value
:
{
kind
:
NotebookCellsChangeType
.
ChangeCellMetadata
,
versionId
:
this
.
_versionId
,
index
:
this
.
cells
.
indexOf
(
cell
),
metadata
:
cell
.
metadata
,
synchronous
:
true
}
...
...
@@ -572,7 +569,6 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
this
.
_eventEmitter
.
emit
({
triggerDirty
:
{
value
:
!
this
.
transientOptions
.
transientOutputs
},
contentChange
:
!
this
.
transientOptions
.
transientOutputs
?
{
value
:
NotebookCellsChangeType
.
Output
}
:
undefined
,
cellsChange
:
undefined
,
modelProxyChange
:
{
value
:
{
...
...
@@ -580,6 +576,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
versionId
:
this
.
versionId
,
index
:
this
.
cells
.
indexOf
(
cell
),
outputs
:
cell
.
outputs
??
[],
transient
:
this
.
transientOptions
.
transientOutputs
,
synchronous
:
true
}
}
...
...
@@ -655,7 +652,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
const
cells
=
this
.
cells
.
splice
(
index
,
length
);
this
.
cells
.
splice
(
newIdx
,
0
,
...
cells
);
this
.
setDirty
(
true
);
this
.
_onDidChangeContent
.
fire
(
NotebookCellsChangeType
.
Move
);
//
this._onDidChangeContent.fire(NotebookCellsChangeType.Move);
this
.
_increaseVersionId
();
this
.
_onDidModelChangeProxy
.
fire
({
kind
:
NotebookCellsChangeType
.
Move
,
versionId
:
this
.
_versionId
,
index
,
length
,
newIdx
,
cells
,
synchronous
});
...
...
src/vs/workbench/contrib/notebook/common/notebookCommon.ts
浏览文件 @
a98552c9
...
...
@@ -277,7 +277,6 @@ export interface INotebookTextModel {
readonly
versionId
:
number
;
languages
:
string
[];
cells
:
ICell
[];
onDidChangeContent
:
Event
<
NotebookCellsChangeType
|
undefined
>
;
onWillDispose
(
listener
:
()
=>
void
):
IDisposable
;
}
...
...
@@ -384,6 +383,7 @@ export interface NotebookOutputChangedEvent {
readonly
index
:
number
;
readonly
versionId
:
number
;
readonly
outputs
:
IProcessedOutput
[];
readonly
transient
:
boolean
;
}
export
interface
NotebookCellsChangeLanguageEvent
{
...
...
src/vs/workbench/contrib/notebook/common/notebookEditorModel.ts
浏览文件 @
a98552c9
...
...
@@ -6,7 +6,7 @@
import
*
as
nls
from
'
vs/nls
'
;
import
{
EditorModel
,
IRevertOptions
}
from
'
vs/workbench/common/editor
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
INotebookEditorModel
,
NotebookDocumentBackupData
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
INotebookEditorModel
,
Notebook
CellsChangeType
,
Notebook
DocumentBackupData
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
NotebookTextModel
}
from
'
vs/workbench/contrib/notebook/common/model/notebookTextModel
'
;
import
{
INotebookService
}
from
'
vs/workbench/contrib/notebook/common/notebookService
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
...
...
@@ -145,9 +145,12 @@ export class NotebookEditorModel extends EditorModel implements INotebookEditorM
this
.
_register
(
this
.
_notebook
);
this
.
_register
(
this
.
_notebook
.
onDidChangeContent
(()
=>
{
this
.
_onDidChangeContent
.
fire
();
this
.
_register
(
this
.
_notebook
.
onDidModelChangeProxy
(
e
=>
{
if
(
e
.
kind
!==
NotebookCellsChangeType
.
Initialize
)
{
this
.
_onDidChangeContent
.
fire
();
}
}));
this
.
_register
(
this
.
_notebook
.
onDidChangeDirty
(()
=>
{
this
.
_onDidChangeDirty
.
fire
();
}));
...
...
src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts
浏览文件 @
a98552c9
...
...
@@ -337,8 +337,8 @@ export class NotebookEditorTestModel extends EditorModel implements INotebookEdi
)
{
super
();
if
(
_notebook
&&
_notebook
.
onDid
ChangeContent
)
{
this
.
_register
(
_notebook
.
onDid
ChangeContent
(()
=>
{
if
(
_notebook
&&
_notebook
.
onDid
ModelChangeProxy
)
{
this
.
_register
(
_notebook
.
onDid
ModelChangeProxy
(()
=>
{
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录