[svn] r7099: vs-plugin/trunk/Nemerle.VsIntegration: LanguageService/NemerleLanguageService.cs Project/Neme...

VladD2 svnadmin at nemerle.org
Fri Dec 15 23:01:27 CET 2006


Log:
Sync with new version of IronPython.

Author: VladD2
Date: Fri Dec 15 23:01:25 2006
New Revision: 7099

Modified:
   vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleLanguageService.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleDependentFileNode.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleFileNodeProperties.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleProjectNode.cs

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	Fri Dec 15 23:01:25 2006
@@ -459,22 +459,27 @@
 			return function;
 		}
 
-		private List<VsExpansion> expansionsList;
-
-		public override void OnParseComplete(ParseRequest req)
+		private List<VsExpansion> _expansionsList;
+		private List<VsExpansion> ExpansionsList
+		{
+			get
 		{
-			if (expansionsList == null)
+				if (_expansionsList != null)
+					return _expansionsList;
+
 				GetSnippets();
+				return _expansionsList;
+			}
 		}
 
 		// Disable the "DoNotPassTypesByReference" warning.
 		//
 		public void AddSnippets(ref NemerleDeclarations declarations)
 		{
-			if (null == expansionsList)
+			if (null == ExpansionsList)
 				return;
 
-			foreach (VsExpansion expansionInfo in expansionsList)
+			foreach (VsExpansion expansionInfo in ExpansionsList)
 			{
 				//declarations.AddDeclaration(new Declaration(expansionInfo));
 				throw new NotImplementedException();
@@ -483,10 +488,10 @@
 
 		private void GetSnippets()
 		{
-			if (null == expansionsList)
-				expansionsList = new List<VsExpansion>();
+			if (null == _expansionsList)
+				_expansionsList = new List<VsExpansion>();
 			else
-				expansionsList.Clear();
+				_expansionsList.Clear();
 
 			IVsTextManager2 textManager = 
 				Microsoft.VisualStudio.Shell.Package.GetGlobalService(
@@ -500,7 +505,7 @@
 
 			foreach (VsExpansion expansion in enumerator)
 				if (!string.IsNullOrEmpty(expansion.shortcut))
-					expansionsList.Add(expansion);
+					_expansionsList.Add(expansion);
 		}
 
 		internal class NemerleGetNameExpansionFunction : ExpansionFunction

Modified: vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleDependentFileNode.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleDependentFileNode.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleDependentFileNode.cs	Fri Dec 15 23:01:25 2006
@@ -41,8 +41,9 @@
         {
             get
             {
-                if (null == _codeDomProvider)
+				if (_codeDomProvider == null)
                     _codeDomProvider = new NemerleFileNodeCodeDomProvider(this);
+
                 return _codeDomProvider;
             }
         }

Modified: vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleFileNodeProperties.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleFileNodeProperties.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleFileNodeProperties.cs	Fri Dec 15 23:01:25 2006
@@ -9,7 +9,7 @@
 	[ComVisible(true)]
 	[CLSCompliant(false)]
 	[Guid(NemerleConstants.FileNodePropertiesGuidString)]
-	public class NemerleFileNodeProperties : FileNodeProperties
+	public class NemerleFileNodeProperties : SingleFileGeneratorNodeProperties
 	{
 		public NemerleFileNodeProperties(HierarchyNode node)
 			: base(node)

Modified: vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleProjectNode.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleProjectNode.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleProjectNode.cs	Fri Dec 15 23:01:25 2006
@@ -267,22 +267,18 @@
 				throw new FileNotFoundException(
 					String.Format("Template file not found: {0}", source));
 
-			// The class name is based on the new file name
-			//
-			string className = Path.GetFileNameWithoutExtension(target);
-			string namespce  = FileTemplateProcessor.GetFileNamespace(target, this);
-
-			FileTemplateProcessor.AddReplace("%className%", className);
-			FileTemplateProcessor.AddReplace("%namespace%", namespce);
-
-			try
+			// We assume that there is no token inside the file because the only
+			// way to add a new element should be through the template wizard that
+			// take care of expanding and replacing the tokens.
+			// The only task to perform is to copy the source file in the
+			// target location.
+			string targetFolder = Path.GetDirectoryName(target);
+			if (!Directory.Exists(targetFolder))
 			{
-				FileTemplateProcessor.UntokenFile(source, target);
-			}
-			catch (Exception e)
-			{
-				throw new FileLoadException("Failed to add template file to project", target, e);
+				Directory.CreateDirectory(targetFolder);
 			}
+
+			File.Copy(source, target);
 		}
 
 		/// <summary>
@@ -311,7 +307,8 @@
 		/// <returns>NemerleFileNode or FileNode</returns>
 		public override FileNode CreateFileNode(ProjectElement item)
 		{
-			if (item == null) throw new ArgumentNullException("item");
+			if (item == null)
+				throw new ArgumentNullException("item");
 
 			NemerleFileNode newNode = new NemerleFileNode(this, item);
 			string          include = item.GetMetadata(ProjectFileConstants.Include);



More information about the svn mailing list