mirror of
https://github.com/open-goal/opengoal-vscode.git
synced 2024-10-19 20:47:37 -04:00
tool to apply decompiler suggestions on define-extern
s
This commit is contained in:
parent
381a18f3d7
commit
3119c06513
|
@ -131,6 +131,10 @@
|
|||
"command": "opengoal.decomp.misc.genMethodStubs",
|
||||
"title": "OpenGOAL - Misc - Generate Method Stubs"
|
||||
},
|
||||
{
|
||||
"command": "opengoal.decomp.misc.applyDecompilerSuggestions",
|
||||
"title": "OpenGOAL - Misc - Apply Decompiler Suggestions to Selection"
|
||||
},
|
||||
{
|
||||
"command": "opengoal.decomp.typeSearcher.open",
|
||||
"title": "OpenGOAL - Misc - Type Searcher"
|
||||
|
|
|
@ -439,6 +439,22 @@ async function genMethodStubs() {
|
|||
return;
|
||||
}
|
||||
|
||||
async function applyDecompilerSuggestions() {
|
||||
const editor = vscode.window.activeTextEditor;
|
||||
if (editor === undefined || editor.selection.isEmpty) {
|
||||
return;
|
||||
}
|
||||
|
||||
editor.edit((selectedText) => {
|
||||
const content = editor.document.getText(editor.selection);
|
||||
const result = content.replace(
|
||||
/\(define-extern (\S+) (\S+)\) ;; (.+)/g,
|
||||
"(define-extern $1 $3)",
|
||||
);
|
||||
selectedText.replace(editor.selection, result);
|
||||
});
|
||||
}
|
||||
|
||||
export async function activateMiscDecompTools() {
|
||||
getExtensionContext().subscriptions.push(
|
||||
vscode.commands.registerCommand(
|
||||
|
@ -482,4 +498,10 @@ export async function activateMiscDecompTools() {
|
|||
genMethodStubs,
|
||||
),
|
||||
);
|
||||
getExtensionContext().subscriptions.push(
|
||||
vscode.commands.registerCommand(
|
||||
"opengoal.decomp.misc.applyDecompilerSuggestions",
|
||||
applyDecompilerSuggestions,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue