<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>Source/BooLangService/BooViewFilter.cs</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -40,12 +40,18 @@ namespace Boo.BooLangService
             return &quot;Boo File (*.boo) *.boo&quot;;
         }
 
+        public override ViewFilter CreateViewFilter(CodeWindowManager mgr, IVsTextView newView)
+        {
+            return new BooViewFilter(mgr, newView);
+        }
+
         public override LanguagePreferences GetLanguagePreferences()
         {
             if (_languagePreferences == null)
             {
                 _languagePreferences = new LanguagePreferences(this.Site, typeof(BooLangService).GUID, BooLangService.LanguageName);
                 _languagePreferences.Init();
+                _languagePreferences.IndentStyle = IndentingStyle.Smart;
             }
             
             return _languagePreferences;</diff>
      <filename>Source/BooLangService/BooLangService.cs</filename>
    </modified>
    <modified>
      <diff>@@ -88,6 +88,7 @@
     &lt;Compile Include=&quot;AssemblyHelper.cs&quot; /&gt;
     &lt;Compile Include=&quot;BooMethods.cs&quot; /&gt;
     &lt;Compile Include=&quot;BooProjectSources.cs&quot; /&gt;
+    &lt;Compile Include=&quot;BooViewFilter.cs&quot; /&gt;
     &lt;Compile Include=&quot;Document\Nodes\NamespaceTreeNode.cs&quot; /&gt;
     &lt;Compile Include=&quot;Document\Nodes\ReferencedNamespaceTreeNode.cs&quot; /&gt;
     &lt;Compile Include=&quot;Document\Nodes\ValueTypeTreeNode.cs&quot; /&gt;</diff>
      <filename>Source/BooLangService/BooLangService.csproj</filename>
    </modified>
    <modified>
      <diff>@@ -14,30 +14,6 @@ namespace BooLangService
         {}
 
         /// &lt;summary&gt;
-        /// Occurs when the changes are committed to the document, typically on save, but more
-        /// importantly on enter.
-        /// &lt;/summary&gt;
-        /// &lt;param name=&quot;reason&quot;&gt;Reason why the changes were committed, i.e. Save.&lt;/param&gt;
-        /// &lt;param name=&quot;changedArea&quot;&gt;TextSpan of where the changes occurred.&lt;/param&gt;
-        public override void OnChangesCommitted(uint reason, TextSpan[] changedArea)
-        {
-            base.OnChangesCommitted(reason, changedArea);
-
-            if (((ChangeCommitGestureFlags)reason &amp; ChangeCommitGestureFlags.CCG_CARET_ON_NEW_BUFFER_LINE) == ChangeCommitGestureFlags.CCG_CARET_ON_NEW_BUFFER_LINE)
-            {
-                // there's been a newline put in by the user
-                if (changedArea.Length &gt; 0)
-                {
-                    // and its actually changed the doc
-                    var indenter = new LineIndenter(this);
-
-                    // change the indentation, if necessary
-                    indenter.ChangeIndentation(changedArea[0]);
-                }
-            }
-        }
-
-        /// &lt;summary&gt;
         /// Gets all text on the specified line upto the column specified.
         /// &lt;/summary&gt;
         /// &lt;param name=&quot;line&quot;&gt;&lt;/param&gt;</diff>
      <filename>Source/BooLangService/BooSource.cs</filename>
    </modified>
    <modified>
      <diff>@@ -124,7 +124,7 @@ namespace Boo.BooLangService.Intellisense
             var scopedParseTree = compiledProject.GetScope(fileName, lineNum);
             var declarations = new IntellisenseDeclarations();
 
-            AddSpecialTypes(declarations);
+            // AddSpecialTypes(declarations);
             AddMembersFromScopeTree(declarations, scopedParseTree);
             AddKeywords(declarations, scopedParseTree);
             AddImports(declarations, GetDocument(scopedParseTree));</diff>
      <filename>Source/BooLangService/Intellisense/DeclarationFinder.cs</filename>
    </modified>
    <modified>
      <diff>@@ -12,63 +12,71 @@ namespace BooLangService
         private readonly Regex removeCommentsRegExp = new Regex(@&quot;.*((?:#|\/\/|\/\*).*)$&quot;, RegexOptions.Compiled);
         // matches a dedenting code line (pass, return, return xxx, return if x = x, return xxx unless x = x, etc...)
         private readonly Regex dedentRegExp = new Regex(@&quot;(?:return|pass)(?:[\t ]?[\w]*[\t ]?(?&lt;exp&gt;(?:if|unless)))?&quot;, RegexOptions.Compiled);
-        private const string Indent = &quot;  &quot;;
         private readonly BooSource source;
+        private readonly IVsTextView view;
+        private readonly char IndentChar;
 
-        public LineIndenter(BooSource source)
+        public LineIndenter(BooSource source, IVsTextView view)
         {
             this.source = source;
+            this.view = view;
+
+            IndentChar = source.LanguageService.Preferences.InsertTabs ? '\t' : ' ';
         }
 
         /// &lt;summary&gt;
-        /// Changes the indentation of the current line based on the last
-        /// bit of code typed.
+        /// Sets the indentation for the next line.
         /// &lt;/summary&gt;
-        /// &lt;param name=&quot;changedArea&quot;&gt;Area of changed code&lt;/param&gt;
-        public void ChangeIndentation(TextSpan changedArea)
+        public void SetIndentationForNextLine()
         {
-            TextSpan area = changedArea;
-            string text = source.GetText(area);
-            string line = source.GetTextUptoPosition(area.iStartLine, area.iStartIndex);
+            int line;
+            int col;
 
-            if (!line.EndsWith(text))
-            {
-                // if commit includes last bit of text typed, the line won't have it yet
-                // so stick it on for our parsing sanity
-                // ** probably not the best thing to be doing here, but we can't just
-                // get the whole line, because we may be pressing return in the centre
-                // of it
-                line += text;
-            }
+            view.GetCaretPos(out line, out col);
 
-            if (RequiresIndent(line))
-            {
-                source.SetText(area, text + Indent);    // add an indent to the end of the changed text
-                MoveCaret(Indent.Length);               // move the caret to the new end of line
-            }
-            else if (RequiresDedent(line))
+            string previousLine = GetPreviousNonWhitespaceLine(line);
+            int indentLevel = GetIndentLevel(previousLine);
+
+            if (RequiresIndent(previousLine))
+                indentLevel++;
+            else if (RequiresDedent(previousLine) &amp;&amp; indentLevel &gt; 0)
+                indentLevel--;
+
+            var nextLine = &quot;&quot;.PadRight(indentLevel, IndentChar);
+            var firstChar = source.ScanToNonWhitespaceChar(line);
+
+            source.SetText(line, 0, line, firstChar, nextLine);
+            view.PositionCaretForEditing(line, indentLevel);
+        }
+
+        private int GetIndentLevel(string line)
+        {
+            var count = 0;
+
+            foreach (var c in line)
             {
-                source.SetText(area, text.Remove(text.Length - Indent.Length)); // remove an indent
-                MoveCaret(-Indent.Length);                                      // move caret in a bit
+                if (c != IndentChar)
+                    break; // got to the text on the line
+
+                count++;
             }
+
+            return count;
         }
 
-        /// &lt;summary&gt;
-        /// Moves the caret a set number of columns.
-        /// &lt;/summary&gt;
-        /// &lt;remarks&gt;
-        /// Use negative numbers to move left.
-        /// &lt;/remarks&gt;
-        /// &lt;param name=&quot;amount&quot;&gt;Number of columns to move.&lt;/param&gt;
-        private void MoveCaret(int amount)
+        private string GetPreviousNonWhitespaceLine(int startLine)
         {
-            IVsTextView view = source.LanguageService.GetPrimaryViewForSource(source);
+            int prevLineIndex = startLine - 1;
+            var lineText = source.GetLine(prevLineIndex);
 
-            int caretLine = 0;
-            int caretCol = 0;
+            //searchig for not blank line
+            while (prevLineIndex &gt; 0 &amp;&amp; string.IsNullOrEmpty(lineText))
+            {
+                prevLineIndex--;
+                lineText = source.GetLine(prevLineIndex);
+            }
 
-            view.GetCaretPos(out caretLine, out caretCol);
-            view.SetCaretPos(caretLine, caretCol + amount);
+            return lineText;
         }
 
         /// &lt;summary&gt;</diff>
      <filename>Source/BooLangService/LineIndenter.cs</filename>
    </modified>
    <modified>
      <diff>@@ -34,9 +34,13 @@
     &lt;StartAction&gt;Project&lt;/StartAction&gt;
   &lt;/PropertyGroup&gt;
   &lt;ItemGroup&gt;
+    &lt;Reference Include=&quot;Boo.Lang, Version=2.0.0.0, Culture=neutral, PublicKeyToken=32c39770e9a21a67, processorArchitecture=MSIL&quot;&gt;
+      &lt;SpecificVersion&gt;False&lt;/SpecificVersion&gt;
+      &lt;HintPath&gt;..\..\Dependencies\boo\build\Boo.Lang.dll&lt;/HintPath&gt;
+    &lt;/Reference&gt;
     &lt;Reference Include=&quot;Boo.Lang.Compiler, Version=2.0.0.0, Culture=neutral, PublicKeyToken=32c39770e9a21a67, processorArchitecture=MSIL&quot;&gt;
       &lt;SpecificVersion&gt;False&lt;/SpecificVersion&gt;
-      &lt;HintPath&gt;..\..\Dependencies\boo\bin\Boo.Lang.Compiler.dll&lt;/HintPath&gt;
+      &lt;HintPath&gt;..\..\Dependencies\boo\build\Boo.Lang.Compiler.dll&lt;/HintPath&gt;
     &lt;/Reference&gt;
     &lt;Reference Include=&quot;Boo.Lang.Parser, Version=2.0.0.0, Culture=neutral, PublicKeyToken=32c39770e9a21a67, processorArchitecture=MSIL&quot;&gt;
       &lt;SpecificVersion&gt;False&lt;/SpecificVersion&gt;</diff>
      <filename>Source/BooLangStudioSpecs/BooLangStudioSpecs.csproj</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 namespace Test.Project
 
 class DummyClass:
-  pass
+	pass
 
 ~
\ No newline at end of file</diff>
      <filename>Source/BooLangStudioSpecs/Intellisense/Fixtures/WhenDisplayingDescriptionsForIntellisense/ClassesArePrefixedWithClassAndUseFullNamespaceName.boo</filename>
    </modified>
    <modified>
      <diff>@@ -11,7 +11,7 @@ namespace Boo.BooLangStudioSpecs.Intellisense
         public void ShowAllReferencedNamespaces()
         {
             CompiledFixtures
-                .SetReferences(Assembly.LoadFrom(@&quot;..\..\..\..\Dependencies\boo\bin\Boo.Lang.dll&quot;))
+                .SetReferences(Assembly.LoadFrom(@&quot;..\..\..\..\Dependencies\boo\build\Boo.Lang.dll&quot;))
                 .GetDeclarations()
                 .AssertPresenceOf(&quot;Boo&quot;);
         }
@@ -20,7 +20,7 @@ namespace Boo.BooLangStudioSpecs.Intellisense
         public void ShowSubNamespacesForPartialImport()
         {
             CompiledFixtures
-                .SetReferences(Assembly.LoadFrom(@&quot;..\..\..\..\Dependencies\boo\bin\Boo.Lang.dll&quot;))
+                .SetReferences(Assembly.LoadFrom(@&quot;..\..\..\..\Dependencies\boo\build\Boo.Lang.dll&quot;))
                 .GetDeclarations()
                 .AssertPresenceOf(&quot;Lang&quot;);
         }
@@ -29,7 +29,7 @@ namespace Boo.BooLangStudioSpecs.Intellisense
         public void ExcludeExposedTypes()
         {
             CompiledFixtures
-                .SetReferences(Assembly.LoadFrom(@&quot;..\..\..\..\Dependencies\boo\bin\Boo.Lang.dll&quot;))
+                .SetReferences(Assembly.LoadFrom(@&quot;..\..\..\..\Dependencies\boo\build\Boo.Lang.dll&quot;))
                 .GetDeclarations()
                 .AssertNonPresenceOf(&quot;ICallable&quot;, &quot;IQuackFu&quot;);
         }</diff>
      <filename>Source/BooLangStudioSpecs/Intellisense/WhenShowingIntellisenseAtImportStatement.cs</filename>
    </modified>
    <modified>
      <diff>@@ -9,7 +9,7 @@ namespace Boo.BooLangStudioSpecs.Intellisense
         public void IncludeSubNamespaces()
         {
             CompiledFixtures
-                .SetReferences(Assembly.LoadFrom(@&quot;..\..\..\..\Dependencies\boo\bin\Boo.Lang.dll&quot;))
+                .SetReferences(Assembly.LoadFrom(@&quot;..\..\..\..\Dependencies\boo\build\Boo.Lang.dll&quot;))
                 .GetDeclarations()
                 .AssertPresenceOf(&quot;Lang&quot;);
         }
@@ -18,7 +18,7 @@ namespace Boo.BooLangStudioSpecs.Intellisense
         public void IncludeExposedTypes()
         {
             CompiledFixtures
-                .SetReferences(Assembly.LoadFrom(@&quot;..\..\..\..\Dependencies\boo\bin\Boo.Lang.dll&quot;))
+                .SetReferences(Assembly.LoadFrom(@&quot;..\..\..\..\Dependencies\boo\build\Boo.Lang.dll&quot;))
                 .GetDeclarations()
                 .AssertPresenceOf(&quot;ICallable&quot;, &quot;IQuackFu&quot;);
         }</diff>
      <filename>Source/BooLangStudioSpecs/Intellisense/WhenShowingIntellisenseForNamespaceSuggestion.cs</filename>
    </modified>
    <modified>
      <diff>@@ -42,7 +42,7 @@ namespace Boo.BooLangStudioSpecs.Intellisense
         public void ShowNamespacesFromReferences()
         {
             CompiledFixtures
-                .SetReferences(Assembly.LoadFrom(@&quot;..\..\..\..\Dependencies\boo\bin\Boo.Lang.dll&quot;))
+                .SetReferences(Assembly.LoadFrom(@&quot;..\..\..\..\Dependencies\boo\build\Boo.Lang.dll&quot;))
                 .GetDeclarations()
                 .AssertPresenceOf(&quot;Boo&quot;);
         }</diff>
      <filename>Source/BooLangStudioSpecs/Intellisense/WhenShowingIntellisenseInMethodBody.cs</filename>
    </modified>
    <modified>
      <diff>@@ -6,13 +6,13 @@ namespace Boo.BooLangStudioSpecs.Intellisense
 {
     public class WhenShowingToolTipForMethod : BaseCompilerContext
     {
-        [Fact(Skip=&quot;Not implemented yet.&quot;)]
+        [Fact(Skip=&quot;This feature is implemented, but I don't really know how to test for it.&quot;)]
         public void ShowMethodParametersWhenInsideParenthesis()
         {
             throw new NotImplementedException();
         }
 
-        [Fact(Skip = &quot;Not implemented yet.&quot;)]
+        [Fact(Skip = &quot;This feature is implemented, but I don't really know how to test for it.&quot;)]
         public void ShowFullDescriptionForMethod()
         {
             throw new NotImplementedException();</diff>
      <filename>Source/BooLangStudioSpecs/Intellisense/WhenShowingToolTipForMethod.cs</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>706509e44bfaaabf3aeb5cba66e3112e7702478e</id>
    </parent>
  </parents>
  <author>
    <name>James Gregory</name>
    <email>james@jagregory.com</email>
  </author>
  <url>http://github.com/jagregory/boolangstudio/commit/6dfa1b52c1419512ac5b5da61c09a913f75eaa1c</url>
  <id>6dfa1b52c1419512ac5b5da61c09a913f75eaa1c</id>
  <committed-date>2008-10-12T05:47:48-07:00</committed-date>
  <authored-date>2008-10-12T05:47:48-07:00</authored-date>
  <message>Reimplemented smart indenting, it actually works properly now.</message>
  <tree>5cc632c37e507774e1c6a28e90e9a02ade030322</tree>
  <committer>
    <name>James Gregory</name>
    <email>james@jagregory.com</email>
  </committer>
</commit>
