From fe1d7db6bfe0590b874177177d82a7af9afb7223 Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Wed, 12 Jul 2023 22:03:50 -0600 Subject: [PATCH] Fix package manager issues causing builds not to succeed (#292) * ci: try omitting yarn, vsce doesn't support yarnV2 (yet) * ci: consolidate dependency updates * lint: formatting --- .github/dependabot.yml | 4 + .github/workflows/release.yaml | 5 +- docs/parinfer-tester/assets/codemirror.js | 467 +++++++++--------- .../assets/parinfer-codemirror.js | 16 +- docs/parinfer-tester/assets/parinfer.js | 16 +- docs/parinfer-tester/index.html | 4 +- src/RecentFiles.ts | 2 +- src/config/config.ts | 16 +- src/config/user-settings.ts | 10 +- src/context.ts | 2 +- src/decomp/decomp-tools.ts | 86 ++-- src/decomp/man-page.ts | 8 +- src/decomp/misc-tools.ts | 48 +- src/decomp/type-caster.ts | 80 +-- src/decomp/type-searcher/type-searcher.ts | 18 +- src/decomp/utils.ts | 22 +- src/extension.ts | 20 +- src/goal/parinfer/parinfer.ts | 28 +- src/languages/common/utils.ts | 2 +- src/languages/ir2/ir2-completions.ts | 6 +- src/languages/ir2/ir2-folder.ts | 20 +- src/languages/ir2/ir2-inlay-hinter.ts | 46 +- src/languages/ir2/ir2-renamer.ts | 2 +- src/languages/ir2/ir2-utils.ts | 8 +- .../disasm/opengoal-disasm-renamer.ts | 2 +- src/languages/opengoal/opengoal-tools.ts | 6 +- src/lsp/download.ts | 2 +- src/lsp/main.ts | 28 +- src/lsp/util.ts | 8 +- src/tools/opengoal/nrepl/opengoal-nrepl.ts | 4 +- src/utils/download.ts | 4 +- src/utils/file-utils.ts | 8 +- src/utils/workspace.ts | 2 +- src/vendor/vscode-pdfviewer/pdfPreviewer.ts | 26 +- src/vendor/vscode-pdfviewer/pdfProvider.ts | 4 +- 35 files changed, 519 insertions(+), 511 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d1fc134..144aad0 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,3 +8,7 @@ updates: directory: "/" schedule: interval: "weekly" + groups: + frontend-dependencies: + patterns: + - "*" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index ce1763a..8f80db8 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -35,11 +35,12 @@ jobs: - name: Bump Version env: VSCE_PAT: ${{ secrets.VSCE_PAT }} + # TODO - https://github.com/microsoft/vscode-vsce/pull/876 run: | git config --global user.name "OpenGOALBot" git config --global user.email "OpenGOALBot@users.noreply.github.com" - yarn vsce package - yarn vsce publish ${{ github.event.inputs.bump }} + yarn vsce package --no-yarn + yarn vsce publish ${{ github.event.inputs.bump }} --no-yarn git push git push origin $(git tag --points-at HEAD) diff --git a/docs/parinfer-tester/assets/codemirror.js b/docs/parinfer-tester/assets/codemirror.js index 1215fd8..f00120c 100644 --- a/docs/parinfer-tester/assets/codemirror.js +++ b/docs/parinfer-tester/assets/codemirror.js @@ -31,7 +31,7 @@ var gecko = /gecko\/\d/i.test(navigator.userAgent); var ie_upto10 = /MSIE \d/.test(navigator.userAgent); var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec( - navigator.userAgent + navigator.userAgent, ); var ie = ie_upto10 || ie_11up; var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : ie_11up[1]); @@ -41,7 +41,7 @@ var presto = /Opera\//.test(navigator.userAgent); var safari = /Apple Computer/.test(navigator.vendor); var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test( - navigator.userAgent + navigator.userAgent, ); var phantom = /PhantomJS/.test(navigator.userAgent); @@ -52,7 +52,7 @@ var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test( - navigator.userAgent + navigator.userAgent, ); var mac = ios || /Mac/.test(navigator.platform); var windows = /win/i.test(navigator.platform); @@ -188,14 +188,14 @@ "div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv], null, - "position: relative; outline: none" + "position: relative; outline: none", ); // Moved around its parent to cover visible view. d.mover = elt( "div", [elt("div", [d.lineSpace], "CodeMirror-lines")], null, - "position: relative" + "position: relative", ); // Set to the height of the document, allowing scrolling. d.sizer = elt("div", [d.mover], "CodeMirror-sizer"); @@ -207,7 +207,7 @@ "div", null, null, - "position: absolute; height: " + scrollerGap + "px; width: 1px;" + "position: absolute; height: " + scrollerGap + "px; width: 1px;", ); // Will contain the gutters, if any. d.gutters = elt("div", null, "CodeMirror-gutters"); @@ -216,14 +216,14 @@ d.scroller = elt( "div", [d.sizer, d.heightForcer, d.gutters], - "CodeMirror-scroll" + "CodeMirror-scroll", ); d.scroller.setAttribute("tabIndex", "-1"); // The element in which the editor lives. d.wrapper = elt( "div", [d.scrollbarFiller, d.gutterFiller, d.scroller], - "CodeMirror" + "CodeMirror", ); // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported) @@ -382,7 +382,7 @@ for (var i = 0; i < specs.length; ++i) { var gutterClass = specs[i]; var gElt = gutters.appendChild( - elt("div", null, "CodeMirror-gutter " + gutterClass) + elt("div", null, "CodeMirror-gutter " + gutterClass), ); if (gutterClass == "CodeMirror-linenumbers") { cm.display.lineGutter = gElt; @@ -476,12 +476,12 @@ var vert = (this.vert = elt( "div", [elt("div", null, null, "min-width: 1px")], - "CodeMirror-vscrollbar" + "CodeMirror-vscrollbar", )); var horiz = (this.horiz = elt( "div", [elt("div", null, null, "height: 100%; min-height: 1px")], - "CodeMirror-hscrollbar" + "CodeMirror-hscrollbar", )); place(vert); place(horiz); @@ -514,7 +514,7 @@ this.vert.firstChild.style.height = Math.max( 0, - measure.scrollHeight - measure.clientHeight + totalHeight + measure.scrollHeight - measure.clientHeight + totalHeight, ) + "px"; } else { this.vert.style.display = ""; @@ -564,7 +564,7 @@ parent.removeChild(this.vert); }, }, - NativeScrollbars.prototype + NativeScrollbars.prototype, ); function NullScrollbars() {} @@ -578,7 +578,7 @@ setScrollTop: function () {}, clear: function () {}, }, - NullScrollbars.prototype + NullScrollbars.prototype, ); CodeMirror.scrollbarModel = { @@ -611,7 +611,7 @@ if (axis == "horizontal") setScrollLeft(cm, pos); else setScrollTop(cm, pos); }, - cm + cm, ); if (cm.display.scrollbars.addClass) addClass(cm.display.wrapper, cm.display.scrollbars.addClass); @@ -686,12 +686,12 @@ from = ensureFrom; to = lineAtHeight( doc, - heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight + heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight, ); } else if (Math.min(ensureTo, doc.lastLine()) >= to) { from = lineAtHeight( doc, - heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight + heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight, ); to = ensureTo; } @@ -742,8 +742,8 @@ elt( "div", [elt("div", last)], - "CodeMirror-linenumber CodeMirror-gutter-elt" - ) + "CodeMirror-linenumber CodeMirror-gutter-elt", + ), ); var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW; @@ -843,7 +843,7 @@ var end = doc.first + doc.size; var from = Math.max( update.visible.from - cm.options.viewportMargin, - doc.first + doc.first, ); var to = Math.min(end, update.visible.to + cm.options.viewportMargin); if (display.viewFrom < from && from - display.viewFrom < 20) @@ -919,7 +919,7 @@ viewport = { top: Math.min( cm.doc.height + paddingVert(cm.display) - displayHeight(cm), - viewport.top + viewport.top, ), }; // Updated line heights might result in the drawn area not @@ -949,7 +949,7 @@ "viewportChange", cm, cm.display.viewFrom, - cm.display.viewTo + cm.display.viewTo, ); cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo; @@ -1079,7 +1079,7 @@ if (updateNumber) { removeChildren(lineView.lineNumber); lineView.lineNumber.appendChild( - document.createTextNode(lineNumberFor(cm.options, lineN)) + document.createTextNode(lineNumberFor(cm.options, lineN)), ); } cur = lineView.node.nextSibling; @@ -1131,7 +1131,7 @@ var wrap = ensureLineWrapped(lineView); lineView.background = wrap.insertBefore( elt("div", null, cls), - wrap.firstChild + wrap.firstChild, ); } } @@ -1199,7 +1199,7 @@ (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px; width: " + dims.gutterTotalWidth + - "px" + "px", ); wrap.insertBefore(lineView.gutterBackground, lineView.text); } @@ -1212,7 +1212,7 @@ "CodeMirror-gutter-wrapper", "left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + - "px" + "px", )); cm.display.input.setUneditable(gutterWrap); wrap.insertBefore(gutterWrap, lineView.text); @@ -1231,8 +1231,8 @@ dims.gutterLeft["CodeMirror-linenumbers"] + "px; width: " + cm.display.lineNumInnerWidth + - "px" - ) + "px", + ), ); if (markers) for (var k = 0; k < cm.options.gutters.length; ++k) { @@ -1248,8 +1248,8 @@ dims.gutterLeft[id] + "px; width: " + dims.gutterWidth[id] + - "px" - ) + "px", + ), ); } } @@ -1404,8 +1404,8 @@ to.line, Math.min( getLine(doc, to.line).text.length, - to.ch + lst(textLines).length - ) + to.ch + lst(textLines).length, + ), ); } var updateInput = cm.curOp.updateInput; @@ -1462,7 +1462,7 @@ } else if (mode.electricInput) { if ( mode.electricInput.test( - getLine(cm.doc, range.head.line).text.slice(0, range.head.ch) + getLine(cm.doc, range.head.line).text.slice(0, range.head.ch), ) ) indented = indentLine(cm, range.head.line, "smart"); @@ -1515,13 +1515,13 @@ "textarea", null, null, - "position: absolute; padding: 0; width: 1px; height: 1em; outline: none" + "position: absolute; padding: 0; width: 1px; height: 1em; outline: none", ); var div = elt( "div", [te], null, - "overflow: hidden; position: relative; width: 3px; height: 0px;" + "overflow: hidden; position: relative; width: 3px; height: 0px;", ); // The textarea is kept positioned near the cursor to prevent the // fact that it'll be scrolled into view on input from scrolling @@ -1637,15 +1637,15 @@ 0, Math.min( display.wrapper.clientHeight - 10, - headPos.top + lineOff.top - wrapOff.top - ) + headPos.top + lineOff.top - wrapOff.top, + ), ); result.teLeft = Math.max( 0, Math.min( display.wrapper.clientWidth - 10, - headPos.left + lineOff.left - wrapOff.left - ) + headPos.left + lineOff.left - wrapOff.left, + ), ); } @@ -1810,7 +1810,7 @@ text.slice(same), prevInput.length - same, null, - self.composing ? "*compose" : null + self.composing ? "*compose" : null, ); // Don't leave long text in the textarea, since it makes further polling slow @@ -1823,7 +1823,7 @@ self.composing.range = cm.markText( self.composing.start, cm.getCursor("to"), - { className: "CodeMirror-composing" } + { className: "CodeMirror-composing" }, ); } }); @@ -1855,7 +1855,7 @@ operation(cm, setSelection)( cm.doc, simpleSelection(pos), - sel_dontScroll + sel_dontScroll, ); var oldCSS = te.style.cssText; @@ -1901,7 +1901,7 @@ te.style.cssText = oldCSS; if (ie && ie_version < 9) display.scrollbars.setScrollTop( - (display.scroller.scrollTop = scrollPos) + (display.scroller.scrollTop = scrollPos), ); // Try to detect the user choosing select-all @@ -1945,7 +1945,7 @@ needsContentAttribute: false, }, - TextareaInput.prototype + TextareaInput.prototype, ); // CONTENTEDITABLE INPUT STYLE @@ -1981,12 +1981,12 @@ var line = cm.getLine(prim.head.line); var found = line.indexOf( data, - Math.max(0, prim.head.ch - data.length) + Math.max(0, prim.head.ch - data.length), ); if (found > -1 && found <= prim.head.ch) input.composing.sel = simpleSelection( Pos(prim.head.line, found), - Pos(prim.head.line, found + data.length) + Pos(prim.head.line, found + data.length), ); }); on(div, "compositionupdate", function (e) { @@ -2045,7 +2045,7 @@ te = kludge.firstChild; cm.display.lineSpace.insertBefore( kludge, - cm.display.lineSpace.firstChild + cm.display.lineSpace.firstChild, ); te.value = lastCopied.join("\n"); var hadFocus = document.activeElement; @@ -2204,7 +2204,7 @@ setSelection( cm.doc, simpleSelection(anchor, head), - sel_dontScroll + sel_dontScroll, ); if (anchor.bad || head.bad) cm.curOp.selectionChanged = true; }); @@ -2241,12 +2241,12 @@ } var newText = cm.doc.splitLines( - domTextBetween(cm, fromNode, toNode, fromLine, toLine) + domTextBetween(cm, fromNode, toNode, fromLine, toLine), ); var oldText = getBetween( cm.doc, Pos(fromLine, 0), - Pos(toLine, getLine(cm.doc, toLine).text.length) + Pos(toLine, getLine(cm.doc, toLine).text.length), ); while (newText.length > 1 && oldText.length > 1) { if (lst(newText) == lst(oldText)) { @@ -2274,7 +2274,7 @@ oldBot = lst(oldText); var maxCutEnd = Math.min( newBot.length - (newText.length == 1 ? cutFront : 0), - oldBot.length - (oldText.length == 1 ? cutFront : 0) + oldBot.length - (oldText.length == 1 ? cutFront : 0), ); while ( cutEnd < maxCutEnd && @@ -2289,7 +2289,7 @@ var chFrom = Pos(fromLine, cutFront); var chTo = Pos( toLine, - oldText.length ? lst(oldText).length - cutEnd : 0 + oldText.length ? lst(oldText).length - cutEnd : 0, ); if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) { replaceRange(cm.doc, newText, chFrom, chTo, "+input"); @@ -2317,7 +2317,7 @@ this.cm, composing.data, 0, - composing.sel + composing.sel, ); }, @@ -2331,7 +2331,7 @@ operation(this.cm, applyTextInput)( this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), - 0 + 0, ); }, @@ -2344,7 +2344,7 @@ needsContentAttribute: true, }, - ContentEditableInput.prototype + ContentEditableInput.prototype, ); function posToDOM(cm, pos) { @@ -2483,7 +2483,7 @@ var found = cm.findMarks( Pos(fromLine, 0), Pos(toLine + 1, 0), - recognizeMarker(+markerID) + recognizeMarker(+markerID), ); if (found.length && (range = found[0].find())) text += getBetween(cm.doc, range.from, range.to).join(lineSep); @@ -2554,7 +2554,7 @@ for (var out = [], i = 0; i < this.ranges.length; i++) out[i] = new Range( copyPos(this.ranges[i].anchor), - copyPos(this.ranges[i].head) + copyPos(this.ranges[i].head), ); return new Selection(out, this.primIndex); }, @@ -2680,7 +2680,7 @@ setSelection( doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), - options + options, ); } @@ -2715,7 +2715,7 @@ for (var i = 0; i < ranges.length; i++) this.ranges[i] = new Range( clipPos(doc, ranges[i].anchor), - clipPos(doc, ranges[i].head) + clipPos(doc, ranges[i].head), ); }, }; @@ -2744,7 +2744,7 @@ doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, - options + options, ); } @@ -2782,7 +2782,7 @@ setSelectionInner( doc, skipAtomicInSelection(doc, doc.sel, null, false), - sel_dontScroll + sel_dontScroll, ); } @@ -2897,7 +2897,7 @@ "div", null, null, - !cm.options.singleCursorHeightPerLine + !cm.options.singleCursorHeightPerLine, ); var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor")); @@ -2909,7 +2909,7 @@ if (pos.other) { // Secondary cursor, shown when on a 'jump' in bi-directional text var otherCursor = output.appendChild( - elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor") + elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"), ); otherCursor.style.display = ""; otherCursor.style.left = pos.other.left + "px"; @@ -2929,7 +2929,7 @@ var rightSide = Math.max( display.sizerWidth, - displayWidth(cm) - display.sizer.offsetLeft + displayWidth(cm) - display.sizer.offsetLeft, ) - padding.right; function add(left, top, width, bottom) { @@ -2949,8 +2949,8 @@ (width == null ? rightSide - left : width) + "px; height: " + (bottom - top) + - "px" - ) + "px", + ), ); } @@ -3007,7 +3007,7 @@ end = rightPos; if (left < leftSide + 1) left = leftSide; add(left, rightPos.top, right - left, rightPos.bottom); - } + }, ); return { start: start, end: end }; } @@ -3023,12 +3023,12 @@ var leftEnd = drawForLine( sFrom.line, sFrom.ch, - singleVLine ? fromLine.text.length + 1 : null + singleVLine ? fromLine.text.length + 1 : null, ).end; var rightStart = drawForLine( sTo.line, singleVLine ? 0 : null, - sTo.ch + sTo.ch, ).start; if (singleVLine) { if (leftEnd.top < rightStart.top - 2) { @@ -3039,7 +3039,7 @@ leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, - leftEnd.bottom + leftEnd.bottom, ); } } @@ -3092,7 +3092,7 @@ cm, line, tooLong ? copyState(doc.mode, state) : state, - true + true, ); line.styles = highlighted.styles; var oldCls = line.styleClasses, @@ -3122,7 +3122,7 @@ startWorker(cm, cm.options.workDelay); return true; } - } + }, ); if (changedLines.length) runInOp(cm, function () { @@ -3267,7 +3267,7 @@ var view = (cm.display.externalMeasured = new LineView( cm.doc, line, - lineN + lineN, )); view.lineN = lineN; var built = (view.built = buildLineContent(cm, view)); @@ -3602,7 +3602,7 @@ cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), - context + context, ); } @@ -3618,7 +3618,7 @@ preparedMeasure, ch, right ? "right" : "left", - varHeight + varHeight, ); if (right) m.left = m.right; else m.right = m.left; @@ -3693,7 +3693,7 @@ doc.first + doc.size - 1, getLine(doc, last).text.length, true, - 1 + 1, ); if (x < 0) x = 0; @@ -3724,7 +3724,7 @@ Pos(lineNo, ch), "line", lineObj, - preparedMeasure + preparedMeasure, ); wrongLine = true; if (innerOff > sp.bottom) return sp.left - adjust; @@ -3757,7 +3757,7 @@ lineNo, ch, ch == from ? fromOutside : toOutside, - xDiff < -1 ? -1 : xDiff > 1 ? 1 : 0 + xDiff < -1 ? -1 : xDiff > 1 ? 1 : 0, ); return pos; } @@ -3870,7 +3870,7 @@ while (op.cursorActivityCalled < op.cursorActivityHandlers.length) op.cursorActivityHandlers[op.cursorActivityCalled++].call( null, - op.cm + op.cm, ); } } while (i < callbacks.length); @@ -3946,7 +3946,7 @@ new DisplayUpdate( cm, op.mustUpdate && { top: op.scrollTop, ensure: op.scrollToPos }, - op.forceUpdate + op.forceUpdate, ); } @@ -3974,11 +3974,11 @@ display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + - cm.display.barWidth + cm.display.barWidth, ); op.maxScrollLeft = Math.max( 0, - display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm) + display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm), ); } @@ -3995,7 +3995,7 @@ setScrollLeft( cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), - true + true, ); cm.display.maxLineChanged = false; } @@ -4035,8 +4035,8 @@ 0, Math.min( display.scroller.scrollHeight - display.scroller.clientHeight, - op.scrollTop - ) + op.scrollTop, + ), ); display.scrollbars.setScrollTop(doc.scrollTop); display.scroller.scrollTop = doc.scrollTop; @@ -4047,7 +4047,10 @@ ) { doc.scrollLeft = Math.max( 0, - Math.min(display.scroller.scrollWidth - displayWidth(cm), op.scrollLeft) + Math.min( + display.scroller.scrollWidth - displayWidth(cm), + op.scrollLeft, + ), ); display.scrollbars.setScrollLeft(doc.scrollLeft); display.scroller.scrollLeft = doc.scrollLeft; @@ -4059,7 +4062,7 @@ cm, clipPos(doc, op.scrollToPos.from), clipPos(doc, op.scrollToPos.to), - op.scrollToPos.margin + op.scrollToPos.margin, ); if (op.scrollToPos.isCursor && cm.state.focused) maybeScrollWindow(cm, coords); @@ -4313,14 +4316,14 @@ } else { if (display.viewFrom > from) display.view = buildViewArray(cm, from, display.viewFrom).concat( - display.view + display.view, ); else if (display.viewFrom < from) display.view = display.view.slice(findViewIndex(cm, from)); display.viewFrom = from; if (display.viewTo < to) display.view = display.view.concat( - buildViewArray(cm, display.viewTo, to) + buildViewArray(cm, display.viewTo, to), ); else if (display.viewTo > to) display.view = display.view.slice(0, findViewIndex(cm, to)); @@ -4359,7 +4362,7 @@ e_preventDefault(e); var word = cm.findWordAt(pos); extendSelection(cm.doc, word.anchor, word.head); - }) + }), ); else on(d.scroller, "dblclick", function (e) { @@ -4435,7 +4438,7 @@ else range = new Range( Pos(pos.line, 0), - clipPos(cm.doc, Pos(pos.line + 1, 0)) + clipPos(cm.doc, Pos(pos.line + 1, 0)), ); cm.setSelection(range.anchor, range.head); cm.focus(); @@ -4572,8 +4575,8 @@ Math.max( 0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - - colDiff - ) + colDiff, + ), ); } return coords; @@ -4740,7 +4743,7 @@ } else if (type == "triple") { var line = new Range( Pos(start.line, 0), - clipPos(doc, Pos(start.line + 1, 0)) + clipPos(doc, Pos(start.line + 1, 0)), ); if (cm.display.shift || doc.extend) ourRange = extendRange(doc, ourRange, line.anchor, line.head); @@ -4758,7 +4761,7 @@ setSelection( doc, normalizeSelection(ranges.concat([ourRange]), ourIndex), - { scroll: false, origin: "*mouse" } + { scroll: false, origin: "*mouse" }, ); } else if ( ranges.length > 1 && @@ -4770,9 +4773,9 @@ doc, normalizeSelection( ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), - 0 + 0, ), - { scroll: false, origin: "*mouse" } + { scroll: false, origin: "*mouse" }, ); startSel = doc.sel; } else { @@ -4790,7 +4793,7 @@ var startCol = countColumn( getLine(doc, start.line).text, start.ch, - tabSize + tabSize, ); var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize); var left = Math.min(startCol, posCol), @@ -4809,8 +4812,8 @@ ranges.push( new Range( Pos(line, leftPos), - Pos(line, findColumn(text, right, tabSize)) - ) + Pos(line, findColumn(text, right, tabSize)), + ), ); } if (!ranges.length) ranges.push(new Range(start, start)); @@ -4818,9 +4821,9 @@ doc, normalizeSelection( startSel.ranges.slice(0, ourIndex).concat(ranges), - ourIndex + ourIndex, ), - { origin: "*mouse", scroll: false } + { origin: "*mouse", scroll: false }, ); cm.scrollIntoView(pos); } else { @@ -4832,7 +4835,7 @@ else var range = new Range( Pos(pos.line, 0), - clipPos(doc, Pos(pos.line + 1, 0)) + clipPos(doc, Pos(pos.line + 1, 0)), ); if (cmp(range.anchor, anchor) > 0) { head = range.head; @@ -4868,7 +4871,7 @@ operation(cm, function () { if (counter == curCount) extend(e); }), - 150 + 150, ); } else { var outside = @@ -4884,7 +4887,7 @@ display.scroller.scrollTop += outside; extend(e); }), - 50 + 50, ); } } @@ -4978,7 +4981,7 @@ makeChange(cm.doc, change); setSelectionReplaceHistory( cm.doc, - simpleSelection(pos, changeEnd(change)) + simpleSelection(pos, changeEnd(change)), ); } }); @@ -5009,7 +5012,7 @@ "", selected[i].anchor, selected[i].head, - "drag" + "drag", ); cm.replaceSelection(text, "around", "paste"); cm.display.input.focus(); @@ -5053,11 +5056,11 @@ cm.display.dragCursor = elt( "div", null, - "CodeMirror-cursors CodeMirror-dragcursors" + "CodeMirror-cursors CodeMirror-dragcursors", ); cm.display.lineSpace.insertBefore( cm.display.dragCursor, - cm.display.cursorDiv + cm.display.cursorDiv, ); } removeChildrenAndAdd(cm.display.dragCursor, frag); @@ -5095,7 +5098,7 @@ return; val = Math.min( val, - cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth + cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth, ); cm.doc.scrollLeft = val; alignHorizontally(cm); @@ -5190,9 +5193,9 @@ 0, Math.min( scroll.scrollTop + dy * wheelPixelsPerUnit, - scroll.scrollHeight - scroll.clientHeight - ) - ) + scroll.scrollHeight - scroll.clientHeight, + ), + ), ); setScrollLeft( cm, @@ -5200,9 +5203,9 @@ 0, Math.min( scroll.scrollLeft + dx * wheelPixelsPerUnit, - scroll.scrollWidth - scroll.clientWidth - ) - ) + scroll.scrollWidth - scroll.clientWidth, + ), + ), ); e_preventDefault(e); display.wheelStartX = null; // Abort measurement, if in progress @@ -5487,7 +5490,7 @@ if (!change.text) return change.to; return Pos( change.from.line + change.text.length - 1, - lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0) + lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0), ); }); @@ -5511,8 +5514,8 @@ out.push( new Range( adjustForChange(range.anchor, change), - adjustForChange(range.head, change) - ) + adjustForChange(range.head, change), + ), ); } return normalizeSelection(out, doc.sel.primIndex); @@ -5621,7 +5624,7 @@ doc, change, selAfter, - stretchSpansOverChange(doc, change) + stretchSpansOverChange(doc, change), ); var rebased = []; @@ -5634,7 +5637,7 @@ doc, change, null, - stretchSpansOverChange(doc, change) + stretchSpansOverChange(doc, change), ); }); } @@ -5722,10 +5725,10 @@ map(doc.sel.ranges, function (range) { return new Range( Pos(range.anchor.line + distance, range.anchor.ch), - Pos(range.head.line + distance, range.head.ch) + Pos(range.head.line + distance, range.head.ch), ); }), - doc.sel.primIndex + doc.sel.primIndex, ); if (doc.cm) { regChange(doc.cm, doc.first, doc.first - distance, distance); @@ -5742,13 +5745,13 @@ doc, change, selAfter, - spans + spans, ); if (change.to.line < doc.first) { shiftDoc( doc, - change.text.length - 1 - (change.to.line - change.from.line) + change.text.length - 1 - (change.to.line - change.from.line), ); return; } @@ -5819,7 +5822,7 @@ display.maxLineChanged = true; recomputeMaxLength = false; } - } + }, ); if (recomputeMaxLength) cm.curOp.updateMaxLine = true; } @@ -5894,7 +5897,7 @@ (coords.bottom - coords.top + scrollGap(cm) + display.barHeight) + "px; left: " + coords.left + - "px; width: 2px;" + "px; width: 2px;", ); cm.display.lineSpace.appendChild(scrollNode); scrollNode.scrollIntoView(doScroll); @@ -5916,7 +5919,7 @@ Math.min(coords.left, endCoords.left), Math.min(coords.top, endCoords.top) - margin, Math.max(coords.left, endCoords.left), - Math.max(coords.bottom, endCoords.bottom) + margin + Math.max(coords.bottom, endCoords.bottom) + margin, ); var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft; @@ -6031,7 +6034,7 @@ Math.min(from.left, to.left), Math.min(from.top, to.top) - range.margin, Math.max(from.right, to.right), - Math.max(from.bottom, to.bottom) + range.margin + Math.max(from.bottom, to.bottom) + range.margin, ); cm.scrollTo(sPos.scrollLeft, sPos.scrollTop); } @@ -6068,7 +6071,7 @@ indentation = doc.mode.indent( state, line.text.slice(curSpaceString.length), - line.text + line.text, ); if (indentation == Pass || indentation > 150) { if (!aggressive) return; @@ -6104,7 +6107,7 @@ indentString, Pos(n, 0), Pos(n, curSpaceString.length), - "+indenthack" + "+indenthack", ); line.stateAfter = null; @@ -6188,7 +6191,7 @@ lineObj, ch, dir, - true + true, ); if (next == null) { if (!boundToLine && findNextLine()) { @@ -6243,7 +6246,7 @@ if (unit == "page") { var pageSize = Math.min( cm.display.wrapper.clientHeight, - window.innerHeight || document.documentElement.clientHeight + window.innerHeight || document.documentElement.clientHeight, ); y = pos.top + @@ -6360,7 +6363,7 @@ this.doc, i, new Range(from, newRanges[i].to()), - sel_dontScroll + sel_dontScroll, ); } else if (range.head.line > end) { indentLine(this, range.head.line, how, true); @@ -6465,7 +6468,7 @@ height = fromCoordSystem( this, { top: height, left: 0 }, - mode || "page" + mode || "page", ).top; return lineAtHeight(this.doc, height + this.display.viewOffset); }, @@ -6560,7 +6563,7 @@ var vspace = Math.max(display.wrapper.clientHeight, this.doc.height), hspace = Math.max( display.sizer.clientWidth, - display.lineSpace.clientWidth + display.lineSpace.clientWidth, ); // Default to positioning above (if specified and possible); otherwise default to positioning below if ( @@ -6588,7 +6591,7 @@ left, top, left + node.offsetWidth, - top + node.offsetHeight + top + node.offsetHeight, ); }, @@ -6626,7 +6629,7 @@ range.head, dir, unit, - cm.options.rtlMoveVisually + cm.options.rtlMoveVisually, ); else return dir < 0 ? range.from() : range.to(); }, sel_move); @@ -6678,7 +6681,7 @@ addToScrollPos( cm, null, - charCoords(cm, pos, "div").top - headPos.top + charCoords(cm, pos, "div").top - headPos.top, ); return pos; }, sel_move); @@ -6766,7 +6769,7 @@ Math.min(range.from.left, range.to.left), Math.min(range.from.top, range.to.top) - range.margin, Math.max(range.from.right, range.to.right), - Math.max(range.from.bottom, range.to.bottom) + range.margin + Math.max(range.from.bottom, range.to.bottom) + range.margin, ); this.scrollTo(sPos.scrollLeft, sPos.scrollTop); } @@ -6874,7 +6877,7 @@ function (cm, val) { cm.setValue(val); }, - true + true, ); option( "mode", @@ -6883,7 +6886,7 @@ cm.doc.modeOption = val; loadMode(cm); }, - true + true, ); option("indentUnit", 2, loadMode, true); @@ -6897,7 +6900,7 @@ clearCaches(cm); regChange(cm); }, - true + true, ); option("lineSeparator", null, function (cm, val) { cm.doc.lineSep = val; @@ -6918,7 +6921,7 @@ cm.doc, val, newBreaks[i], - Pos(newBreaks[i].line, newBreaks[i].ch + val.length) + Pos(newBreaks[i].line, newBreaks[i].ch + val.length), ); }); option( @@ -6927,10 +6930,10 @@ function (cm, val, old) { cm.state.specialChars = new RegExp( val.source + (val.test("\t") ? "" : "|\t"), - "g" + "g", ); if (old != CodeMirror.Init) cm.refresh(); - } + }, ); option( "specialCharPlaceholder", @@ -6938,7 +6941,7 @@ function (cm) { cm.refresh(); }, - true + true, ); option("electricChars", true); option( @@ -6946,10 +6949,10 @@ mobile ? "contenteditable" : "textarea", function () { throw new Error( - "inputStyle can not (yet) be changed in a running editor" + "inputStyle can not (yet) be changed in a running editor", ); // FIXME }, - true + true, ); option("rtlMoveVisually", !windows); option("wholeLineUpdateBefore", true); @@ -6961,7 +6964,7 @@ themeChanged(cm); guttersChanged(cm); }, - true + true, ); option("keyMap", "default", function (cm, val, old) { var next = getKeyMap(val); @@ -6979,7 +6982,7 @@ setGuttersForLineNumbers(cm.options); guttersChanged(cm); }, - true + true, ); option( "fixedGutter", @@ -6990,7 +6993,7 @@ : "0"; cm.refresh(); }, - true + true, ); option( "coverGutterNextToScrollbar", @@ -6998,7 +7001,7 @@ function (cm) { updateScrollbars(cm); }, - true + true, ); option( "scrollbarStyle", @@ -7009,7 +7012,7 @@ cm.display.scrollbars.setScrollTop(cm.doc.scrollTop); cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft); }, - true + true, ); option( "lineNumbers", @@ -7018,7 +7021,7 @@ setGuttersForLineNumbers(cm.options); guttersChanged(cm); }, - true + true, ); option("firstLineNumber", 1, guttersChanged, true); option( @@ -7027,7 +7030,7 @@ return integer; }, guttersChanged, - true + true, ); option("showCursorWhenSelecting", false, updateSelection, true); @@ -7050,7 +7053,7 @@ function (cm, val) { if (!val) cm.display.input.reset(); }, - true + true, ); option("dragDrop", true, dragDropChanged); @@ -7073,7 +7076,7 @@ function (cm) { cm.refresh(); }, - true + true, ); option("maxHighlightLength", 10000, resetModeState, true); option("moveInputWithCursor", true, function (cm, val) { @@ -7241,14 +7244,14 @@ cm.setSelection( Pos(cm.firstLine(), 0), Pos(cm.lastLine()), - sel_dontScroll + sel_dontScroll, ); }, singleSelection: function (cm) { cm.setSelection( cm.getCursor("anchor"), cm.getCursor("head"), - sel_dontScroll + sel_dontScroll, ); }, killLine: function (cm) { @@ -7288,7 +7291,7 @@ var top = cm.charCoords(range.head, "div").top + 5; var rightPos = cm.coordsChar( { left: cm.display.lineDiv.offsetWidth + 100, top: top }, - "div" + "div", ); return { from: range.from(), to: rightPos }; }); @@ -7316,7 +7319,7 @@ function (range) { return lineStart(cm, range.head.line); }, - { origin: "+move", bias: 1 } + { origin: "+move", bias: 1 }, ); }, goLineStartSmart: function (cm) { @@ -7324,7 +7327,7 @@ function (range) { return lineStartSmart(cm, range.head); }, - { origin: "+move", bias: 1 } + { origin: "+move", bias: 1 }, ); }, goLineEnd: function (cm) { @@ -7332,7 +7335,7 @@ function (range) { return lineEnd(cm, range.head.line); }, - { origin: "+move", bias: -1 } + { origin: "+move", bias: -1 }, ); }, goLineRight: function (cm) { @@ -7340,7 +7343,7 @@ var top = cm.charCoords(range.head, "div").top + 5; return cm.coordsChar( { left: cm.display.lineDiv.offsetWidth + 100, top: top }, - "div" + "div", ); }, sel_move); }, @@ -7455,7 +7458,7 @@ line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2), Pos(cur.line, cur.ch - 2), cur, - "+transpose" + "+transpose", ); } else if (cur.line > cm.doc.first) { var prev = getLine(cm.doc, cur.line - 1).text; @@ -7466,7 +7469,7 @@ prev.charAt(prev.length - 1), Pos(cur.line - 1, prev.length - 1), Pos(cur.line, 1), - "+transpose" + "+transpose", ); } } @@ -7484,7 +7487,7 @@ cm.doc.lineSeparator(), range.anchor, range.head, - "+input" + "+input", ); cm.indentLine(range.from().line + 1, null, true); ensureCursorVisible(cm); @@ -7834,7 +7837,7 @@ this.start, this.tabSize, this.lastColumnPos, - this.lastColumnValue + this.lastColumnValue, ); this.lastColumnPos = this.start; } @@ -8049,7 +8052,7 @@ marker.widgetNode = elt( "span", [marker.replacedWith], - "CodeMirror-widget" + "CodeMirror-widget", ); if (!options.handleMouseEvents) marker.widgetNode.setAttribute("cm-ignore-events", "true"); @@ -8062,7 +8065,7 @@ conflictingCollapsedRange(doc, to.line, from, to, marker)) ) throw new Error( - "Inserting collapsed marker partially overlapping an existing one" + "Inserting collapsed marker partially overlapping an existing one", ); sawCollapsedSpans = true; } @@ -8072,7 +8075,7 @@ doc, { from: from, to: to, origin: "markText" }, doc.sel, - NaN + NaN, ); var curLine = from.line, @@ -8092,8 +8095,8 @@ new MarkedSpan( marker, curLine == from.line ? from.ch : null, - curLine == to.line ? to.ch : null - ) + curLine == to.line ? to.ch : null, + ), ); ++curLine; }); @@ -8142,7 +8145,7 @@ // markers. var SharedTextMarker = (CodeMirror.SharedTextMarker = function ( markers, - primary + primary, ) { this.markers = markers; this.primary = primary; @@ -8169,7 +8172,7 @@ linkedDocs(doc, function (doc) { if (widget) options.widgetNode = widget.cloneNode(true); markers.push( - markText(doc, clipPos(doc, from), clipPos(doc, to), options, type) + markText(doc, clipPos(doc, from), clipPos(doc, to), options, type), ); for (var i = 0; i < doc.linked.length; ++i) if (doc.linked[i].isParent) return; @@ -8184,7 +8187,7 @@ doc.clipPos(Pos(doc.lastLine())), function (m) { return m.parent; - } + }, ); } @@ -8200,7 +8203,7 @@ mFrom, mTo, marker.primary, - marker.primary.type + marker.primary.type, ); marker.markers.push(subMark); subMark.parent = marker; @@ -8278,7 +8281,7 @@ span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh); (nw || (nw = [])).push( - new MarkedSpan(marker, span.from, endsAfter ? null : span.to) + new MarkedSpan(marker, span.from, endsAfter ? null : span.to), ); } } @@ -8305,8 +8308,8 @@ new MarkedSpan( marker, startsBefore ? null : span.from - endCh, - span.to == null ? null : span.to - endCh - ) + span.to == null ? null : span.to - endCh, + ), ); } } @@ -8380,7 +8383,7 @@ for (var i = 0; i < first.length; ++i) if (first[i].to == null) (gapMarkers || (gapMarkers = [])).push( - new MarkedSpan(first[i].marker, null, null) + new MarkedSpan(first[i].marker, null, null), ); for (var i = 0; i < gap; ++i) newMarkers.push(gapMarkers); newMarkers.push(last); @@ -8621,7 +8624,7 @@ return lineIsHiddenInner( doc, end.line, - getMarkedSpanFor(end.line.markedSpans, span.marker) + getMarkedSpanFor(end.line.markedSpans, span.marker), ); } if (span.marker.inclusiveRight && span.to == line.text.length) return true; @@ -8704,7 +8707,7 @@ parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;"; removeChildrenAndAdd( cm.display.measure, - elt("div", [widget.node], null, parentStyle) + elt("div", [widget.node], null, parentStyle), ); } return (widget.height = widget.node.offsetHeight); @@ -8721,7 +8724,7 @@ widgets.splice( Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, - widget + widget, ); widget.line = line; if (cm && !lineIsHidden(doc, line)) { @@ -8851,7 +8854,7 @@ } else { style = extractLineClasses( readToken(mode, stream, state, inner), - lineClasses + lineClasses, ); } if (inner) { @@ -8894,7 +8897,7 @@ st.push(end, style); }, lineClasses, - forceToEnd + forceToEnd, ); // Run overlays, adjust style array. @@ -8927,7 +8930,7 @@ } } }, - lineClasses + lineClasses, ); } @@ -8946,7 +8949,7 @@ line, line.text.length > cm.options.maxHighlightLength ? copyState(cm.doc.mode, state) - : state + : state, ); line.stateAfter = state; line.styles = result.styles; @@ -8997,7 +9000,7 @@ "span", null, null, - webkit ? "padding-right: .1px" : null + webkit ? "padding-right: .1px" : null, ); var builder = { pre: elt("pre", [content], "CodeMirror-line"), @@ -9025,18 +9028,18 @@ insertLineContent( line, builder, - getLineStyles(cm, line, allowFrontierUpdate) + getLineStyles(cm, line, allowFrontierUpdate), ); if (line.styleClasses) { if (line.styleClasses.bgClass) builder.bgClass = joinClasses( line.styleClasses.bgClass, - builder.bgClass || "" + builder.bgClass || "", ); if (line.styleClasses.textClass) builder.textClass = joinClasses( line.styleClasses.textClass, - builder.textClass || "" + builder.textClass || "", ); } @@ -9045,7 +9048,7 @@ builder.map.push( 0, 0, - builder.content.appendChild(zeroWidthElement(cm.display.measure)) + builder.content.appendChild(zeroWidthElement(cm.display.measure)), ); // Store the map and a cache object for the current logical line @@ -9054,7 +9057,7 @@ lineView.measure.cache = {}; } else { (lineView.measure.maps || (lineView.measure.maps = [])).push( - builder.map + builder.map, ); (lineView.measure.caches || (lineView.measure.caches = [])).push({}); } @@ -9068,7 +9071,7 @@ if (builder.pre.className) builder.textClass = joinClasses( builder.pre.className, - builder.textClass || "" + builder.textClass || "", ); return builder; @@ -9105,7 +9108,7 @@ var skipped = m ? m.index - pos : text.length - pos; if (skipped) { var txt = document.createTextNode( - displayText.slice(pos, pos + skipped) + displayText.slice(pos, pos + skipped), ); if (ie && ie_version < 9) content.appendChild(elt("span", [txt])); else content.appendChild(txt); @@ -9119,14 +9122,14 @@ var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - (builder.col % tabSize); var txt = content.appendChild( - elt("span", spaceStr(tabWidth), "cm-tab") + elt("span", spaceStr(tabWidth), "cm-tab"), ); txt.setAttribute("role", "presentation"); txt.setAttribute("cm-text", "\t"); builder.col += tabWidth; } else if (m[0] == "\r" || m[0] == "\n") { var txt = content.appendChild( - elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar") + elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar"), ); txt.setAttribute("cm-text", m[0]); builder.col += 1; @@ -9181,7 +9184,7 @@ startStyle, null, title, - css + css, ); startStyle = null; text = text.slice(part.to - start); @@ -9216,7 +9219,7 @@ builder.addToken( builder, allText.slice(at, (at = styles[i])), - interpretTokenStyle(styles[i + 1], builder.cm.options) + interpretTokenStyle(styles[i + 1], builder.cm.options), ); return; } @@ -9276,7 +9279,7 @@ builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos, collapsed.marker, - collapsed.from == null + collapsed.from == null, ); if (collapsed.to == null) return; if (collapsed.to == pos) collapsed = false; @@ -9300,7 +9303,7 @@ spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", title, - css + css, ); } if (end >= upto) { @@ -9373,7 +9376,7 @@ firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), - lastSpans + lastSpans, ); } else { var added = linesFor(1, text.length - 1); @@ -9381,13 +9384,13 @@ new Line( lastText + firstLine.text.slice(to.ch), lastSpans, - estimateHeight - ) + estimateHeight, + ), ); update( firstLine, firstLine.text.slice(0, from.ch) + text[0], - spansFor(0) + spansFor(0), ); doc.insert(from.line + 1, added); } @@ -9395,14 +9398,14 @@ update( firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), - spansFor(0) + spansFor(0), ); doc.remove(from.line + 1, nlines); } else { update( firstLine, firstLine.text.slice(0, from.ch) + text[0], - spansFor(0) + spansFor(0), ); update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans); var added = linesFor(1, text.length - 1); @@ -9647,7 +9650,7 @@ origin: "setValue", full: true, }, - true + true, ); setSelection(this, simpleSelection(top)); }), @@ -9715,7 +9718,7 @@ this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, - options + options, ); }), setSelection: docMethodOp(function (anchor, head, options) { @@ -9723,7 +9726,7 @@ this, clipPos(this, anchor), clipPos(this, head || anchor), - options + options, ); }), extendSelection: docMethodOp(function (head, other, options) { @@ -9731,7 +9734,7 @@ this, clipPos(this, head), other && clipPos(this, other), - options + options, ); }), extendSelections: docMethodOp(function (heads, options) { @@ -9745,7 +9748,7 @@ for (var i = 0, out = []; i < ranges.length; i++) out[i] = new Range( clipPos(this, ranges[i].anchor), - clipPos(this, ranges[i].head) + clipPos(this, ranges[i].head), ); if (primary == null) primary = Math.min(ranges.length - 1, this.sel.primIndex); @@ -9754,12 +9757,12 @@ addSelection: docMethodOp(function (anchor, head, options) { var ranges = this.sel.ranges.slice(0); ranges.push( - new Range(clipPos(this, anchor), clipPos(this, head || anchor)) + new Range(clipPos(this, anchor), clipPos(this, head || anchor)), ); setSelection( this, normalizeSelection(ranges, ranges.length - 1), - options + options, ); }), @@ -9888,7 +9891,7 @@ else if (classTest(cls).test(line[prop])) return false; else line[prop] += " " + cls; return true; - } + }, ); }), removeLineClass: docMethodOp(function (handle, where, cls) { @@ -9918,7 +9921,7 @@ cur.slice(end) || null; } return true; - } + }, ); }), @@ -9935,7 +9938,7 @@ clipPos(this, from), clipPos(this, to), options, - "range" + "range", ); }, setBookmark: function (pos, options) { @@ -10029,7 +10032,7 @@ getLines(this, this.first, this.first + this.size), this.modeOption, this.first, - this.lineSep + this.lineSep, ); doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft; @@ -10052,7 +10055,7 @@ getLines(this, from, to), options.mode || this.modeOption, from, - this.lineSep + this.lineSep, ); if (options.sharedHist) copy.history = this.history; (this.linked || (this.linked = [])).push({ @@ -10084,7 +10087,7 @@ function (doc) { splitIds.push(doc.id); }, - true + true, ); other.history = new History(null); other.history.done = copyHistoryArray(this.history.done, splitIds); @@ -10161,7 +10164,7 @@ n -= doc.first; if (n < 0 || n >= doc.size) throw new Error( - "There is no line " + (n + doc.first) + " in the document." + "There is no line " + (n + doc.first) + " in the document.", ); for (var chunk = doc; !chunk.lines; ) { for (var i = 0; ; ++i) { @@ -10310,7 +10313,7 @@ function (doc) { attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, - true + true, ); return histChange; } @@ -10452,7 +10455,7 @@ (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans; ++n; - } + }, ); } @@ -10484,7 +10487,7 @@ var event = events[i]; if (event.ranges) { copy.push( - instantiateSel ? Selection.prototype.deepCopy.call(event) : event + instantiateSel ? Selection.prototype.deepCopy.call(event) : event, ); continue; } @@ -10753,7 +10756,7 @@ end, tabSize, startIndex, - startValue + startValue, ) { if (end == null) { end = string.search(/[^\s\u00a0]/); @@ -11040,7 +11043,7 @@ var test = elt("span", "\u200b"); removeChildrenAndAdd( measure, - elt("span", [test, document.createTextNode("x")]) + elt("span", [test, document.createTextNode("x")]), ); if (measure.firstChild.offsetHeight != 0) zwspSupported = @@ -11054,7 +11057,7 @@ "span", "\u00a0", null, - "display: inline-block; width: 1px; margin-right: -1px" + "display: inline-block; width: 1px; margin-right: -1px", ); node.setAttribute("cm-text", ""); return node; @@ -11066,7 +11069,7 @@ if (badBidiRects != null) return badBidiRects; var txt = removeChildrenAndAdd( measure, - document.createTextNode("A\u062eA") + document.createTextNode("A\u062eA"), ); var r0 = range(txt, 0, 1).getBoundingClientRect(); if (!r0 || r0.left == r0.right) return false; // Safari returns null in some cases (#2780) @@ -11087,7 +11090,7 @@ if (nl == -1) nl = string.length; var line = string.slice( pos, - string.charAt(nl - 1) == "\r" ? nl - 1 : nl + string.charAt(nl - 1) == "\r" ? nl - 1 : nl, ); var rt = line.indexOf("\r"); if (rt != -1) { @@ -11220,7 +11223,7 @@ f( Math.max(part.from, from), Math.min(part.to, to), - part.level == 1 ? "rtl" : "ltr" + part.level == 1 ? "rtl" : "ltr", ); found = true; } diff --git a/docs/parinfer-tester/assets/parinfer-codemirror.js b/docs/parinfer-tester/assets/parinfer-codemirror.js index b1fd5ac..c67588e 100644 --- a/docs/parinfer-tester/assets/parinfer-codemirror.js +++ b/docs/parinfer-tester/assets/parinfer-codemirror.js @@ -75,7 +75,7 @@ mode + '" is invalid. ' + "Must be one of: " + - MODES.join(",") + MODES.join(","), ); } } @@ -85,7 +85,7 @@ if (!state) { throw error( "You must call parinferCodeMirror.init(cm) on a CodeMirror instance " + - "before you can use the rest of the API." + "before you can use the rest of the API.", ); } return state; @@ -141,7 +141,7 @@ error.extra.lineNo, error.extra.x, error.extra.x + 1, - CLASSNAME_ERROR + CLASSNAME_ERROR, ); } } @@ -158,7 +158,7 @@ trail.lineNo, trail.startX, trail.endX, - CLASSNAME_PARENTRAIL + CLASSNAME_PARENTRAIL, ); } } @@ -259,7 +259,7 @@ "", { line: lineNo, ch: x + delta }, { line: lineNo, ch: x }, - "+indent" + "+indent", ); } } @@ -333,7 +333,7 @@ paren.closer.lineNo, paren.closer.x, paren.closer.x + 1, - CLASSNAME_LOCUS_PAREN + CLASSNAME_LOCUS_PAREN, ); } hideParens(cm, paren.children); @@ -389,7 +389,7 @@ switch (layer.type) { case "guides": paper.path( - ["M", open.midx, open.bottom, "V", close.bottom].join(" ") + ["M", open.midx, open.bottom, "V", close.bottom].join(" "), ); break; case "locus": @@ -423,7 +423,7 @@ open.midx, "V", open.bottom, - ].join(" ") + ].join(" "), ); break; } diff --git a/docs/parinfer-tester/assets/parinfer.js b/docs/parinfer-tester/assets/parinfer.js index e8a0feb..7863aaa 100644 --- a/docs/parinfer-tester/assets/parinfer.js +++ b/docs/parinfer-tester/assets/parinfer.js @@ -480,7 +480,7 @@ result.lineNo, result.x, result.x + origCh.length, - ch + ch, ); result.indentDelta -= origCh.length - ch.length; } @@ -849,7 +849,7 @@ cursorX, cursorLine, result.parenTrail.startX, - result.lineNo + result.lineNo, ) && !isCursorInComment(result, cursorX, cursorLine) ); } @@ -862,7 +862,7 @@ var clamping = isCursorClampingParenTrail( result, result.cursorX, - result.cursorLine + result.cursorLine, ); if (clamping) { @@ -1107,7 +1107,7 @@ opener, result.parenTrail.lineNo, result.parenTrail.startX + i, - closeCh + closeCh, ); } } @@ -1118,7 +1118,7 @@ result.parenTrail.lineNo, result.parenTrail.startX, result.parenTrail.endX, - parens + parens, ); result.parenTrail.endX = result.parenTrail.startX + parens.length; rememberParenTrail(result); @@ -1161,7 +1161,7 @@ opener, result.parenTrail.lineNo, result.parenTrail.endX, - closeCh + closeCh, ); } @@ -1170,7 +1170,7 @@ result, result.parenTrail.lineNo, result.parenTrail.endX, - closeCh + closeCh, ); result.parenTrail.endX++; @@ -1346,7 +1346,7 @@ result.cursorX, result.cursorLine, result.x, - result.lineNo + result.lineNo, ) ) { resetParenTrail(result, result.lineNo, result.x); diff --git a/docs/parinfer-tester/index.html b/docs/parinfer-tester/index.html index 0716cfd..8aa6396 100644 --- a/docs/parinfer-tester/index.html +++ b/docs/parinfer-tester/index.html @@ -1,4 +1,4 @@ - + @@ -24,7 +24,7 @@ diff --git a/src/RecentFiles.ts b/src/RecentFiles.ts index d50c066..e1197a5 100644 --- a/src/RecentFiles.ts +++ b/src/RecentFiles.ts @@ -13,7 +13,7 @@ export class RecentFiles { if (editor?.document != undefined) { this.addFile(editor?.document.fileName); } - }) + }), ); } diff --git a/src/config/config.ts b/src/config/config.ts index 0cc91c5..84ffe05 100644 --- a/src/config/config.ts +++ b/src/config/config.ts @@ -19,15 +19,15 @@ export function getConfig() { typeSearcherPath: configOptions.get("typeSearcherPath"), jak1DecompConfigVersion: configOptions.get( "decompilerJak1ConfigVersion", - "ntsc_v1" + "ntsc_v1", ), jak2DecompConfigVersion: configOptions.get( "decompilerJak2ConfigVersion", - "ntsc_v1" + "ntsc_v1", ), colorsGoalGlobals: configOptions.get("colors.goal.entity.global"), colorsGoalStorageControl: configOptions.get( - "colors.goal.storage.control" + "colors.goal.storage.control", ), colorsGoalSymbols: configOptions.get("colors.goal.symbol"), colorsIRTypeAnalysis: configOptions.get("colors.ir.typeanalysis"), @@ -56,7 +56,7 @@ export async function updateEeManPagePath(path: string) { await userConfig.update( "opengoal.eeManPagePath", path, - vscode.ConfigurationTarget.Global + vscode.ConfigurationTarget.Global, ); } @@ -65,7 +65,7 @@ export async function updateVuManPagePath(path: string) { await userConfig.update( "opengoal.vuManPagePath", path, - vscode.ConfigurationTarget.Global + vscode.ConfigurationTarget.Global, ); } @@ -74,7 +74,7 @@ export async function updateDecompilerPath(path: string) { await userConfig.update( "opengoal.decompilerPath", path, - vscode.ConfigurationTarget.Global + vscode.ConfigurationTarget.Global, ); } @@ -83,7 +83,7 @@ export async function updateTypeSearcherPath(path: string) { await userConfig.update( "opengoal.typeSearcherPath", path, - vscode.ConfigurationTarget.Global + vscode.ConfigurationTarget.Global, ); } @@ -92,6 +92,6 @@ export async function updateOpengoalParinferMode(mode: string) { await userConfig.update( "opengoal.parinferMode", mode, - vscode.ConfigurationTarget.Global + vscode.ConfigurationTarget.Global, ); } diff --git a/src/config/user-settings.ts b/src/config/user-settings.ts index 0c036c2..606a0b2 100644 --- a/src/config/user-settings.ts +++ b/src/config/user-settings.ts @@ -35,7 +35,7 @@ export async function setVSIconAssociations() { // - NOTE this may break situations where a file type is being handled by another extension let currentIconAssociations: any = userConfig.get( - "vsicons.associations.files" + "vsicons.associations.files", ); if (currentIconAssociations === undefined) { currentIconAssociations = opengoalVSIconAssocs; @@ -64,11 +64,11 @@ export async function setVSIconAssociations() { await userConfig.update( "vsicons.associations.files", currentIconAssociations, - vscode.ConfigurationTarget.Global + vscode.ConfigurationTarget.Global, ); } catch (err) { getMainChannel().append( - `Failed to write icon configuration override - ${err}` + `Failed to write icon configuration override - ${err}`, ); } } @@ -267,7 +267,7 @@ export async function setTextmateColors() { const userConfig = vscode.workspace.getConfiguration(); const currentTokenColorCustomizations: any = userConfig.get( - "editor.tokenColorCustomizations" + "editor.tokenColorCustomizations", ); const opengoalTextMateRules = getTextMateRules(); @@ -302,7 +302,7 @@ export async function setTextmateColors() { await userConfig.update( "editor.tokenColorCustomizations", currentTokenColorCustomizations, - vscode.ConfigurationTarget.Global + vscode.ConfigurationTarget.Global, ); } catch (err) { getMainChannel().append(`Failed to write textmate rule override - ${err}`); diff --git a/src/context.ts b/src/context.ts index 9e7750f..c026848 100644 --- a/src/context.ts +++ b/src/context.ts @@ -36,7 +36,7 @@ export function getProjectRoot(): vscode.Uri { // if it's still undefined, throw an error if (projectRoot === undefined) { vscode.window.showErrorMessage( - "OpenGOAL - Unable to locate 'jak-project' workspace folder" + "OpenGOAL - Unable to locate 'jak-project' workspace folder", ); throw new Error("unable to locate 'jak-project' workspace folder"); } diff --git a/src/decomp/decomp-tools.ts b/src/decomp/decomp-tools.ts index 7cba10b..0696fbc 100644 --- a/src/decomp/decomp-tools.ts +++ b/src/decomp/decomp-tools.ts @@ -24,7 +24,7 @@ let fsWatcher: vscode.FileSystemWatcher | undefined; const decompStatusItem = vscode.window.createStatusBarItem( vscode.StatusBarAlignment.Left, - 0 + 0, ); enum DecompStatus { @@ -85,12 +85,12 @@ function getDecompilerConfig(gameName: GameName): string | undefined { if (gameName == GameName.Jak1) { decompConfigPath = vscode.Uri.joinPath( getProjectRoot(), - `decompiler/config/jak1/jak1_config.jsonc` + `decompiler/config/jak1/jak1_config.jsonc`, ).fsPath; } else if (gameName == GameName.Jak2) { decompConfigPath = vscode.Uri.joinPath( getProjectRoot(), - `decompiler/config/jak2/jak2_config.jsonc` + `decompiler/config/jak2/jak2_config.jsonc`, ).fsPath; } if (decompConfigPath === undefined || !existsSync(decompConfigPath)) { @@ -124,7 +124,7 @@ async function checkDecompilerPath(): Promise { const potentialPath = vscode.Uri.joinPath( getProjectRoot(), - defaultDecompPath() + defaultDecompPath(), ); if (existsSync(potentialPath.fsPath)) { decompilerPath = potentialPath.fsPath; @@ -137,7 +137,7 @@ async function checkDecompilerPath(): Promise { }); if (path === undefined || path.length == 0) { vscode.window.showErrorMessage( - "OpenGOAL - Aborting decompilation, you didn't provide a path to the executable" + "OpenGOAL - Aborting decompilation, you didn't provide a path to the executable", ); return undefined; } @@ -150,7 +150,7 @@ async function checkDecompilerPath(): Promise { async function decompFiles( decompConfig: string, gameName: GameName, - fileNames: string[] + fileNames: string[], ) { if (fileNames.length == 0) { return; @@ -186,7 +186,7 @@ async function decompFiles( } catch (error: any) { updateStatus(DecompStatus.Errored); channel.append( - `DECOMP ERROR:\nSTDOUT:\n${error.stdout}\nSTDERR:\n${error.stderr}` + `DECOMP ERROR:\nSTDOUT:\n${error.stdout}\nSTDERR:\n${error.stderr}`, ); } } @@ -198,7 +198,7 @@ async function getValidObjectNames(gameName: string) { "goal_src", gameName, "build", - "all_objs.json" + "all_objs.json", ); if (!existsSync(objsPath)) { return undefined; @@ -224,11 +224,11 @@ async function decompSpecificFile() { ["jak1", "jak2"], { title: "Game?", - } + }, ); if (gameNameSelection === undefined) { await vscode.window.showErrorMessage( - "OpenGOAL - can't decompile, didn't provide a game name" + "OpenGOAL - can't decompile, didn't provide a game name", ); return; } else { @@ -251,7 +251,7 @@ async function decompSpecificFile() { if (fileName === undefined) { await vscode.window.showErrorMessage( - "OpenGOAL - can't decompile, didn't provide an object name" + "OpenGOAL - can't decompile, didn't provide an object name", ); return; } @@ -260,7 +260,7 @@ async function decompSpecificFile() { const decompConfig = getDecompilerConfig(gameName); if (decompConfig === undefined) { await vscode.window.showErrorMessage( - `OpenGOAL - Can't decompile no ${gameName.toString} config selected` + `OpenGOAL - Can't decompile no ${gameName.toString} config selected`, ); return; } @@ -272,7 +272,7 @@ async function decompCurrentFile() { const editor = vscode.window.activeTextEditor; if (!editor || !editor.document === undefined) { await vscode.window.showErrorMessage( - "No active file open, can't decompile!" + "No active file open, can't decompile!", ); return; } @@ -280,7 +280,7 @@ async function decompCurrentFile() { let fileName = path.basename(editor.document.fileName); if (!fileName.match(/.*_ir2\.asm/)) { await vscode.window.showErrorMessage( - "Current file is not a valid IR2 file, can't decompile!" + "Current file is not a valid IR2 file, can't decompile!", ); return; } else { @@ -291,14 +291,14 @@ async function decompCurrentFile() { const gameName = determineGameFromPath(editor.document.uri); if (gameName === undefined) { await vscode.window.showErrorMessage( - "OpenGOAL - Can't decompile, couldn't determine game from file" + "OpenGOAL - Can't decompile, couldn't determine game from file", ); return; } const decompConfig = getDecompilerConfig(gameName); if (decompConfig === undefined) { await vscode.window.showErrorMessage( - `OpenGOAL - Can't decompile no ${gameName.toString} config selected` + `OpenGOAL - Can't decompile no ${gameName.toString} config selected`, ); return; } @@ -309,24 +309,24 @@ async function decompCurrentFile() { async function decompAllActiveFiles() { let jak1ObjectNames = truncateFileNameEndings( getFileNamesFromUris(getUrisFromTabs(/.*jak1\/.*_ir2\.asm/)), - "_ir2.asm" + "_ir2.asm", ); jak1ObjectNames = jak1ObjectNames.concat( truncateFileNameEndings( getFileNamesFromUris(getUrisFromTabs(/.*jak1\/.*_disasm\.gc/)), - "_disasm.gc" - ) + "_disasm.gc", + ), ); jak1ObjectNames = [...new Set(jak1ObjectNames)]; let jak2ObjectNames = truncateFileNameEndings( getFileNamesFromUris(getUrisFromTabs(/.*jak2\/.*_ir2\.asm/)), - "_ir2.asm" + "_ir2.asm", ); jak2ObjectNames = jak2ObjectNames.concat( truncateFileNameEndings( getFileNamesFromUris(getUrisFromTabs(/.*jak2\/.*_disasm\.gc/)), - "_disasm.gc" - ) + "_disasm.gc", + ), ); jak2ObjectNames = [...new Set(jak2ObjectNames)]; @@ -334,7 +334,7 @@ async function decompAllActiveFiles() { const jak1Config = getDecompilerConfig(GameName.Jak1); if (jak1Config === undefined) { await vscode.window.showErrorMessage( - "OpenGOAL - Can't decompile no Jak 1 config selected" + "OpenGOAL - Can't decompile no Jak 1 config selected", ); return; } @@ -345,7 +345,7 @@ async function decompAllActiveFiles() { const jak2Config = getDecompilerConfig(GameName.Jak2); if (jak2Config === undefined) { await vscode.window.showErrorMessage( - "OpenGOAL - Can't decompile no Jak 2 config selected" + "OpenGOAL - Can't decompile no Jak 2 config selected", ); return; } @@ -373,7 +373,7 @@ function openManPage() { function toggleAutoDecompilation() { if (fsWatcher === undefined) { fsWatcher = vscode.workspace.createFileSystemWatcher( - "**/decompiler/config/**/*.{jsonc,json,gc}" + "**/decompiler/config/**/*.{jsonc,json,gc}", ); fsWatcher.onDidChange((uri: vscode.Uri) => { decompAllActiveFiles(); @@ -396,7 +396,7 @@ async function updateSourceFile() { const editor = vscode.window.activeTextEditor; if (!editor || !editor.document === undefined) { await vscode.window.showErrorMessage( - "No active file open, can't decompile!" + "No active file open, can't decompile!", ); return; } @@ -427,7 +427,7 @@ async function updateSourceFile() { encoding: "utf8", cwd: getProjectRoot()?.fsPath, timeout: 20000, - } + }, ); updateStatus(DecompStatus.Idle); channel.append(stdout.toString()); @@ -438,7 +438,7 @@ async function updateReferenceTest() { const editor = vscode.window.activeTextEditor; if (!editor || !editor.document === undefined) { await vscode.window.showErrorMessage( - "No active file open, can't decompile!" + "No active file open, can't decompile!", ); return; } @@ -466,7 +466,7 @@ async function updateReferenceTest() { } const folderToSearch = vscode.Uri.joinPath( getProjectRoot(), - `goal_src/${gameName}` + `goal_src/${gameName}`, ); const files = await glob(`**/${fileName}.gc`, { cwd: folderToSearch.fsPath, @@ -480,8 +480,8 @@ async function updateReferenceTest() { getProjectRoot(), `test/decompiler/reference/${gameName}/${files[0].replace( ".gc", - "_REF.gc" - )}` + "_REF.gc", + )}`, ).fsPath; const decompContents = await fs.readFile(disasmFilePath, { @@ -499,7 +499,7 @@ export async function activateDecompTools() { // no color support :( - https://github.com/microsoft/vscode/issues/571 channel = vscode.window.createOutputChannel( "OpenGOAL Decompiler", - "opengoal-ir" + "opengoal-ir", ); toggleAutoDecompilation(); @@ -509,37 +509,37 @@ export async function activateDecompTools() { // Commands getExtensionContext().subscriptions.push( - vscode.commands.registerCommand("opengoal.decomp.openManPage", openManPage) + vscode.commands.registerCommand("opengoal.decomp.openManPage", openManPage), ); getExtensionContext().subscriptions.push( vscode.commands.registerCommand( "opengoal.decomp.decompileCurrentFile", - decompCurrentFile - ) + decompCurrentFile, + ), ); getExtensionContext().subscriptions.push( vscode.commands.registerCommand( "opengoal.decomp.decompileSpecificFile", - decompSpecificFile - ) + decompSpecificFile, + ), ); getExtensionContext().subscriptions.push( vscode.commands.registerCommand( "opengoal.decomp.toggleAutoDecompilation", - toggleAutoDecompilation - ) + toggleAutoDecompilation, + ), ); getExtensionContext().subscriptions.push( vscode.commands.registerCommand( "opengoal.decomp.updateSourceFile", - updateSourceFile - ) + updateSourceFile, + ), ); getExtensionContext().subscriptions.push( vscode.commands.registerCommand( "opengoal.decomp.updateReferenceTest", - updateReferenceTest - ) + updateReferenceTest, + ), ); activateDecompTypeSearcher(); diff --git a/src/decomp/man-page.ts b/src/decomp/man-page.ts index 9b88761..11f79ee 100644 --- a/src/decomp/man-page.ts +++ b/src/decomp/man-page.ts @@ -85,21 +85,21 @@ export async function open_in_pdf(mnemonic: string) { // Finally, open the PDF if (selected_option.type == "ee") { const path = vscode.Uri.parse( - `${config.eeManPagePath}#page=${selected_option.page}` + `${config.eeManPagePath}#page=${selected_option.page}`, ); vscode.commands.executeCommand( "vscode.openWith", path, - "pdf.opengoal.manpage" + "pdf.opengoal.manpage", ); } else if (selected_option.type == "vu") { const path = vscode.Uri.parse( - `${config.vuManPagePath}#page=${selected_option.page}` + `${config.vuManPagePath}#page=${selected_option.page}`, ); vscode.commands.executeCommand( "vscode.openWith", path, - "pdf.opengoal.manpage" + "pdf.opengoal.manpage", ); } } diff --git a/src/decomp/misc-tools.ts b/src/decomp/misc-tools.ts index 1dbb41e..e2e2c78 100644 --- a/src/decomp/misc-tools.ts +++ b/src/decomp/misc-tools.ts @@ -37,7 +37,7 @@ async function addToOffsets() { (match, key) => { console.log(`${match}-${key}`); return `${parseInt(key) + incAmount}`; - } + }, ); selectedText.replace(editor.selection, result); @@ -86,7 +86,7 @@ async function preserveBlock() { blockContent = content; selectedText.replace( editor.selection, - `;; +++${fileName}:${blockName}\n${content}\n;; ---${fileName}:${blockName}` + `;; +++${fileName}:${blockName}\n${content}\n;; ---${fileName}:${blockName}`, ); }); @@ -95,7 +95,7 @@ async function preserveBlock() { const projectRoot = getWorkspaceFolderByName("jak-project"); if (projectRoot === undefined) { vscode.window.showErrorMessage( - "OpenGOAL - Unable to locate 'jak-project' workspace folder" + "OpenGOAL - Unable to locate 'jak-project' workspace folder", ); return undefined; } @@ -112,7 +112,7 @@ async function preserveBlock() { // Otherwise, let's update it... await updateFileBeforeDecomp( gsrcPath, - `;; +++${blockName}\n${blockContent}\n;; ---${blockName}` + `;; +++${blockName}\n${blockContent}\n;; ---${blockName}`, ); } @@ -184,20 +184,20 @@ async function generateTypeFlags() { // :flag-assert #xcb036003d4 / #x9 0000 0010 let clipboardVal = ` :method-count-assert ${parseInt( methodCount.replace("0x", ""), - 16 + 16, )}\n`; clipboardVal += ` :size-assert #x${parseInt( flags.slice(-4), - 16 + 16, ).toString(16)} ;; ${parseInt(flags.slice(-4), 16)}\n`; clipboardVal += ` :flag-assert #x${parseInt( methodCount.replace("0x", ""), - 16 + 16, ).toString(16)}${flags}`; vscode.env.clipboard.writeText(clipboardVal); vscode.window.showInformationMessage( - "OpenGOAL - Type Flags Copied to Clipboard!" + "OpenGOAL - Type Flags Copied to Clipboard!", ); return; } @@ -215,7 +215,7 @@ async function genTypeFields() { ["basic", "structure"], { title: "Structure Type?", - } + }, ); if (structureTypeSelection === undefined) { return; @@ -421,7 +421,7 @@ async function genMethodStubs() { } if (foundType && line.includes("method-count-assert")) { parentTypeMethodCount = parseInt( - line.split("method-count-assert")[1].trim() + line.split("method-count-assert")[1].trim(), ); break; } @@ -441,43 +441,43 @@ export async function activateMiscDecompTools() { getExtensionContext().subscriptions.push( vscode.commands.registerCommand( "opengoal.decomp.misc.addToOffsets", - addToOffsets - ) + addToOffsets, + ), ); getExtensionContext().subscriptions.push( vscode.commands.registerCommand( "opengoal.decomp.misc.preserveBlock", - preserveBlock - ) + preserveBlock, + ), ); getExtensionContext().subscriptions.push( vscode.commands.registerCommand( "opengoal.decomp.misc.convertHexToDec", - convertHexToDec - ) + convertHexToDec, + ), ); getExtensionContext().subscriptions.push( vscode.commands.registerCommand( "opengoal.decomp.misc.convertDecToHex", - convertDecToHex - ) + convertDecToHex, + ), ); getExtensionContext().subscriptions.push( vscode.commands.registerCommand( "opengoal.decomp.misc.generateTypeFlags", - generateTypeFlags - ) + generateTypeFlags, + ), ); getExtensionContext().subscriptions.push( vscode.commands.registerCommand( "opengoal.decomp.misc.genTypeFields", - genTypeFields - ) + genTypeFields, + ), ); getExtensionContext().subscriptions.push( vscode.commands.registerCommand( "opengoal.decomp.misc.genMethodStubs", - genMethodStubs - ) + genMethodStubs, + ), ); } diff --git a/src/decomp/type-caster.ts b/src/decomp/type-caster.ts index ad26bac..91ecd7d 100644 --- a/src/decomp/type-caster.ts +++ b/src/decomp/type-caster.ts @@ -63,7 +63,7 @@ async function checkTypeSearcherPath(): Promise { const potentialPath = vscode.Uri.joinPath( getProjectRoot(), - defaultTypeSearcherPath() + defaultTypeSearcherPath(), ); if (existsSync(potentialPath.fsPath)) { typeSearcherPath = potentialPath.fsPath; @@ -92,7 +92,7 @@ export async function updateTypeCastSuggestions(gameName: GameName) { try { const jsonPath = vscode.Uri.joinPath( getExtensionContext().extensionUri, - `${gameName.toString()}-types.json` + `${gameName.toString()}-types.json`, ).fsPath; await execFileAsync( typeSearcherPath, @@ -101,7 +101,7 @@ export async function updateTypeCastSuggestions(gameName: GameName) { encoding: "utf8", cwd: getProjectRoot().fsPath, timeout: 500, - } + }, ); if (existsSync(jsonPath)) { const result = readFileSync(jsonPath, { encoding: "utf-8" }); @@ -135,7 +135,7 @@ async function applyLabelCast( objectName: string, labelRef: string, castToType: string, - pointerSize?: number + pointerSize?: number, ) { const configDir = await getDecompilerConfigDirectory(editor.document.uri); if (configDir === undefined) { @@ -173,7 +173,7 @@ async function applyLabelCast( async function validActiveFile(editor: vscode.TextEditor): Promise { if (!editor.document === undefined) { await vscode.window.showErrorMessage( - "No active file open, can't decompile!" + "No active file open, can't decompile!", ); return false; } @@ -181,7 +181,7 @@ async function validActiveFile(editor: vscode.TextEditor): Promise { const fileName = basename(editor.document.fileName); if (!fileName.match(/.*_ir2\.asm/)) { await vscode.window.showErrorMessage( - "Current file is not a valid IR2 file." + "Current file is not a valid IR2 file.", ); return false; } @@ -190,7 +190,7 @@ async function validActiveFile(editor: vscode.TextEditor): Promise { function generateCastSelectionItems( fullList: string[] | undefined, - recentList: string[] | undefined + recentList: string[] | undefined, ): vscode.QuickPickItem[] { const items: vscode.QuickPickItem[] = []; if (recentList !== undefined && recentList.length > 0) { @@ -222,7 +222,7 @@ function generateCastSelectionItems( }, { label: "__custom", - } + }, ); return items; } @@ -252,7 +252,7 @@ async function labelCastSelection() { // Get the stack index const labelRef = await getLabelReference( - editor.document.lineAt(editor.selection.start.line).text + editor.document.lineAt(editor.selection.start.line).text, ); if (labelRef === undefined) { return; @@ -268,7 +268,7 @@ async function labelCastSelection() { const items = generateCastSelectionItems( typeCastSuggestions.get(gameName), - recentLabelCasts.get(gameName) + recentLabelCasts.get(gameName), ); let castToType; if (items.length > 0) { @@ -311,7 +311,7 @@ async function labelCastSelection() { objectName, labelRef, castToType.trim(), - pointerSize + pointerSize, ); lastCastKind = CastKind.Label; @@ -333,7 +333,7 @@ async function applyStackCast( editor: vscode.TextEditor, funcName: string, stackOffset: number, - castToType: string + castToType: string, ) { const configDir = await getDecompilerConfigDirectory(editor.document.uri); if (configDir === undefined) { @@ -361,7 +361,7 @@ async function stackCastSelection() { // Get the relevant function/method name const funcName = await getFuncNameFromSelection( editor.document, - editor.selection + editor.selection, ); if (funcName === undefined) { return; @@ -369,7 +369,7 @@ async function stackCastSelection() { // Get the stack index const stackOffset = await getStackOffset( - editor.document.lineAt(editor.selection.start.line).text + editor.document.lineAt(editor.selection.start.line).text, ); if (stackOffset === undefined) { return; @@ -385,7 +385,7 @@ async function stackCastSelection() { const items = generateCastSelectionItems( typeCastSuggestions.get(gameName), - recentStackCasts.get(gameName) + recentStackCasts.get(gameName), ); let castToType; if (items.length > 0) { @@ -420,7 +420,7 @@ async function stackCastSelection() { function getRegisters( document: vscode.TextDocument, - selection: vscode.Selection + selection: vscode.Selection, ): string[] { const regSet = new Set(); for (let i = selection.start.line; i <= selection.end.line; i++) { @@ -436,7 +436,7 @@ async function applyTypeCast( funcName: string, castContext: CastContext, registerSelection: string, - castToType: string + castToType: string, ) { const configDir = await getDecompilerConfigDirectory(editor.document.uri); if (configDir === undefined) { @@ -481,7 +481,7 @@ async function typeCastSelection() { // Determine the range of the selection const startOpNum = await getOpNumber( - editor.document.lineAt(editor.selection.start.line).text + editor.document.lineAt(editor.selection.start.line).text, ); if (startOpNum === undefined) { return; @@ -489,7 +489,7 @@ async function typeCastSelection() { const castContext = new CastContext(startOpNum); if (!editor.selection.isSingleLine) { const endOpNum = await getOpNumber( - editor.document.lineAt(editor.selection.end.line).text + editor.document.lineAt(editor.selection.end.line).text, ); if (endOpNum === undefined) { return; @@ -500,7 +500,7 @@ async function typeCastSelection() { // Get the relevant function/method name const funcName = await getFuncNameFromSelection( editor.document, - editor.selection + editor.selection, ); if (funcName === undefined) { return; @@ -510,7 +510,7 @@ async function typeCastSelection() { const registers = getRegisters(editor.document, editor.selection); if (registers.length == 0) { await vscode.window.showErrorMessage( - "Found no registers to cast in that selection" + "Found no registers to cast in that selection", ); return; } @@ -521,7 +521,7 @@ async function typeCastSelection() { }); if (registerSelection === undefined) { await vscode.window.showErrorMessage( - "Can't cast if no register is provided" + "Can't cast if no register is provided", ); return; } @@ -536,7 +536,7 @@ async function typeCastSelection() { const items = generateCastSelectionItems( typeCastSuggestions.get(gameName), - recentTypeCasts.get(gameName) + recentTypeCasts.get(gameName), ); let castToType; if (items.length > 0) { @@ -566,7 +566,7 @@ async function typeCastSelection() { funcName, castContext, registerSelection, - castToType.trim() + castToType.trim(), ); lastCastKind = CastKind.TypeCast; @@ -589,7 +589,7 @@ async function repeatLastCast() { if (lastCastKind === CastKind.Label) { const objectName = basename(editor.document.fileName).split("_ir2.asm")[0]; const labelRef = await getLabelReference( - editor.document.lineAt(editor.selection.start.line).text + editor.document.lineAt(editor.selection.start.line).text, ); if (labelRef === undefined || lastLabelCastType === undefined) { return; @@ -599,12 +599,12 @@ async function repeatLastCast() { objectName, labelRef, lastLabelCastType, - lastLabelCastSize + lastLabelCastSize, ); } else if (lastCastKind === CastKind.Stack) { const funcName = await getFuncNameFromSelection( editor.document, - editor.selection + editor.selection, ); if (funcName === undefined) { return; @@ -612,7 +612,7 @@ async function repeatLastCast() { // Get the stack index const stackOffset = await getStackOffset( - editor.document.lineAt(editor.selection.start.line).text + editor.document.lineAt(editor.selection.start.line).text, ); if (stackOffset === undefined || lastStackCastType === undefined) { return; @@ -621,13 +621,13 @@ async function repeatLastCast() { } else if (lastCastKind === CastKind.TypeCast) { const funcName = await getFuncNameFromSelection( editor.document, - editor.selection + editor.selection, ); if (funcName === undefined) { return; } const startOpNum = await getOpNumber( - editor.document.lineAt(editor.selection.start.line).text + editor.document.lineAt(editor.selection.start.line).text, ); if (startOpNum === undefined) { return; @@ -635,7 +635,7 @@ async function repeatLastCast() { const castContext = new CastContext(startOpNum); if (!editor.selection.isSingleLine) { const endOpNum = await getOpNumber( - editor.document.lineAt(editor.selection.end.line).text + editor.document.lineAt(editor.selection.end.line).text, ); if (endOpNum === undefined) { return; @@ -652,7 +652,7 @@ async function repeatLastCast() { funcName, castContext, lastTypeCastRegister, - lastTypeCastType + lastTypeCastType, ); } } @@ -661,25 +661,25 @@ export async function activateTypeCastTools() { getExtensionContext().subscriptions.push( vscode.commands.registerCommand( "opengoal.decomp.casts.labelCastSelection", - labelCastSelection - ) + labelCastSelection, + ), ); getExtensionContext().subscriptions.push( vscode.commands.registerCommand( "opengoal.decomp.casts.stackCastSelection", - stackCastSelection - ) + stackCastSelection, + ), ); getExtensionContext().subscriptions.push( vscode.commands.registerCommand( "opengoal.decomp.casts.typeCastSelection", - typeCastSelection - ) + typeCastSelection, + ), ); getExtensionContext().subscriptions.push( vscode.commands.registerCommand( "opengoal.decomp.casts.repeatLast", - repeatLastCast - ) + repeatLastCast, + ), ); } diff --git a/src/decomp/type-searcher/type-searcher.ts b/src/decomp/type-searcher/type-searcher.ts index c2593c4..4713dc0 100644 --- a/src/decomp/type-searcher/type-searcher.ts +++ b/src/decomp/type-searcher/type-searcher.ts @@ -237,24 +237,24 @@ async function searchForTypes(message: any): Promise { projectRoot = getWorkspaceFolderByName("jak-project"); if (projectRoot === undefined) { vscode.window.showErrorMessage( - "OpenGOAL - Unable to locate 'jak-project' workspace folder" + "OpenGOAL - Unable to locate 'jak-project' workspace folder", ); return []; } } const typeSearcherPath = vscode.Uri.joinPath( projectRoot, - defaultTypeSearcherPath() + defaultTypeSearcherPath(), ); if (!existsSync(typeSearcherPath.fsPath)) { vscode.window.showErrorMessage( - "OpenGOAL - Unable to locate 'type_searcher' binary" + "OpenGOAL - Unable to locate 'type_searcher' binary", ); } const searchFile = vscode.Uri.joinPath( projectRoot, - "search-results.json" + "search-results.json", ).fsPath; const args = [`--output-path`, searchFile, "--game", message.gameName]; @@ -298,7 +298,7 @@ async function searchForTypes(message: any): Promise { encoding: "utf8", cwd: projectRoot?.fsPath, timeout: 20000, - } + }, ); // Parse the file const result = readFileSync(searchFile, { encoding: "utf-8" }); @@ -324,7 +324,7 @@ async function openPanel() { { enableScripts: true, retainContextWhenHidden: true, - } + }, ); currentPanel.webview.html = getWebviewContent(); @@ -342,7 +342,7 @@ async function openPanel() { } }, undefined, - getExtensionContext().subscriptions + getExtensionContext().subscriptions, ); } @@ -351,7 +351,7 @@ export async function activateDecompTypeSearcher() { getExtensionContext().subscriptions.push( vscode.commands.registerCommand( "opengoal.decomp.typeSearcher.open", - openPanel - ) + openPanel, + ), ); } diff --git a/src/decomp/utils.ts b/src/decomp/utils.ts index 66f564a..57f16ee 100644 --- a/src/decomp/utils.ts +++ b/src/decomp/utils.ts @@ -14,7 +14,7 @@ import { getWorkspaceFolderByName } from "../utils/workspace"; export function getCastFileData( projectRoot: vscode.Uri, document: vscode.TextDocument, - fileName: string + fileName: string, ): any | undefined { const gameName = determineGameFromPath(document.uri); if (gameName === undefined) { @@ -25,12 +25,12 @@ export function getCastFileData( if (gameName == GameName.Jak1) { castFilePath = vscode.Uri.joinPath( projectRoot, - `decompiler/config/jak1/${config.jak2DecompConfigVersion}/${fileName}` + `decompiler/config/jak1/${config.jak2DecompConfigVersion}/${fileName}`, ).fsPath; } else if (gameName == GameName.Jak2) { castFilePath = vscode.Uri.joinPath( projectRoot, - `decompiler/config/jak2/${config.jak2DecompConfigVersion}/${fileName}` + `decompiler/config/jak2/${config.jak2DecompConfigVersion}/${fileName}`, ).fsPath; } if (!existsSync(castFilePath)) { @@ -41,12 +41,12 @@ export function getCastFileData( } export function getDecompilerConfigDirectory( - activeFile: vscode.Uri + activeFile: vscode.Uri, ): string | undefined { const projectRoot = getWorkspaceFolderByName("jak-project"); if (projectRoot === undefined) { vscode.window.showErrorMessage( - "OpenGOAL - Unable to locate 'jak-project' workspace folder" + "OpenGOAL - Unable to locate 'jak-project' workspace folder", ); return undefined; } @@ -57,13 +57,13 @@ export function getDecompilerConfigDirectory( decompConfigPath = vscode.Uri.joinPath( projectRoot, `decompiler/config/jak1/`, - getConfig().jak1DecompConfigVersion + getConfig().jak1DecompConfigVersion, ).fsPath; } else if (gameName == GameName.Jak2) { decompConfigPath = vscode.Uri.joinPath( projectRoot, `decompiler/config/jak2/`, - getConfig().jak1DecompConfigVersion + getConfig().jak1DecompConfigVersion, ).fsPath; } if (decompConfigPath === undefined || !existsSync(decompConfigPath)) { @@ -78,7 +78,7 @@ export async function updateVarCasts( funcName: string, argMeta: ArgumentMeta | undefined, currSymbol: string, - newName: string + newName: string, ) { // If the user provides a name with a space and an extra word, interpret that as the variable type let varType = undefined; @@ -91,7 +91,7 @@ export async function updateVarCasts( const projectRoot = getWorkspaceFolderByName("jak-project"); if (projectRoot === undefined) { vscode.window.showErrorMessage( - "OpenGOAL - Unable to locate 'jak-project' workspace folder" + "OpenGOAL - Unable to locate 'jak-project' workspace folder", ); return; } @@ -113,7 +113,7 @@ export async function updateVarCasts( for (const argName of varNameData[funcName].args) { if (argName === newName) { vscode.window.showErrorMessage( - "OpenGOAL - Cannot cast different args to the same name, unsupported!" + "OpenGOAL - Cannot cast different args to the same name, unsupported!", ); return; } @@ -155,7 +155,7 @@ export async function updateVarCasts( value === newName) ) { vscode.window.showErrorMessage( - "OpenGOAL - Cannot cast different variables to the same name, unsupported!" + "OpenGOAL - Cannot cast different variables to the same name, unsupported!", ); return; } diff --git a/src/extension.ts b/src/extension.ts index cd2f3fb..945d0cd 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -39,7 +39,7 @@ export async function activate(context: vscode.ExtensionContext) { }); context.subscriptions.push( - vscode.commands.registerCommand("opengoal.switchFile", switchFile) + vscode.commands.registerCommand("opengoal.switchFile", switchFile), ); activateDecompTools(); @@ -48,7 +48,7 @@ export async function activate(context: vscode.ExtensionContext) { // Customized PDF Viewer const provider = new PdfCustomProvider( - vscode.Uri.file(context.extensionPath) + vscode.Uri.file(context.extensionPath), ); context.subscriptions.push( vscode.window.registerCustomEditorProvider( @@ -59,8 +59,8 @@ export async function activate(context: vscode.ExtensionContext) { enableFindWidget: false, // default retainContextWhenHidden: true, }, - } - ) + }, + ), ); // TODO - disposable stuff? @@ -68,24 +68,24 @@ export async function activate(context: vscode.ExtensionContext) { // Language Customizations vscode.languages.registerFoldingRangeProvider( { scheme: "file", language: "opengoal-ir" }, - new IRFoldingRangeProvider() + new IRFoldingRangeProvider(), ); vscode.languages.registerInlayHintsProvider( { scheme: "file", language: "opengoal-ir" }, - new IRInlayHintsProvider() + new IRInlayHintsProvider(), ); vscode.languages.registerRenameProvider( { scheme: "file", language: "opengoal", pattern: "**/*_disasm.gc" }, - new OpenGOALDisasmRenameProvider() + new OpenGOALDisasmRenameProvider(), ); vscode.languages.registerRenameProvider( { scheme: "file", language: "opengoal-ir" }, - new IRRenameProvider() + new IRRenameProvider(), ); vscode.languages.registerCompletionItemProvider( { scheme: "file", language: "opengoal-ir" }, new IRCompletionItemProvider(), - "@" // NOTE - can't use `"` without overriding a default setting https://github.com/microsoft/vscode/issues/131238#issuecomment-902519923 + "@", // NOTE - can't use `"` without overriding a default setting https://github.com/microsoft/vscode/issues/131238#issuecomment-902519923 ); // Start the LSP @@ -101,7 +101,7 @@ export async function activate(context: vscode.ExtensionContext) { vscode.workspace.onDidSaveTextDocument(nreplOnFileSaveHandler); } catch (err) { vscode.window.showErrorMessage( - "Failed to activate OpenGOAL extension, see logs for details" + "Failed to activate OpenGOAL extension, see logs for details", ); getMainChannel().append(`Failed to activate extension - ${err}`); } diff --git a/src/goal/parinfer/parinfer.ts b/src/goal/parinfer/parinfer.ts index b1267c1..516515f 100644 --- a/src/goal/parinfer/parinfer.ts +++ b/src/goal/parinfer/parinfer.ts @@ -19,7 +19,7 @@ function parinferRangeToVSCodeRange(parenTrail: any) { parenTrail.lineNo, parenTrail.startX, parenTrail.lineNo, - parenTrail.endX + parenTrail.endX, ); } @@ -74,7 +74,7 @@ let currentParinferMode = ParinferMode.DISABLED; const parinferStatusItem = vscode.window.createStatusBarItem( vscode.StatusBarAlignment.Left, - 0 + 0, ); function updateStatus() { @@ -125,7 +125,7 @@ function applyParinfer( editor: vscode.TextEditor, text: string, options: ParinferOptions, - mode: ParinferMode + mode: ParinferMode, ) { // console.log(`Options Before - ${JSON.stringify(options, null, 2)}`); let parinferResult: any; // TODO - make a type def for this @@ -154,18 +154,18 @@ function applyParinfer( { undoStopAfter: false, undoStopBefore: false, - } + }, ) .then(function (editWasApplied) { if (editWasApplied) { // set the new cursor position const newCursorPosition = new vscode.Position( parinferResult.cursorLine, - parinferResult.cursorX + parinferResult.cursorX, ); const nextCursor = new vscode.Selection( newCursorPosition, - newCursorPosition + newCursorPosition, ); editor.selection = nextCursor; updateParenTrails(editor, parinferResult.parenTrails); @@ -218,12 +218,12 @@ function processEventQueue() { activeEditor, selectionEvent.text, options, - currentParinferMode + currentParinferMode, ); } export function onChangeSelection( - event: vscode.TextEditorSelectionChangeEvent + event: vscode.TextEditorSelectionChangeEvent, ) { const editor = event.textEditor; @@ -262,7 +262,7 @@ function getTextFromRange(txt: string, range: vscode.Range, length: integer) { function convertChangeObjects( oldText: string, - changeEvent: vscode.TextDocumentContentChangeEvent + changeEvent: vscode.TextDocumentContentChangeEvent, ) { return { lineNo: changeEvent.range.start.line, @@ -270,7 +270,7 @@ function convertChangeObjects( oldText: getTextFromRange( oldText, changeEvent.range, - changeEvent.rangeLength + changeEvent.rangeLength, ), x: changeEvent.range.start.character, }; @@ -338,17 +338,17 @@ function showChangeModeMenu() { } export function registerParinferCommands( - context: vscode.ExtensionContext + context: vscode.ExtensionContext, ): void { changeParinferMode( - (getConfig().opengoalParinferMode as ParinferMode) ?? ParinferMode.DISABLED + (getConfig().opengoalParinferMode as ParinferMode) ?? ParinferMode.DISABLED, ); updateStatus(); parinferStatusItem.hide(); // TODO - consolidate menu https://github.com/rust-lang/rust-analyzer/blob/9c03aa1ac2e67051db83a85baf3cfee902e4dd84/editors/code/src/ctx.ts#L406 context.subscriptions.push( vscode.commands.registerCommand( "opengoal.parinfer.changeMode", - showChangeModeMenu - ) + showChangeModeMenu, + ), ); } diff --git a/src/languages/common/utils.ts b/src/languages/common/utils.ts index e1d732b..cd6e260 100644 --- a/src/languages/common/utils.ts +++ b/src/languages/common/utils.ts @@ -2,7 +2,7 @@ import * as vscode from "vscode"; export function getSymbolAtPosition( document: vscode.TextDocument, - position: vscode.Position + position: vscode.Position, ) { const symbolRange = document.getWordRangeAtPosition(position, /[^\s()]+/g); if (symbolRange === undefined) { diff --git a/src/languages/ir2/ir2-completions.ts b/src/languages/ir2/ir2-completions.ts index 4666614..a4d87d2 100644 --- a/src/languages/ir2/ir2-completions.ts +++ b/src/languages/ir2/ir2-completions.ts @@ -6,7 +6,7 @@ export class IRCompletionItemProvider implements vscode.CompletionItemProvider { document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken, - context: vscode.CompletionContext + context: vscode.CompletionContext, ): vscode.ProviderResult< vscode.CompletionItem[] | vscode.CompletionList > { @@ -29,7 +29,7 @@ export class IRCompletionItemProvider implements vscode.CompletionItemProvider { position.line, position.character - 1, position.line, - position.character + position.character, ); let docstring = `"something\n`; @@ -51,7 +51,7 @@ export class IRCompletionItemProvider implements vscode.CompletionItemProvider { resolveCompletionItem?( item: vscode.CompletionItem, - token: vscode.CancellationToken + token: vscode.CancellationToken, ): vscode.ProviderResult { throw new Error("Method not implemented."); } diff --git a/src/languages/ir2/ir2-folder.ts b/src/languages/ir2/ir2-folder.ts index 42082d0..7464454 100644 --- a/src/languages/ir2/ir2-folder.ts +++ b/src/languages/ir2/ir2-folder.ts @@ -29,8 +29,8 @@ export class IRFoldingRangeProvider implements vscode.FoldingRangeProvider { new vscode.FoldingRange( currFunctionStart, i - 1, - vscode.FoldingRangeKind.Region - ) + vscode.FoldingRangeKind.Region, + ), ); } } @@ -42,8 +42,8 @@ export class IRFoldingRangeProvider implements vscode.FoldingRangeProvider { new vscode.FoldingRange( currLabelStart, i - 1, - vscode.FoldingRangeKind.Region - ) + vscode.FoldingRangeKind.Region, + ), ); } currLabelStart = i; @@ -56,8 +56,8 @@ export class IRFoldingRangeProvider implements vscode.FoldingRangeProvider { new vscode.FoldingRange( currLabelStart, i - 1, - vscode.FoldingRangeKind.Region - ) + vscode.FoldingRangeKind.Region, + ), ); currLabelStart = -1; } @@ -68,8 +68,8 @@ export class IRFoldingRangeProvider implements vscode.FoldingRangeProvider { new vscode.FoldingRange( currBranchStart, i - 1, - vscode.FoldingRangeKind.Region - ) + vscode.FoldingRangeKind.Region, + ), ); } currBranchStart = i; @@ -82,8 +82,8 @@ export class IRFoldingRangeProvider implements vscode.FoldingRangeProvider { new vscode.FoldingRange( currBranchStart, i - 1, - vscode.FoldingRangeKind.Region - ) + vscode.FoldingRangeKind.Region, + ), ); currBranchStart = -1; } diff --git a/src/languages/ir2/ir2-inlay-hinter.ts b/src/languages/ir2/ir2-inlay-hinter.ts index fcc3fa2..01c2128 100644 --- a/src/languages/ir2/ir2-inlay-hinter.ts +++ b/src/languages/ir2/ir2-inlay-hinter.ts @@ -62,7 +62,7 @@ export class IRInlayHintsProvider implements vscode.InlayHintsProvider { public async provideInlayHints( document: vscode.TextDocument, range: vscode.Range, - token: vscode.CancellationToken + token: vscode.CancellationToken, ): Promise { // Check if the file has already been computed in the cache // We store the entire files hints in the cache and just return the ones that the range wants here @@ -97,7 +97,7 @@ export class IRInlayHintsProvider implements vscode.InlayHintsProvider { private async getAllPotentialStackValues( stackCastData: any, - stackOffset: number + stackOffset: number, ): Promise { // Consistently sort the values const values = []; @@ -112,7 +112,7 @@ export class IRInlayHintsProvider implements vscode.InlayHintsProvider { private async generateStackCastHints( stackCastData: any, lineNumber: number, - line: string + line: string, ): Promise { const hints = []; // If the line has an op number, we will care about it @@ -133,7 +133,7 @@ export class IRInlayHintsProvider implements vscode.InlayHintsProvider { ].map((a) => a.index); const hintLabel = await this.getAllPotentialStackValues( stackCastData, - stackOffset + stackOffset, ); for (const index of indexes) { if (index === undefined) { @@ -141,7 +141,7 @@ export class IRInlayHintsProvider implements vscode.InlayHintsProvider { } const newHint = new vscode.InlayHint( new vscode.Position(lineNumber, index + `sp, ${stackOffset}`.length), - `: ${hintLabel.join(" | ")}` + `: ${hintLabel.join(" | ")}`, ); newHint.paddingLeft = true; newHint.kind = vscode.InlayHintKind.Type; @@ -155,7 +155,7 @@ export class IRInlayHintsProvider implements vscode.InlayHintsProvider { private async getAllPotentialLabelValues( labelCastData: any, - labelRef: string + labelRef: string, ): Promise { // Consistently sort the values const values = []; @@ -174,7 +174,7 @@ export class IRInlayHintsProvider implements vscode.InlayHintsProvider { private async generateLabelCastHints( labelCastData: any, lineNumber: number, - line: string + line: string, ): Promise { const hints = []; // If the line has an op number, we will care about it @@ -191,11 +191,11 @@ export class IRInlayHintsProvider implements vscode.InlayHintsProvider { continue; } const indexes = [...line.matchAll(new RegExp(labelRef, "gi"))].map( - (a) => a.index + (a) => a.index, ); const hintLabel = await this.getAllPotentialLabelValues( labelCastData, - labelRef + labelRef, ); for (const index of indexes) { if (index === undefined) { @@ -203,7 +203,7 @@ export class IRInlayHintsProvider implements vscode.InlayHintsProvider { } const newHint = new vscode.InlayHint( new vscode.Position(lineNumber, index + `L${labelRef}`.length), - `: ${hintLabel.join(" | ")}` + `: ${hintLabel.join(" | ")}`, ); newHint.paddingLeft = true; newHint.kind = vscode.InlayHintKind.Type; @@ -218,7 +218,7 @@ export class IRInlayHintsProvider implements vscode.InlayHintsProvider { private async getAllPotentialTypeValues( typeCastData: any, opNumber: number, - register: string + register: string, ): Promise { // Consistently sort the values const values = []; @@ -241,7 +241,7 @@ export class IRInlayHintsProvider implements vscode.InlayHintsProvider { private async generateTypeCastHints( typeCastData: any, lineNumber: number, - line: string + line: string, ): Promise { const hints = []; // If the line has an op number, we will care about it @@ -268,12 +268,12 @@ export class IRInlayHintsProvider implements vscode.InlayHintsProvider { continue; } const indexes = [...line.matchAll(new RegExp(register, "gi"))].map( - (a) => a.index + (a) => a.index, ); const hintLabel = await this.getAllPotentialTypeValues( typeCastData, opNumber, - register + register, ); for (const index of indexes) { if (index === undefined) { @@ -281,7 +281,7 @@ export class IRInlayHintsProvider implements vscode.InlayHintsProvider { } const newHint = new vscode.InlayHint( new vscode.Position(lineNumber, index + register.length), - `: ${hintLabel.join(" | ")}` + `: ${hintLabel.join(" | ")}`, ); newHint.paddingLeft = true; newHint.kind = vscode.InlayHintKind.Type; @@ -295,12 +295,12 @@ export class IRInlayHintsProvider implements vscode.InlayHintsProvider { } private async computeHintsForDocument( - document: vscode.TextDocument + document: vscode.TextDocument, ): Promise { const projectRoot = getWorkspaceFolderByName("jak-project"); if (projectRoot === undefined) { vscode.window.showErrorMessage( - "OpenGOAL - Unable to locate 'jak-project' workspace folder" + "OpenGOAL - Unable to locate 'jak-project' workspace folder", ); return undefined; } @@ -308,19 +308,19 @@ export class IRInlayHintsProvider implements vscode.InlayHintsProvider { const labelCastData = getCastFileData( projectRoot, document, - "label_types.jsonc" + "label_types.jsonc", ); const stackCastData = getCastFileData( projectRoot, document, - "stack_structures.jsonc" + "stack_structures.jsonc", ); const typeCastData = getCastFileData( projectRoot, document, - "type_casts.jsonc" + "type_casts.jsonc", ); let funcName = undefined; @@ -331,7 +331,7 @@ export class IRInlayHintsProvider implements vscode.InlayHintsProvider { // Label casts are file-level, so the func name doesn't matter if (labelCastData !== undefined && fileName in labelCastData) { hints = hints.concat( - await this.generateLabelCastHints(labelCastData[fileName], i, line) + await this.generateLabelCastHints(labelCastData[fileName], i, line), ); } @@ -348,12 +348,12 @@ export class IRInlayHintsProvider implements vscode.InlayHintsProvider { // Collect any potential hints for this line if (typeCastData !== undefined && funcName in typeCastData) { hints = hints.concat( - await this.generateTypeCastHints(typeCastData[funcName], i, line) + await this.generateTypeCastHints(typeCastData[funcName], i, line), ); } if (stackCastData !== undefined && funcName in stackCastData) { hints = hints.concat( - await this.generateStackCastHints(stackCastData[funcName], i, line) + await this.generateStackCastHints(stackCastData[funcName], i, line), ); } } diff --git a/src/languages/ir2/ir2-renamer.ts b/src/languages/ir2/ir2-renamer.ts index 5e875f2..615b825 100644 --- a/src/languages/ir2/ir2-renamer.ts +++ b/src/languages/ir2/ir2-renamer.ts @@ -9,7 +9,7 @@ export class IRRenameProvider implements vscode.RenameProvider { document: vscode.TextDocument, position: vscode.Position, newName: string, - token: vscode.CancellationToken + token: vscode.CancellationToken, ): Promise { const symbol = getSymbolAtPosition(document, position); if (symbol === undefined) { diff --git a/src/languages/ir2/ir2-utils.ts b/src/languages/ir2/ir2-utils.ts index a089fe0..5afe491 100644 --- a/src/languages/ir2/ir2-utils.ts +++ b/src/languages/ir2/ir2-utils.ts @@ -4,7 +4,7 @@ import * as vscode from "vscode"; // This is somewhat guaranteed by the fact that this is how the embded syntax highlighting works export function insideGoalCodeInIR( document: vscode.TextDocument, - position: vscode.Position + position: vscode.Position, ): boolean { // Somewhat primitive, walk back until we find a `;;-*-OpenGOAL-Start-*-` before we find a `.function` let idx = position.line; @@ -23,7 +23,7 @@ export function insideGoalCodeInIR( export async function getFuncNameFromPosition( document: vscode.TextDocument, - position: vscode.Position + position: vscode.Position, ): Promise { const funcNameRegex = /; \.function (.*).*/g; for (let i = position.line; i >= 0; i--) { @@ -34,14 +34,14 @@ export async function getFuncNameFromPosition( } } await vscode.window.showErrorMessage( - "Couldn't determine function or method name" + "Couldn't determine function or method name", ); return undefined; } export async function getFuncNameFromSelection( document: vscode.TextDocument, - selection: vscode.Selection + selection: vscode.Selection, ): Promise { return await getFuncNameFromPosition(document, selection.start); } diff --git a/src/languages/opengoal/disasm/opengoal-disasm-renamer.ts b/src/languages/opengoal/disasm/opengoal-disasm-renamer.ts index c6e2be9..6bdf587 100644 --- a/src/languages/opengoal/disasm/opengoal-disasm-renamer.ts +++ b/src/languages/opengoal/disasm/opengoal-disasm-renamer.ts @@ -11,7 +11,7 @@ export class OpenGOALDisasmRenameProvider implements vscode.RenameProvider { document: vscode.TextDocument, position: vscode.Position, newName: string, - token: vscode.CancellationToken + token: vscode.CancellationToken, ): Promise { const symbol = getSymbolAtPosition(document, position); if (symbol === undefined) { diff --git a/src/languages/opengoal/opengoal-tools.ts b/src/languages/opengoal/opengoal-tools.ts index 8074fcb..ba64f31 100644 --- a/src/languages/opengoal/opengoal-tools.ts +++ b/src/languages/opengoal/opengoal-tools.ts @@ -12,7 +12,7 @@ export interface ArgumentDefinition { } export function getArgumentsInSignature( - signature: string + signature: string, ): ArgumentDefinition[] { const isArgument = signature.includes("defun") || @@ -50,7 +50,7 @@ export function getArgumentsInSignature( // TODO - likely doesn't work on states export function getSymbolsArgumentInfo( line: string, - symbol: string + symbol: string, ): ArgumentMeta | undefined { // TODO - 'new' method handling // If it's an argument, we have to figure out the index @@ -80,7 +80,7 @@ export function getSymbolsArgumentInfo( // Determines the name of the current function/method that we are in export function determineCurrentFunctionName( document: vscode.TextDocument, - position: vscode.Position + position: vscode.Position, ): string | undefined { for (let i = position.line; i > 0; i--) { const currLine = document.lineAt(i).text; diff --git a/src/lsp/download.ts b/src/lsp/download.ts index d5efd8d..bf49382 100644 --- a/src/lsp/download.ts +++ b/src/lsp/download.ts @@ -5,7 +5,7 @@ import { downloadFromUrl } from "../utils/download"; export async function downloadLsp( extensionPath: string, - version: string + version: string, ): Promise { const assetName = getLspReleaseAssetName(version); if (assetName === undefined) { diff --git a/src/lsp/main.ts b/src/lsp/main.ts index 34b0f65..ed31292 100644 --- a/src/lsp/main.ts +++ b/src/lsp/main.ts @@ -90,12 +90,12 @@ class LSPStatusItem { } const statusItem = new LSPStatusItem( - vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 0) + vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 0), ); async function ensureServerDownloaded(): Promise { const installedVersion = getVersionFromMetaFile( - extensionContext.extensionPath + extensionContext.extensionPath, ); const configuredVersion = getConfig().opengoalLspVersion; @@ -116,7 +116,7 @@ async function ensureServerDownloaded(): Promise { // Check that the file wasn't unexpectedly removed const lspPath = getLspPath( extensionContext.extensionPath, - installedVersion + installedVersion, ); if (lspPath === undefined) { versionToDownload = latestVersion; @@ -130,7 +130,7 @@ async function ensureServerDownloaded(): Promise { statusItem.updateStatus("downloading", versionToDownload); const newLspPath = await downloadLsp( extensionContext.extensionPath, - versionToDownload + versionToDownload, ); if (newLspPath === undefined) { statusItem.updateStatus("error"); @@ -149,7 +149,7 @@ async function maybeDownloadLspServer(): Promise { // Copy the binary to the extension directory so it doesn't block future compilations const lspPath = path.join( extensionContext.extensionPath, - `opengoal-lsp-local.bin` + `opengoal-lsp-local.bin`, ); fs.copyFileSync(userConfiguredOpengoalLspPath, lspPath); opengoalLspPath = lspPath; @@ -202,7 +202,7 @@ function createClient(lspPath: string): LanguageClient { "opengoal-lsp", "OpenGOAL LSP", serverOptions, - clientOptions + clientOptions, ); } @@ -255,7 +255,7 @@ class StatusBarFeature implements StaticFeature { disposeAll(this.requestHandlers); } }); - }) + }), ); } } @@ -300,7 +300,7 @@ async function restartClient() { function showMenu( items: vscode.QuickPickItem[], - commands: Record + commands: Record, ) { void vscode.window .showQuickPick(items, { title: "OpenGOAL LSP" }) @@ -336,24 +336,24 @@ function startedMenuCommand() { function registerLifeCycleCommands(context: vscode.ExtensionContext): void { context.subscriptions.push( - vscode.commands.registerCommand("opengoal.lsp.start", startClientCommand) + vscode.commands.registerCommand("opengoal.lsp.start", startClientCommand), ); context.subscriptions.push( - vscode.commands.registerCommand("opengoal.lsp.stop", stopClient) + vscode.commands.registerCommand("opengoal.lsp.stop", stopClient), ); context.subscriptions.push( - vscode.commands.registerCommand("opengoal.lsp.restart", restartClient) + vscode.commands.registerCommand("opengoal.lsp.restart", restartClient), ); context.subscriptions.push( vscode.commands.registerCommand( "opengoal.lsp.showLspStartedMenu", - startedMenuCommand - ) + startedMenuCommand, + ), ); } export async function activate( - context: vscode.ExtensionContext + context: vscode.ExtensionContext, ): Promise { extensionContext = context; registerLifeCycleCommands(context); diff --git a/src/lsp/util.ts b/src/lsp/util.ts index 27aba61..78ee95b 100644 --- a/src/lsp/util.ts +++ b/src/lsp/util.ts @@ -13,7 +13,7 @@ const versionFileName = "lsp-metadata.json"; export function getLspReleaseAssetName( version: string, - platform: string = process.platform + platform: string = process.platform, ): string | undefined { if (!(platform in artifactNameTemplates)) { console.log(`Unsupported platform '${platform}'`); @@ -31,7 +31,7 @@ export function getLspReleaseAssetName( export async function getLatestVersion(): Promise { try { const releasesJSON = await fetchFromUrl( - "https://api.github.com/repos/open-goal/jak-project/releases" + "https://api.github.com/repos/open-goal/jak-project/releases", ); const releases = JSON.parse(releasesJSON); return releases[0].tag_name; @@ -42,7 +42,7 @@ export async function getLatestVersion(): Promise { export function getLspPath( extensionPath: string, - version: string + version: string, ): string | undefined { const lspName = getLspReleaseAssetName(version); if (lspName === undefined) { @@ -73,7 +73,7 @@ export function writeLspMetadata(extensionPath: string, version: string): void { filePath, JSON.stringify({ version: version, - }) + }), ); } catch (e: any) { console.log("Could not write lsp metadata file.", e.message); diff --git a/src/tools/opengoal/nrepl/opengoal-nrepl.ts b/src/tools/opengoal/nrepl/opengoal-nrepl.ts index 6241a77..95af744 100644 --- a/src/tools/opengoal/nrepl/opengoal-nrepl.ts +++ b/src/tools/opengoal/nrepl/opengoal-nrepl.ts @@ -9,7 +9,7 @@ let socket: PromiseSocket | undefined = undefined; const nreplStatusItem = vscode.window.createStatusBarItem( vscode.StatusBarAlignment.Left, - 0 + 0, ); function updateStatus() { @@ -95,7 +95,7 @@ export async function reloadFile(fileName: string) { export function registerNReplCommands(context: vscode.ExtensionContext): void { context.subscriptions.push( vscode.commands.registerCommand("opengoal.nrepl.jackin", jackIn), - vscode.commands.registerCommand("opengoal.nrepl.unjack", unJack) + vscode.commands.registerCommand("opengoal.nrepl.unjack", unJack), ); updateStatus(); nreplStatusItem.show(); diff --git a/src/utils/download.ts b/src/utils/download.ts index b32e589..268368d 100644 --- a/src/utils/download.ts +++ b/src/utils/download.ts @@ -21,7 +21,7 @@ export async function fetchFromUrl(fullUrl: string): Promise { res.on("end", () => { resolve(data); }); - } + }, ) .on("error", (err: any) => { console.error(`Error downloading file from ${url}: ${err.message}`); @@ -32,7 +32,7 @@ export async function fetchFromUrl(fullUrl: string): Promise { export async function downloadFromUrl( url: string, - filePath: string + filePath: string, ): Promise { console.log("Downloading file from", url); return new Promise((resolve, reject) => { diff --git a/src/utils/file-utils.ts b/src/utils/file-utils.ts index b34aa21..6e57226 100644 --- a/src/utils/file-utils.ts +++ b/src/utils/file-utils.ts @@ -56,7 +56,7 @@ export function determineGameFromPath(path: vscode.Uri): GameName | undefined { } export function determineGameFromAllTypes( - path: vscode.Uri + path: vscode.Uri, ): GameName | undefined { if (path.fsPath.includes("jak2")) { return GameName.Jak2; @@ -86,12 +86,12 @@ async function* walkForName(dir: string, name: string): any { export async function findFileInGoalSrc( rootFolder: vscode.Uri, gameName: string, - fileName: string + fileName: string, ): Promise { const searchFolder = vscode.Uri.joinPath( rootFolder, "goal_src", - gameName + gameName, ).fsPath; if (!fileName.includes(".gc")) { @@ -110,7 +110,7 @@ export async function findFileInGoalSrc( export async function updateFileBeforeDecomp( filePath: string, - content: string + content: string, ) { const fileContents = await fs.readFile(filePath, "utf-8"); const fileLines = fileContents.split(/\r?\n/); diff --git a/src/utils/workspace.ts b/src/utils/workspace.ts index dc543be..a47198d 100644 --- a/src/utils/workspace.ts +++ b/src/utils/workspace.ts @@ -24,7 +24,7 @@ export function getFileNamesFromUris(uris: vscode.Uri[]): string[] { export function truncateFileNameEndings( names: string[], - toRemove: string + toRemove: string, ): string[] { return names.map((name) => name.split(toRemove)[0]); } diff --git a/src/vendor/vscode-pdfviewer/pdfPreviewer.ts b/src/vendor/vscode-pdfviewer/pdfPreviewer.ts index 6389780..5489a7c 100644 --- a/src/vendor/vscode-pdfviewer/pdfPreviewer.ts +++ b/src/vendor/vscode-pdfviewer/pdfPreviewer.ts @@ -15,7 +15,7 @@ export class PdfPreview extends Disposable { constructor( private readonly extensionRoot: vscode.Uri, private readonly resource: vscode.Uri, - private readonly webviewEditor: vscode.WebviewPanel + private readonly webviewEditor: vscode.WebviewPanel, ) { super(); this.associatedUri = resource; @@ -36,42 +36,42 @@ export class PdfPreview extends Disposable { "vscode.openWith", resource, "default", - webviewEditor.viewColumn + webviewEditor.viewColumn, ); break; } } - }) + }), ); this._register( webviewEditor.onDidChangeViewState(() => { this.update(); - }) + }), ); this._register( webviewEditor.onDidDispose(() => { this._previewState = "Disposed"; - }) + }), ); const watcher = this._register( - vscode.workspace.createFileSystemWatcher(resource.fsPath) + vscode.workspace.createFileSystemWatcher(resource.fsPath), ); this._register( watcher.onDidChange((e) => { if (e.toString() === this.resource.toString()) { this.reload(); } - }) + }), ); this._register( watcher.onDidDelete((e) => { if (e.toString() === this.resource.toString()) { this.webviewEditor.dispose(); } - }) + }), ); this.webviewEditor.webview.html = this.getWebviewContents(); @@ -133,7 +133,7 @@ export class PdfPreview extends Disposable { PDF.js viewer diff --git a/src/vendor/vscode-pdfviewer/pdfProvider.ts b/src/vendor/vscode-pdfviewer/pdfProvider.ts index 9cb30df..20c53a6 100644 --- a/src/vendor/vscode-pdfviewer/pdfProvider.ts +++ b/src/vendor/vscode-pdfviewer/pdfProvider.ts @@ -16,12 +16,12 @@ export class PdfCustomProvider implements vscode.CustomReadonlyEditorProvider { public async resolveCustomEditor( document: vscode.CustomDocument, - webviewEditor: vscode.WebviewPanel + webviewEditor: vscode.WebviewPanel, ): Promise { const preview = new PdfPreview( this.extensionRoot, document.uri, - webviewEditor + webviewEditor, ); this._previews.set(document.uri, preview); this.setActivePreview(preview);