Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
a8f61a85
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,发现更多精彩内容 >>
提交
a8f61a85
编写于
3月 10, 2020
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove ICompositeCodeEditor#activate
上级
52ea4ff1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
23 addition
and
50 deletion
+23
-50
src/vs/workbench/common/editor.ts
src/vs/workbench/common/editor.ts
+1
-3
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
+22
-38
src/vs/workbench/services/editor/browser/codeEditorService.ts
...vs/workbench/services/editor/browser/codeEditorService.ts
+0
-9
未找到文件。
src/vs/workbench/common/editor.ts
浏览文件 @
a8f61a85
...
...
@@ -165,7 +165,6 @@ export interface ICompositeCodeEditor {
readonly
onDidChangeActiveEditor
:
Event
<
ICompositeCodeEditor
>
;
readonly
activeCodeEditor
:
IEditor
|
undefined
;
// readonly editors: readonly ICodeEditor[] maybe supported with uris
activate
(
input
:
IResourceEditorInput
):
IEditor
|
undefined
;
}
export
namespace
ICompositeCodeEditor
{
...
...
@@ -173,8 +172,7 @@ export namespace ICompositeCodeEditor {
if
(
!
thing
||
typeof
thing
!==
'
object
'
)
{
return
false
;
}
return
typeof
(
<
ICompositeCodeEditor
>
thing
).
activate
===
'
function
'
&&
typeof
(
<
ICompositeCodeEditor
>
thing
).
onDidChangeActiveEditor
===
'
function
'
;
return
typeof
(
<
ICompositeCodeEditor
>
thing
).
onDidChangeActiveEditor
===
'
function
'
;
}
}
...
...
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
浏览文件 @
a8f61a85
...
...
@@ -27,7 +27,7 @@ import { INotebookService } from 'vs/workbench/contrib/notebook/browser/notebook
import
{
OutputRenderer
}
from
'
vs/workbench/contrib/notebook/browser/view/output/outputRenderer
'
;
import
{
BackLayerWebView
}
from
'
vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView
'
;
import
{
CodeCellRenderer
,
MarkdownCellRenderer
,
NotebookCellListDelegate
}
from
'
vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer
'
;
import
{
CELL_MARGIN
,
NotebookCellsSplice
,
IOutput
,
parseCellUri
,
CellKind
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
CELL_MARGIN
,
NotebookCellsSplice
,
IOutput
,
CellKind
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
IWebviewService
}
from
'
vs/workbench/contrib/webview/browser/webview
'
;
import
{
getExtraColor
}
from
'
vs/workbench/contrib/welcome/walkThrough/common/walkThroughUtils
'
;
import
{
IEditorGroup
,
IEditorGroupsService
}
from
'
vs/workbench/services/editor/common/editorGroupsService
'
;
...
...
@@ -40,6 +40,7 @@ import { NotebookFindWidget } from 'vs/workbench/contrib/notebook/browser/contri
import
{
NotebookViewModel
,
INotebookEditorViewState
,
IModelDecorationsChangeAccessor
}
from
'
vs/workbench/contrib/notebook/browser/viewModel/notebookViewModel
'
;
import
{
IEditorGroupView
}
from
'
vs/workbench/browser/parts/editor/editor
'
;
import
{
CellViewModel
}
from
'
vs/workbench/contrib/notebook/browser/viewModel/notebookCellViewModel
'
;
import
{
isEqual
}
from
'
vs/base/common/resources
'
;
const
$
=
DOM
.
$
;
const
NOTEBOOK_EDITOR_VIEW_STATE_PREFERENCE_KEY
=
'
NotebookEditorViewState
'
;
...
...
@@ -85,40 +86,6 @@ export class NotebookCodeEditors implements ICompositeCodeEditor {
?
this
.
_renderedEditors
.
get
(
focused
)
:
undefined
;
}
activate
(
input
:
IResourceEditorInput
):
ICodeEditor
|
undefined
{
const
data
=
parseCellUri
(
input
.
resource
);
if
(
!
data
)
{
return
undefined
;
}
// find the CellViewModel which represents the cell with the
// given uri, scroll it into view so that the editor is alive,
// and then set selection et al..
for
(
let
i
=
0
;
i
<
this
.
_list
.
length
;
i
++
)
{
const
item
=
this
.
_list
.
element
(
i
);
if
(
item
.
cell
.
uri
.
toString
()
===
input
.
resource
.
toString
())
{
this
.
_list
.
reveal
(
i
,
0.2
);
this
.
_list
.
setFocus
([
i
]);
const
editor
=
this
.
_renderedEditors
.
get
(
item
);
if
(
!
editor
)
{
break
;
}
if
(
input
.
options
?.
selection
)
{
const
{
selection
}
=
input
.
options
;
editor
.
setSelection
({
...
selection
,
endLineNumber
:
selection
.
endLineNumber
||
selection
.
startLineNumber
,
endColumn
:
selection
.
endColumn
||
selection
.
startColumn
});
}
if
(
!
input
.
options
?.
preserveFocus
)
{
editor
.
focus
();
}
return
editor
;
}
}
return
undefined
;
}
}
export
class
NotebookEditor
extends
BaseEditor
implements
INotebookEditor
{
...
...
@@ -312,9 +279,26 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
await
this
.
attachModel
(
input
,
model
);
}
if
(
options
instanceof
NotebookEditorOptions
)
{
if
(
options
.
cellOptions
)
{
this
.
control
?.
activate
(
options
.
cellOptions
);
// reveal cell if editor options tell to do so
if
(
options
instanceof
NotebookEditorOptions
&&
options
.
cellOptions
)
{
const
cellOptions
=
options
.
cellOptions
;
const
cell
=
this
.
notebookViewModel
!
.
viewCells
.
find
(
cell
=>
isEqual
(
cell
.
cell
.
uri
,
cellOptions
.
resource
));
if
(
cell
&&
this
.
renderedEditors
.
has
(
cell
))
{
this
.
revealInCenterIfOutsideViewport
(
cell
);
const
editor
=
this
.
renderedEditors
.
get
(
cell
)
!
;
if
(
editor
)
{
if
(
cellOptions
.
options
?.
selection
)
{
const
{
selection
}
=
cellOptions
.
options
;
editor
.
setSelection
({
...
selection
,
endLineNumber
:
selection
.
endLineNumber
||
selection
.
startLineNumber
,
endColumn
:
selection
.
endColumn
||
selection
.
startColumn
});
}
if
(
!
cellOptions
.
options
?.
preserveFocus
)
{
editor
.
focus
();
}
}
}
}
}
...
...
src/vs/workbench/services/editor/browser/codeEditorService.ts
浏览文件 @
a8f61a85
...
...
@@ -63,15 +63,6 @@ export class CodeEditorService extends CodeEditorServiceImpl {
return
targetEditor
;
}
// CompositeCodeEditor
const
control
=
this
.
editorService
.
activeEditorPane
?.
getControl
();
if
(
ICompositeCodeEditor
.
is
(
control
))
{
const
editor
=
control
.
activate
(
input
);
if
(
isCodeEditor
(
editor
))
{
return
editor
;
}
}
// Open using our normal editor service
return
this
.
doOpenCodeEditor
(
input
,
source
,
sideBySide
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录