Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
4aee31ef
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,发现更多精彩内容 >>
未验证
提交
4aee31ef
编写于
10月 16, 2019
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Switch to use a notification when the max computation time is reached
上级
86ea9e1d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
28 addition
and
15 deletion
+28
-15
src/vs/editor/browser/editorBrowser.ts
src/vs/editor/browser/editorBrowser.ts
+5
-0
src/vs/editor/browser/widget/diffEditorWidget.ts
src/vs/editor/browser/widget/diffEditorWidget.ts
+4
-0
src/vs/workbench/contrib/codeEditor/browser/diffEditorHelper.ts
.../workbench/contrib/codeEditor/browser/diffEditorHelper.ts
+19
-15
未找到文件。
src/vs/editor/browser/editorBrowser.ts
浏览文件 @
4aee31ef
...
@@ -864,6 +864,11 @@ export interface IDiffEditor extends editorCommon.IEditor {
...
@@ -864,6 +864,11 @@ export interface IDiffEditor extends editorCommon.IEditor {
* @internal
* @internal
*/
*/
readonly
renderIndicators
:
boolean
;
readonly
renderIndicators
:
boolean
;
/**
* Timeout in milliseconds after which diff computation is cancelled.
* @internal
*/
readonly
maxComputationTime
:
number
;
/**
/**
* @see ICodeEditor.getDomNode
* @see ICodeEditor.getDomNode
...
...
src/vs/editor/browser/widget/diffEditorWidget.ts
浏览文件 @
4aee31ef
...
@@ -400,6 +400,10 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
...
@@ -400,6 +400,10 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
return
this
.
_renderSideBySide
;
return
this
.
_renderSideBySide
;
}
}
public
get
maxComputationTime
():
number
{
return
this
.
_maxComputationTime
;
}
public
get
renderIndicators
():
boolean
{
public
get
renderIndicators
():
boolean
{
return
this
.
_renderIndicators
;
return
this
.
_renderIndicators
;
}
}
...
...
src/vs/workbench/contrib/codeEditor/browser/diffEditorHelper.ts
浏览文件 @
4aee31ef
...
@@ -12,11 +12,11 @@ import { FloatingClickWidget } from 'vs/workbench/browser/parts/editor/editorWid
...
@@ -12,11 +12,11 @@ import { FloatingClickWidget } from 'vs/workbench/browser/parts/editor/editorWid
import
{
IDiffComputationResult
}
from
'
vs/editor/common/services/editorWorkerService
'
;
import
{
IDiffComputationResult
}
from
'
vs/editor/common/services/editorWorkerService
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IConfigurationService
,
ConfigurationTarget
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IConfigurationService
,
ConfigurationTarget
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
INotificationService
,
Severity
}
from
'
vs/platform/notification/common/notification
'
;
const
enum
WidgetState
{
const
enum
WidgetState
{
Hidden
,
Hidden
,
HintWhitespace
,
HintWhitespace
HintTimeout
}
}
class
DiffEditorHelperContribution
extends
Disposable
implements
IEditorContribution
{
class
DiffEditorHelperContribution
extends
Disposable
implements
IEditorContribution
{
...
@@ -29,6 +29,7 @@ class DiffEditorHelperContribution extends Disposable implements IEditorContribu
...
@@ -29,6 +29,7 @@ class DiffEditorHelperContribution extends Disposable implements IEditorContribu
private
readonly
_diffEditor
:
IDiffEditor
,
private
readonly
_diffEditor
:
IDiffEditor
,
@
IInstantiationService
private
readonly
_instantiationService
:
IInstantiationService
,
@
IInstantiationService
private
readonly
_instantiationService
:
IInstantiationService
,
@
IConfigurationService
private
readonly
_configurationService
:
IConfigurationService
,
@
IConfigurationService
private
readonly
_configurationService
:
IConfigurationService
,
@
INotificationService
private
readonly
_notificationService
:
INotificationService
,
)
{
)
{
super
();
super
();
this
.
_helperWidget
=
null
;
this
.
_helperWidget
=
null
;
...
@@ -37,7 +38,22 @@ class DiffEditorHelperContribution extends Disposable implements IEditorContribu
...
@@ -37,7 +38,22 @@ class DiffEditorHelperContribution extends Disposable implements IEditorContribu
this
.
_register
(
this
.
_diffEditor
.
onDidUpdateDiff
(()
=>
{
this
.
_register
(
this
.
_diffEditor
.
onDidUpdateDiff
(()
=>
{
this
.
_setState
(
this
.
_deduceState
(
this
.
_diffEditor
.
getDiffComputationResult
()));
const
diffComputationResult
=
this
.
_diffEditor
.
getDiffComputationResult
();
this
.
_setState
(
this
.
_deduceState
(
diffComputationResult
));
if
(
diffComputationResult
&&
diffComputationResult
.
quitEarly
)
{
this
.
_notificationService
.
prompt
(
Severity
.
Warning
,
nls
.
localize
(
'
hintTimeout
'
,
"
The diff algorithm was stopped early (after {0} ms.)
"
,
this
.
_diffEditor
.
maxComputationTime
),
[{
label
:
nls
.
localize
(
'
removeTimeout
'
,
"
Remove limit
"
),
run
:
()
=>
{
this
.
_configurationService
.
updateValue
(
'
diffEditor.maxComputationTime
'
,
0
,
ConfigurationTarget
.
USER
);
}
}],
{}
);
}
}));
}));
}
}
...
@@ -48,9 +64,6 @@ class DiffEditorHelperContribution extends Disposable implements IEditorContribu
...
@@ -48,9 +64,6 @@ class DiffEditorHelperContribution extends Disposable implements IEditorContribu
if
(
this
.
_diffEditor
.
ignoreTrimWhitespace
&&
diffComputationResult
.
changes
.
length
===
0
&&
!
diffComputationResult
.
identical
)
{
if
(
this
.
_diffEditor
.
ignoreTrimWhitespace
&&
diffComputationResult
.
changes
.
length
===
0
&&
!
diffComputationResult
.
identical
)
{
return
WidgetState
.
HintWhitespace
;
return
WidgetState
.
HintWhitespace
;
}
}
if
(
diffComputationResult
.
quitEarly
)
{
return
WidgetState
.
HintTimeout
;
}
return
WidgetState
.
Hidden
;
return
WidgetState
.
Hidden
;
}
}
...
@@ -75,21 +88,12 @@ class DiffEditorHelperContribution extends Disposable implements IEditorContribu
...
@@ -75,21 +88,12 @@ class DiffEditorHelperContribution extends Disposable implements IEditorContribu
this
.
_helperWidgetListener
=
this
.
_helperWidget
.
onClick
(()
=>
this
.
_onDidClickHelperWidget
());
this
.
_helperWidgetListener
=
this
.
_helperWidget
.
onClick
(()
=>
this
.
_onDidClickHelperWidget
());
this
.
_helperWidget
.
render
();
this
.
_helperWidget
.
render
();
}
}
if
(
this
.
_state
===
WidgetState
.
HintTimeout
)
{
this
.
_helperWidget
=
this
.
_instantiationService
.
createInstance
(
FloatingClickWidget
,
this
.
_diffEditor
.
getModifiedEditor
(),
nls
.
localize
(
'
hintTimeout
'
,
"
Remove diff computation timeout
"
),
null
);
this
.
_helperWidgetListener
=
this
.
_helperWidget
.
onClick
(()
=>
this
.
_onDidClickHelperWidget
());
this
.
_helperWidget
.
render
();
}
}
}
private
_onDidClickHelperWidget
():
void
{
private
_onDidClickHelperWidget
():
void
{
if
(
this
.
_state
===
WidgetState
.
HintWhitespace
)
{
if
(
this
.
_state
===
WidgetState
.
HintWhitespace
)
{
this
.
_configurationService
.
updateValue
(
'
diffEditor.ignoreTrimWhitespace
'
,
false
,
ConfigurationTarget
.
USER
);
this
.
_configurationService
.
updateValue
(
'
diffEditor.ignoreTrimWhitespace
'
,
false
,
ConfigurationTarget
.
USER
);
}
}
if
(
this
.
_state
===
WidgetState
.
HintTimeout
)
{
this
.
_configurationService
.
updateValue
(
'
diffEditor.maxComputationTime
'
,
0
,
ConfigurationTarget
.
USER
);
}
}
}
dispose
():
void
{
dispose
():
void
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录