[svn] r6678: vs-plugin/trunk/Nemerle.VsIntegration: Engine/ProjectInfo.cs Package/NemerleLanguageService.c...

VladD2 svnadmin at nemerle.org
Sat Sep 23 04:01:42 CEST 2006


Log:
Work on relocation.

Author: VladD2
Date: Sat Sep 23 04:01:38 2006
New Revision: 6678

Modified:
   vs-plugin/trunk/Nemerle.VsIntegration/Engine/ProjectInfo.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Package/NemerleLanguageService.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Package/NemerleProjectNode.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Utils.cs

Modified: vs-plugin/trunk/Nemerle.VsIntegration/Engine/ProjectInfo.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Engine/ProjectInfo.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Engine/ProjectInfo.cs	Sat Sep 23 04:01:38 2006
@@ -26,9 +26,17 @@
 		private Dictionary<string, int>      _filesMap      = new Dictionary<string, int>();
 		private static ProjectInfoCollection _projectsInfos = new ProjectInfoCollection();
 		private string                       _projectLocation;
+		private readonly IServiceProvider    _site;
 
-		public ProjectInfo(MSBuild.Project buildProject, IVsHierarchy hierarchy, string fileName, string location)
+		public ProjectInfo(
+			IServiceProvider site, 
+			MSBuild.Project buildProject, 
+			IVsHierarchy hierarchy, 
+			string fileName, 
+			string location
+		)
 		{
+			_site = site;
 			ErrorHelper.ThrowIsNull(hierarchy, "hierarchy");
 			_buildProject = buildProject;
 			CompilationOptions options = new CompilationOptions();
@@ -255,8 +263,16 @@
 				oldEndIndex, oldEndLine, startIndex, startLine)
 			)
 			{
+				// ×čńňî îňëŕäî÷íŕ˙ őđĺíü.
+				// Îáíîâëĺě ńîäĺđćčěîĺ ôŕéëŕ, ňŕę ęŕę îí čçěĺíčëń˙, ŕ Engine îá ýňîě ďîęŕ íĺçíŕĺň.
+				string code = Utils.GetFileCode(_site, filePath);
+				Project.Engine.Sources.AddOrUpdate(filePath, code);
+				// Îáíóë˙ĺě ńńűëęó íŕ ďđîĺęň. Ýňî ďđčâîäčň ę ňîěó, ÷ňî ńëĺäóţůĺĺ îáđŕůĺíčĺ
+				// ę ńâîéńňâó Project ńîçäŕńň íîâűé ďđîĺęň, ŕ ńňŕëî áűňü ďîńňđîčň íîâîĺ äĺđĺâî ňčďîâ.
 				ResetTypeTree();
-				Project.UpdateDebugTree(Project.CompileUnits.GetFileIndex(filePath));
+				// Îáíîâë˙ĺě GUI-äĺđĺâî âčçóŕëčçčđóţůĺĺ ŔŃŇ ňĺęóůĺăî ôŕéëŕ.
+				int fileIndex = Location.GetFileIndex(filePath);
+				Project.UpdateDebugTree(fileIndex);
 			}
 		}
 

Modified: vs-plugin/trunk/Nemerle.VsIntegration/Package/NemerleLanguageService.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Package/NemerleLanguageService.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Package/NemerleLanguageService.cs	Sat Sep 23 04:01:38 2006
@@ -1,3 +1,5 @@
+#region impots
+
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
@@ -27,6 +29,8 @@
 
 using VsShell = Microsoft.VisualStudio.Shell.VsShellUtilities;
 
+#endregion
+
 namespace Nemerle.VisualStudio.Package
 {
 	[Guid(GlobalConstants.LanguageServiceGuidString)]

Modified: vs-plugin/trunk/Nemerle.VsIntegration/Package/NemerleProjectNode.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Package/NemerleProjectNode.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Package/NemerleProjectNode.cs	Sat Sep 23 04:01:38 2006
@@ -234,7 +234,7 @@
 			// IT: ProjectInfo needs to be created before loading
 			// as we will catch assembly reference adding.
 			//
-			_projectInfo = new ProjectInfo(BuildProject, InteropSafeHierarchy, filename, location);
+			_projectInfo = new ProjectInfo(Site, BuildProject, InteropSafeHierarchy, filename, location);
 
 			ProjectInfo.ProjectsInfos.Add(_projectInfo);
 

Modified: vs-plugin/trunk/Nemerle.VsIntegration/Utils.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Utils.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Utils.cs	Sat Sep 23 04:01:38 2006
@@ -6,6 +6,8 @@
 using Nemerle.Compiler;
 using System.Reflection;
 using Msbuild = Microsoft.Build.BuildEngine;
+using Nemerle.VisualStudio.Package;
+using Microsoft.VisualStudio.Package;
 
 namespace Nemerle
 {
@@ -14,6 +16,18 @@
 	{
 		static class Utils
 		{
+			//public static string GetFileCode(int fileIndex)
+			//{
+			//  return GetFileCode(Location.GetFileName(fileIndex));
+			//}
+
+			public static string GetFileCode(IServiceProvider site, string filePath)
+			{
+				NemerleLanguageService lang = (NemerleLanguageService)site.GetService(typeof(NemerleLanguageService));
+				Source source = lang.GetSource(filePath);
+				return source.GetText();
+			}
+
 			public static bool IsTrue(Msbuild.Project project, string valueName)
 			{
 				return Eq(project.GetEvaluatedProperty(valueName), "true");



More information about the svn mailing list