Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
298a5d07
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,发现更多精彩内容 >>
提交
298a5d07
编写于
2月 13, 2020
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move typings to common.
上级
7d12ce55
变更
18
显示空白变更内容
内联
并排
Showing
18 changed file
with
173 addition
and
137 deletion
+173
-137
extensions/notebook-test/src/notebookProvider.ts
extensions/notebook-test/src/notebookProvider.ts
+1
-1
src/vs/editor/common/modes.ts
src/vs/editor/common/modes.ts
+0
-100
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+1
-1
src/vs/workbench/api/browser/mainThreadNotebook.ts
src/vs/workbench/api/browser/mainThreadNotebook.ts
+10
-1
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+7
-4
src/vs/workbench/api/common/extHostNotebook.ts
src/vs/workbench/api/common/extHostNotebook.ts
+20
-15
src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts
...rkbench/contrib/notebook/browser/notebook.contribution.ts
+1
-1
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
+3
-3
src/vs/workbench/contrib/notebook/browser/notebookEditorInput.ts
...workbench/contrib/notebook/browser/notebookEditorInput.ts
+1
-1
src/vs/workbench/contrib/notebook/browser/notebookHandler.ts
src/vs/workbench/contrib/notebook/browser/notebookHandler.ts
+1
-2
src/vs/workbench/contrib/notebook/browser/notebookService.ts
src/vs/workbench/contrib/notebook/browser/notebookService.ts
+1
-1
src/vs/workbench/contrib/notebook/browser/renderers/cellRenderer.ts
...kbench/contrib/notebook/browser/renderers/cellRenderer.ts
+1
-1
src/vs/workbench/contrib/notebook/browser/renderers/cellViewModel.ts
...bench/contrib/notebook/browser/renderers/cellViewModel.ts
+1
-1
src/vs/workbench/contrib/notebook/browser/renderers/codeCell.ts
.../workbench/contrib/notebook/browser/renderers/codeCell.ts
+2
-1
src/vs/workbench/contrib/notebook/browser/renderers/contentWidget.ts
...bench/contrib/notebook/browser/renderers/contentWidget.ts
+2
-1
src/vs/workbench/contrib/notebook/browser/renderers/markdownCell.ts
...kbench/contrib/notebook/browser/renderers/markdownCell.ts
+2
-1
src/vs/workbench/contrib/notebook/browser/renderers/outputRenderer.ts
...ench/contrib/notebook/browser/renderers/outputRenderer.ts
+2
-2
src/vs/workbench/contrib/notebook/common/notebook.ts
src/vs/workbench/contrib/notebook/common/notebook.ts
+117
-0
未找到文件。
extensions/notebook-test/src/notebookProvider.ts
浏览文件 @
298a5d07
...
...
@@ -8,7 +8,7 @@ import * as path from 'path';
declare
var
TextEncoder
:
any
;
const
mjAPI
=
require
(
"
mathjax-node
-svg2png
"
);
const
mjAPI
=
require
(
"
mathjax-node
"
);
mjAPI
.
config
({
MathJax
:
{
// traditional MathJax configuration
...
...
src/vs/editor/common/modes.ts
浏览文件 @
298a5d07
...
...
@@ -1518,106 +1518,6 @@ export interface IWebviewPanelOptions {
readonly
retainContextWhenHidden
?:
boolean
;
}
/**
* @internal
*/
export
interface
INotebookSelectors
{
readonly
filenamePattern
?:
string
;
}
/**
* @internal
*/
export
interface
IStreamOutput
{
output_type
:
'
stream
'
;
text
:
string
;
}
/**
* @internal
*/
export
interface
IErrorOutput
{
output_type
:
'
error
'
;
/**
* Exception Name
*/
ename
?:
string
;
/**
* Exception Value
*/
evalue
?:
string
;
/**
* Exception call stacks
*/
traceback
?:
string
[];
}
/**
* @internal
*/
export
interface
IDisplayOutput
{
output_type
:
'
display_data
'
;
/**
* { mime_type: value }
*/
data
:
{
string
:
string
};
}
/**
* @internal
*/
export
interface
IGenericOutput
{
output_type
:
string
;
}
/**
* @internal
*/
export
type
IOutput
=
IStreamOutput
|
any
;
/**
* @internal
*/
export
interface
ICell
{
handle
:
number
;
source
:
string
[];
language
:
string
;
cell_type
:
'
markdown
'
|
'
code
'
;
outputs
:
IOutput
[];
onDidChangeOutputs
?:
Event
<
void
>
;
isDirty
:
boolean
;
}
/**
* @internal
*/
export
interface
LanguageInfo
{
file_extension
:
string
;
}
/**
* @internal
*/
export
interface
IMetadata
{
language_info
:
LanguageInfo
;
}
/**
* @internal
*/
export
interface
INotebook
{
handle
:
number
;
// metadata: IMetadata;
readonly
uri
:
URI
;
languages
:
string
[];
cells
:
ICell
[];
onDidChangeCells
?:
Event
<
void
>
;
onDidChangeDirtyState
:
Event
<
boolean
>
;
onWillDispose
(
listener
:
()
=>
void
):
IDisposable
;
save
():
Promise
<
boolean
>
;
}
export
interface
CodeLens
{
range
:
IRange
;
id
?:
string
;
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
298a5d07
...
...
@@ -1431,7 +1431,7 @@ declare module 'vscode' {
* @returns HTML fragment. We can probably return `CellOutput` instead of string ?
*/
render
(
document
:
NotebookDocument
,
cell
:
NotebookCell
,
output
:
CellOutput
):
string
;
dependencie
s
?:
Uri
[];
preload
s
?:
Uri
[];
}
namespace
window
{
...
...
src/vs/workbench/api/browser/mainThreadNotebook.ts
浏览文件 @
298a5d07
...
...
@@ -8,9 +8,9 @@ import { MainContext, MainThreadNotebookShape, NotebookExtensionDescription, IEx
import
{
Disposable
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
URI
,
UriComponents
}
from
'
vs/base/common/uri
'
;
import
{
INotebookService
,
IMainNotebookController
}
from
'
vs/workbench/contrib/notebook/browser/notebookService
'
;
import
{
INotebook
,
ICell
,
IOutput
}
from
'
vs/editor/common/modes
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
IMarkdownString
}
from
'
vs/base/common/htmlContent
'
;
import
{
ICell
,
IOutput
,
INotebook
,
INotebookMimeTypeSelector
}
from
'
vs/workbench/contrib/notebook/common/notebook
'
;
export
class
MainThreadCell
implements
ICell
{
private
_onDidChangeOutputs
=
new
Emitter
<
void
>
();
...
...
@@ -183,6 +183,7 @@ export class MainThreadNotebookDocument extends Disposable implements INotebook
@
extHostNamedCustomer
(
MainContext
.
MainThreadNotebook
)
export
class
MainThreadNotebooks
extends
Disposable
implements
MainThreadNotebookShape
{
private
readonly
_notebookProviders
=
new
Map
<
string
,
MainThreadNotebookController
>
();
private
readonly
_renderers
=
new
Map
<
number
,
MainThreadNotebookController
>
();
private
readonly
_proxy
:
ExtHostNotebookShape
;
constructor
(
...
...
@@ -196,6 +197,14 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo
}));
}
$registerNotebookRenderer
(
extension
:
NotebookExtensionDescription
,
selectors
:
INotebookMimeTypeSelector
,
handle
:
number
):
Promise
<
void
>
{
throw
new
Error
(
'
Method not implemented.
'
);
}
$unregisterNotebookRenderer
(
handle
:
number
):
Promise
<
void
>
{
throw
new
Error
(
'
Method not implemented.
'
);
}
async
$registerNotebookProvider
(
extension
:
NotebookExtensionDescription
,
viewType
:
string
):
Promise
<
void
>
{
let
controller
=
new
MainThreadNotebookController
(
this
.
_proxy
,
this
,
viewType
);
this
.
_notebookProviders
.
set
(
viewType
,
controller
);
...
...
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
298a5d07
...
...
@@ -50,6 +50,7 @@ import { ExtensionActivationReason } from 'vs/workbench/api/common/extHostExtens
import
{
TunnelDto
}
from
'
vs/workbench/api/common/extHostTunnelService
'
;
import
{
TunnelOptions
}
from
'
vs/platform/remote/common/tunnel
'
;
import
{
TimelineItem
,
TimelineProviderDescriptor
,
TimelineChangeEvent
,
TimelineItemWithSource
}
from
'
vs/workbench/contrib/timeline/common/timeline
'
;
import
{
INotebook
,
ICell
,
INotebookMimeTypeSelector
}
from
'
vs/workbench/contrib/notebook/common/notebook
'
;
export
interface
IEnvironment
{
isExtensionDevelopmentDebug
:
boolean
;
...
...
@@ -627,10 +628,12 @@ export interface ExtHostWebviewsShape {
export
interface
MainThreadNotebookShape
extends
IDisposable
{
$registerNotebookProvider
(
extension
:
NotebookExtensionDescription
,
viewType
:
string
):
Promise
<
void
>
;
$unregisterNotebookProvider
(
viewType
:
string
):
Promise
<
void
>
;
$registerNotebookRenderer
(
extension
:
NotebookExtensionDescription
,
selectors
:
INotebookMimeTypeSelector
,
handle
:
number
):
Promise
<
void
>
;
$unregisterNotebookRenderer
(
handle
:
number
):
Promise
<
void
>
;
$createNotebookDocument
(
handle
:
number
,
viewType
:
string
,
resource
:
UriComponents
):
Promise
<
void
>
;
$updateNotebook
(
viewType
:
string
,
resource
:
UriComponents
,
notebook
:
modes
.
INotebook
):
Promise
<
void
>
;
$updateNotebookCells
(
viewType
:
string
,
resource
:
UriComponents
,
cells
:
modes
.
ICell
[]):
Promise
<
void
>
;
$updateNotebookCell
(
viewType
:
string
,
resource
:
UriComponents
,
cell
:
modes
.
ICell
):
Promise
<
void
>
;
$updateNotebook
(
viewType
:
string
,
resource
:
UriComponents
,
notebook
:
INotebook
):
Promise
<
void
>
;
$updateNotebookCells
(
viewType
:
string
,
resource
:
UriComponents
,
cells
:
ICell
[]):
Promise
<
void
>
;
$updateNotebookCell
(
viewType
:
string
,
resource
:
UriComponents
,
cell
:
ICell
):
Promise
<
void
>
;
$updateNotebookLanguages
(
viewType
:
string
,
resource
:
UriComponents
,
languages
:
string
[]):
Promise
<
void
>
;
}
...
...
@@ -1457,7 +1460,7 @@ export interface ExtHostNotebookShape {
$executeNotebook
(
viewType
:
string
,
uri
:
URI
):
Promise
<
void
>
;
$executeNotebookCell
(
viewType
:
string
,
uri
:
URI
,
cellHandle
:
number
):
Promise
<
void
>
;
$latexRenderer
(
viewType
:
string
,
value
:
string
):
Promise
<
IMarkdownString
|
undefined
>
;
$createRawCell
(
viewType
:
string
,
uri
:
URI
,
index
:
number
,
language
:
string
,
type
:
'
markdown
'
|
'
code
'
):
Promise
<
modes
.
ICell
|
undefined
>
;
$createRawCell
(
viewType
:
string
,
uri
:
URI
,
index
:
number
,
language
:
string
,
type
:
'
markdown
'
|
'
code
'
):
Promise
<
ICell
|
undefined
>
;
$deleteCell
(
viewType
:
string
,
uri
:
URI
,
index
:
number
):
Promise
<
boolean
>
;
$saveNotebook
(
viewType
:
string
,
uri
:
URI
):
Promise
<
boolean
>
;
$updateActiveEditor
(
viewType
:
string
,
uri
:
URI
):
Promise
<
void
>
;
...
...
src/vs/workbench/api/common/extHostNotebook.ts
浏览文件 @
298a5d07
...
...
@@ -12,10 +12,9 @@ import { DisposableStore } 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
{
ICell
}
from
'
vs/editor/common/modes
'
;
// import { ExtHostDocumentData } from 'vs/workbench/api/common/extHostDocumentData';
import
*
as
extHostTypeConverter
from
'
vs/workbench/api/common/extHostTypeConverters
'
;
import
{
IMarkdownString
}
from
'
vs/base/common/htmlContent
'
;
import
{
ICell
}
from
'
vs/workbench/contrib/notebook/common/notebook
'
;
export
class
ExtHostCell
implements
vscode
.
NotebookCell
{
...
...
@@ -101,7 +100,7 @@ export class ExtHostNotebookDocument implements vscode.NotebookDocument {
}
else
{
return
output
;
}
})
})
;
}
this
.
_proxy
.
$updateNotebookCell
(
this
.
viewType
,
this
.
uri
,
{
...
...
@@ -152,7 +151,7 @@ export class ExtHostNotebookDocument implements vscode.NotebookDocument {
}
else
{
return
output
;
}
})
})
;
}
return
{
...
...
@@ -162,7 +161,7 @@ export class ExtHostNotebookDocument implements vscode.NotebookDocument {
cell_type
:
cell
.
cell_type
,
outputs
:
outputs
,
isDirty
:
false
}
}
;
}
));
}
...
...
@@ -187,7 +186,7 @@ export class ExtHostNotebookDocument implements vscode.NotebookDocument {
}
else
{
return
output
;
}
})
})
;
}
this
.
_proxy
.
$updateNotebookCell
(
this
.
viewType
,
this
.
uri
,
{
...
...
@@ -302,6 +301,9 @@ export class ExtHostNotebookEditor implements vscode.NotebookEditor {
}
export
class
ExtHostNotebookOutputRenderer
{
private
static
_handlePool
:
number
=
0
;
readonly
handle
=
ExtHostNotebookOutputRenderer
.
_handlePool
++
;
constructor
(
private
filter
:
vscode
.
NotebookOutputSelector
,
private
renderer
:
vscode
.
NotebookOutputRenderer
...
...
@@ -332,7 +334,7 @@ export class ExtHostNotebookOutputRenderer {
}
render
(
document
:
ExtHostNotebookDocument
,
cell
:
ExtHostCell
,
output
:
vscode
.
CellOutput
):
vscode
.
CellDisplayOutput
{
let
html
=
this
.
renderer
.
render
(
document
,
cell
,
output
);
let
html
=
this
.
renderer
.
render
(
document
,
cell
,
output
);
return
{
output_type
:
'
display_data
'
,
...
...
@@ -357,7 +359,7 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
private
readonly
_notebookProviders
=
new
Map
<
string
,
{
readonly
provider
:
vscode
.
NotebookProvider
,
readonly
extension
:
IExtensionDescription
}
>
();
private
readonly
_documents
=
new
Map
<
string
,
ExtHostNotebookDocument
>
();
private
readonly
_editors
=
new
Map
<
string
,
ExtHostNotebookEditor
>
();
private
readonly
_notebookOutputRenderers
:
ExtHostNotebookOutputRenderer
[]
=
[]
;
private
readonly
_notebookOutputRenderers
=
new
Map
<
number
,
ExtHostNotebookOutputRenderer
>
()
;
constructor
(
mainContext
:
IMainContext
,
private
_documentsAndEditors
:
ExtHostDocumentsAndEditors
)
{
...
...
@@ -377,16 +379,19 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
filter
:
vscode
.
NotebookOutputSelector
,
renderer
:
vscode
.
NotebookOutputRenderer
):
vscode
.
Disposable
{
this
.
_notebookOutputRenderers
.
push
(
new
ExtHostNotebookOutputRenderer
(
filter
,
renderer
));
let
extHostRenderer
=
new
ExtHostNotebookOutputRenderer
(
filter
,
renderer
);
this
.
_notebookOutputRenderers
.
set
(
extHostRenderer
.
handle
,
extHostRenderer
);
this
.
_proxy
.
$registerNotebookRenderer
({
id
:
extension
.
identifier
,
location
:
extension
.
extensionLocation
},
filter
,
extHostRenderer
.
handle
);
return
new
VSCodeDisposable
(()
=>
{
})
this
.
_notebookOutputRenderers
.
delete
(
extHostRenderer
.
handle
);
this
.
_proxy
.
$unregisterNotebookRenderer
(
extHostRenderer
.
handle
);
});
}
findBestMatchedRenderer
(
output
:
vscode
.
CellOutput
):
ExtHostNotebookOutputRenderer
|
undefined
{
for
(
let
i
=
0
;
i
<
this
.
_notebookOutputRenderers
.
length
;
i
++
)
{
if
(
this
.
_notebookOutputRenderers
[
i
].
matches
(
output
))
{
return
this
.
_notebookOutputRenderers
[
i
];
for
(
let
renderer
of
this
.
_notebookOutputRenderers
)
{
if
(
renderer
[
1
].
matches
(
output
))
{
return
renderer
[
1
];
}
}
...
...
src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts
浏览文件 @
298a5d07
...
...
@@ -25,7 +25,7 @@ import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import
{
InputFocusedContextKey
,
InputFocusedContext
}
from
'
vs/platform/contextkey/common/contextkeys
'
;
import
{
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
KeybindingWeight
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
NotebookHandler
}
from
'
vs/workbench/contrib/notebook/browser/
renderers/interfaces
'
;
import
{
NotebookHandler
}
from
'
vs/workbench/contrib/notebook/browser/
notebookHandler
'
;
Registry
.
as
<
IEditorRegistry
>
(
EditorExtensions
.
Editors
).
registerEditor
(
EditorDescriptor
.
create
(
...
...
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
浏览文件 @
298a5d07
...
...
@@ -31,10 +31,10 @@ import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
getZoomLevel
}
from
'
vs/base/browser/browser
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
INotebook
}
from
'
vs/editor/common/modes
'
;
import
{
IContextKeyService
,
IContextKey
,
RawContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
NotebookHandler
,
CELL_MARGIN
}
from
'
vs/workbench/contrib/notebook/browser/renderers/interfaces
'
;
import
{
IOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
import
{
INotebook
,
CELL_MARGIN
}
from
'
vs/workbench/contrib/notebook/common/notebook
'
;
import
{
NotebookHandler
}
from
'
vs/workbench/contrib/notebook/browser/notebookHandler
'
;
const
$
=
DOM
.
$
;
const
NOTEBOOK_EDITOR_VIEW_STATE_PREFERENCE_KEY
=
'
NotebookEditorViewState
'
;
...
...
@@ -280,7 +280,7 @@ export class NotebookEditor extends BaseEditor implements NotebookHandler {
let
viewState
=
this
.
loadTextEditorViewState
(
input
);
this
.
notebook
=
model
.
getNotebook
();
this
.
viewType
=
input
.
viewType
;
this
.
viewCells
=
this
.
notebook
.
cells
.
map
(
cell
=>
{
this
.
viewCells
=
this
.
notebook
!
.
cells
.
map
(
cell
=>
{
const
isEditing
=
viewState
&&
viewState
.
editingCells
[
cell
.
handle
];
return
new
CellViewModel
(
input
.
viewType
!
,
this
.
notebook
!
.
handle
,
cell
,
!!
isEditing
,
this
.
modelService
,
this
.
modeService
,
this
.
openerService
,
this
.
notebookService
,
this
.
themeService
);
});
...
...
src/vs/workbench/contrib/notebook/browser/notebookEditorInput.ts
浏览文件 @
298a5d07
...
...
@@ -7,8 +7,8 @@ import { EditorInput, EditorModel, IEditorInput, GroupIdentifier, ISaveOptions }
import
{
ITextModelService
}
from
'
vs/editor/common/services/resolverService
'
;
import
{
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
INotebook
,
ICell
}
from
'
vs/editor/common/modes
'
;
import
{
INotebookService
}
from
'
vs/workbench/contrib/notebook/browser/notebookService
'
;
import
{
INotebook
,
ICell
}
from
'
vs/workbench/contrib/notebook/common/notebook
'
;
export
class
NotebookEditorModel
extends
EditorModel
{
private
_dirty
=
false
;
...
...
src/vs/workbench/contrib/notebook/browser/
renderers/interfaces
.ts
→
src/vs/workbench/contrib/notebook/browser/
notebookHandler
.ts
浏览文件 @
298a5d07
...
...
@@ -3,14 +3,13 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
*
as
DOM
from
'
vs/base/browser/dom
'
;
import
{
IMouseWheelEvent
}
from
'
vs/base/browser/mouseEvent
'
;
import
{
BareFontInfo
}
from
'
vs/editor/common/config/fontInfo
'
;
import
{
CodeEditorWidget
}
from
'
vs/editor/browser/widget/codeEditorWidget
'
;
import
{
CellViewModel
}
from
'
vs/workbench/contrib/notebook/browser/renderers/cellViewModel
'
;
export
const
CELL_MARGIN
=
24
;
export
interface
NotebookHandler
{
viewType
:
string
|
undefined
;
insertEmptyNotebookCell
(
listIndex
:
number
|
undefined
,
cell
:
CellViewModel
,
type
:
'
markdown
'
|
'
code
'
,
direction
:
'
above
'
|
'
below
'
):
Promise
<
void
>
;
...
...
src/vs/workbench/contrib/notebook/browser/notebookService.ts
浏览文件 @
298a5d07
...
...
@@ -5,13 +5,13 @@
import
{
Disposable
,
IDisposable
,
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
INotebook
,
ICell
}
from
'
vs/editor/common/modes
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
notebookExtensionPoint
}
from
'
vs/workbench/contrib/notebook/browser/extensionPoint
'
;
import
{
NotebookProviderInfo
}
from
'
vs/workbench/contrib/notebook/common/notebookProvider
'
;
import
{
NotebookExtensionDescription
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
IMarkdownString
}
from
'
vs/base/common/htmlContent
'
;
import
{
INotebook
,
ICell
}
from
'
vs/workbench/contrib/notebook/common/notebook
'
;
function
MODEL_ID
(
resource
:
URI
):
string
{
return
resource
.
toString
();
...
...
src/vs/workbench/contrib/notebook/browser/renderers/cellRenderer.ts
浏览文件 @
298a5d07
...
...
@@ -17,12 +17,12 @@ import { getZoomLevel } from 'vs/base/browser/browser';
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
NotebookHandler
,
CellRenderTemplate
}
from
'
vs/workbench/contrib/notebook/browser/renderers/interfaces
'
;
import
{
StatefullMarkdownCell
}
from
'
vs/workbench/contrib/notebook/browser/renderers/markdownCell
'
;
import
{
CellViewModel
}
from
'
./cellViewModel
'
;
import
{
CodeCell
}
from
'
vs/workbench/contrib/notebook/browser/renderers/codeCell
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
CellRenderTemplate
,
NotebookHandler
}
from
'
vs/workbench/contrib/notebook/browser/notebookHandler
'
;
export
class
NotebookCellListDelegate
implements
IListVirtualDelegate
<
CellViewModel
>
{
private
_lineHeight
:
number
;
...
...
src/vs/workbench/contrib/notebook/browser/renderers/cellViewModel.ts
浏览文件 @
298a5d07
...
...
@@ -9,12 +9,12 @@ import { Disposable } from 'vs/base/common/lifecycle';
import
{
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
ICell
}
from
'
vs/editor/common/modes
'
;
import
*
as
UUID
from
'
vs/base/common/uuid
'
;
import
{
MarkdownRenderer
}
from
'
vs/workbench/contrib/notebook/browser/renderers/mdRenderer
'
;
import
{
IOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
import
{
INotebookService
}
from
'
vs/workbench/contrib/notebook/browser/notebookService
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
ICell
}
from
'
vs/workbench/contrib/notebook/common/notebook
'
;
export
class
CellViewModel
extends
Disposable
{
private
_textModel
:
ITextModel
|
null
=
null
;
...
...
src/vs/workbench/contrib/notebook/browser/renderers/codeCell.ts
浏览文件 @
298a5d07
...
...
@@ -5,13 +5,14 @@
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
CellViewModel
}
from
'
vs/workbench/contrib/notebook/browser/renderers/cellViewModel
'
;
import
{
CellRenderTemplate
,
NotebookHandler
,
CELL_MARGIN
}
from
'
vs/workbench/contrib/notebook/browser/renderers/interfaces
'
;
import
{
getResizesObserver
}
from
'
vs/workbench/contrib/notebook/browser/renderers/sizeObserver
'
;
import
{
MimeTypeRenderer
}
from
'
vs/workbench/contrib/notebook/browser/renderers/outputRenderer
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
CELL_MARGIN
}
from
'
vs/workbench/contrib/notebook/common/notebook
'
;
import
{
CellRenderTemplate
,
NotebookHandler
}
from
'
vs/workbench/contrib/notebook/browser/notebookHandler
'
;
export
class
CodeCell
extends
Disposable
{
constructor
(
...
...
src/vs/workbench/contrib/notebook/browser/renderers/contentWidget.ts
浏览文件 @
298a5d07
...
...
@@ -13,7 +13,8 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
WebviewResourceScheme
}
from
'
vs/workbench/contrib/webview/common/resourceLoader
'
;
import
*
as
path
from
'
vs/base/common/path
'
;
import
{
NotebookHandler
,
CELL_MARGIN
}
from
'
vs/workbench/contrib/notebook/browser/renderers/interfaces
'
;
import
{
CELL_MARGIN
}
from
'
vs/workbench/contrib/notebook/common/notebook
'
;
import
{
NotebookHandler
}
from
'
vs/workbench/contrib/notebook/browser/notebookHandler
'
;
export
interface
IDimentionMessage
{
type
:
'
dimension
'
;
...
...
src/vs/workbench/contrib/notebook/browser/renderers/markdownCell.ts
浏览文件 @
298a5d07
...
...
@@ -6,10 +6,11 @@
import
{
CodeEditorWidget
}
from
'
vs/editor/browser/widget/codeEditorWidget
'
;
import
{
Disposable
,
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
CellViewModel
}
from
'
vs/workbench/contrib/notebook/browser/renderers/cellViewModel
'
;
import
{
CellRenderTemplate
,
NotebookHandler
,
CELL_MARGIN
}
from
'
vs/workbench/contrib/notebook/browser/renderers/interfaces
'
;
import
{
IEditorOptions
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
getResizesObserver
}
from
'
vs/workbench/contrib/notebook/browser/renderers/sizeObserver
'
;
import
{
CELL_MARGIN
}
from
'
vs/workbench/contrib/notebook/common/notebook
'
;
import
{
NotebookHandler
,
CellRenderTemplate
}
from
'
vs/workbench/contrib/notebook/browser/notebookHandler
'
;
export
class
StatefullMarkdownCell
extends
Disposable
{
private
editor
:
CodeEditorWidget
|
null
=
null
;
...
...
src/vs/workbench/contrib/notebook/browser/renderers/outputRenderer.ts
浏览文件 @
298a5d07
...
...
@@ -8,15 +8,15 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
import
{
RGBA
,
Color
}
from
'
vs/base/common/color
'
;
import
{
ansiColorIdentifiers
}
from
'
vs/workbench/contrib/terminal/common/terminalColorRegistry
'
;
import
{
isArray
}
from
'
vs/base/common/types
'
;
import
{
IOutput
}
from
'
vs/editor/common/modes
'
;
import
*
as
marked
from
'
vs/base/common/marked/marked
'
;
import
{
NotebookHandler
}
from
'
vs/workbench/contrib/notebook/browser/renderers/interfaces
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
CodeEditorWidget
}
from
'
vs/editor/browser/widget/codeEditorWidget
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
IEditorOptions
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
IOutput
}
from
'
vs/workbench/contrib/notebook/common/notebook
'
;
import
{
NotebookHandler
}
from
'
vs/workbench/contrib/notebook/browser/notebookHandler
'
;
export
function
registerMineTypeRenderer
(
types
:
string
[],
renderer
:
IMimeRenderer
)
{
types
.
forEach
(
type
=>
{
...
...
src/vs/workbench/contrib/notebook/common/notebook.ts
0 → 100644
浏览文件 @
298a5d07
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
export
interface
INotebookMimeTypeSelector
{
type
:
string
;
subTypes
?:
string
[];
}
/**
* @internal
*/
export
interface
INotebookSelectors
{
readonly
filenamePattern
?:
string
;
}
/**
* @internal
*/
export
interface
IStreamOutput
{
output_type
:
'
stream
'
;
text
:
string
;
}
/**
* @internal
*/
export
interface
IErrorOutput
{
output_type
:
'
error
'
;
/**
* Exception Name
*/
ename
?:
string
;
/**
* Exception Value
*/
evalue
?:
string
;
/**
* Exception call stacks
*/
traceback
?:
string
[];
}
/**
* @internal
*/
export
interface
IDisplayOutput
{
output_type
:
'
display_data
'
;
/**
* { mime_type: value }
*/
data
:
{
string
:
string
};
}
/**
* @internal
*/
export
interface
IGenericOutput
{
output_type
:
string
;
}
/**
* @internal
*/
export
type
IOutput
=
IStreamOutput
|
any
;
/**
* @internal
*/
export
interface
ICell
{
handle
:
number
;
source
:
string
[];
language
:
string
;
cell_type
:
'
markdown
'
|
'
code
'
;
outputs
:
IOutput
[];
onDidChangeOutputs
?:
Event
<
void
>
;
isDirty
:
boolean
;
}
/**
* @internal
*/
export
interface
LanguageInfo
{
file_extension
:
string
;
}
/**
* @internal
*/
export
interface
IMetadata
{
language_info
:
LanguageInfo
;
}
/**
* @internal
*/
export
interface
INotebook
{
handle
:
number
;
// metadata: IMetadata;
readonly
uri
:
URI
;
languages
:
string
[];
cells
:
ICell
[];
onDidChangeCells
?:
Event
<
void
>
;
onDidChangeDirtyState
:
Event
<
boolean
>
;
onWillDispose
(
listener
:
()
=>
void
):
IDisposable
;
save
():
Promise
<
boolean
>
;
}
export
const
CELL_MARGIN
=
24
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录