mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-26 11:56:21 +08:00
GP-1035: Python interpreter code completion now works prior to executing
any python statements
This commit is contained in:
@@ -332,7 +332,7 @@ public class GhidraPythonInterpreter extends InteractiveInterpreter {
|
||||
*
|
||||
* @param script The script whose class hierarchy is to be used for injection.
|
||||
*/
|
||||
private void injectScriptHierarchy(PythonScript script) {
|
||||
void injectScriptHierarchy(PythonScript script) {
|
||||
|
||||
if (script == null) {
|
||||
return;
|
||||
|
||||
@@ -226,8 +226,14 @@ public class PythonPlugin extends ProgramPlugin
|
||||
|
||||
// Setup the PythonScript describing the state of the interactive prompt.
|
||||
// This allows things like currentProgram and currentAddress to dynamically reflect
|
||||
// what's happening in the listing.
|
||||
// what's happening in the listing. Injecting the script hierarchy early here allows
|
||||
// code completion to work before commands are entered.
|
||||
interactiveScript = new PythonScript();
|
||||
interactiveScript.set(
|
||||
new GhidraState(tool, tool.getProject(), getCurrentProgram(), getProgramLocation(),
|
||||
getProgramSelection(), getProgramHighlight()),
|
||||
interactiveTaskMonitor, new PrintWriter(getConsole().getStdOut()));
|
||||
interpreter.injectScriptHierarchy(interactiveScript);
|
||||
interactiveTaskMonitor = new PythonInteractiveTaskMonitor(console.getStdOut());
|
||||
|
||||
// Start the input thread that receives python commands to execute.
|
||||
|
||||
Reference in New Issue
Block a user