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
This commit is contained in:
Tyler Wilding 2023-07-12 22:03:50 -06:00 committed by GitHub
parent 73d7d111ba
commit fe1d7db6bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 519 additions and 511 deletions

View file

@ -8,3 +8,7 @@ updates:
directory: "/"
schedule:
interval: "weekly"
groups:
frontend-dependencies:
patterns:
- "*"

View file

@ -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)

File diff suppressed because it is too large Load diff

View file

@ -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;
}

View file

@ -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);

View file

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
@ -24,7 +24,7 @@
<script src="./assets/parinfer-codemirror.js"></script>
<script>
var myCodeMirror = CodeMirror.fromTextArea(
document.getElementById("code-indent")
document.getElementById("code-indent"),
);
parinferCodeMirror.init(myCodeMirror);
</script>

View file

@ -13,7 +13,7 @@ export class RecentFiles {
if (editor?.document != undefined) {
this.addFile(editor?.document.fileName);
}
})
}),
);
}

View file

@ -19,15 +19,15 @@ export function getConfig() {
typeSearcherPath: configOptions.get<string>("typeSearcherPath"),
jak1DecompConfigVersion: configOptions.get<string>(
"decompilerJak1ConfigVersion",
"ntsc_v1"
"ntsc_v1",
),
jak2DecompConfigVersion: configOptions.get<string>(
"decompilerJak2ConfigVersion",
"ntsc_v1"
"ntsc_v1",
),
colorsGoalGlobals: configOptions.get<string>("colors.goal.entity.global"),
colorsGoalStorageControl: configOptions.get<string>(
"colors.goal.storage.control"
"colors.goal.storage.control",
),
colorsGoalSymbols: configOptions.get<string>("colors.goal.symbol"),
colorsIRTypeAnalysis: configOptions.get<string>("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,
);
}

View file

@ -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}`);

View file

@ -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");
}

View file

@ -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<string | undefined> {
const potentialPath = vscode.Uri.joinPath(
getProjectRoot(),
defaultDecompPath()
defaultDecompPath(),
);
if (existsSync(potentialPath.fsPath)) {
decompilerPath = potentialPath.fsPath;
@ -137,7 +137,7 @@ async function checkDecompilerPath(): Promise<string | undefined> {
});
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<string | undefined> {
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();

View file

@ -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",
);
}
}

View file

@ -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,
),
);
}

View file

@ -63,7 +63,7 @@ async function checkTypeSearcherPath(): Promise<string | undefined> {
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<boolean> {
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<boolean> {
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<boolean> {
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<string>();
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,
),
);
}

View file

@ -237,24 +237,24 @@ async function searchForTypes(message: any): Promise<any> {
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<any> {
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,
),
);
}

View file

@ -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;
}

View file

@ -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}`);
}

View file

@ -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,
),
);
}

View file

@ -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) {

View file

@ -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<vscode.CompletionItem>
> {
@ -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<vscode.CompletionItem> {
throw new Error("Method not implemented.");
}

View file

@ -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;
}

View file

@ -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<vscode.InlayHint[] | undefined> {
// 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<string[]> {
// 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<vscode.InlayHint[]> {
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<string[]> {
// 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<vscode.InlayHint[]> {
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<string[]> {
// 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<vscode.InlayHint[]> {
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<vscode.InlayHint[] | 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;
}
@ -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),
);
}
}

View file

@ -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<vscode.WorkspaceEdit | undefined> {
const symbol = getSymbolAtPosition(document, position);
if (symbol === undefined) {

View file

@ -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<string | undefined> {
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<string | undefined> {
return await getFuncNameFromPosition(document, selection.start);
}

View file

@ -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<vscode.WorkspaceEdit | undefined> {
const symbol = getSymbolAtPosition(document, position);
if (symbol === undefined) {

View file

@ -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;

View file

@ -5,7 +5,7 @@ import { downloadFromUrl } from "../utils/download";
export async function downloadLsp(
extensionPath: string,
version: string
version: string,
): Promise<string | undefined> {
const assetName = getLspReleaseAssetName(version);
if (assetName === undefined) {

View file

@ -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<string | undefined> {
const installedVersion = getVersionFromMetaFile(
extensionContext.extensionPath
extensionContext.extensionPath,
);
const configuredVersion = getConfig().opengoalLspVersion;
@ -116,7 +116,7 @@ async function ensureServerDownloaded(): Promise<string | undefined> {
// 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<string | undefined> {
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<void> {
// 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<string, string>
commands: Record<string, string>,
) {
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<void> {
extensionContext = context;
registerLifeCycleCommands(context);

View file

@ -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<string> {
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<string> {
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);

View file

@ -9,7 +9,7 @@ let socket: PromiseSocket<Socket> | 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();

View file

@ -21,7 +21,7 @@ export async function fetchFromUrl(fullUrl: string): Promise<string> {
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<string> {
export async function downloadFromUrl(
url: string,
filePath: string
filePath: string,
): Promise<void> {
console.log("Downloading file from", url);
return new Promise((resolve, reject) => {

View file

@ -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<string | undefined> {
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/);

View file

@ -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]);
}

View file

@ -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 {
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; connect-src ${cspSource}; script-src 'unsafe-inline' ${cspSource}; style-src 'unsafe-inline' ${cspSource}; img-src blob: data: ${cspSource};">
<meta id="pdf-preview-config" data-config="${escapeAttribute(
JSON.stringify(settings)
JSON.stringify(settings),
)}">
<title>PDF.js viewer</title>
<link rel="resource" type="application/l10n" href="${resolveAsUri(
@ -141,25 +141,25 @@ export class PdfPreview extends Disposable {
"pdfjs",
"web",
"locale",
"locale.properties"
"locale.properties",
)}">
<link rel="stylesheet" href="${resolveAsUri(
"lib",
"pdfjs",
"web",
"viewer.css"
"viewer.css",
)}">
<link rel="stylesheet" href="${resolveAsUri(
"lib",
"vscode-pdfviewer",
"pdf.css"
"pdf.css",
)}">
<script src="${resolveAsUri("lib", "pdfjs", "build", "pdf.js")}"></script>
<script src="${resolveAsUri(
"lib",
"pdfjs",
"build",
"pdf.worker.js"
"pdf.worker.js",
)}"></script>
<script src="${resolveAsUri("lib", "pdfjs", "web", "viewer.js")}"></script>
<script src="${resolveAsUri("lib", "vscode-pdfviewer", "main.js")}"></script>

View file

@ -16,12 +16,12 @@ export class PdfCustomProvider implements vscode.CustomReadonlyEditorProvider {
public async resolveCustomEditor(
document: vscode.CustomDocument,
webviewEditor: vscode.WebviewPanel
webviewEditor: vscode.WebviewPanel,
): Promise<void> {
const preview = new PdfPreview(
this.extensionRoot,
document.uri,
webviewEditor
webviewEditor,
);
this._previews.set(document.uri, preview);
this.setActivePreview(preview);