Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
ffae23b5
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ffae23b5
编写于
7月 21, 2021
作者:
R
Rob Lourens
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Delete unused cell renderer parts
上级
b5253894
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
2 addition
and
122 deletion
+2
-122
src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts
...h/contrib/notebook/browser/view/renderers/cellRenderer.ts
+2
-122
未找到文件。
src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts
浏览文件 @
ffae23b5
...
@@ -5,15 +5,12 @@
...
@@ -5,15 +5,12 @@
import
{
getPixelRatio
,
getZoomLevel
}
from
'
vs/base/browser/browser
'
;
import
{
getPixelRatio
,
getZoomLevel
}
from
'
vs/base/browser/browser
'
;
import
*
as
DOM
from
'
vs/base/browser/dom
'
;
import
*
as
DOM
from
'
vs/base/browser/dom
'
;
import
*
as
aria
from
'
vs/base/browser/ui/aria/aria
'
;
import
{
renderIcon
}
from
'
vs/base/browser/ui/iconLabel/iconLabels
'
;
import
{
IListRenderer
,
IListVirtualDelegate
}
from
'
vs/base/browser/ui/list/list
'
;
import
{
IListRenderer
,
IListVirtualDelegate
}
from
'
vs/base/browser/ui/list/list
'
;
import
{
ProgressBar
}
from
'
vs/base/browser/ui/progressbar/progressbar
'
;
import
{
ProgressBar
}
from
'
vs/base/browser/ui/progressbar/progressbar
'
;
import
{
ToolBar
}
from
'
vs/base/browser/ui/toolbar/toolbar
'
;
import
{
ToolBar
}
from
'
vs/base/browser/ui/toolbar/toolbar
'
;
import
{
Action
,
IAction
}
from
'
vs/base/common/actions
'
;
import
{
Action
,
IAction
}
from
'
vs/base/common/actions
'
;
import
*
as
Codicons
from
'
vs/base/common/codicons
'
;
import
{
Color
}
from
'
vs/base/common/color
'
;
import
{
Color
}
from
'
vs/base/common/color
'
;
import
{
combinedDisposable
,
Disposable
,
DisposableStore
,
IDisposable
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
combinedDisposable
,
Disposable
,
DisposableStore
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
MarshalledId
}
from
'
vs/base/common/marshalling
'
;
import
{
MarshalledId
}
from
'
vs/base/common/marshalling
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
...
@@ -37,11 +34,10 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
...
@@ -37,11 +34,10 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
syncing
}
from
'
vs/platform/theme/common/iconRegistry
'
;
import
{
ThemeIcon
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
ThemeIcon
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
DeleteCellAction
,
INotebookActionContext
,
INotebookCellActionContext
}
from
'
vs/workbench/contrib/notebook/browser/contrib/coreActions
'
;
import
{
DeleteCellAction
,
INotebookActionContext
,
INotebookCellActionContext
}
from
'
vs/workbench/contrib/notebook/browser/contrib/coreActions
'
;
import
{
BaseCellRenderTemplate
,
CodeCellLayoutInfo
,
CodeCellRenderTemplate
,
EXPAND_CELL_INPUT_COMMAND_ID
,
ICellViewModel
,
INotebookEditor
,
isCodeCellRenderTemplate
,
MarkdownCellRenderTemplate
,
NOTEBOOK_CELL_EXECUTION_STATE
,
NOTEBOOK_CELL_LIST_FOCUSED
,
NOTEBOOK_CELL_TYPE
,
NOTEBOOK_EDITOR_FOCUSED
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
BaseCellRenderTemplate
,
CodeCellLayoutInfo
,
CodeCellRenderTemplate
,
EXPAND_CELL_INPUT_COMMAND_ID
,
ICellViewModel
,
INotebookEditor
,
isCodeCellRenderTemplate
,
MarkdownCellRenderTemplate
,
NOTEBOOK_CELL_EXECUTION_STATE
,
NOTEBOOK_CELL_LIST_FOCUSED
,
NOTEBOOK_CELL_TYPE
,
NOTEBOOK_EDITOR_FOCUSED
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
errorStateIcon
,
successStateIcon
,
unfoldIcon
}
from
'
vs/workbench/contrib/notebook/browser/notebookIcons
'
;
import
{
unfoldIcon
}
from
'
vs/workbench/contrib/notebook/browser/notebookIcons
'
;
import
{
CodiconActionViewItem
}
from
'
vs/workbench/contrib/notebook/browser/view/renderers/cellActionView
'
;
import
{
CodiconActionViewItem
}
from
'
vs/workbench/contrib/notebook/browser/view/renderers/cellActionView
'
;
import
{
CellContextKeyManager
}
from
'
vs/workbench/contrib/notebook/browser/view/renderers/cellContextKeys
'
;
import
{
CellContextKeyManager
}
from
'
vs/workbench/contrib/notebook/browser/view/renderers/cellContextKeys
'
;
import
{
CellDragAndDropController
,
DRAGGING_CLASS
}
from
'
vs/workbench/contrib/notebook/browser/view/renderers/cellDnd
'
;
import
{
CellDragAndDropController
,
DRAGGING_CLASS
}
from
'
vs/workbench/contrib/notebook/browser/view/renderers/cellDnd
'
;
...
@@ -1045,122 +1041,6 @@ export function getCodeCellExecutionContextKeyService(contextKeyService: IContex
...
@@ -1045,122 +1041,6 @@ export function getCodeCellExecutionContextKeyService(contextKeyService: IContex
return
executionContextKeyService
;
return
executionContextKeyService
;
}
}
export
class
TimerRenderer
{
constructor
(
private
readonly
container
:
HTMLElement
)
{
DOM
.
hide
(
container
);
}
private
intervalTimer
:
number
|
undefined
;
start
(
startTime
:
number
,
adjustment
:
number
):
IDisposable
{
this
.
stop
();
DOM
.
show
(
this
.
container
);
const
intervalTimer
=
setInterval
(()
=>
{
const
duration
=
Date
.
now
()
-
startTime
+
adjustment
;
this
.
container
.
textContent
=
this
.
formatDuration
(
duration
);
},
100
);
this
.
intervalTimer
=
intervalTimer
as
unknown
as
number
|
undefined
;
return
toDisposable
(()
=>
{
clearInterval
(
intervalTimer
);
});
}
stop
()
{
if
(
this
.
intervalTimer
)
{
clearInterval
(
this
.
intervalTimer
);
}
}
show
(
duration
:
number
)
{
this
.
stop
();
DOM
.
show
(
this
.
container
);
this
.
container
.
textContent
=
this
.
formatDuration
(
duration
);
}
clear
()
{
DOM
.
hide
(
this
.
container
);
this
.
stop
();
this
.
container
.
textContent
=
''
;
}
private
formatDuration
(
duration
:
number
)
{
const
seconds
=
Math
.
floor
(
duration
/
1000
);
const
tenths
=
String
(
duration
-
seconds
*
1000
).
charAt
(
0
);
return
`
${
seconds
}
.
${
tenths
}
s`
;
}
}
export
class
RunStateRenderer
{
private
static
readonly
MIN_SPINNER_TIME
=
200
;
private
spinnerTimer
:
any
|
undefined
;
private
lastRunState
:
NotebookCellExecutionState
|
undefined
;
private
pendingNewState
:
NotebookCellExecutionState
|
undefined
;
private
pendingLastRunSuccess
:
boolean
|
undefined
;
constructor
(
private
readonly
element
:
HTMLElement
)
{
DOM
.
hide
(
element
);
}
clear
()
{
if
(
this
.
spinnerTimer
)
{
clearTimeout
(
this
.
spinnerTimer
);
this
.
spinnerTimer
=
undefined
;
}
}
renderState
(
runState
:
NotebookCellExecutionState
|
undefined
,
getCellIndex
:
()
=>
number
,
lastRunSuccess
:
boolean
|
undefined
=
undefined
)
{
if
(
this
.
spinnerTimer
)
{
this
.
pendingNewState
=
runState
;
this
.
pendingLastRunSuccess
=
lastRunSuccess
;
return
;
}
let
runStateTooltip
:
string
|
undefined
;
if
(
!
runState
&&
lastRunSuccess
)
{
aria
.
alert
(
`Code cell at
${
getCellIndex
()}
finishes running successfully`
);
DOM
.
reset
(
this
.
element
,
renderIcon
(
successStateIcon
));
}
else
if
(
!
runState
&&
!
lastRunSuccess
)
{
aria
.
alert
(
`Code cell at
${
getCellIndex
()}
finishes running with errors`
);
DOM
.
reset
(
this
.
element
,
renderIcon
(
errorStateIcon
));
}
else
if
(
runState
===
NotebookCellExecutionState
.
Executing
)
{
runStateTooltip
=
localize
(
'
runStateExecuting
'
,
"
Executing
"
);
if
(
this
.
lastRunState
!==
NotebookCellExecutionState
.
Executing
)
{
aria
.
alert
(
`Code cell at
${
getCellIndex
()}
starts running`
);
}
DOM
.
reset
(
this
.
element
,
renderIcon
(
syncing
));
this
.
spinnerTimer
=
setTimeout
(()
=>
{
this
.
spinnerTimer
=
undefined
;
if
(
this
.
pendingNewState
&&
this
.
pendingNewState
!==
runState
)
{
this
.
renderState
(
this
.
pendingNewState
,
getCellIndex
,
this
.
pendingLastRunSuccess
);
this
.
pendingNewState
=
undefined
;
}
},
RunStateRenderer
.
MIN_SPINNER_TIME
);
}
else
if
(
runState
===
NotebookCellExecutionState
.
Pending
)
{
// Not spinning
runStateTooltip
=
localize
(
'
runStatePending
'
,
"
Pending
"
);
DOM
.
reset
(
this
.
element
,
renderIcon
(
Codicons
.
Codicon
.
clock
));
}
else
{
this
.
element
.
innerText
=
''
;
}
if
(
!
runState
&&
typeof
lastRunSuccess
!==
'
boolean
'
)
{
DOM
.
hide
(
this
.
element
);
}
else
{
this
.
element
.
style
.
display
=
'
flex
'
;
}
if
(
runStateTooltip
)
{
this
.
element
.
setAttribute
(
'
title
'
,
runStateTooltip
);
}
this
.
lastRunState
=
runState
;
}
}
export
class
ListTopCellToolbar
extends
Disposable
{
export
class
ListTopCellToolbar
extends
Disposable
{
private
topCellToolbar
:
HTMLElement
;
private
topCellToolbar
:
HTMLElement
;
private
menu
:
IMenu
;
private
menu
:
IMenu
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录