Skip to content

Commit d89806e

Browse files
committed
Add coq.proofDiff option to disable proof diffs.
Motivation: this option can be very slow, according to #317 (comment). TODO: should probably be `coq.proofViewDiff`, but `coq.proofViewDiff.XYZ` options exist and I'll test for interference later.
1 parent 4a93ed2 commit d89806e

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@
129129
"default": "first-interaction",
130130
"description": "Create the proof view when a Coq script is opened, the user first interacts with coqtop, or else let the user do it manually."
131131
},
132+
"coq.proofViewDiff": {
133+
"type": "boolean",
134+
"default": "true",
135+
"markdownDescription": "Enable/disable VsCoq's Proof View Diff. Only has acceptable performance on small goals."
136+
},
132137
"coq.proofViewDiff.addedTextIsItalic": {
133138
"type": "boolean",
134139
"default": false,

server/src/protocol.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export interface CoqSettings {
7777
/** After each command, check sentence-states for inconsistencies */
7878
checkSentenceStateConsistency?: boolean,
7979
}
80+
proofViewDiff: boolean
8081
}
8182

8283
export interface FailValue {

server/src/stm/STM.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,9 @@ export class CoqStateMachine {
420420
endCommand();
421421
}
422422
}
423+
private get proofViewDiff(): boolean {
424+
return server.project.settings.coq.proofViewDiff
425+
}
423426

424427
/**
425428
* Return the cached goal for the given position
@@ -429,7 +432,7 @@ export class CoqStateMachine {
429432
try {
430433
const state = (direction==="subsequent" ? this.getStateAt(pos) : null) || this.getPrecedingStateAt(pos);
431434
if(state && state.hasGoal())
432-
return Object.assign({type: 'proof-view'} as {type: 'proof-view'}, state.getGoal(this.goalsCache));
435+
return Object.assign({type: 'proof-view'} as {type: 'proof-view'}, state.getGoal(this.goalsCache, this.proofViewDiff));
433436
else
434437
return {type: "no-proof"}
435438
} catch(error) {
@@ -857,7 +860,7 @@ private routeId = 1;
857860
focus: this.getFocusedPosition()
858861
});
859862
this.focusedSentence.setGoal(pv);
860-
return {type: 'proof-view', ...this.focusedSentence.getGoal(this.goalsCache)};
863+
return {type: 'proof-view', ...this.focusedSentence.getGoal(this.goalsCache, this.proofViewDiff)};
861864
default:
862865
this.console.warn("Goal returned an unexpected value: " + util.inspect(goals,false,undefined));
863866
}

server/src/stm/State.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,11 @@ export class State {
191191
this.goal = goal;
192192
}
193193

194-
public getGoal(goalsCache: GoalsCache) : ProofView|null {
194+
public getGoal(goalsCache: GoalsCache, proofViewDiff : boolean) : ProofView|null {
195195
if(!this.goal)
196196
return null;
197197
const newGoals = {...goalsCache.getProofView(this.goal), focus: this.textRange.end};
198-
if(this.prev && this.prev.goal) {
198+
if(this.prev && this.prev.goal && proofViewDiff) {
199199
const oldGoals = goalsCache.getProofView(this.prev.goal);
200200
return diff.diffProofView(oldGoals, newGoals);
201201
}

0 commit comments

Comments
 (0)