Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
508dead0
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,发现更多精彩内容 >>
提交
508dead0
编写于
3月 14, 2020
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
list view resize: anchored element will keep its visual position
上级
6cc118c0
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
47 addition
and
5 deletion
+47
-5
src/vs/base/browser/ui/list/listView.ts
src/vs/base/browser/ui/list/listView.ts
+8
-2
src/vs/base/browser/ui/list/listWidget.ts
src/vs/base/browser/ui/list/listWidget.ts
+1
-1
src/vs/workbench/contrib/notebook/browser/contrib/notebookActions.ts
...bench/contrib/notebook/browser/contrib/notebookActions.ts
+36
-1
src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts
...rkbench/contrib/notebook/browser/view/notebookCellList.ts
+2
-1
未找到文件。
src/vs/base/browser/ui/list/listView.ts
浏览文件 @
508dead0
...
@@ -279,14 +279,20 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
...
@@ -279,14 +279,20 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
this
.
scrollableElement
.
triggerScrollFromMouseWheelEvent
(
browserEvent
);
this
.
scrollableElement
.
triggerScrollFromMouseWheelEvent
(
browserEvent
);
}
}
updateElementHeight
(
index
:
number
,
size
:
number
):
void
{
updateElementHeight
(
index
:
number
,
size
:
number
,
anchorIndex
:
number
|
null
):
void
{
if
(
this
.
items
[
index
].
size
===
size
)
{
if
(
this
.
items
[
index
].
size
===
size
)
{
return
;
return
;
}
}
const
lastRenderRange
=
this
.
getRenderRange
(
this
.
lastRenderTop
,
this
.
lastRenderHeight
);
const
lastRenderRange
=
this
.
getRenderRange
(
this
.
lastRenderTop
,
this
.
lastRenderHeight
);
const
heightDiff
=
index
<
lastRenderRange
.
start
?
size
-
this
.
items
[
index
].
size
:
0
;
const
heightDiff
=
(
anchorIndex
!==
null
&&
anchorIndex
>
index
&&
anchorIndex
<=
lastRenderRange
.
end
)
?
size
-
this
.
items
[
index
].
size
// Element at anchor index will keep its visual position
:
index
<
lastRenderRange
.
start
?
size
-
this
.
items
[
index
].
size
:
0
;
this
.
rangeMap
.
splice
(
index
,
1
,
[{
size
:
size
}]);
this
.
rangeMap
.
splice
(
index
,
1
,
[{
size
:
size
}]);
this
.
items
[
index
].
size
=
size
;
this
.
items
[
index
].
size
=
size
;
...
...
src/vs/base/browser/ui/list/listWidget.ts
浏览文件 @
508dead0
...
@@ -1314,7 +1314,7 @@ export class List<T> implements ISpliceable<T>, IDisposable {
...
@@ -1314,7 +1314,7 @@ export class List<T> implements ISpliceable<T>, IDisposable {
}
}
updateElementHeight
(
index
:
number
,
size
:
number
):
void
{
updateElementHeight
(
index
:
number
,
size
:
number
):
void
{
this
.
view
.
updateElementHeight
(
index
,
size
);
this
.
view
.
updateElementHeight
(
index
,
size
,
null
);
}
}
rerender
():
void
{
rerender
():
void
{
...
...
src/vs/workbench/contrib/notebook/browser/contrib/notebookActions.ts
浏览文件 @
508dead0
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
import
{
KeyCode
,
KeyMod
}
from
'
vs/base/common/keyCodes
'
;
import
{
KeyCode
,
KeyMod
}
from
'
vs/base/common/keyCodes
'
;
import
{
MenuRegistry
,
MenuId
,
Action2
,
registerAction2
}
from
'
vs/platform/actions/common/actions
'
;
import
{
MenuRegistry
,
MenuId
,
Action2
,
registerAction2
}
from
'
vs/platform/actions/common/actions
'
;
import
{
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
InputFocusedContext
,
InputFocusedContextKey
}
from
'
vs/platform/contextkey/common/contextkeys
'
;
import
{
InputFocusedContext
,
InputFocusedContextKey
,
IsDevelopmentContext
}
from
'
vs/platform/contextkey/common/contextkeys
'
;
import
{
KeybindingWeight
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
KeybindingWeight
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
INotebookService
}
from
'
vs/workbench/contrib/notebook/browser/notebookService
'
;
import
{
INotebookService
}
from
'
vs/workbench/contrib/notebook/browser/notebookService
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
...
@@ -470,3 +470,38 @@ registerAction2(class extends Action2 {
...
@@ -470,3 +470,38 @@ registerAction2(class extends Action2 {
editor
.
focusNotebookCell
(
newCell
,
true
);
editor
.
focusNotebookCell
(
newCell
,
true
);
}
}
});
});
registerAction2
(
class
extends
Action2
{
constructor
()
{
super
({
id
:
'
workbench.action.notebook.testResize
'
,
title
:
'
Notebook Test Cell Resize
'
,
keybinding
:
{
when
:
IsDevelopmentContext
,
primary
:
undefined
,
weight
:
KeybindingWeight
.
WorkbenchContrib
},
f1
:
true
});
}
async
run
(
accessor
:
ServicesAccessor
):
Promise
<
void
>
{
const
editorService
=
accessor
.
get
(
IEditorService
);
const
resource
=
editorService
.
activeEditor
?.
resource
;
if
(
!
resource
)
{
return
;
}
const
editor
=
getActiveNotebookEditor
(
editorService
);
if
(
!
editor
)
{
return
;
}
const
cells
=
editor
.
viewModel
?.
viewCells
;
if
(
cells
&&
cells
.
length
)
{
const
firstCell
=
cells
[
0
];
editor
.
layoutNotebookCell
(
firstCell
,
400
);
}
}
});
src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts
浏览文件 @
508dead0
...
@@ -118,7 +118,8 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
...
@@ -118,7 +118,8 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
}
}
updateElementHeight
(
index
:
number
,
size
:
number
):
void
{
updateElementHeight
(
index
:
number
,
size
:
number
):
void
{
this
.
view
.
updateElementHeight
(
index
,
size
);
const
focused
=
this
.
getFocus
();
this
.
view
.
updateElementHeight
(
index
,
size
,
focused
.
length
?
focused
[
0
]
:
null
);
}
}
// override
// override
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录