Skip to content

Commit

Permalink
ASTDiff GUI: Further improvement for #672
Browse files Browse the repository at this point in the history
Speed up the folding process
  • Loading branch information
pouryafard75 authored and tsantalis committed Aug 19, 2024
1 parent ac735a4 commit b40cb7c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/gui/webdiff/viewers/monaco/MonacoCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,9 @@ public String getDiffName() {

public String makeDiffConfig() {
boolean spv = !showFilenames;
int spvInt = spv ? 1 : 0;
return "{ "
+ "moved: " + this.isMoved
+ ", id: " + id
+ ", spv: " + spv
+ ", file: \"" + srcFileName + "\""
+ ", left: " + this.getLeftJsConfig()
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/web/dist/monaco.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ function monaco(config) {
rightEditor.deltaDecorations([], rightDecorations);
rightEditor.getModel().moved = config.moved;
leftEditor.getModel().moved = config.moved;
rightEditor.getModel().id = config.id
leftEditor.getModel().id = config.id
rightEditor.onMouseDown((event) => {
if (event.target.range) {
const allDecorations = rightEditor.getModel().getDecorationsInRange(event.target.range, rightEditor.id, true)
Expand Down Expand Up @@ -229,6 +231,7 @@ function createFoldingRanges(linesToFold) {
function setAllFoldings(config, leftEditor, rightEditor) {
const foldingRangeProvider = {
provideFoldingRanges: (model, context, token) => {
if (model.id !== config.id) return;
let rangesToFold = createFoldingRanges(getLinesToFold(config, model, 2));
return rangesToFold.map(range => ({
start: range.startLineNumber,
Expand Down

0 comments on commit b40cb7c

Please sign in to comment.