public override void Run()
        {
            PadDescriptor pad = SD.Workbench.GetPad(typeof(FSharpInteractive));

            pad.BringPadToFront();
            FSharpInteractive fsharpInteractive = (FSharpInteractive)pad.PadContent;

            if (fsharpInteractive.foundCompiler)
            {
                ITextEditor textEditor = SD.GetActiveViewContentService <ITextEditor>();
                if (textEditor != null)
                {
                    if (textEditor.SelectionLength > 0)
                    {
                        fsharpInteractive.fsiProcess.StandardInput.WriteLine(textEditor.SelectedText);
                    }
                    else
                    {
                        var line = textEditor.Document.GetLineByNumber(textEditor.Caret.Line);
                        fsharpInteractive.fsiProcess.StandardInput.WriteLine(textEditor.Document.GetText(line));
                    }
                    fsharpInteractive.fsiProcess.StandardInput.WriteLine(";;");
                }
            }
        }
Beispiel #2
0
        public override void Run()
        {
            PadDescriptor pad = WorkbenchSingleton.Workbench.GetPad(typeof(FSharpInteractive));

            pad.BringPadToFront();
            FSharpInteractive fsharpInteractive = (FSharpInteractive)pad.PadContent;

            if (fsharpInteractive.foundCompiler)
            {
                ITextEditorProvider editorProvider = WorkbenchSingleton.Workbench.ActiveViewContent as ITextEditorProvider;
                if (editorProvider != null)
                {
                    var textEditor = editorProvider.TextEditor;
                    if (textEditor.SelectionLength > 0)
                    {
                        fsharpInteractive.fsiProcess.StandardInput.WriteLine(textEditor.SelectedText);
                    }
                    else
                    {
                        var line = textEditor.Document.GetLine(textEditor.Caret.Line);
                        fsharpInteractive.fsiProcess.StandardInput.WriteLine(line.Text);
                    }
                    fsharpInteractive.fsiProcess.StandardInput.WriteLine(";;");
                }
            }
        }
        public override void Run()
        {
            PadDescriptor pad = WorkbenchSingleton.Workbench.GetPad(typeof(FSharpInteractive));

            pad.BringPadToFront();
            FSharpInteractive fsharpInteractive = (FSharpInteractive)pad.PadContent;

            if (fsharpInteractive.foundCompiler)
            {
                ITextEditorControlProvider editorProvider = WorkbenchSingleton.Workbench.ActiveViewContent as ITextEditorControlProvider;
                if (editorProvider != null)
                {
                    var textArea = editorProvider.TextEditorControl.ActiveTextAreaControl.TextArea;
                    if (textArea.SelectionManager.HasSomethingSelected)
                    {
                        foreach (var selection in textArea.SelectionManager.SelectionCollection)
                        {
                            fsharpInteractive.fsiProcess.StandardInput.WriteLine(selection.SelectedText);
                        }
                    }
                    else
                    {
                        var line        = textArea.Document.GetLineNumberForOffset(textArea.Caret.Offset);
                        var lineSegment = textArea.Document.GetLineSegment(line);
                        var lineText    = textArea.Document.GetText(lineSegment.Offset, lineSegment.TotalLength);
                        fsharpInteractive.fsiProcess.StandardInput.WriteLine(lineText);
                    }
                    fsharpInteractive.fsiProcess.StandardInput.WriteLine(";;");
                }
            }
        }