[svn] r7487: vs-plugin/trunk: Nemerle.Compiler.Utils/Nemerle.Completion2/CompilerConcreteDefinitions/Intel...

VladD2 svnadmin at nemerle.org
Sun Feb 25 06:50:25 CET 2007


Log:
Work on ProjectReference.

Author: VladD2
Date: Sun Feb 25 06:50:22 2007
New Revision: 7487

Modified:
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CompilerConcreteDefinitions/IntelliSenseModeLibraryReferenceManager.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-main.n
   vs-plugin/trunk/Nemerle.VsIntegration/Project/ProjectInfo.cs

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CompilerConcreteDefinitions/IntelliSenseModeLibraryReferenceManager.n
==============================================================================
Files vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CompilerConcreteDefinitions/IntelliSenseModeLibraryReferenceManager.n	(original) and vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CompilerConcreteDefinitions/IntelliSenseModeLibraryReferenceManager.n	Sun Feb 25 06:50:22 2007 differ

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-main.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-main.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-main.n	Sun Feb 25 06:50:22 2007
@@ -53,10 +53,15 @@
               Hierarchy.RemoveProgramTypes();
           else
           {
-            foreach (asm in _callback.GetAssemblyReferences())
+            // Get assembly references from IDE.
+            def asmRefs = _callback.GetAssemblyReferences().ToArray();
+            // Update library list.
+            Factories.IntelliSenseModeLibraryReferenceManager.UpdateAssemblies(asmRefs);
+
+            foreach (asm in asmRefs) // Add all asseblies into compiler
               LibrariesManager.AddLibrary(asm);
             
-            LoadExternalLibraries ();
+            LoadExternalLibraries(); // reload types information
           }
           
           // next time Init is called, we won't reload libs

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 Feb 25 06:50:22 2007
@@ -129,14 +129,19 @@
 			Engine.Reset();
 		}
 
+		/// <summary>Watchers for project assemble reference.</summary>
+		List<FileSystemWatcher> _assembleReferenceWatchers = new List<FileSystemWatcher>();
+
 		IEnumerable<string> IEngineCallback.GetAssemblyReferences()
 		{
+			ResetAssembleReferenceWatchers();
+			
 			foreach (ReferenceNode node in _assemblyReferences)
 			{
 				string assemblyId = null;
 				ProjectReferenceNode  prjRef = node as ProjectReferenceNode;
-				if (prjRef != null)
-					assemblyId = prjRef.ReferencedProjectOutputPath;
+				if (prjRef != null) // Is project reference...
+					assemblyId = prjRef.ReferencedProjectOutputPath; // calc real assembly name.
 				else if (node.Url != null) //IT: if dll does not exist, the Url will be null.
 					assemblyId = node.Url;
 				else
@@ -145,9 +150,35 @@
 				}
 
 				if (assemblyId != null)
+				{
+					AddAssembleReferenceWatcher(assemblyId);
 					yield return assemblyId;
 			}
 		}
+		}
+
+		private void AddAssembleReferenceWatcher(string filePath)
+		{
+			string path = Path.GetDirectoryName(filePath);
+			string name = Path.GetFileName(filePath);
+			FileSystemWatcher watcher = new FileSystemWatcher(path, name);
+			watcher.Changed += watcher_Changed;
+			_assembleReferenceWatchers.Add(watcher);
+			watcher.EnableRaisingEvents = true;
+		}
+
+		void ResetAssembleReferenceWatchers()
+		{
+			foreach (FileSystemWatcher watcher in _assembleReferenceWatchers)
+				watcher.Dispose();
+
+			_assembleReferenceWatchers.Clear();
+		}
+
+		void watcher_Changed(object sender, FileSystemEventArgs e)
+		{
+			Engine.Reset();
+		}
 
 		#endregion
 



More information about the svn mailing list