Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
0192291e
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,发现更多精彩内容 >>
提交
0192291e
编写于
3月 04, 2020
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
disposables
上级
568a5291
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
33 addition
and
46 deletion
+33
-46
src/vs/workbench/api/browser/mainThreadNotebook.ts
src/vs/workbench/api/browser/mainThreadNotebook.ts
+1
-0
src/vs/workbench/api/common/extHostNotebook.ts
src/vs/workbench/api/common/extHostNotebook.ts
+32
-46
未找到文件。
src/vs/workbench/api/browser/mainThreadNotebook.ts
浏览文件 @
0192291e
...
...
@@ -200,6 +200,7 @@ export class MainThreadNotebookDocument extends Disposable implements INotebook
dispose
()
{
this
.
_onWillDispose
.
fire
();
this
.
_cellListeners
.
forEach
(
val
=>
val
.
dispose
());
super
.
dispose
();
}
}
...
...
src/vs/workbench/api/common/extHostNotebook.ts
浏览文件 @
0192291e
...
...
@@ -8,18 +8,13 @@ import { ExtHostNotebookShape, IMainContext, MainThreadNotebookShape, MainContex
import
{
IExtensionDescription
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
Disposable
as
VSCodeDisposable
}
from
'
./extHostTypes
'
;
import
{
URI
,
UriComponents
}
from
'
vs/base/common/uri
'
;
import
{
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
DisposableStore
,
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
readonly
}
from
'
vs/base/common/errors
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
ExtHostDocumentsAndEditors
}
from
'
vs/workbench/api/common/extHostDocumentsAndEditors
'
;
import
{
INotebookDisplayOrder
,
parseCellUri
,
parseCellHandle
,
ITransformedDisplayOutputDto
,
IOrderedMimeType
,
IStreamOutput
,
IErrorOutput
,
mimeTypeSupportedByCore
,
IOutput
,
sortMimeTypes
,
diff
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
ISplice
}
from
'
vs/base/common/sequence
'
;
interface
ExtHostOutputDisplayOrder
{
defaultOrder
:
string
[];
userOrder
?:
string
[];
}
export
class
ExtHostCell
implements
vscode
.
NotebookCell
{
private
static
_handlePool
:
number
=
0
;
...
...
@@ -88,8 +83,7 @@ export class ExtHostCell implements vscode.NotebookCell {
}
}
export
class
ExtHostNotebookDocument
implements
vscode
.
NotebookDocument
,
vscode
.
Disposable
{
export
class
ExtHostNotebookDocument
extends
Disposable
implements
vscode
.
NotebookDocument
{
private
static
_handlePool
:
number
=
0
;
readonly
handle
=
ExtHostNotebookDocument
.
_handlePool
++
;
...
...
@@ -151,9 +145,11 @@ export class ExtHostNotebookDocument implements vscode.NotebookDocument, vscode.
public
uri
:
URI
,
public
renderingHandler
:
ExtHostNotebookOutputRenderingHandler
)
{
super
();
}
dispose
()
{
super
.
dispose
();
this
.
_cellDisposableMapping
.
forEach
(
cell
=>
cell
.
dispose
());
}
...
...
@@ -332,9 +328,8 @@ export class ExtHostNotebookDocument implements vscode.NotebookDocument, vscode.
}
}
export
class
ExtHostNotebookEditor
implements
vscode
.
NotebookEditor
,
vscode
.
Disposable
{
export
class
ExtHostNotebookEditor
extends
Disposable
implements
vscode
.
NotebookEditor
{
private
_viewColumn
:
vscode
.
ViewColumn
|
undefined
;
private
_disposableStore
=
new
DisposableStore
();
constructor
(
viewType
:
string
,
...
...
@@ -343,7 +338,8 @@ export class ExtHostNotebookEditor implements vscode.NotebookEditor, vscode.Disp
public
document
:
ExtHostNotebookDocument
,
private
_documentsAndEditors
:
ExtHostDocumentsAndEditors
)
{
this
.
_disposableStore
.
add
(
this
.
_documentsAndEditors
.
onDidAddDocuments
(
documents
=>
{
super
();
this
.
_register
(
this
.
_documentsAndEditors
.
onDidAddDocuments
(
documents
=>
{
for
(
const
data
of
documents
)
{
let
textDocument
=
data
.
document
;
let
parsedCellUri
=
parseCellUri
(
textDocument
.
uri
);
...
...
@@ -359,13 +355,13 @@ export class ExtHostNotebookEditor implements vscode.NotebookEditor, vscode.Disp
if
(
cellHandle
!==
undefined
)
{
if
(
this
.
document
.
uri
.
fsPath
===
notebookUri
.
fsPath
)
{
document
.
attachCellTextDocument
(
Number
(
cellHandle
)
,
textDocument
);
document
.
attachCellTextDocument
(
cellHandle
,
textDocument
);
}
}
}
}));
this
.
_
disposableStore
.
add
(
this
.
_documentsAndEditors
.
onDidRemoveDocuments
(
documents
=>
{
this
.
_
register
(
this
.
_documentsAndEditors
.
onDidRemoveDocuments
(
documents
=>
{
for
(
const
data
of
documents
)
{
let
textDocument
=
data
.
document
;
let
parsedCellUri
=
parseCellUri
(
textDocument
.
uri
);
...
...
@@ -381,17 +377,13 @@ export class ExtHostNotebookEditor implements vscode.NotebookEditor, vscode.Disp
if
(
cellHandle
!==
undefined
)
{
if
(
this
.
document
.
uri
.
fsPath
===
notebookUri
.
fsPath
)
{
document
.
detachCellTextDocument
(
Number
(
cellHandle
)
,
textDocument
);
document
.
detachCellTextDocument
(
cellHandle
,
textDocument
);
}
}
}
}));
}
dispose
()
{
this
.
_disposableStore
.
dispose
();
}
createCell
(
content
:
string
,
language
:
string
,
type
:
CellKind
,
outputs
:
vscode
.
CellOutput
[]):
vscode
.
NotebookCell
{
let
cell
=
new
ExtHostCell
(
content
,
type
,
language
,
outputs
);
return
cell
;
...
...
@@ -435,7 +427,7 @@ export class ExtHostNotebookOutputRenderer {
}
export
interface
ExtHostNotebookOutputRenderingHandler
{
outputDisplayOrder
:
ExtHostOutput
DisplayOrder
|
undefined
;
outputDisplayOrder
:
INotebook
DisplayOrder
|
undefined
;
findBestMatchedRenderer
(
mimeType
:
string
):
ExtHostNotebookOutputRenderer
[];
}
...
...
@@ -603,14 +595,14 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
async
$deleteCell
(
viewType
:
string
,
uri
:
UriComponents
,
index
:
number
):
Promise
<
boolean
>
{
let
provider
=
this
.
_notebookProviders
.
get
(
viewType
);
if
(
provider
)
{
let
document
=
this
.
_documents
.
get
(
URI
.
revive
(
uri
).
toString
());
if
(
!
provider
)
{
return
false
;
}
if
(
document
)
{
return
document
.
deleteCell
(
index
);
}
let
document
=
this
.
_documents
.
get
(
URI
.
revive
(
uri
).
toString
());
return
false
;
if
(
document
)
{
return
document
.
deleteCell
(
index
);
}
return
false
;
...
...
@@ -628,37 +620,31 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
}
async
$updateActiveEditor
(
viewType
:
string
,
uri
:
UriComponents
):
Promise
<
void
>
{
let
document
=
this
.
_documents
.
get
(
URI
.
revive
(
uri
).
toString
());
if
(
document
)
{
this
.
_activeNotebookDocument
=
document
;
}
else
{
this
.
_activeNotebookDocument
=
undefined
;
}
this
.
_activeNotebookDocument
=
this
.
_documents
.
get
(
URI
.
revive
(
uri
).
toString
());
}
async
$destoryNotebookDocument
(
viewType
:
string
,
uri
:
UriComponents
):
Promise
<
boolean
>
{
let
provider
=
this
.
_notebookProviders
.
get
(
viewType
);
if
(
provider
)
{
let
document
=
this
.
_documents
.
get
(
URI
.
revive
(
uri
).
toString
());
if
(
!
provider
)
{
return
false
;
}
if
(
document
)
{
document
.
dispose
();
this
.
_documents
.
delete
(
URI
.
revive
(
uri
).
toString
());
}
let
document
=
this
.
_documents
.
get
(
URI
.
revive
(
uri
).
toString
());
let
editor
=
this
.
_editors
.
get
(
URI
.
revive
(
uri
).
toString
());
if
(
document
)
{
document
.
dispose
();
this
.
_documents
.
delete
(
URI
.
revive
(
uri
).
toString
());
}
if
(
editor
)
{
editor
.
dispose
();
this
.
_editors
.
delete
(
URI
.
revive
(
uri
).
toString
());
}
let
editor
=
this
.
_editors
.
get
(
URI
.
revive
(
uri
).
toString
());
return
true
;
if
(
editor
)
{
editor
.
dispose
();
this
.
_editors
.
delete
(
URI
.
revive
(
uri
).
toString
());
}
return
fals
e
;
return
tru
e
;
}
$acceptDisplayOrder
(
displayOrder
:
INotebookDisplayOrder
):
void
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录