public OutputBuffer(ReplWindow window) { _maxSize = _initialMaxSize; _lock = new object(); _timer = new DispatcherTimer(); _timer.Tick += (sender, args) => Flush(); _timer.Interval = TimeSpan.FromMilliseconds(400); _window = window; ResetColors(); }
public PromptMargin(IWpfTextViewHost wpfTextViewHost, IEditorFormatMap editorFormatMap) { _textView = wpfTextViewHost.TextView; _editorFormatMap = editorFormatMap; _promptProvider = ReplWindow.FromBuffer(_textView.TextBuffer); _promptProvider.MarginVisibilityChanged += new Action(OnMarginVisibilityChanged); _visualManager = new PromptMarginVisualManager(this, editorFormatMap); _visualManager.MarginVisual.IsVisibleChanged += this.OnIsVisibleChanged; OnMarginVisibilityChanged(); }
public InteractiveWindow(string title, AutomationElement element, VisualStudioApp app) : base(null, element) { _app = app; _title = title; var compModel = _app.GetService<IComponentModel>(typeof(SComponentModel)); var replWindowProvider = compModel.GetService<IReplWindowProvider>(); _replWindow = replWindowProvider.GetReplWindows() .OfType<ReplWindow>() .FirstOrDefault(p => p.Title.Equals(title, StringComparison.CurrentCulture)); _replWindowInfo = _replWindows.GetValue(_replWindow, window => { var info = new ReplWindowInfo(); window.ReadyForInput += new Action(info.OnReadyForInput); return info; }); }
public RuntimeUnityEditorCore(MonoBehaviour pluginObject, ILoggerWrapper logger) { if (Instance != null) { throw new InvalidOperationException("Can only create one instance of the Core object"); } PluginObject = pluginObject; Logger = logger; Instance = this; Inspector = new Inspector.Inspector(targetTransform => TreeViewer.SelectAndShowObject(targetTransform)); TreeViewer = new ObjectTreeViewer(pluginObject); TreeViewer.InspectorOpenCallback = items => { Inspector.InspectorClear(); foreach (var stackEntry in items) { Inspector.InspectorPush(stackEntry); } }; if (Utils.UnityFeatureHelper.SupportsVectrosity) { GizmoDrawer = new GizmoDrawer(pluginObject); TreeViewer.TreeSelectionChangedCallback = transform => GizmoDrawer.UpdateState(transform); } if (Utils.UnityFeatureHelper.SupportsCursorIndex && Utils.UnityFeatureHelper.SupportsXml) { try { Repl = new ReplWindow(); } catch (Exception ex) { Logger.Log(LogLevel.Warning, "Failed to load REPL - " + ex.Message); } } }
public void WithStandardInputPrompt(string prompt, Action <string> action) { if ((bool)ReplWindow.GetOptionValue(ReplOptions.DisplayPromptInMargin)) { action(String.Empty); return; } string oldPrompt = (string)ReplWindow.GetOptionValue(ReplOptions.StandardInputPrompt); ReplWindow.SetOptionValue(ReplOptions.StandardInputPrompt, prompt); try { action(prompt); } finally { ReplWindow.SetOptionValue(ReplOptions.StandardInputPrompt, oldPrompt); } }
public InteractiveWindow(string title, AutomationElement element, VisualStudioApp app) : base(null, element) { _app = app; _title = title; var compModel = _app.GetService <IComponentModel>(typeof(SComponentModel)); var replWindowProvider = compModel.GetService <IReplWindowProvider>(); _replWindow = replWindowProvider.GetReplWindows() .OfType <ReplWindow>() .FirstOrDefault(p => p.Title.Equals(title, StringComparison.CurrentCulture)); _replWindowInfo = _replWindows.GetValue(_replWindow, window => { var info = new ReplWindowInfo(); window.ReadyForInput += new Action(info.OnReadyForInput); return(info); }); }
/// <summary> /// Standard constructor for the tool window. /// </summary> public VsReplWindow(IComponentModel /*!*/ model, IReplEvaluator /*!*/ evaluator, IContentType /*!*/ contentType, string /*!*/ title, Guid languageServiceGuid, Guid replGuid, int?id) : base(null) { if (id != null) { IronStudioPackage.Instance.SaveReplInfo(id.Value, evaluator, contentType, title, languageServiceGuid, replGuid); } _replWindow = new VsReplWindowImpl(model, this, evaluator, contentType, title); _guid = replGuid; _langSvcGuid = languageServiceGuid; // Set the window title reading it from the resources.z Caption = _replWindow.Title; // Set the image that will appear on the tab of the window frame // when docked with an other window // The resource ID correspond to the one defined in the resx file // while the Index is the offset in the bitmap strip. Each image in // the strip being 16x16. BitmapResourceID = 301; BitmapIndex = 1; }
protected void Awake() { Instance = this; DnSpyPath = new ConfigWrapper <string>(nameof(DnSpyPath), this); DnSpyPath.SettingChanged += (sender, args) => DnSpyHelper.DnSpyPath = DnSpyPath.Value; DnSpyHelper.DnSpyPath = DnSpyPath.Value; Inspector = new Inspector.Inspector(targetTransform => TreeViewer.SelectAndShowObject(targetTransform)); TreeViewer = new ObjectTreeViewer(items => { Inspector.InspectorClear(); foreach (var stackEntry in items) { Inspector.InspectorPush(stackEntry); } }); Repl = new ReplWindow(); DnSpyPath = new ConfigWrapper <string>(nameof(DnSpyPath), this); DnSpyPath.SettingChanged += (sender, args) => DnSpyHelper.DnSpyPath = DnSpyPath.Value; DnSpyHelper.DnSpyPath = DnSpyPath.Value; }
internal static void HandleReturn(ReplWindow buffer) { HandleReturn(buffer.CurrentView, buffer.Classifier); }
private static bool IsCaretInStringLiteral(ReplWindow buffer) { var caret = buffer.CurrentView.Caret; var spans = buffer.Classifier.GetClassificationSpans(buffer.CurrentView.GetTextElementSpan(caret.Position.BufferPosition)); if (spans.Count > 0) { return spans[0].ClassificationType.IsOfType(PredefinedClassificationTypeNames.String); } return false; }
private static string CurrentLine(ReplWindow buffer) { return CurrentLine(buffer.CurrentView); }
private ReplWindow CreateReplWindowInternal(IReplEvaluator evaluator, IContentType contentType, string[] roles, int id, string title, Guid languageServiceGuid, string replId) { var service = (IVsUIShell)ServiceProvider.GlobalProvider.GetService(typeof(SVsUIShell)); var model = (IComponentModel)ServiceProvider.GlobalProvider.GetService(typeof(SComponentModel)); SaveReplInfo(id, evaluator, contentType, roles, title, languageServiceGuid, replId); var replWindow = new ReplWindow(model, evaluator, contentType, roles, title, languageServiceGuid, replId); Guid clsId = replWindow.ToolClsid; Guid toolType = typeof(ReplWindow).GUID; Guid empty = Guid.Empty; IVsWindowFrame frame; // we don't pass __VSCREATETOOLWIN.CTW_fMultiInstance because multi instance panes are // destroyed when closed. We are really multi instance but we don't want to be closed. This // seems to work fine. var creationFlags = __VSCREATETOOLWIN.CTW_fInitNew; if (!roles.Contains("DontPersist")) { creationFlags |= __VSCREATETOOLWIN.CTW_fForceCreate; } ErrorHandler.ThrowOnFailure( service.CreateToolWindow( (uint)(creationFlags), (uint)id, replWindow.GetIVsWindowPane(), ref clsId, ref toolType, ref empty, null, title, null, out frame ) ); replWindow.Frame = frame; replWindow.OnToolBarAdded(); _windows[id] = replWindow; return replWindow; }
public void Reset() { Console.WriteLine("REPL resetting"); Assert.IsTrue(ReplWindow.Reset().Wait(10000)); }
public IGlyphFactory GetGlyphFactory(IWpfTextView /*!*/ view, IWpfTextViewMargin /*!*/ margin) { ReplWindow repl = ReplWindow.FromBuffer(view.TextBuffer); return((repl != null) ? new GlyphFactory(repl) : null); }
public GlyphFactory(ReplWindow /*!*/ promptProvider) { Contract.Assert(promptProvider != null); _promptProvider = promptProvider; }
/// <summary> /// Standard constructor for the tool window. /// </summary> public VsReplWindow(IComponentModel/*!*/ model, IReplEvaluator/*!*/ evaluator, IContentType/*!*/ contentType, string/*!*/ title, Guid languageServiceGuid, Guid replGuid, int? id) : base(null) { if (id != null) { IronStudioPackage.Instance.SaveReplInfo(id.Value, evaluator, contentType, title, languageServiceGuid, replGuid); } _replWindow = new VsReplWindowImpl(model, this, evaluator, contentType, title); _guid = replGuid; _langSvcGuid = languageServiceGuid; // Set the window title reading it from the resources.z Caption = _replWindow.Title; // Set the image that will appear on the tab of the window frame // when docked with an other window // The resource ID correspond to the one defined in the resx file // while the Index is the offset in the bitmap strip. Each image in // the strip being 16x16. BitmapResourceID = 301; BitmapIndex = 1; }
public void Reset() { ReplWindow.Reset(); }
private static string CurrentLine(ReplWindow buffer) { return(CurrentLine(buffer.CurrentView)); }
public ITagger <T> CreateTagger <T>(ITextBuffer /*!*/ buffer) where T : ITag { ReplWindow repl = ReplWindow.FromBuffer(buffer); return((repl != null) ? (ITagger <T>)(object) new Tagger(repl) : null); }
private void OnClose(object sender, EventArgs ea) { _replWindow.Dispose(); _replWindow = null; try { //File.Delete(FilePath); } catch (Exception e) { // TODO: Log error Debug.WriteLine("Error while deleting temporary REPL file: {0}", e.ToString()); } }