Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
db3acf9e
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,发现更多精彩内容 >>
提交
db3acf9e
编写于
5月 22, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
grid - add and use editorGroupToViewColumn
上级
dbcf54cc
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
21 addition
and
25 deletion
+21
-25
src/vs/workbench/api/electron-browser/mainThreadDocumentsAndEditors.ts
...nch/api/electron-browser/mainThreadDocumentsAndEditors.ts
+2
-6
src/vs/workbench/api/electron-browser/mainThreadEditors.ts
src/vs/workbench/api/electron-browser/mainThreadEditors.ts
+2
-2
src/vs/workbench/api/electron-browser/mainThreadWebview.ts
src/vs/workbench/api/electron-browser/mainThreadWebview.ts
+7
-14
src/vs/workbench/api/shared/editor.ts
src/vs/workbench/api/shared/editor.ts
+10
-3
未找到文件。
src/vs/workbench/api/electron-browser/mainThreadDocumentsAndEditors.ts
浏览文件 @
db3acf9e
...
...
@@ -13,7 +13,7 @@ import { ExtHostContext, ExtHostDocumentsAndEditorsShape, IModelAddedData, IText
import
{
MainThreadTextEditor
}
from
'
./mainThreadEditor
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
IEditorGroupsService
}
from
'
vs/workbench/services/group/common/editorGroupsService
'
;
import
{
EditorViewColumn
}
from
'
vs/workbench/api/shared/editor
'
;
import
{
EditorViewColumn
,
editorGroupToViewColumn
}
from
'
vs/workbench/api/shared/editor
'
;
import
{
IEditor
}
from
'
vs/workbench/common/editor
'
;
import
{
extHostCustomer
}
from
'
vs/workbench/api/electron-browser/extHostCustomers
'
;
import
{
MainThreadDocuments
}
from
'
vs/workbench/api/electron-browser/mainThreadDocuments
'
;
...
...
@@ -424,16 +424,12 @@ export class MainThreadDocumentsAndEditors {
private
_findEditorPosition
(
editor
:
MainThreadTextEditor
):
EditorViewColumn
{
for
(
let
workbenchEditor
of
this
.
_editorService
.
visibleControls
)
{
if
(
editor
.
matches
(
workbenchEditor
))
{
return
this
.
findEditorPosition
(
workbenchEditor
);
return
editorGroupToViewColumn
(
this
.
_editorGroupService
,
workbenchEditor
.
group
);
}
}
return
undefined
;
}
findEditorPosition
(
workbenchEditor
:
IEditor
):
number
{
return
this
.
_editorGroupService
.
groups
.
indexOf
(
workbenchEditor
.
group
);
}
findTextEditorIdFor
(
editor
:
IEditor
):
string
{
for
(
let
id
in
this
.
_textEditors
)
{
if
(
this
.
_textEditors
[
id
].
matches
(
editor
))
{
...
...
src/vs/workbench/api/electron-browser/mainThreadEditors.ts
浏览文件 @
db3acf9e
...
...
@@ -18,7 +18,7 @@ import { IRange } from 'vs/editor/common/core/range';
import
{
ISelection
}
from
'
vs/editor/common/core/selection
'
;
import
{
IDecorationOptions
,
IDecorationRenderOptions
,
ILineChange
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ISingleEditOperation
}
from
'
vs/editor/common/model
'
;
import
{
EditorViewColumn
,
viewColumnToEditorGroup
}
from
'
vs/workbench/api/shared/editor
'
;
import
{
EditorViewColumn
,
viewColumnToEditorGroup
,
editorGroupToViewColumn
}
from
'
vs/workbench/api/shared/editor
'
;
import
{
CommandsRegistry
}
from
'
vs/platform/commands/common/commands
'
;
import
{
IApplyEditsOptions
,
ITextEditorConfigurationUpdate
,
IUndoStopOptions
,
TextEditorRevealType
,
WorkspaceEditDto
,
reviveWorkspaceEditDto
}
from
'
vs/workbench/api/node/extHost.protocol
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
...
...
@@ -101,7 +101,7 @@ export class MainThreadTextEditors implements MainThreadTextEditorsShape {
for
(
let
workbenchEditor
of
this
.
_editorService
.
visibleControls
)
{
const
id
=
this
.
_documentsAndEditors
.
findTextEditorIdFor
(
workbenchEditor
);
if
(
id
)
{
result
[
id
]
=
this
.
_documentsAndEditors
.
findEditorPosition
(
workbenchEditor
);
result
[
id
]
=
editorGroupToViewColumn
(
this
.
_editorGroupService
,
workbenchEditor
.
group
);
}
}
return
result
;
...
...
src/vs/workbench/api/electron-browser/mainThreadWebview.ts
浏览文件 @
db3acf9e
...
...
@@ -8,7 +8,7 @@ import URI, { UriComponents } from 'vs/base/common/uri';
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
EditorViewColumn
,
viewColumnToEditorGroup
}
from
'
vs/workbench/api/shared/editor
'
;
import
{
EditorViewColumn
,
viewColumnToEditorGroup
,
editorGroupToViewColumn
}
from
'
vs/workbench/api/shared/editor
'
;
import
{
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
IOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
import
{
ExtHostContext
,
ExtHostWebviewsShape
,
IExtHostContext
,
MainContext
,
MainThreadWebviewsShape
,
WebviewPanelHandle
}
from
'
vs/workbench/api/node/extHost.protocol
'
;
...
...
@@ -19,7 +19,6 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
import
{
IExtensionService
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
IEditorGroupsService
}
from
'
vs/workbench/services/group/common/editorGroupsService
'
;
import
{
extHostNamedCustomer
}
from
'
./extHostCustomers
'
;
import
{
GroupIdentifier
}
from
'
vs/workbench/common/editor
'
;
@
extHostNamedCustomer
(
MainContext
.
MainThreadWebviews
)
export
class
MainThreadWebviews
implements
MainThreadWebviewsShape
,
WebviewReviver
{
...
...
@@ -150,7 +149,7 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv
state
=
{};
}
return
this
.
_proxy
.
$deserializeWebviewPanel
(
handle
,
webview
.
state
.
viewType
,
webview
.
getTitle
(),
state
,
this
.
positionOfGroup
(
webview
.
group
),
webview
.
options
)
return
this
.
_proxy
.
$deserializeWebviewPanel
(
handle
,
webview
.
state
.
viewType
,
webview
.
getTitle
(),
state
,
editorGroupToViewColumn
(
this
.
_editorGroupService
,
webview
.
group
),
webview
.
options
)
.
then
(
undefined
,
()
=>
{
webview
.
html
=
MainThreadWebviews
.
getDeserializationFailedContents
(
viewType
);
});
...
...
@@ -211,7 +210,7 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv
if
(
newActiveWebview
&&
newActiveWebview
.
handle
===
this
.
_activeWebview
)
{
// Webview itself unchanged but position may have changed
this
.
_proxy
.
$onDidChangeWebviewPanelViewState
(
newActiveWebview
.
handle
,
true
,
this
.
positionOfGroup
(
newActiveWebview
.
input
.
group
));
this
.
_proxy
.
$onDidChangeWebviewPanelViewState
(
newActiveWebview
.
handle
,
true
,
editorGroupToViewColumn
(
this
.
_editorGroupService
,
newActiveWebview
.
input
.
group
));
return
;
}
...
...
@@ -219,25 +218,19 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv
if
(
typeof
this
.
_activeWebview
!==
'
undefined
'
)
{
const
oldActiveWebview
=
this
.
_webviews
.
get
(
this
.
_activeWebview
);
if
(
oldActiveWebview
)
{
this
.
_proxy
.
$onDidChangeWebviewPanelViewState
(
this
.
_activeWebview
,
false
,
this
.
positionOfGroup
(
oldActiveWebview
.
group
));
this
.
_proxy
.
$onDidChangeWebviewPanelViewState
(
this
.
_activeWebview
,
false
,
editorGroupToViewColumn
(
this
.
_editorGroupService
,
oldActiveWebview
.
group
));
}
}
// Then for newly active
if
(
newActiveWebview
)
{
this
.
_proxy
.
$onDidChangeWebviewPanelViewState
(
newActiveWebview
.
handle
,
true
,
this
.
positionOfGroup
(
activeEditor
.
group
.
id
));
this
.
_proxy
.
$onDidChangeWebviewPanelViewState
(
newActiveWebview
.
handle
,
true
,
editorGroupToViewColumn
(
this
.
_editorGroupService
,
activeEditor
.
group
));
this
.
_activeWebview
=
newActiveWebview
.
handle
;
}
else
{
this
.
_activeWebview
=
undefined
;
}
}
private
positionOfGroup
(
groupId
:
GroupIdentifier
):
number
{
const
group
=
this
.
_editorGroupService
.
getGroup
(
groupId
);
return
this
.
_editorGroupService
.
groups
.
indexOf
(
group
);
}
private
onVisibleEditorsChanged
():
void
{
for
(
const
workbenchEditor
of
this
.
_editorService
.
visibleControls
)
{
if
(
!
workbenchEditor
.
input
)
{
...
...
@@ -245,8 +238,8 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv
}
this
.
_webviews
.
forEach
((
input
,
handle
)
=>
{
const
inputPosition
=
this
.
positionOfGroup
(
input
.
group
);
const
editorPosition
=
this
.
positionOfGroup
(
workbenchEditor
.
group
.
id
);
const
inputPosition
=
editorGroupToViewColumn
(
this
.
_editorGroupService
,
input
.
group
);
const
editorPosition
=
editorGroupToViewColumn
(
this
.
_editorGroupService
,
workbenchEditor
.
group
);
if
(
workbenchEditor
.
input
.
matches
(
input
)
&&
inputPosition
!==
editorPosition
)
{
input
.
updateGroup
(
workbenchEditor
.
group
.
id
);
...
...
src/vs/workbench/api/shared/editor.ts
浏览文件 @
db3acf9e
...
...
@@ -5,13 +5,14 @@
'
use strict
'
;
import
{
IEditorGroupsService
}
from
'
vs/workbench/services/group/common/editorGroupsService
'
;
import
{
IEditorGroupsService
,
IEditorGroup
,
GroupsOrder
}
from
'
vs/workbench/services/group/common/editorGroupsService
'
;
import
{
GroupIdentifier
}
from
'
vs/workbench/common/editor
'
;
import
{
ACTIVE_GROUP
,
SIDE_GROUP
}
from
'
vs/workbench/services/editor/common/editorService
'
;
// TODO@api this was previously a hardcoded list of editor positions (ONE, TWO, THREE)
// that with the introduction of grid editor feature is now unbounded. This should be
// revisited when the grid functionality is exposed to extensions
// revisited when the grid functionality is exposed to extensions,
export
type
EditorViewColumn
=
number
;
export
function
viewColumnToEditorGroup
(
editorGroupService
:
IEditorGroupsService
,
position
?:
EditorViewColumn
):
GroupIdentifier
{
...
...
@@ -19,7 +20,7 @@ export function viewColumnToEditorGroup(editorGroupService: IEditorGroupsService
return
ACTIVE_GROUP
;
// prefer active group when position is undefined
}
const
groups
=
editorGroupService
.
g
roups
;
const
groups
=
editorGroupService
.
g
etGroups
(
GroupsOrder
.
CREATION_TIME
)
;
let
candidate
=
groups
[
position
];
if
(
candidate
)
{
...
...
@@ -32,4 +33,10 @@ export function viewColumnToEditorGroup(editorGroupService: IEditorGroupsService
}
return
SIDE_GROUP
;
// open to the side if group not found
}
export
function
editorGroupToViewColumn
(
editorGroupService
:
IEditorGroupsService
,
editorGroup
:
IEditorGroup
|
GroupIdentifier
):
EditorViewColumn
{
const
group
=
typeof
editorGroup
===
'
number
'
?
editorGroupService
.
getGroup
(
editorGroup
)
:
editorGroup
;
return
editorGroupService
.
getGroups
(
GroupsOrder
.
CREATION_TIME
).
indexOf
(
group
);
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录