Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
bae64052
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,发现更多精彩内容 >>
提交
bae64052
编写于
8月 12, 2020
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
unit test for document remove
上级
5f6d850a
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
50 addition
and
9 deletion
+50
-9
src/vs/workbench/api/browser/mainThreadNotebook.ts
src/vs/workbench/api/browser/mainThreadNotebook.ts
+1
-1
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+1
-1
src/vs/workbench/api/common/extHostNotebook.ts
src/vs/workbench/api/common/extHostNotebook.ts
+1
-1
src/vs/workbench/test/browser/api/extHostNotebook.test.ts
src/vs/workbench/test/browser/api/extHostNotebook.test.ts
+45
-4
src/vs/workbench/test/browser/api/extHostNotebookConcatDocument.test.ts
...ch/test/browser/api/extHostNotebookConcatDocument.test.ts
+2
-2
未找到文件。
src/vs/workbench/api/browser/mainThreadNotebook.ts
浏览文件 @
bae64052
...
...
@@ -203,7 +203,7 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo
async
removeNotebookTextModel
(
uri
:
URI
):
Promise
<
void
>
{
// TODO@rebornix, remove cell should use emitDelta as well to ensure document/editor events are sent together
await
this
.
_proxy
.
$acceptDocumentAndEditorsDelta
({
removedDocuments
:
[
uri
]
});
this
.
_proxy
.
$acceptDocumentAndEditorsDelta
({
removedDocuments
:
[
uri
]
});
let
textModelDisposableStore
=
this
.
_editorEventListenersMapping
.
get
(
uri
.
toString
());
textModelDisposableStore
?.
dispose
();
this
.
_editorEventListenersMapping
.
delete
(
URI
.
from
(
uri
).
toString
());
...
...
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
bae64052
...
...
@@ -1633,7 +1633,7 @@ export interface ExtHostNotebookShape {
$acceptModelChanged
(
uriComponents
:
UriComponents
,
event
:
NotebookCellsChangedEvent
):
void
;
$acceptModelSaved
(
uriComponents
:
UriComponents
):
void
;
$acceptEditorPropertiesChanged
(
uriComponents
:
UriComponents
,
data
:
INotebookEditorPropertiesChangeData
):
void
;
$acceptDocumentAndEditorsDelta
(
delta
:
INotebookDocumentsAndEditorsDelta
):
Promise
<
void
>
;
$acceptDocumentAndEditorsDelta
(
delta
:
INotebookDocumentsAndEditorsDelta
):
void
;
$undoNotebook
(
viewType
:
string
,
uri
:
UriComponents
,
editId
:
number
,
isDirty
:
boolean
):
Promise
<
void
>
;
$redoNotebook
(
viewType
:
string
,
uri
:
UriComponents
,
editId
:
number
,
isDirty
:
boolean
):
Promise
<
void
>
;
...
...
src/vs/workbench/api/common/extHostNotebook.ts
浏览文件 @
bae64052
...
...
@@ -1513,7 +1513,7 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
this
.
_editors
.
set
(
editorId
,
{
editor
});
}
async
$acceptDocumentAndEditorsDelta
(
delta
:
INotebookDocumentsAndEditorsDelta
)
{
$acceptDocumentAndEditorsDelta
(
delta
:
INotebookDocumentsAndEditorsDelta
):
void
{
let
editorChanged
=
false
;
if
(
delta
.
removedDocuments
)
{
...
...
src/vs/workbench/test/browser/api/extHostNotebook.test.ts
浏览文件 @
bae64052
...
...
@@ -10,7 +10,7 @@ import { TestRPCProtocol } from 'vs/workbench/test/browser/api/testRPCProtocol';
import
{
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
NullLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
mock
}
from
'
vs/base/test/common/mock
'
;
import
{
MainContext
,
MainThreadCommandsShape
,
MainThreadNotebookShape
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
IModelAddedData
,
MainContext
,
MainThreadCommandsShape
,
MainThreadNotebookShape
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
ExtHostNotebookDocument
,
ExtHostNotebookController
}
from
'
vs/workbench/api/common/extHostNotebook
'
;
import
{
CellKind
,
CellUri
,
NotebookCellsChangeType
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
...
...
@@ -47,7 +47,7 @@ suite('NotebookCell#Document', function () {
let
reg
=
extHostNotebooks
.
registerNotebookContentProvider
(
nullExtensionDescription
,
'
test
'
,
new
class
extends
mock
<
vscode
.
NotebookContentProvider
>
()
{
// async openNotebook() { }
});
await
extHostNotebooks
.
$acceptDocumentAndEditorsDelta
({
extHostNotebooks
.
$acceptDocumentAndEditorsDelta
({
addedDocuments
:
[{
handle
:
0
,
uri
:
notebookUri
,
...
...
@@ -77,7 +77,7 @@ suite('NotebookCell#Document', function () {
selections
:
[
0
]
}]
});
await
extHostNotebooks
.
$acceptDocumentAndEditorsDelta
({
newActiveEditor
:
'
_notebook_editor_0
'
});
extHostNotebooks
.
$acceptDocumentAndEditorsDelta
({
newActiveEditor
:
'
_notebook_editor_0
'
});
notebook
=
extHostNotebooks
.
notebookDocuments
[
0
]
!
;
...
...
@@ -116,7 +116,7 @@ suite('NotebookCell#Document', function () {
removedCellUris
.
push
(
doc
.
uri
.
toString
());
});
await
extHostNotebooks
.
$acceptDocumentAndEditorsDelta
({
removedDocuments
:
[
notebook
.
uri
]
});
extHostNotebooks
.
$acceptDocumentAndEditorsDelta
({
removedDocuments
:
[
notebook
.
uri
]
});
reg
.
dispose
();
assert
.
strictEqual
(
removedCellUris
.
length
,
2
);
...
...
@@ -174,4 +174,45 @@ suite('NotebookCell#Document', function () {
await
p
;
});
test
(
'
cell document stays open when notebook is still open
'
,
async
function
()
{
const
docs
:
vscode
.
TextDocument
[]
=
[];
const
addData
:
IModelAddedData
[]
=
[];
for
(
let
cell
of
notebook
.
cells
)
{
const
doc
=
extHostDocuments
.
getDocument
(
cell
.
uri
);
assert
.
ok
(
doc
);
assert
.
equal
(
extHostDocuments
.
getDocument
(
cell
.
uri
).
isClosed
,
false
);
docs
.
push
(
doc
);
addData
.
push
({
EOL
:
'
\n
'
,
isDirty
:
doc
.
isDirty
,
lines
:
doc
.
getText
().
split
(
'
\n
'
),
modeId
:
doc
.
languageId
,
uri
:
doc
.
uri
,
versionId
:
doc
.
version
});
}
// this call happens when opening a document on the main side
extHostDocumentsAndEditors
.
$acceptDocumentsAndEditorsDelta
({
addedDocuments
:
addData
});
// this call happens when closing a document from the main side
extHostDocumentsAndEditors
.
$acceptDocumentsAndEditorsDelta
({
removedDocuments
:
docs
.
map
(
d
=>
d
.
uri
)
});
// notebook is still open -> cell documents stay open
for
(
let
cell
of
notebook
.
cells
)
{
assert
.
ok
(
extHostDocuments
.
getDocument
(
cell
.
uri
));
assert
.
equal
(
extHostDocuments
.
getDocument
(
cell
.
uri
).
isClosed
,
false
);
}
// close notebook -> docs are closed
extHostNotebooks
.
$acceptDocumentAndEditorsDelta
({
removedDocuments
:
[
notebook
.
uri
]
});
for
(
let
cell
of
notebook
.
cells
)
{
assert
.
throws
(()
=>
extHostDocuments
.
getDocument
(
cell
.
uri
));
}
for
(
let
doc
of
docs
)
{
assert
.
equal
(
doc
.
isClosed
,
true
);
}
});
});
src/vs/workbench/test/browser/api/extHostNotebookConcatDocument.test.ts
浏览文件 @
bae64052
...
...
@@ -48,7 +48,7 @@ suite('NotebookConcatDocument', function () {
let
reg
=
extHostNotebooks
.
registerNotebookContentProvider
(
nullExtensionDescription
,
'
test
'
,
new
class
extends
mock
<
vscode
.
NotebookContentProvider
>
()
{
// async openNotebook() { }
});
await
extHostNotebooks
.
$acceptDocumentAndEditorsDelta
({
extHostNotebooks
.
$acceptDocumentAndEditorsDelta
({
addedDocuments
:
[{
handle
:
0
,
uri
:
notebookUri
,
...
...
@@ -72,7 +72,7 @@ suite('NotebookConcatDocument', function () {
}
]
});
await
extHostNotebooks
.
$acceptDocumentAndEditorsDelta
({
newActiveEditor
:
'
_notebook_editor_0
'
});
extHostNotebooks
.
$acceptDocumentAndEditorsDelta
({
newActiveEditor
:
'
_notebook_editor_0
'
});
notebook
=
extHostNotebooks
.
notebookDocuments
[
0
]
!
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录