未验证 提交 0a55dcfc 编写于 作者: A Alex Dima

Show hint when the diff algorithm quits early

上级 3fc780dc
......@@ -632,6 +632,9 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
if (typeof newOptions.maximumComputationTime !== 'undefined') {
this._maximumComputationTime = newOptions.maximumComputationTime;
if (this._isVisible) {
this._beginUpdateDecorationsSoon();
}
}
let beginUpdateDecorations = false;
......
......@@ -465,7 +465,7 @@ const editorConfiguration: IConfigurationNode = {
'diffEditor.maximumComputationTime': {
type: 'number',
default: 5000,
description: nls.localize('maximumComputationTime', "Timeout in milliseconds after which diff computation is cancelled.")
description: nls.localize('maximumComputationTime', "Timeout in milliseconds after which diff computation is cancelled. Use 0 for no timeout.")
},
'diffEditor.renderSideBySide': {
type: 'boolean',
......
......@@ -15,7 +15,8 @@ import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configur
const enum WidgetState {
Hidden,
HintWhitespace
HintWhitespace,
HintTimeout
}
class DiffEditorHelperContribution extends Disposable implements IEditorContribution {
......@@ -47,6 +48,9 @@ class DiffEditorHelperContribution extends Disposable implements IEditorContribu
if (this._diffEditor.ignoreTrimWhitespace && diffComputationResult.changes.length === 0 && !diffComputationResult.identical) {
return WidgetState.HintWhitespace;
}
if (diffComputationResult.quitEarly) {
return WidgetState.HintTimeout;
}
return WidgetState.Hidden;
}
......@@ -71,12 +75,21 @@ class DiffEditorHelperContribution extends Disposable implements IEditorContribu
this._helperWidgetListener = this._helperWidget.onClick(() => this._onDidClickHelperWidget());
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 {
if (this._state === WidgetState.HintWhitespace) {
this._configurationService.updateValue('diffEditor.ignoreTrimWhitespace', false, ConfigurationTarget.USER);
}
if (this._state === WidgetState.HintTimeout) {
this._configurationService.updateValue('diffEditor.maximumComputationTime', 0, ConfigurationTarget.USER);
}
}
dispose(): void {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册