Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
8c91f01f
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,发现更多精彩内容 >>
提交
8c91f01f
编写于
12月 18, 2017
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixes #9012: Add toggle for "ignore trim whitespace" while diffing
上级
04db94e3
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
68 addition
and
1 deletion
+68
-1
src/vs/workbench/browser/parts/editor/media/IgnoreTrimWhiteSpaceChecked_16x.svg
...er/parts/editor/media/IgnoreTrimWhiteSpaceChecked_16x.svg
+1
-0
src/vs/workbench/browser/parts/editor/media/IgnoreTrimWhiteSpaceChecked_16x_inverse.svg
.../editor/media/IgnoreTrimWhiteSpaceChecked_16x_inverse.svg
+1
-0
src/vs/workbench/browser/parts/editor/media/IgnoreTrimWhiteSpace_16x.svg
...h/browser/parts/editor/media/IgnoreTrimWhiteSpace_16x.svg
+1
-0
src/vs/workbench/browser/parts/editor/media/IgnoreTrimWhiteSpace_16x_inverse.svg
...r/parts/editor/media/IgnoreTrimWhiteSpace_16x_inverse.svg
+1
-0
src/vs/workbench/browser/parts/editor/media/textdiffeditor.css
...s/workbench/browser/parts/editor/media/textdiffeditor.css
+17
-1
src/vs/workbench/browser/parts/editor/textDiffEditor.ts
src/vs/workbench/browser/parts/editor/textDiffEditor.ts
+47
-0
未找到文件。
src/vs/workbench/browser/parts/editor/media/IgnoreTrimWhiteSpaceChecked_16x.svg
0 → 100644
浏览文件 @
8c91f01f
<svg
xmlns=
"http://www.w3.org/2000/svg"
viewBox=
"0 0 16 16"
><style>
.st0{opacity:0}.st0,.st1{fill:#f6f6f6}.st2{fill:#424242}
</style><g
id=
"outline"
><path
class=
"st0"
d=
"M0 0h16v16H0z"
/><path
class=
"st1"
d=
"M12 4v8H4V4h8z"
/></g><path
class=
"st2"
d=
"M5 9h6v2H5V9zm0-4v2h6V5H5z"
id=
"icon_x5F_bg"
/><rect
fill=
"#000000"
x=
"1"
y=
"1"
width=
"14"
height=
"14"
fill-opacity=
"0"
stroke=
"#424242"
></rect></svg>
src/vs/workbench/browser/parts/editor/media/IgnoreTrimWhiteSpaceChecked_16x_inverse.svg
0 → 100644
浏览文件 @
8c91f01f
<svg
xmlns=
"http://www.w3.org/2000/svg"
viewBox=
"0 0 16 16"
><style>
.st0{opacity:0}.st0,.st1{fill:#252526}.st2{fill:#c5c5c5}
</style><g
id=
"outline"
><path
class=
"st0"
d=
"M0 0h16v16H0z"
/><path
class=
"st1"
d=
"M12 4v8H4V4h8z"
/></g><path
class=
"st2"
d=
"M5 9h6v2H5V9zm0-4v2h6V5H5z"
id=
"icon_x5F_bg"
/><rect
fill=
"#000000"
x=
"1"
y=
"1"
width=
"14"
height=
"14"
fill-opacity=
"0"
stroke=
"#c5c5c5"
></rect></svg>
src/vs/workbench/browser/parts/editor/media/IgnoreTrimWhiteSpace_16x.svg
0 → 100644
浏览文件 @
8c91f01f
<svg
xmlns=
"http://www.w3.org/2000/svg"
viewBox=
"0 0 16 16"
><style>
.st0{opacity:0}.st0,.st1{fill:#f6f6f6}.st2{fill:#424242}
</style><g
id=
"outline"
><path
class=
"st0"
d=
"M0 0h16v16H0z"
/><path
class=
"st1"
d=
"M12 4v8H4V4h8z"
/></g><path
class=
"st2"
d=
"M5 9h6v2H5V9zm0-4v2h6V5H5z"
id=
"icon_x5F_bg"
/></svg>
\ No newline at end of file
src/vs/workbench/browser/parts/editor/media/IgnoreTrimWhiteSpace_16x_inverse.svg
0 → 100644
浏览文件 @
8c91f01f
<svg
xmlns=
"http://www.w3.org/2000/svg"
viewBox=
"0 0 16 16"
><style>
.st0{opacity:0}.st0,.st1{fill:#252526}.st2{fill:#c5c5c5}
</style><g
id=
"outline"
><path
class=
"st0"
d=
"M0 0h16v16H0z"
/><path
class=
"st1"
d=
"M12 4v8H4V4h8z"
/></g><path
class=
"st2"
d=
"M5 9h6v2H5V9zm0-4v2h6V5H5z"
id=
"icon_x5F_bg"
/></svg>
\ No newline at end of file
src/vs/workbench/browser/parts/editor/media/textdiffeditor.css
浏览文件 @
8c91f01f
...
...
@@ -19,4 +19,20 @@
.vs-dark
.monaco-workbench
.textdiff-editor-action.previous
,
.hc-black
.monaco-workbench
.textdiff-editor-action.previous
{
background
:
url('previous-diff-inverse.svg')
center
center
no-repeat
;
}
\ No newline at end of file
}
.vs
.monaco-workbench
.textdiff-editor-action.toggleIgnoreTrimWhitespace
{
background
:
url('IgnoreTrimWhiteSpace_16x.svg')
center
center
no-repeat
;
}
.vs-dark
.monaco-workbench
.textdiff-editor-action.toggleIgnoreTrimWhitespace
,
.hc-black
.monaco-workbench
.textdiff-editor-action.toggleIgnoreTrimWhitespace
{
background
:
url('IgnoreTrimWhiteSpace_16x_inverse.svg ')
center
center
no-repeat
;
}
.vs
.monaco-workbench
.textdiff-editor-action.toggleIgnoreTrimWhitespace.is-checked
{
background
:
url('IgnoreTrimWhiteSpaceChecked_16x.svg')
center
center
no-repeat
;
}
.vs-dark
.monaco-workbench
.textdiff-editor-action.toggleIgnoreTrimWhitespace.is-checked
,
.hc-black
.monaco-workbench
.textdiff-editor-action.toggleIgnoreTrimWhitespace.is-checked
{
background
:
url('IgnoreTrimWhiteSpaceChecked_16x_inverse.svg ')
center
center
no-repeat
;
}
src/vs/workbench/browser/parts/editor/textDiffEditor.ts
浏览文件 @
8c91f01f
...
...
@@ -34,6 +34,8 @@ import { IEditorGroupService } from 'vs/workbench/services/group/common/groupSer
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
IEditorInput
}
from
'
vs/platform/editor/common/editor
'
;
import
{
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
/**
* The text editor that leverages the diff text editor for the editing experience.
...
...
@@ -45,18 +47,27 @@ export class TextDiffEditor extends BaseTextEditor {
private
diffNavigator
:
DiffNavigator
;
private
nextDiffAction
:
NavigateAction
;
private
previousDiffAction
:
NavigateAction
;
private
toggleIgnoreTrimWhitespaceAction
:
ToggleIgnoreTrimWhitespaceAction
;
private
_configurationListener
:
IDisposable
;
constructor
(
@
ITelemetryService
telemetryService
:
ITelemetryService
,
@
IInstantiationService
instantiationService
:
IInstantiationService
,
@
IStorageService
storageService
:
IStorageService
,
@
ITextResourceConfigurationService
configurationService
:
ITextResourceConfigurationService
,
@
IConfigurationService
private
readonly
_actualConfigurationService
:
IConfigurationService
,
@
IWorkbenchEditorService
private
editorService
:
IWorkbenchEditorService
,
@
IThemeService
themeService
:
IThemeService
,
@
IEditorGroupService
editorGroupService
:
IEditorGroupService
,
@
ITextFileService
textFileService
:
ITextFileService
)
{
super
(
TextDiffEditor
.
ID
,
telemetryService
,
instantiationService
,
storageService
,
configurationService
,
themeService
,
textFileService
,
editorGroupService
);
this
.
_configurationListener
=
this
.
_actualConfigurationService
.
onDidChangeConfiguration
((
e
)
=>
{
if
(
e
.
affectsConfiguration
(
'
diffEditor.ignoreTrimWhitespace
'
))
{
this
.
updateIgnoreTrimWhitespaceAction
();
}
});
}
public
getTitle
():
string
{
...
...
@@ -72,6 +83,8 @@ export class TextDiffEditor extends BaseTextEditor {
// Actions
this
.
nextDiffAction
=
new
NavigateAction
(
this
,
true
);
this
.
previousDiffAction
=
new
NavigateAction
(
this
,
false
);
this
.
toggleIgnoreTrimWhitespaceAction
=
new
ToggleIgnoreTrimWhitespaceAction
(
this
.
_actualConfigurationService
);
this
.
updateIgnoreTrimWhitespaceAction
();
// Support navigation within the diff editor by overriding the editor service within
const
delegatingEditorService
=
this
.
instantiationService
.
createInstance
(
DelegatingWorkbenchEditorService
);
...
...
@@ -163,6 +176,7 @@ export class TextDiffEditor extends BaseTextEditor {
this
.
nextDiffAction
.
updateEnablement
();
this
.
previousDiffAction
.
updateEnablement
();
});
this
.
updateIgnoreTrimWhitespaceAction
();
},
error
=>
{
// In case we tried to open a file and the response indicates that this is not a text file, fallback to binary diff.
...
...
@@ -176,6 +190,13 @@ export class TextDiffEditor extends BaseTextEditor {
});
}
private
updateIgnoreTrimWhitespaceAction
():
void
{
const
ignoreTrimWhitespace
=
this
.
configurationService
.
getValue
<
boolean
>
(
this
.
getResource
(),
'
diffEditor.ignoreTrimWhitespace
'
);
if
(
this
.
toggleIgnoreTrimWhitespaceAction
)
{
this
.
toggleIgnoreTrimWhitespaceAction
.
updateClassName
(
ignoreTrimWhitespace
);
}
}
private
openAsBinary
(
input
:
EditorInput
,
options
:
EditorOptions
):
boolean
{
if
(
input
instanceof
DiffEditorInput
)
{
const
originalInput
=
input
.
originalInput
;
...
...
@@ -273,6 +294,7 @@ export class TextDiffEditor extends BaseTextEditor {
public
getActions
():
IAction
[]
{
return
[
this
.
toggleIgnoreTrimWhitespaceAction
,
this
.
previousDiffAction
,
this
.
nextDiffAction
];
...
...
@@ -303,6 +325,8 @@ export class TextDiffEditor extends BaseTextEditor {
this
.
diffNavigator
.
dispose
();
}
this
.
_configurationListener
.
dispose
();
super
.
dispose
();
}
}
...
...
@@ -340,6 +364,29 @@ class NavigateAction extends Action {
}
}
class
ToggleIgnoreTrimWhitespaceAction
extends
Action
{
static
ID
=
'
workbench.action.compareEditor.toggleIgnoreTrimWhitespace
'
;
private
_isChecked
:
boolean
;
constructor
(
@
IConfigurationService
private
readonly
_configurationService
:
IConfigurationService
)
{
super
(
ToggleIgnoreTrimWhitespaceAction
.
ID
);
this
.
label
=
nls
.
localize
(
'
toggleIgnoreTrimWhitespace.label
'
,
"
Ignore Trim Whitespace
"
);
}
public
updateClassName
(
ignoreTrimWhitespace
:
boolean
):
void
{
this
.
_isChecked
=
ignoreTrimWhitespace
;
this
.
class
=
`textdiff-editor-action toggleIgnoreTrimWhitespace
${
this
.
_isChecked
?
'
is-checked
'
:
''
}
`
;
}
public
run
():
TPromise
<
any
>
{
this
.
_configurationService
.
updateValue
(
`diffEditor.ignoreTrimWhitespace`
,
!
this
.
_isChecked
);
return
null
;
}
}
class
ToggleEditorModeAction
extends
Action
{
private
static
readonly
ID
=
'
toggle.diff.editorMode
'
;
private
static
readonly
INLINE_LABEL
=
nls
.
localize
(
'
inlineDiffLabel
'
,
"
Switch to Inline View
"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录