Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
273159c1
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,发现更多精彩内容 >>
提交
273159c1
编写于
7月 08, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
introduce option to reveal an editor (for #8714)
上级
e72019a5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
68 addition
and
10 deletion
+68
-10
src/vs/platform/editor/common/editor.ts
src/vs/platform/editor/common/editor.ts
+6
-0
src/vs/workbench/browser/parts/editor/editorPart.ts
src/vs/workbench/browser/parts/editor/editorPart.ts
+22
-4
src/vs/workbench/common/editor.ts
src/vs/workbench/common/editor.ts
+40
-6
未找到文件。
src/vs/platform/editor/common/editor.ts
浏览文件 @
273159c1
...
@@ -151,6 +151,12 @@ export interface IEditorOptions {
...
@@ -151,6 +151,12 @@ export interface IEditorOptions {
*/
*/
forceOpen
?:
boolean
;
forceOpen
?:
boolean
;
/**
* Will reveal the editor if it is already opened in any editor group.
* This prevents duplicates of the same editor input showing up.
*/
revealIfOpened
?:
boolean
;
/**
/**
* An editor that is pinned remains in the editor stack even when another editor is being opened.
* An editor that is pinned remains in the editor stack even when another editor is being opened.
* An editor that is not pinned will always get replaced by another editor that is not pinned.
* An editor that is not pinned will always get replaced by another editor that is not pinned.
...
...
src/vs/workbench/browser/parts/editor/editorPart.ts
浏览文件 @
273159c1
...
@@ -192,7 +192,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
...
@@ -192,7 +192,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
if
(
!
options
)
{
options
=
null
;
}
if
(
!
options
)
{
options
=
null
;
}
// Determine position to open editor in (left, center, right)
// Determine position to open editor in (left, center, right)
const
position
=
this
.
validatePosition
(
arg3
,
widthRatios
);
const
position
=
this
.
findPosition
(
input
,
options
,
arg3
,
widthRatios
);
// Some conditions under which we prevent the request
// Some conditions under which we prevent the request
if
(
if
(
...
@@ -1151,9 +1151,9 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
...
@@ -1151,9 +1151,9 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
super
.
dispose
();
super
.
dispose
();
}
}
private
validatePosition
(
sideBySide
?:
boolean
,
widthRatios
?:
number
[]):
Position
;
private
findPosition
(
input
:
EditorInput
,
options
?:
EditorOptions
,
sideBySide
?:
boolean
,
widthRatios
?:
number
[]):
Position
;
private
validatePosition
(
desiredPosition
?:
Position
,
widthRatios
?:
number
[]):
Position
;
private
findPosition
(
input
:
EditorInput
,
options
?:
EditorOptions
,
desiredPosition
?:
Position
,
widthRatios
?:
number
[]):
Position
;
private
validatePosition
(
arg1
?:
any
,
widthRatios
?:
number
[]):
Position
{
private
findPosition
(
input
:
EditorInput
,
options
?:
EditorOptions
,
arg1
?:
any
,
widthRatios
?:
number
[]):
Position
{
// With defined width ratios, always trust the provided position
// With defined width ratios, always trust the provided position
if
(
widthRatios
&&
types
.
isNumber
(
arg1
))
{
if
(
widthRatios
&&
types
.
isNumber
(
arg1
))
{
...
@@ -1167,6 +1167,24 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
...
@@ -1167,6 +1167,24 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
return
Position
.
LEFT
;
// can only be LEFT
return
Position
.
LEFT
;
// can only be LEFT
}
}
// Respect option to reveal an editor if it is already opened
if
(
options
&&
options
.
revealIfOpened
)
{
if
(
typeof
arg1
===
'
number
'
)
{
const
desiredGroup
=
this
.
stacks
.
groupAt
(
arg1
);
if
(
desiredGroup
&&
desiredGroup
.
contains
(
input
))
{
return
arg1
;
}
}
const
groups
=
this
.
stacks
.
groups
;
for
(
let
i
=
0
;
i
<
groups
.
length
;
i
++
)
{
const
group
=
groups
[
i
];
if
(
group
.
contains
(
input
))
{
return
this
.
stacks
.
positionOfGroup
(
group
);
}
}
}
// Position is unknown: pick last active or LEFT
// Position is unknown: pick last active or LEFT
if
(
types
.
isUndefinedOrNull
(
arg1
)
||
arg1
===
false
)
{
if
(
types
.
isUndefinedOrNull
(
arg1
)
||
arg1
===
false
)
{
let
lastActivePosition
=
this
.
sideBySideControl
.
getActivePosition
();
let
lastActivePosition
=
this
.
sideBySideControl
.
getActivePosition
();
...
...
src/vs/workbench/common/editor.ts
浏览文件 @
273159c1
...
@@ -430,6 +430,7 @@ export class EditorOptions implements IEditorOptions {
...
@@ -430,6 +430,7 @@ export class EditorOptions implements IEditorOptions {
let
options
=
new
EditorOptions
();
let
options
=
new
EditorOptions
();
options
.
preserveFocus
=
settings
.
preserveFocus
;
options
.
preserveFocus
=
settings
.
preserveFocus
;
options
.
forceOpen
=
settings
.
forceOpen
;
options
.
forceOpen
=
settings
.
forceOpen
;
options
.
revealIfOpened
=
settings
.
revealIfOpened
;
options
.
pinned
=
settings
.
pinned
;
options
.
pinned
=
settings
.
pinned
;
options
.
index
=
settings
.
index
;
options
.
index
=
settings
.
index
;
options
.
inactive
=
settings
.
inactive
;
options
.
inactive
=
settings
.
inactive
;
...
@@ -443,6 +444,7 @@ export class EditorOptions implements IEditorOptions {
...
@@ -443,6 +444,7 @@ export class EditorOptions implements IEditorOptions {
public
mixin
(
other
:
EditorOptions
):
void
{
public
mixin
(
other
:
EditorOptions
):
void
{
this
.
preserveFocus
=
other
.
preserveFocus
;
this
.
preserveFocus
=
other
.
preserveFocus
;
this
.
forceOpen
=
other
.
forceOpen
;
this
.
forceOpen
=
other
.
forceOpen
;
this
.
revealIfOpened
=
other
.
revealIfOpened
;
this
.
pinned
=
other
.
pinned
;
this
.
pinned
=
other
.
pinned
;
this
.
index
=
other
.
index
;
this
.
index
=
other
.
index
;
}
}
...
@@ -460,6 +462,12 @@ export class EditorOptions implements IEditorOptions {
...
@@ -460,6 +462,12 @@ export class EditorOptions implements IEditorOptions {
*/
*/
public
forceOpen
:
boolean
;
public
forceOpen
:
boolean
;
/**
* Will reveal the editor if it is already opened in any editor group.
* This prevents duplicates of the same editor input showing up.
*/
public
revealIfOpened
:
boolean
;
/**
/**
* An editor that is pinned remains in the editor stack even when another editor is being opened.
* An editor that is pinned remains in the editor stack even when another editor is being opened.
* An editor that is not pinned will always get replaced by another editor that is not pinned.
* An editor that is not pinned will always get replaced by another editor that is not pinned.
...
@@ -482,16 +490,16 @@ export class EditorOptions implements IEditorOptions {
...
@@ -482,16 +490,16 @@ export class EditorOptions implements IEditorOptions {
* Base Text Editor Options.
* Base Text Editor Options.
*/
*/
export
class
TextEditorOptions
extends
EditorOptions
{
export
class
TextEditorOptions
extends
EditorOptions
{
pr
ivate
startLineNumber
:
number
;
pr
otected
startLineNumber
:
number
;
pr
ivate
startColumn
:
number
;
pr
otected
startColumn
:
number
;
pr
ivate
endLineNumber
:
number
;
pr
otected
endLineNumber
:
number
;
pr
ivate
endColumn
:
number
;
pr
otected
endColumn
:
number
;
private
editorViewState
:
IEditorViewState
;
private
editorViewState
:
IEditorViewState
;
public
static
from
(
input
:
IResourceInput
):
TextEditorOptions
{
public
static
from
(
input
:
IResourceInput
):
TextEditorOptions
{
let
options
:
TextEditorOptions
=
null
;
let
options
:
TextEditorOptions
=
null
;
if
(
input
&&
input
.
options
)
{
if
(
input
&&
input
.
options
)
{
if
(
input
.
options
.
selection
||
input
.
options
.
forceOpen
||
input
.
options
.
preserveFocus
||
input
.
options
.
pinned
||
input
.
options
.
inactive
||
typeof
input
.
options
.
index
===
'
number
'
)
{
if
(
input
.
options
.
selection
||
input
.
options
.
forceOpen
||
input
.
options
.
revealIfOpened
||
input
.
options
.
preserveFocus
||
input
.
options
.
pinned
||
input
.
options
.
inactive
||
typeof
input
.
options
.
index
===
'
number
'
)
{
options
=
new
TextEditorOptions
();
options
=
new
TextEditorOptions
();
}
}
...
@@ -504,6 +512,10 @@ export class TextEditorOptions extends EditorOptions {
...
@@ -504,6 +512,10 @@ export class TextEditorOptions extends EditorOptions {
options
.
forceOpen
=
true
;
options
.
forceOpen
=
true
;
}
}
if
(
input
.
options
.
revealIfOpened
)
{
options
.
revealIfOpened
=
true
;
}
if
(
input
.
options
.
preserveFocus
)
{
if
(
input
.
options
.
preserveFocus
)
{
options
.
preserveFocus
=
true
;
options
.
preserveFocus
=
true
;
}
}
...
@@ -531,6 +543,7 @@ export class TextEditorOptions extends EditorOptions {
...
@@ -531,6 +543,7 @@ export class TextEditorOptions extends EditorOptions {
let
options
=
new
TextEditorOptions
();
let
options
=
new
TextEditorOptions
();
options
.
preserveFocus
=
settings
.
preserveFocus
;
options
.
preserveFocus
=
settings
.
preserveFocus
;
options
.
forceOpen
=
settings
.
forceOpen
;
options
.
forceOpen
=
settings
.
forceOpen
;
options
.
revealIfOpened
=
settings
.
revealIfOpened
;
options
.
pinned
=
settings
.
pinned
;
options
.
pinned
=
settings
.
pinned
;
options
.
index
=
settings
.
index
;
options
.
index
=
settings
.
index
;
...
@@ -616,6 +629,15 @@ export class TextEditorOptions extends EditorOptions {
...
@@ -616,6 +629,15 @@ export class TextEditorOptions extends EditorOptions {
}
}
}
}
export
interface
ITextDiffEditorOptions
extends
ITextEditorOptions
{
/**
* Whether to auto reveal the first change when the text editor is opened or not. By default
* the first change will not be revealed.
*/
autoRevealFirstChange
:
boolean
;
}
/**
/**
* Base Text Diff Editor Options.
* Base Text Diff Editor Options.
*/
*/
...
@@ -624,11 +646,23 @@ export class TextDiffEditorOptions extends TextEditorOptions {
...
@@ -624,11 +646,23 @@ export class TextDiffEditorOptions extends TextEditorOptions {
/**
/**
* Helper to create TextDiffEditorOptions inline.
* Helper to create TextDiffEditorOptions inline.
*/
*/
public
static
create
(
settings
:
{
autoRevealFirstChange
?:
boolean
;
preserveFocus
?:
boolean
;
forceOpen
?:
boolean
;
}
):
TextDiffEditorOptions
{
public
static
create
(
settings
:
ITextDiffEditorOptions
):
TextDiffEditorOptions
{
let
options
=
new
TextDiffEditorOptions
();
let
options
=
new
TextDiffEditorOptions
();
options
.
autoRevealFirstChange
=
settings
.
autoRevealFirstChange
;
options
.
autoRevealFirstChange
=
settings
.
autoRevealFirstChange
;
options
.
preserveFocus
=
settings
.
preserveFocus
;
options
.
preserveFocus
=
settings
.
preserveFocus
;
options
.
forceOpen
=
settings
.
forceOpen
;
options
.
forceOpen
=
settings
.
forceOpen
;
options
.
revealIfOpened
=
settings
.
revealIfOpened
;
options
.
pinned
=
settings
.
pinned
;
options
.
index
=
settings
.
index
;
if
(
settings
.
selection
)
{
options
.
startLineNumber
=
settings
.
selection
.
startLineNumber
;
options
.
startColumn
=
settings
.
selection
.
startColumn
;
options
.
endLineNumber
=
settings
.
selection
.
endLineNumber
||
settings
.
selection
.
startLineNumber
;
options
.
endColumn
=
settings
.
selection
.
endColumn
||
settings
.
selection
.
startColumn
;
}
return
options
;
return
options
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录