mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
GP-1035: Python interpreter code completion now works prior to executing
any python statements
This commit is contained in:
parent
432e5252d6
commit
21d8d18134
2 changed files with 8 additions and 2 deletions
|
@ -332,7 +332,7 @@ public class GhidraPythonInterpreter extends InteractiveInterpreter {
|
||||||
*
|
*
|
||||||
* @param script The script whose class hierarchy is to be used for injection.
|
* @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) {
|
if (script == null) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -226,8 +226,14 @@ public class PythonPlugin extends ProgramPlugin
|
||||||
|
|
||||||
// Setup the PythonScript describing the state of the interactive prompt.
|
// Setup the PythonScript describing the state of the interactive prompt.
|
||||||
// This allows things like currentProgram and currentAddress to dynamically reflect
|
// 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 = 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());
|
interactiveTaskMonitor = new PythonInteractiveTaskMonitor(console.getStdOut());
|
||||||
|
|
||||||
// Start the input thread that receives python commands to execute.
|
// Start the input thread that receives python commands to execute.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue