Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
dbc6e4ce
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,发现更多精彩内容 >>
提交
dbc6e4ce
编写于
7月 05, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
text diff options support (for #30085)
上级
313aad16
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
78 addition
and
69 deletion
+78
-69
src/vs/platform/editor/common/editor.ts
src/vs/platform/editor/common/editor.ts
+14
-0
src/vs/workbench/common/editor.ts
src/vs/workbench/common/editor.ts
+64
-69
未找到文件。
src/vs/platform/editor/common/editor.ts
浏览文件 @
dbc6e4ce
...
...
@@ -107,6 +107,11 @@ export interface IResourceDiffInput extends IBaseResourceInput {
* The right hand side URI to open inside a diff editor.
*/
rightResource
:
URI
;
/**
* Optional options to use when opening the text diff input.
*/
options
?:
ITextDiffEditorOptions
;
}
export
interface
IResourceSideBySideInput
extends
IBaseResourceInput
{
...
...
@@ -296,4 +301,13 @@ export interface ITextEditorOptions extends IEditorOptions {
* Option to scroll vertically or horizontally as necessary and reveal a range centered vertically only if it lies outside the viewport.
*/
revealInCenterIfOutsideViewport
?:
boolean
;
}
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
;
}
\ No newline at end of file
src/vs/workbench/common/editor.ts
浏览文件 @
dbc6e4ce
...
...
@@ -11,7 +11,7 @@ import types = require('vs/base/common/types');
import
URI
from
'
vs/base/common/uri
'
;
import
{
IDisposable
,
dispose
,
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IEditor
,
IEditorViewState
,
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IEditorInput
,
IEditorModel
,
IEditorOptions
,
ITextEditorOptions
,
IBaseResourceInput
,
Position
,
Verbosity
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IEditorInput
,
IEditorModel
,
IEditorOptions
,
ITextEditorOptions
,
IBaseResourceInput
,
Position
,
Verbosity
,
ITextDiffEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
import
{
SyncDescriptor
}
from
'
vs/platform/instantiation/common/descriptors
'
;
import
{
IInstantiationService
,
IConstructorSignature0
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
RawContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
...
...
@@ -587,52 +587,72 @@ export class TextEditorOptions extends EditorOptions {
private
editorViewState
:
IEditorViewState
;
public
static
from
(
input
:
IBaseResourceInput
):
TextEditorOptions
{
if
(
!
input
||
!
input
.
options
)
{
return
null
;
}
let
options
:
TextEditorOptions
=
null
;
if
(
input
&&
input
.
options
)
{
if
(
input
.
options
.
selection
||
input
.
options
.
viewState
||
input
.
options
.
forceOpen
||
input
.
options
.
revealIfVisible
||
input
.
options
.
revealIfOpened
||
input
.
options
.
preserveFocus
||
input
.
options
.
pinned
||
input
.
options
.
inactive
||
typeof
input
.
options
.
index
===
'
number
'
)
{
if
(
input
.
options
.
selection
||
input
.
options
.
viewState
||
typeof
input
.
options
.
forceOpen
===
'
boolean
'
||
typeof
input
.
options
.
revealIfVisible
===
'
boolean
'
||
typeof
input
.
options
.
revealIfOpened
===
'
boolean
'
||
typeof
input
.
options
.
preserveFocus
===
'
boolean
'
||
typeof
input
.
options
.
revealInCenterIfOutsideViewport
===
'
boolean
'
||
typeof
input
.
options
.
pinned
===
'
boolean
'
||
typeof
input
.
options
.
inactive
===
'
boolean
'
||
typeof
input
.
options
.
index
===
'
number
'
||
typeof
(
input
.
options
as
ITextDiffEditorOptions
).
autoRevealFirstChange
===
'
boolean
'
)
{
const
textDiffOptions
=
input
.
options
as
ITextDiffEditorOptions
;
if
(
typeof
textDiffOptions
.
autoRevealFirstChange
===
'
boolean
'
)
{
options
=
new
TextDiffEditorOptions
();
(
<
TextDiffEditorOptions
>
options
).
autoRevealFirstChange
=
textDiffOptions
.
autoRevealFirstChange
;
}
else
{
options
=
new
TextEditorOptions
();
}
}
if
(
input
.
options
.
selection
)
{
const
selection
=
input
.
options
.
selection
;
options
.
selection
(
selection
.
startLineNumber
,
selection
.
startColumn
,
selection
.
endLineNumber
,
selection
.
endColumn
);
}
if
(
input
.
options
.
selection
)
{
const
selection
=
input
.
options
.
selection
;
options
.
selection
(
selection
.
startLineNumber
,
selection
.
startColumn
,
selection
.
endLineNumber
,
selection
.
endColumn
);
}
if
(
input
.
options
.
forceOpen
)
{
options
.
forceOpen
=
tru
e
;
}
if
(
input
.
options
.
viewState
)
{
options
.
editorViewState
=
input
.
options
.
viewState
as
IEditorViewStat
e
;
}
if
(
input
.
options
.
revealIfVisible
)
{
options
.
revealIfVisible
=
true
;
}
if
(
input
.
options
.
forceOpen
)
{
options
.
forceOpen
=
true
;
}
if
(
input
.
options
.
revealIfOpened
)
{
options
.
revealIfOpened
=
true
;
}
if
(
input
.
options
.
revealIfVisible
)
{
options
.
revealIfVisible
=
true
;
}
if
(
input
.
options
.
preserveFocus
)
{
options
.
preserveFocus
=
true
;
}
if
(
input
.
options
.
revealIfOpened
)
{
options
.
revealIfOpened
=
true
;
}
if
(
input
.
options
.
pinned
)
{
options
.
pinned
=
true
;
}
if
(
input
.
options
.
preserveFocus
)
{
options
.
preserveFocus
=
true
;
}
if
(
input
.
options
.
inactive
)
{
options
.
inactive
=
true
;
}
if
(
input
.
options
.
revealInCenterIfOutsideViewport
)
{
options
.
revealInCenterIfOutsideViewport
=
true
;
}
if
(
input
.
options
.
revealInCenterIfOutsideViewport
)
{
options
.
revealInCenterIfOutsideViewport
=
true
;
}
if
(
input
.
options
.
pinned
)
{
options
.
pinned
=
true
;
}
if
(
input
.
options
.
viewStat
e
)
{
options
.
editorViewState
=
input
.
options
.
viewState
as
IEditorViewStat
e
;
}
if
(
input
.
options
.
inactiv
e
)
{
options
.
inactive
=
tru
e
;
}
if
(
typeof
input
.
options
.
index
===
'
number
'
)
{
options
.
index
=
input
.
options
.
index
;
}
if
(
typeof
input
.
options
.
index
===
'
number
'
)
{
options
.
index
=
input
.
options
.
index
;
}
return
options
;
...
...
@@ -642,7 +662,16 @@ export class TextEditorOptions extends EditorOptions {
* Helper to create TextEditorOptions inline.
*/
public
static
create
(
settings
:
ITextEditorOptions
=
Object
.
create
(
null
)):
TextEditorOptions
{
const
options
=
new
TextEditorOptions
();
let
options
:
TextEditorOptions
;
const
textDiffOptions
=
settings
as
ITextDiffEditorOptions
;
if
(
typeof
textDiffOptions
.
autoRevealFirstChange
===
'
boolean
'
)
{
options
=
new
TextDiffEditorOptions
();
(
<
TextDiffEditorOptions
>
options
).
autoRevealFirstChange
=
textDiffOptions
.
autoRevealFirstChange
;
}
else
{
options
=
new
TextEditorOptions
();
}
options
.
preserveFocus
=
settings
.
preserveFocus
;
options
.
forceOpen
=
settings
.
forceOpen
;
options
.
revealIfVisible
=
settings
.
revealIfVisible
;
...
...
@@ -752,45 +781,11 @@ 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.
*/
export
class
TextDiffEditorOptions
extends
TextEditorOptions
{
/**
* Helper to create TextDiffEditorOptions inline.
*/
public
static
create
(
settings
:
ITextDiffEditorOptions
):
TextDiffEditorOptions
{
const
options
=
new
TextDiffEditorOptions
();
options
.
autoRevealFirstChange
=
settings
.
autoRevealFirstChange
;
options
.
preserveFocus
=
settings
.
preserveFocus
;
options
.
forceOpen
=
settings
.
forceOpen
;
options
.
revealIfVisible
=
settings
.
revealIfVisible
;
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
;
}
/**
* Whether to auto reveal the first change when the text editor is opened or not. By default
* the first change will not be revealed.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录