public override string[] SuggestCodeCompletion(string code) { if (CanLoadInterpreter) { Value cmd = Eval.NewString(process, code); Eval.InvokeMethod(process, typeof(AbstractInterpreter), "SuggestCodeCompletion", interpreter, new Value[] { cmd }); return(null); } else { return(null); } }
bool InjectInterpreter() { if (!DebuggerService.IsDebuggerLoaded) { PrintLine(ResourceService.GetString("ICSharpCode.BooInterpreter.Debuggee.ErrorDebuggerNotLoaded")); return(false); } WindowsDebugger winDebugger = DebuggerService.CurrentDebugger as WindowsDebugger; if (winDebugger == null) { PrintLine(ResourceService.GetString("ICSharpCode.BooInterpreter.Debuggee.ErrorIncompatibleDebugger")); return(false); } if (winDebugger.DebuggedProcess == null) { PrintLine(ResourceService.GetString("ICSharpCode.BooInterpreter.Debuggee.ErrorNoProgramDebugged")); return(false); } process = winDebugger.DebuggedProcess; process.Expired += delegate { interpreter = null; }; process.LogMessage -= OnDebuggerLogMessage; process.LogMessage += OnDebuggerLogMessage; Value assembly; // Boo.Lang.Interpreter.dll string path = Path.Combine(Path.GetDirectoryName(typeof(InterpreterContext).Assembly.Location), "Boo.Lang.Interpreter.dll"); assembly = LoadAssembly(path); // Debugger.BooInterpreter.dll assembly = LoadAssembly(typeof(DebugeeInteractiveInterpreter).Assembly.Location); Value interpreterType = Eval.NewString(process, typeof(DebugeeInteractiveInterpreter).FullName); interpreter = Eval.InvokeMethod(process, typeof(Assembly), "CreateInstance", assembly, new Value[] { interpreterType }); interpreter_localVariable = interpreter.GetMember("localVariable"); RunCommand( "import System\n" + "import System.IO\n" + "import System.Text\n" + "interpreter.RememberLastValue = true\n" + "interpreter.Print = def(msg): System.Diagnostics.Debugger.Log(0xB00, \"DebugeeInterpreterContext.PrintLine\", msg)"); return(true); }
public void SetPrimitiveValue(Thread evalThread, object value) { if (this.Type.IsKnownType(KnownTypeCode.String)) { this.SetValue(evalThread, Eval.NewString(evalThread, value.ToString())); } else { if (!this.Type.IsPrimitiveType()) { throw new DebuggerException("Value is not a primitive type"); } if (value == null) { throw new DebuggerException("Can not set primitive value to null"); } CorGenericValue.SetValue(this.Type.GetDefinition().KnownTypeCode, value); } }