[svn] r7179: vs-plugin/trunk: Nemerle.Compiler.Utils/Utils.n Nemerle.VsIntegration/GUI/AstToolControl.Desi...

VladD2 svnadmin at nemerle.org
Sun Dec 31 06:14:53 CET 2006


Log:
Work on AstToolWindow.

Author: VladD2
Date: Sun Dec 31 06:14:48 2006
New Revision: 7179

Modified:
   vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n
   vs-plugin/trunk/Nemerle.VsIntegration/GUI/AstToolControl.Designer.cs
   vs-plugin/trunk/Nemerle.VsIntegration/GUI/AstToolControl.cs
   vs-plugin/trunk/Nemerle.VsIntegration/GUI/AstToolControl.resx
   vs-plugin/trunk/Nemerle.VsIntegration/GUI/AutoSizeListView.cs
   vs-plugin/trunk/Nemerle.VsIntegration/GUI/NativeMethods.cs
   vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleLanguageService.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VisualStudio.csproj
   vs-plugin/trunk/Nemerle.VsIntegration/Project/ProjectInfo.cs

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n	Sun Dec 31 06:14:48 2006
@@ -18,17 +18,24 @@
   {
     InvariantCultureCompareInfo : CompareInfo = CultureInfo.InvariantCulture.CompareInfo;
 
-    public FillList(rootNamespase : Decl.Namespace, items : SCG.List[object]) : void
+    public FillList(rootNamespase : Decl.Namespace, items : SCG.List[string * Location]) : void
     {
-      def cnt = items.Count;
+      //def cnt = items.Count;
       items.Clear();
 
-      if (cnt == 4)
-        items.AddRange(array["aaaaaaa" : object, "bbb", "cccccccccccccccc", "dd", "eee"]);
-      else
-        items.AddRange(array["aaaaaaa" : object, "bbb", "cccccccccccccccc", "dd"]);
+      items.Add(("{BOF", rootNamespase.Location.FromStart()));
+      items.Add(("EOF}", rootNamespase.Location.FromEnd()));
+      
+
+      
+      //if (cnt == 4)
+        //items.AddRange(array["aaaaaaa" : object, "bbb", "cccccccccccccccc", "dd", "eee"]);
+      //else
+        //items.AddRange(array["aaaaaaa" : object, "bbb", "cccccccccccccccc", "dd"]);
+      //
+      
 
-      _ = rootNamespase;
+      //_ = rootNamespase;
     }
 
     // Returns whether the first location is strictly inside the second

Modified: vs-plugin/trunk/Nemerle.VsIntegration/GUI/AstToolControl.Designer.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/GUI/AstToolControl.Designer.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/GUI/AstToolControl.Designer.cs	Sun Dec 31 06:14:48 2006
@@ -95,7 +95,9 @@
 			this._grid.Size = new System.Drawing.Size(245, 292);
 			this._grid.TabIndex = 1;
 			this._grid.VirtualMode = true;
+			this._grid.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this._grid_CellClick);
 			this._grid.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this._grid_CellValueNeeded);
+			this._grid.CellToolTipTextNeeded += new System.Windows.Forms.DataGridViewCellToolTipTextNeededEventHandler(this._grid_CellToolTipTextNeeded);
 			// 
 			// _astColumn
 			// 

Modified: vs-plugin/trunk/Nemerle.VsIntegration/GUI/AstToolControl.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/GUI/AstToolControl.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/GUI/AstToolControl.cs	Sun Dec 31 06:14:48 2006
@@ -7,6 +7,8 @@
 using System.Windows.Forms;
 using Nemerle.Completion2;
 using CompUtils = Nemerle.Compiler.Utils.Utils;
+using Nemerle.Compiler;
+using Nemerle.Builtins;
 
 namespace Nemerle.VisualStudio.GUI
 {
@@ -17,7 +19,7 @@
 			InitializeComponent();
 		}
 
-		List<object> _items = new List<object>(10000);
+		List<Tuple<string, Location>> _items = new List<Tuple<string, Location>>(10000);
 
 		Decl.Namespace _rootNamespase;
 
@@ -45,7 +47,32 @@
 
 		private void _grid_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e)
 		{
-			e.Value = _items[e.RowIndex];
+			try
+			{
+				e.Value = _items[e.RowIndex].field0;
+			}
+			catch { }
+	}
+
+		private void _grid_CellToolTipTextNeeded(object sender, DataGridViewCellToolTipTextNeededEventArgs e)
+		{
+			try
+			{
+				e.ToolTipText = _items[e.RowIndex].ToString();
+			}
+			catch { }
+		}
+
+		public static event ShowLocation ShowLocation;
+
+		private void _grid_CellClick(object sender, DataGridViewCellEventArgs e)
+		{
+			try
+			{
+				if (ShowLocation != null)
+					ShowLocation(_items[e.RowIndex].field1);
+			}
+			catch { }
 		}
 	}
 }

Modified: vs-plugin/trunk/Nemerle.VsIntegration/GUI/AstToolControl.resx
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/GUI/AstToolControl.resx	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/GUI/AstToolControl.resx	Sun Dec 31 06:14:48 2006
@@ -123,4 +123,7 @@
   <metadata name="_astColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="_toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
 </root>
\ No newline at end of file

Modified: vs-plugin/trunk/Nemerle.VsIntegration/GUI/AutoSizeListView.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/GUI/AutoSizeListView.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/GUI/AutoSizeListView.cs	Sun Dec 31 06:14:48 2006
@@ -2,6 +2,7 @@
 using System.Drawing;
 using System.Runtime.InteropServices;
 using System.Windows.Forms;
+using Nemerle.VisualStudio.GUI.Native;
 
 namespace Nemerle.VisualStudio.GUI
 {

Modified: vs-plugin/trunk/Nemerle.VsIntegration/GUI/NativeMethods.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/GUI/NativeMethods.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/GUI/NativeMethods.cs	Sun Dec 31 06:14:48 2006
@@ -3,7 +3,7 @@
 using System.Runtime.InteropServices;
 using System.Security;
 
-namespace Nemerle.VisualStudio.GUI
+namespace Nemerle.VisualStudio.GUI.Native
 {
 	[SuppressUnmanagedCodeSecurity]
 	internal static class NativeMethods

Modified: vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleLanguageService.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleLanguageService.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleLanguageService.cs	Sun Dec 31 06:14:48 2006
@@ -17,6 +17,7 @@
 using Nemerle.VisualStudio.Project;
 
 using VsShell = Microsoft.VisualStudio.Shell.VsShellUtilities;
+using Nemerle.VisualStudio.GUI;
 
 namespace Nemerle.VisualStudio.LanguageService
 {
@@ -28,6 +29,7 @@
 		public NemerleLanguageService()
 		{
 			CompiledUnitAstBrowser.ShowLocation += CompiledUnitAstBrowser_ShowLocation;
+			AstToolControl.ShowLocation += CompiledUnitAstBrowser_ShowLocation;
 		}
 
 		public override void Dispose()
@@ -153,7 +155,17 @@
 						return true;
 					});
 
-				return GetDefaultScope(request);
+				AuthoringScope scope = GetDefaultScope(request);
+
+
+				AstToolWindow tool = AstToolWindow.AstTool;
+				if (tool != null && tool.IsAutoUpdate)
+				{
+					Decl.Namespace ns = projectInfo.Engine.Project.CompileUnits[source.FileIndex];
+					tool.RootNamespase = ns;
+				}
+
+				return scope;
 			}
 			catch (Exception e)
 			{

Modified: vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VisualStudio.csproj
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VisualStudio.csproj	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VisualStudio.csproj	Sun Dec 31 06:14:48 2006
@@ -192,6 +192,7 @@
     <CtcFile Include="CtcComponents\PkgCmd.ctc">
       <ResourceName>1000</ResourceName>
     </CtcFile>
+    <Content Include="!ToDo\ToDo.txt" />
     <Content Include="CodeSnippets\Snippets\foreach.snippet">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>

Modified: vs-plugin/trunk/Nemerle.VsIntegration/Project/ProjectInfo.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Project/ProjectInfo.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Project/ProjectInfo.cs	Sun Dec 31 06:14:48 2006
@@ -333,15 +333,6 @@
 				Engine.Project.UpdateDebugTree(fileIndex);
 #endif
 			}
-
-			AstToolWindow tool = AstToolWindow.AstTool;
-			if (tool != null && tool.IsAutoUpdate)
-			{
-				int fileIndex = Location.GetFileIndex(filePath);
-				//FixMe: get_Item is accessor! It must be accessed directly! Fix ncc.
-				Decl.Namespace ns = Engine.Project.CompileUnits[fileIndex];
-				tool.RootNamespase = ns;
-			}
 		}
 
 		public Nemerle.Completion2.Project Project



More information about the svn mailing list