diff --git a/src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/Boo.InterpreterAddIn.booproj b/src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/Boo.InterpreterAddIn.booproj index 9803a1f268..96e7e02d8c 100644 --- a/src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/Boo.InterpreterAddIn.booproj +++ b/src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/Boo.InterpreterAddIn.booproj @@ -33,6 +33,7 @@ + diff --git a/src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/InteractiveInterpreterControl.boo b/src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/InteractiveInterpreterControl.boo index bf22a89b5d..6de5b70b86 100644 --- a/src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/InteractiveInterpreterControl.boo +++ b/src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/InteractiveInterpreterControl.boo @@ -133,8 +133,8 @@ class InteractiveInterpreterControl(TextEditorControl): _block = System.IO.StringWriter() [getter(Interpreter)] - _interpreter as Boo.Lang.Interpreter.InteractiveInterpreter - + _interpreter = InterpreterWrapper() + _codeCompletionWindow as CodeCompletionWindow [property(CompletionWindowImageProvider, value is not null)] @@ -148,10 +148,8 @@ class InteractiveInterpreterControl(TextEditorControl): _blockKeys = false def constructor(): - self._interpreter = Boo.Lang.Interpreter.InteractiveInterpreter( - RememberLastValue: true, - Print: self.print) - self._interpreter.SetValue("cls", cls) + self._interpreter.LinePrinted += self.print + self._interpreter.Cleared += self.cls self._lineHistory = LineHistory(CurrentLineChanged: _lineHistory_CurrentLineChanged) self.Document.HighlightingStrategy = GetBooHighlighting() self.EnableFolding = false @@ -178,19 +176,19 @@ class InteractiveInterpreterControl(TextEditorControl): def Eval(code as string): try: - _interpreter.LoopEval(code) + _interpreter.RunCommand(code) ensure: _state = InputState.SingleLine - + private def ConsumeCurrentLine(): text as string = CurrentLineText # was accessing Control.text member _lineHistory.Add(text) print("") return text - + private def GetLastLineSegment(): return self.Document.GetLineSegment(self.Document.LineSegmentCollection.Count) - + private def SingleLineInputState(): code = ConsumeCurrentLine() if code[-1:] in ":", "\\": @@ -199,39 +197,39 @@ class InteractiveInterpreterControl(TextEditorControl): _block.WriteLine(code) else: Eval(code) - + private def BlockInputState(): code = ConsumeCurrentLine() if 0 == len(code): - Eval(_block.ToString()) + Eval(_block.ToString()) else: _block.WriteLine(code) def print(msg): - AppendText("${msg}\r\n") - + AppendText("${msg}\r\n") + def prompt(): AppendText((">>> ", "... ")[_state]) - + def ClearLine(): segment = GetLastLineSegment() self.Document.Replace(segment.Offset + 4, self.CurrentLineText.Length, "") - + def AppendText(text as string): segment = GetLastLineSegment() self.Document.Insert(segment.Offset + segment.TotalLength, text) MoveCaretToEnd() - + def MoveCaretToEnd(): segment = GetLastLineSegment() newOffset = segment.Offset + segment.TotalLength MoveCaretToOffset(newOffset) - + def MoveCaretToOffset(offset as int): self.ActiveTextAreaControl.Caret.Position = self.Document.OffsetToPosition(offset) - + override def InitializeTextAreaControl(newControl as TextAreaControl): super(newControl) newControl.TextArea.DoProcessDialogKey += HandleDialogKey @@ -332,8 +330,3 @@ class InteractiveInterpreterControl(TextEditorControl): def GetBooHighlighting(): return HighlightingManager.Manager.FindHighlighter("Boo") - - static def InstallDefaultSyntaxModeProvider(): - HighlightingManager.Manager.AddSyntaxModeFileProvider( - FileSyntaxModeProvider(Path.GetDirectoryName(Application.ExecutablePath))) - diff --git a/src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/InterpreterWrapper.boo b/src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/InterpreterWrapper.boo new file mode 100644 index 0000000000..72d55b13fa --- /dev/null +++ b/src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/InterpreterWrapper.boo @@ -0,0 +1,35 @@ +// +// 2005 AlphaSierraPapa +// GNU General Public License +// +// $Revision$ +// + +namespace Boo.InterpreterAddIn + +import System +import System.Windows.Forms + +class InterpreterWrapper: + _interpreter as Boo.Lang.Interpreter.InteractiveInterpreter + + def constructor(): + _interpreter = Boo.Lang.Interpreter.InteractiveInterpreter( + RememberLastValue: true, + Print: self.OnPrintLine) + _interpreter.SetValue("cls", { Cleared() }) + + event LinePrinted as callable(string) + event Cleared as MethodInvoker + + private def OnPrintLine(text as string): + LinePrinted(text) + + def RunCommand(code as string): + _interpreter.LoopEval(code) + + def SuggestCodeCompletion(code as string): + // David: the code completion items have to be passed as strings; + // but it's not important, you can return null if you want. + return _interpreter.SuggestCodeCompletion(code) + diff --git a/src/AddIns/BackendBindings/Boo/BooBinding/Project/BooBinding.addin b/src/AddIns/BackendBindings/Boo/BooBinding/Project/BooBinding.addin index 5256e29e13..21a2d23abb 100644 --- a/src/AddIns/BackendBindings/Boo/BooBinding/Project/BooBinding.addin +++ b/src/AddIns/BackendBindings/Boo/BooBinding/Project/BooBinding.addin @@ -52,13 +52,6 @@ - - - - - - Never - diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/ICSharpCode.TextEditor.csproj b/src/Libraries/ICSharpCode.TextEditor/Project/ICSharpCode.TextEditor.csproj index 941f0fb563..2db2015491 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/ICSharpCode.TextEditor.csproj +++ b/src/Libraries/ICSharpCode.TextEditor/Project/ICSharpCode.TextEditor.csproj @@ -182,6 +182,7 @@ + \ No newline at end of file diff --git a/src/AddIns/BackendBindings/Boo/BooBinding/Project/Resources/Boo.xshd b/src/Libraries/ICSharpCode.TextEditor/Project/Resources/Boo.xshd similarity index 100% rename from src/AddIns/BackendBindings/Boo/BooBinding/Project/Resources/Boo.xshd rename to src/Libraries/ICSharpCode.TextEditor/Project/Resources/Boo.xshd diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Resources/SyntaxModes.xml b/src/Libraries/ICSharpCode.TextEditor/Project/Resources/SyntaxModes.xml index 4669923df2..ac49a0f2a7 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/Resources/SyntaxModes.xml +++ b/src/Libraries/ICSharpCode.TextEditor/Project/Resources/SyntaxModes.xml @@ -7,6 +7,10 @@ name = "BAT" extensions = ".bat"/> + + @@ -45,5 +49,5 @@ + extensions = ".xml;.xsl;.xslt;.xsd;.manifest;.config;.addin;.xshd;.wxs;.proj;.csproj;.vbproj;.ilproj;.booproj;.build;.xfrm;.targets"/> diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Resources/XML-Mode.xshd b/src/Libraries/ICSharpCode.TextEditor/Project/Resources/XML-Mode.xshd index 8b3dc7ea8c..e941345ea5 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/Resources/XML-Mode.xshd +++ b/src/Libraries/ICSharpCode.TextEditor/Project/Resources/XML-Mode.xshd @@ -1,6 +1,6 @@ - +