[svn] r6825: vs-plugin/trunk: Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.csproj Nemerle.Compiler.Utils/...

VladD2 svnadmin at nemerle.org
Fri Nov 3 12:21:42 CET 2006


Log:
Refactoring:
1. SourceTextManager now initialized by NemerleSource instate NemerleLanguageService and IVsTextView.
2. Method GetNearestPosition renamed to GetPositionOfLineIndex.
3. Method GetLineAndColumn renamed to GetLineIndexOfPosition.
4. Add ProjectManager class. It is provide create SourceTextManager by filePath.
5. Raname ISourceTextManager to ISource.

Author: VladD2
Date: Fri Nov  3 12:21:33 2006
New Revision: 6825

Added:
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TextManagement/ISource.n
      - copied, changed from rev 6824, vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TextManagement/ISourceTextManager.n
   vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/ProjectManager.cs
Removed:
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TextManagement/ISourceTextManager.n
Modified:
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.csproj
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Namespace.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Using.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.Init.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TextManagement/IProjectManager.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TextManagement/ProjectManager.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n
   vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleAuthoringScope.cs
   vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleLanguageService.cs
   vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/SourceTextManager.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VsIntegration.csproj
   vs-plugin/trunk/Nemerle.VsIntegration/Project/ProjectInfo.cs

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.csproj
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.csproj	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.csproj	Fri Nov  3 12:21:33 2006
@@ -148,9 +148,11 @@
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Nemerle.Completion2\TextManagement\IProjectManager.n" />
-    <Compile Include="Nemerle.Completion2\TextManagement\ISourceTextManager.n" />
     <Compile Include="Nemerle.Completion2\TextManagement\ProjectManager.n" />
   </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Nemerle.Completion2\TextManagement\ISource.n" />
+  </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Namespace.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Namespace.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Namespace.n	Fri Nov  3 12:21:33 2006
@@ -16,7 +16,7 @@
       _fileIndex : int,
       _line      : int,
       _col       : int,
-      _source    : ISourceTextManager
+      _source    : ISource
     )
       : array[CompletionElem]
     {

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n	Fri Nov  3 12:21:33 2006
@@ -22,7 +22,7 @@
       fileIndex : int,
       line      : int,
       col       : int, 
-      source    : ISourceTextManager
+      source    : ISource
     )
       : array[CompletionElem]
     {
@@ -77,7 +77,7 @@
       fileIndex : int,
       line      : int,
       col       : int,
-      source    : ISourceTextManager
+      source    : ISource
     )
       : Location * object * object
     {
@@ -152,7 +152,7 @@
       fileIndex : int,
       line      : int,
       col       : int,
-      source    : ISourceTextManager,
+      source    : ISource,
       //2IT: ďđŕęňč÷ĺńęč ëţáîé ęëŕńń â ęîěďčë˙ňîđĺ ńîäĺđćčň ńńűëęó íŕ ManagerClass.
       // Ďî ęđŕéíĺé ěĺđĺ MemberBuilder č TypeBuilder ňî÷íî čő čěĺţň.
       // Ňŕę ÷ňî ýňîň ďŕđŕěĺňđ ńęîđĺĺ âńĺăî îřčáęŕ.
@@ -183,7 +183,7 @@
       fileIndex : int,
       line      : int,
       col       : int,
-      source    : ISourceTextManager
+      source    : ISource
     )
       : list [GotoInfo]
     {
@@ -228,7 +228,7 @@
       fileIndex : int,
       line      : int,
       col       : int, 
-      source    : ISourceTextManager
+      source    : ISource
     )
       : MethodTipInfo
     {

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Using.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Using.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Using.n	Fri Nov  3 12:21:33 2006
@@ -21,7 +21,7 @@
       fileIndex : int,
       line      : int,
       col       : int,
-      source    : ISourceTextManager
+      source    : ISource
     )
       : array[CompletionElem]
     {

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n	Fri Nov  3 12:21:33 2006
@@ -29,7 +29,7 @@
       [NotNull] filePath : string, 
                 line     : int,
                 col      : int,
-      [NotNull] source   : ISourceTextManager
+      [NotNull] source   : ISource
     )
       : array[CompletionElem]
     {
@@ -120,7 +120,7 @@
       [NotNull] filePath : string,
                 line     : int,
                 col      : int,
-      [NotNull] source   : ISourceTextManager
+      [NotNull] source   : ISource
     )
       : QuickTipInfo
     {
@@ -140,7 +140,7 @@
       [NotNull] filePath : string,
                 line     : int,
                 col      : int,
-      [NotNull] source   : ISourceTextManager
+      [NotNull] source   : ISource
     )
       : array [GotoInfo]
     {
@@ -162,7 +162,7 @@
 
     public Check(
       /*[NotNull]*/ fileName        : string,
-      /*[NotNull]*/ source          : ISourceTextManager,
+      /*[NotNull]*/ source          : ISource,
       /*[NotNull]*/ addHiddenRegion : AddHiddenRegion,
       /*[NotNull]*/ addError        : AddError
     )
@@ -397,7 +397,7 @@
       [NotNull] filePath : string,
                 line     : int,
                 col      : int,
-      [NotNull] source   : ISourceTextManager
+      [NotNull] source   : ISource
     )
       : MethodTipInfo
     {

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.Init.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.Init.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.Init.n	Fri Nov  3 12:21:33 2006
@@ -106,7 +106,7 @@
       throw System.Exception("Tag not found.");
     }
 
-    private class TestSourceTextManager : ISourceTextManager
+    private class TestSourceTextManager : ISource
     {
       public this(filePath : string)
       {
@@ -146,12 +146,12 @@
         throw NotImplementedException();
       }
 
-      public GetNearestPosition(_line : int, _col : int) : int
+      public GetPositionOfLineIndex(_line : int, _col : int) : int
       {
         throw NotImplementedException();
       }
 
-      public GetLineAndColumn(_pos : int) : int * int
+      public GetLineIndexOfPosition(_pos : int) : int * int
       {
         throw NotImplementedException();
       }

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n	Fri Nov  3 12:21:33 2006
@@ -46,8 +46,8 @@
       def (line, col) = ReadLocation(file, $"Start block 1");
       def txtMan = ProjectManager.SimpleSourceTextManager(File.ReadAllText(file));
 
-      def pos = txtMan.ToPosition(line, col);
-      def (line2, col2) = txtMan.GetLineAndColumn(pos);
+      def pos = txtMan.GetPositionOfLineIndex(line, col);
+      def (line2, col2) = txtMan.GetLineIndexOfPosition(pos);
 
       Assert.AreEqual(line2, line);
       Assert.AreEqual(col2,  col);
@@ -81,12 +81,14 @@
 
     private SimpleSourceTextManager_Start_block(blockNum : int, testStr : string) : void
     {
+      def testStr = testStr.Replace("\r\n", "\n");
       def file = FilePath1;
       def (line, col) = ReadLocation(file, $"Start block $blockNum");
       def (endLine, endCol) = ReadLocation(file, $"End block $blockNum");
       def txtMan = ProjectManager.SimpleSourceTextManager(File.ReadAllText(file));
 
       def result = txtMan.GetRegion(line, col, endLine, endCol);
+      def result = result.Replace("\r\n", "\n");
 
       Assert.IsNotNull(result, "result is null");
       Assert.AreEqual (result, testStr);

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TextManagement/IProjectManager.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TextManagement/IProjectManager.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TextManagement/IProjectManager.n	Fri Nov  3 12:21:33 2006
@@ -5,6 +5,6 @@
 {
   public interface IProjectManager
   {
-    GetSourceManager(filePath : string) : ISourceTextManager
+    GetSourceManager(filePath : string) : ISource
   }
 }

Copied: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TextManagement/ISource.n (from rev 6824, vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TextManagement/ISourceTextManager.n)
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TextManagement/ISourceTextManager.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TextManagement/ISource.n	Fri Nov  3 12:21:33 2006
@@ -3,12 +3,12 @@
 
 namespace Nemerle.Completion2
 {
-  public interface ISourceTextManager
+  public interface ISource
   {
     GetRegion(lineStart : int, colStart : int, lineEnd : int, colEnd : int) : string;
     GetRegion(location : Location) : string;
     GetLine(line : int) : string;
-    GetNearestPosition(line : int, col : int) : int;
-    GetLineAndColumn(pos  : int) : int * int;
+    GetPositionOfLineIndex(line : int, col : int) : int;
+    GetLineIndexOfPosition(pos  : int) : int * int;
   }
 }

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TextManagement/ProjectManager.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TextManagement/ProjectManager.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TextManagement/ProjectManager.n	Fri Nov  3 12:21:33 2006
@@ -5,28 +5,21 @@
 namespace Nemerle.Completion2
 {
   [Record]
-  class ProjectManager : IProjectManager
+  public class ProjectManager : IProjectManager
 	{
     [Accessor] _engine : Engine;
 
     /// Get manager of code file.
-    public virtual GetSourceManager(filePath : string) : ISourceTextManager
+    public virtual GetSourceManager(filePath : string) : ISource
     {
       SimpleSourceTextManager(this.Engine.Sources[filePath])
     }
 
     [Record]
-    internal class SimpleSourceTextManager : ISourceTextManager
+    internal class SimpleSourceTextManager : ISource
     {
       [Accessor] _code : string;
 
-      /// Convert location (line/char coordinate) to position (character offset).
-      /// Coordinats is 1 based.
-      public ToPosition(line : int, @char : int) : int
-      {
-        ToPositionImpl(0, 0, 0, line - 1, @char - 1)
-      }
-
       /// !!! Coordinats is zero based!
       private ToPositionImpl(
         startLine     : int, 
@@ -113,11 +106,16 @@
           Code.Substring(startPos, Code.Length - startPos);
       }
 
-      public GetNearestPosition(_line : int, _col : int) : int { throw NotImplementedException(); }
+      /// Convert location (line/char coordinate) to position (character offset).
+      /// Coordinats is 1 based.
+      public GetPositionOfLineIndex(line : int, @char : int) : int
+      {
+        ToPositionImpl(0, 0, 0, line - 1, @char - 1);
+      }
 
       /// Return coordinate corresponding to given position.
       /// "position" is zero based. Returning coordinate is 1 based.
-      public GetLineAndColumn(position : int) : int * int
+      public GetLineIndexOfPosition(position : int) : int * int
       {
         mutable i = 0;
         def code  = Code;

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	Fri Nov  3 12:21:33 2006
@@ -16,7 +16,7 @@
   {
     public GetMethodBody(
       this /*[NotNull]*/ method   : MethodBuilder,
-           /*[NotNull]*/ source   : ISourceTextManager
+           /*[NotNull]*/ source   : ISource
     )
       : PExpr * TExpr * Exception
     {

Modified: vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleAuthoringScope.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleAuthoringScope.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleAuthoringScope.cs	Fri Nov  3 12:21:33 2006
@@ -26,7 +26,7 @@
 			_overloadPossibility = overloadPossibility;
 		}
 
-		public NemerleAuthoringScope(ProjectInfo project, AuthoringSink sink, string filePath, ISourceTextManager source)
+		public NemerleAuthoringScope(ProjectInfo project, AuthoringSink sink, string filePath, ISource source)
 			: this(project, sink)
 		{
 			_filePath   = filePath;
@@ -54,7 +54,7 @@
 		private Methods            _methods;
 		private ProjectInfo        _project;
 		private string             _filePath;
-		private ISourceTextManager _sourceText;
+		private ISource _sourceText;
 
 		#endregion
 

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 Nov  3 12:21:33 2006
@@ -228,7 +228,7 @@
 
 				projectInfo.Project.Check(
 					request.FileName,
-					new SourceTextManager(this, request.View),
+					new SourceTextManager(projectInfo.GetSource(request.FileName)),
 					delegate(Location location, string text, bool isExpanded)
 					{
 						NewHiddenRegion r = new NewHiddenRegion();
@@ -279,7 +279,8 @@
 				return null;
 
 			return new NemerleAuthoringScope(
-				projectInfo, request.Sink, request.FileName, new SourceTextManager(this, request.View));
+				projectInfo, request.Sink, request.FileName,
+				new SourceTextManager(projectInfo.GetSource(request.FileName)));
 		}
 
 		private AuthoringScope GetCompleteWord(ParseRequest request)
@@ -292,7 +293,8 @@
 					return null;
 
 				CompletionElem[] overloads = projectInfo.CompleteWord(
-					request.FileName, request.Line, request.Col, new SourceTextManager(this, request.View));
+					request.FileName, request.Line, request.Col,
+					new SourceTextManager(projectInfo.GetSource(request.FileName)));
 
 				if (overloads.Length > 0)
 					return new NemerleAuthoringScope(projectInfo, request.Sink, overloads);
@@ -323,7 +325,8 @@
 			}
 
 			NemerleMethods methods = projectInfo.GetMethodTip(
-				request.FileName, request.Line, col, new SourceTextManager(this, request.View));
+				request.FileName, request.Line, col,
+				new SourceTextManager(projectInfo.GetSource(request.FileName)));
 
 			if (methods != null)
 			{
@@ -357,7 +360,12 @@
 			return GetDefaultScope(request);
 		}
 
-		private string GetCodeRegion(ParseRequest request, int startLine, int startCol, int endLine, int endCol)
+		private string GetCodeRegion(
+			ParseRequest request, 
+			int startLine, 
+			int startCol, 
+			int endLine, int endCol
+		)
 		{
 			string region;
 
@@ -377,8 +385,10 @@
 
 		private AuthoringScope GetDefaultScope(ParseRequest request)
 		{
+			ProjectInfo projectInfo = ProjectInfo.FindProject(request.FileName);
 			return new NemerleAuthoringScope(
-				ProjectInfo.FindProject(request.FileName), request.Sink, request.FileName, new SourceTextManager(this, request.View));
+				projectInfo, request.Sink, request.FileName,
+				new SourceTextManager(projectInfo.GetSource(request.FileName)));
 		}
 
 		private ProjectInfo GetProjectInfo(ParseRequest request)
@@ -430,7 +440,12 @@
 			return base.GetImageList();
 		}
 
-		public override int ValidateBreakpointLocation(IVsTextBuffer buffer, int line, int col, TextSpan[] pCodeSpan)
+		public override int ValidateBreakpointLocation(
+			IVsTextBuffer buffer, 
+			int line, 
+			int col, 
+			TextSpan[] pCodeSpan
+		)
 		{
 			if (pCodeSpan != null)
 			{
@@ -492,7 +507,9 @@
 
 		private int classNameCounter = 0;
 
-		public override ExpansionFunction CreateExpansionFunction(ExpansionProvider provider, string functionName)
+		public override ExpansionFunction CreateExpansionFunction(
+			ExpansionProvider provider, 
+			string functionName)
 		{
 			ExpansionFunction function = null;
 
@@ -534,12 +551,15 @@
 			else
 				expansionsList.Clear();
 
-			IVsTextManager2 textManager = Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(SVsTextManager)) as IVsTextManager2;
+			IVsTextManager2 textManager = 
+				Microsoft.VisualStudio.Shell.Package.GetGlobalService(
+				typeof(SVsTextManager)) as IVsTextManager2;
 
 			if (textManager == null)
 				return;
 
-			SnippetsEnumerator enumerator = new SnippetsEnumerator(textManager, GetLanguageServiceGuid());
+			SnippetsEnumerator enumerator = new SnippetsEnumerator(
+				textManager, GetLanguageServiceGuid());
 
 			foreach (VsExpansion expansion in enumerator)
 				if (!string.IsNullOrEmpty(expansion.shortcut))

Added: vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/ProjectManager.cs
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/ProjectManager.cs	Fri Nov  3 12:21:33 2006
@@ -0,0 +1,35 @@
+using System;
+using Nemerle.Completion2;
+using Nemerle.VisualStudio.Project;
+
+namespace Nemerle.VisualStudio.LanguageService
+{
+	class ProjectManager : Nemerle.Completion2.ProjectManager
+	{
+		public ProjectManager(NemerleLanguageService languageService, Engine engine)
+			: base(engine)
+		{
+			ErrorHelper.ThrowIsNull(languageService, "languageService");
+			_languageService = languageService;
+		}
+
+		NemerleLanguageService _languageService;
+
+		/// Get manager of code file.
+		public override ISource GetSourceManager(string filePath)
+		{
+			ProjectInfo info = ProjectInfo.FindProject(filePath);
+			if (info == null)
+				throw new ArgumentException("File '" + filePath + "' not in the project.",
+					filePath);
+			else
+			{
+				NemerleSource source = info.GetSource(filePath);
+				if (source == null)
+					return base.GetSourceManager(filePath);
+				else
+					return new SourceTextManager(info.GetSource(filePath));
+			}
+		}
+	}
+}

Modified: vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/SourceTextManager.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/SourceTextManager.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/SourceTextManager.cs	Fri Nov  3 12:21:33 2006
@@ -11,48 +11,27 @@
 
 namespace Nemerle.VisualStudio.LanguageService
 {
-	class SourceTextManager : ISourceTextManager
+	class SourceTextManager : ISource
 	{
-		public SourceTextManager(NemerleLanguageService service, IVsTextView view)
+		public SourceTextManager(NemerleSource source)
 		{
-			_view    = view;
-			_service = service;
+			_source  = source;
 		}
 
-		IVsTextView            _view;
-		NemerleLanguageService _service;
-
-		private IVsTextLines _textLines;
 		public  IVsTextLines  TextLines
 		{
-			get
-			{
-				if (_textLines == null)
-					_view.GetBuffer(out _textLines);
-
-				return _textLines;
-			}
+			get { return Source.GetTextLines(); }
 		}
 
 		private NemerleSource _source;
 		public  NemerleSource  Source
 		{
-			get
-			{
-				if (_source == null)
-					_source = (NemerleSource)_service.GetSource(TextLines);
-				return _source;
-			}
+			get { return _source; }
 		}
 
 		public string GetRegion(int lineStart, int colStart, int lineEnd, int colEnd)
 		{
-			string region;
-
-			if (_view.GetTextStream(lineStart - 1, colStart- 1, lineEnd - 1, colEnd - 1, out region) == VSConstants.S_OK)
-				return region;
-
-			return "";
+			return Source.GetText(lineStart - 1, colStart - 1, lineEnd - 1, colEnd - 1);
 		}
 
 		public string GetRegion(Location loc)
@@ -81,17 +60,16 @@
 			return Source.GetLine(line);
 		}
 
-		public int GetNearestPosition(int line, int col)
+		public int GetPositionOfLineIndex(int line, int col)
 		{
-			int pos, spaces;
-			return _view.GetNearestPosition(line - 1, col - 1, out pos, out spaces) == VSConstants.S_OK? pos: -1;
+			return Source.GetPositionOfLineIndex(line - 1, col - 1);
 		}
 
-		public Tuple<int, int> GetLineAndColumn(int pos)
+		public Tuple<int, int> GetLineIndexOfPosition(int pos)
 		{
 			int line, col;
 
-			_view.GetLineAndColumn(pos, out line, out col);
+			Source.GetLineIndexOfPosition(pos, out line, out col);
 
 			return new Tuple<int,int>(line + 1, col + 1);
 		}

Modified: vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VsIntegration.csproj
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VsIntegration.csproj	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VsIntegration.csproj	Fri Nov  3 12:21:33 2006
@@ -139,6 +139,7 @@
     <Compile Include="LanguageService\NemerleLanguageService.cs" />
     <Compile Include="LanguageService\NemerleScanner.cs" />
     <Compile Include="LanguageService\NemerleSource.cs" />
+    <Compile Include="LanguageService\ProjectManager.cs" />
     <Compile Include="LanguageService\SourceTextManager.cs" />
     <Compile Include="NemerlePackage.cs" />
     <Compile Include="Project\NemerleAssemblyReference.cs" />

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	Fri Nov  3 12:21:33 2006
@@ -36,6 +36,7 @@
 			string             location
 		)
 		{
+			ErrorHelper.ThrowIsNull(projectNode, "projectNode");
 			ErrorHelper.ThrowIsNull(hierarchy, "hierarchy");
 
 			_projectNode = projectNode;
@@ -345,13 +346,13 @@
 			get { return Engine.Project; }
 		}
 
-		public CompletionElem[] CompleteWord(string filePath, int line, int col, ISourceTextManager source)
+		public CompletionElem[] CompleteWord(string filePath, int line, int col, ISource source)
 		{
 			ErrorHelper.ThrowIfPathNullOrEmpty(filePath, "filePath");
 			return Project.CompleteWord(filePath, line + 1, col + 1, source);
 		}
 
-		public QuickTipInfo GetQuickTip(string filePath, int line, int col, ISourceTextManager source)
+		public QuickTipInfo GetQuickTip(string filePath, int line, int col, ISource source)
 		{
 			ErrorHelper.ThrowIfPathNullOrEmpty(filePath, "filePath");
 
@@ -363,13 +364,13 @@
 			return info;
 		}
 
-		public GotoInfo[] GetGoto(string filePath, int line, int col, ISourceTextManager source)
+		public GotoInfo[] GetGoto(string filePath, int line, int col, ISource source)
 		{
 			ErrorHelper.ThrowIfPathNullOrEmpty(filePath, "filePath");
 			return Project.GetGotoInfo(filePath, line + 1, col + 1, source);
 		}
 
-		public NemerleMethods GetMethodTip(string filePath, int line, int col, ISourceTextManager source)
+		public NemerleMethods GetMethodTip(string filePath, int line, int col, ISource source)
 		{
 			ErrorHelper.ThrowIfPathNullOrEmpty(filePath, "filePath");
 



More information about the svn mailing list