[svn] r6688: vs-plugin/trunk/Nemerle.VsIntegration: CodeSnippets/Snippets/if.snippet Engine/Analyzer.cs En...

IT svnadmin at nemerle.org
Sun Sep 24 05:01:24 CEST 2006


Log:
C# integration project refactoring.

Author: IT
Date: Sun Sep 24 05:01:12 2006
New Revision: 6688

Added:
   vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleDeclarations.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Project/
Removed:
   vs-plugin/trunk/Nemerle.VsIntegration/Engine/Analyzer.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Engine/Definitions.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Engine/Engine.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Engine/Inferred.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Engine/Locator.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Engine/Scope.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Engine/ScopeWalker.cs
   vs-plugin/trunk/Nemerle.VsIntegration/NemerleCodeDomProvider.cs
   vs-plugin/trunk/Nemerle.VsIntegration/NemerlePackage.cs
   vs-plugin/trunk/Nemerle.VsIntegration/NemerleScope.cs
   vs-plugin/trunk/Nemerle.VsIntegration/NemerleSink.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Package/NemerleDeclarations.cs
Modified:
   vs-plugin/trunk/Nemerle.VsIntegration/CodeSnippets/Snippets/if.snippet
   vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleAuthoringScope.cs
   vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleAuthoringSink.cs
   vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleLanguageService.cs
   vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleScanner.cs
   vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleSource.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VsIntegration.csproj
   vs-plugin/trunk/Nemerle.VsIntegration/Package/NemerleProjectPackage.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/ClassLibrary/ClassLibrary.nproj
   vs-plugin/trunk/Nemerle.VsIntegration/Utils.cs

Modified: vs-plugin/trunk/Nemerle.VsIntegration/CodeSnippets/Snippets/if.snippet
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/CodeSnippets/Snippets/if.snippet	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/CodeSnippets/Snippets/if.snippet	Sun Sep 24 05:01:12 2006
@@ -29,8 +29,7 @@
           <Default>false</Default>
         </Literal>
       </Declarations><Code Language="nemerle">
-<![CDATA[if ($expression$) $selected$$TrueExpr$ else $FalseExpr$$end$
-]]>
+				<![CDATA[if ($expression$) $selected$$TrueExpr$ else $FalseExpr$$end$]]>
 			</Code>
 		</Snippet>
 	</CodeSnippet>

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	Sun Sep 24 05:01:12 2006
@@ -8,7 +8,7 @@
 
 using Microsoft.Samples.VisualStudio.LanguageService;
 
-namespace Nemerle.VisualStudio.Package
+namespace Nemerle.VisualStudio.LanguageService
 {
 	class NemerleAuthoringScope : AuthoringScope
 	{

Modified: vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleAuthoringSink.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleAuthoringSink.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleAuthoringSink.cs	Sun Sep 24 05:01:12 2006
@@ -4,7 +4,7 @@
 
 using Microsoft.Samples.VisualStudio.LanguageService;
 
-namespace Nemerle.VisualStudio.Package
+namespace Nemerle.VisualStudio.LanguageService
 {
 	public class NemerleAuthoringSink : AuthoringSink
 	{

Added: vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleDeclarations.cs
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleDeclarations.cs	Sun Sep 24 05:01:12 2006
@@ -0,0 +1,126 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+
+using Microsoft.VisualStudio.Package;
+using Microsoft.VisualStudio.TextManager.Interop;
+
+using Nemerle.Completion2;
+
+namespace Nemerle.VisualStudio.LanguageService
+{
+	public class NemerleDeclarations : Declarations
+	{
+		readonly CompletionElem[] _overloadPossibility;
+
+		public NemerleDeclarations(CompletionElem[] overloadPossibility)
+		{
+			_overloadPossibility = overloadPossibility;
+			Sort();
+		}
+
+		[SuppressMessage("Microsoft.Design", "CA1024")]
+		public override int GetCount()
+		{
+			return _overloadPossibility.Length;
+		}
+
+		public override string GetDisplayText(int index)
+		{
+			return _overloadPossibility[index].DisplayName;
+		}
+
+		public override string GetDescription(int index)
+		{
+			return _overloadPossibility[index].Description;
+		}
+
+		public override string GetName(int index)
+		{
+			return _overloadPossibility[index].DisplayName;
+		}
+
+		public override int GetGlyph(int index)
+		{
+			return _overloadPossibility[index].GlyphType;
+		}
+
+		class ByNameComparer : IComparer<CompletionElem>
+		{
+			public static readonly ByNameComparer Instace = new ByNameComparer();
+
+			public int Compare(CompletionElem x, CompletionElem y)
+			{
+				return x.DisplayName.CompareTo(y.DisplayName);
+			}
+		}
+
+		public void Sort()
+		{
+			Array.Sort(_overloadPossibility, ByNameComparer.Instace);
+		}
+
+		// This method is called to get the string to commit to the source buffer.
+		// Note that the initial extent is only what the user has typed so far.
+		// Disable the "ParameterNamesShouldMatchBaseDeclaration" warning.
+		//
+		[SuppressMessage("Microsoft.Naming", "CA1725")]
+		public override string OnCommit(
+			IVsTextView textView, string textSoFar, char commitCharacter, int index, ref TextSpan initialExtent)
+		{
+			// We intercept this call only to get the initial extent
+			// of what was committed to the source buffer.
+
+			//commitSpan = initialExtent;
+			return base.OnCommit(textView, textSoFar, commitCharacter, index, 
+				ref initialExtent);
+		}
+
+		// This method is called after the string has been committed to the source buffer.
+		//
+		public override char OnAutoComplete(IVsTextView textView, 
+			string committedText, char commitCharacter, int index)
+		{
+			//const char defaultReturnValue = '\0';
+			//Declaration item = declarations[index] as Declaration;
+			//if (item == null)
+			//  return defaultReturnValue;
+
+			//// In this example, NemerleDeclaration identifies types with an enum.
+			//// You can choose a different approach.
+			//if (item.Type != Declaration.DeclarationType.Snippet)
+			//  return defaultReturnValue;
+			
+			//Source src = languageService.GetSource(textView);
+			//if (src == null)
+			//  return defaultReturnValue;
+			
+			//ExpansionProvider ep = src.GetExpansionProvider();
+			//if (ep == null)
+			//  return defaultReturnValue;
+			
+			//string title;
+			//string path;
+			//int commitLength = commitSpan.iEndIndex - commitSpan.iStartIndex;
+			//if (commitLength < committedText.Length)
+			//{
+			//  // Replace everything that was inserted so calculate the span of the
+			//  // full
+			//  // insertion, taking into account what was inserted when the 
+			//  // commitSpan was obtained in the first place.
+			//  commitSpan.iEndIndex += (committedText.Length - commitLength);
+			//}
+
+			//if (ep.FindExpansionByShortcut(textView, committedText, commitSpan,
+			//                               true, out title, out path) >= 0)
+			//{
+			//  ep.InsertNamedExpansion(textView, title, path, commitSpan, false);
+			//}
+			//return defaultReturnValue;
+			//throw new NotImplementedException();
+
+			return base.OnAutoComplete(textView, committedText, 
+				commitCharacter, index);
+		}
+	}
+}

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 Sep 24 05:01:12 2006
@@ -1,5 +1,3 @@
-#region impots
-
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
@@ -29,12 +27,10 @@
 
 using VsShell = Microsoft.VisualStudio.Shell.VsShellUtilities;
 
-#endregion
-
-namespace Nemerle.VisualStudio.Package
+namespace Nemerle.VisualStudio.LanguageService
 {
 	[Guid(GlobalConstants.LanguageServiceGuidString)]
-	public class NemerleLanguageService : LanguageService
+	public class NemerleLanguageService : Microsoft.VisualStudio.Package.LanguageService
 	{
 		public NemerleLanguageService()
 		{
@@ -148,7 +144,7 @@
 				_preferences.Init();
 #if DEBUG
 				//VladD2: Switch on synchronous mode for debugging purpose!
-				//TODO: Coment it if necessary.
+				//TODO: Comment it if necessary.
 				_preferences.EnableAsyncCompletion = false;
 #endif
 			}

Modified: vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleScanner.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleScanner.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleScanner.cs	Sun Sep 24 05:01:12 2006
@@ -4,7 +4,7 @@
 
 using Nemerle.Compiler;
 
-namespace Nemerle.VisualStudio.Package
+namespace Nemerle.VisualStudio.LanguageService
 {
 	class NemerleScanner : IScanner
 	{

Modified: vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleSource.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleSource.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleSource.cs	Sun Sep 24 05:01:12 2006
@@ -9,7 +9,7 @@
 
 using Microsoft.Samples.VisualStudio.LanguageService;
 
-namespace Nemerle.VisualStudio.Package
+namespace Nemerle.VisualStudio.LanguageService
 {
 	public delegate AuthoringScope ScopeCreatorCallback(ParseRequest request);
 

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	Sun Sep 24 05:01:12 2006
@@ -77,16 +77,12 @@
     <Compile Include="LibraryNode.cs" />
     <Compile Include="NemerleColorableItem.cs" />
     <Compile Include="NemerleConstants.cs" />
-    <Compile Include="Package\NemerleDeclarations.cs" />
-    <Compile Include="Package\NemerleLanguageService.cs" />
-    <Compile Include="Package\NemerleAuthoringScope.cs" />
+    <Compile Include="LanguageService\NemerleDeclarations.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="NemerleLibraryManager.cs" />
     <Compile Include="NemerleLibraryNode.cs" />
     <Compile Include="Package\NemerleMethods.cs" />
     <Compile Include="Package\NemerleProjectPackage.cs" />
-    <Compile Include="Package\NemerleScanner.cs" />
-    <Compile Include="Package\NemerleSource.cs" />
     <Compile Include="Package\NemerleViewFilter.cs" />
     <Compile Include="RegisterSnippetsAttribute.cs" />
     <Compile Include="Resources.Designer.cs">
@@ -135,8 +131,12 @@
     <Compile Include="$(VisualStudioIntegration)\Common\Source\CSharp\RegistrationAttributes\WebSiteProjectRelatedFilesAttribute.cs">
       <Link>RegistrationAttributes\WebSiteProjectRelatedFilesAttribute.cs</Link>
     </Compile>
+    <Compile Include="LanguageService\NemerleAuthoringScope.cs" />
+    <Compile Include="LanguageService\NemerleAuthoringSink.cs" />
+    <Compile Include="LanguageService\NemerleLanguageService.cs" />
+    <Compile Include="LanguageService\NemerleScanner.cs" />
+    <Compile Include="LanguageService\NemerleSource.cs" />
     <Compile Include="Package\Automation\NemerleOAFileItem.cs" />
-    <Compile Include="Package\NemerleAuthoringSink.cs" />
     <Compile Include="Utils.cs" />
     <Compile Include="ConfigurationPropertyPages.cs" />
     <Compile Include="Package\NemerleEditorFactory.cs" />
@@ -258,7 +258,7 @@
     <Service Include="{B4F97281-0DBD-4835-9ED8-7DFB966E87FF}" />
   </ItemGroup>
   <ItemGroup>
-    <Folder Include="Parsing\" />
+    <Folder Include="Project\" />
   </ItemGroup>
   <PropertyGroup>
     <TargetRegistryRoot>Software\Microsoft\VisualStudio\8.0Exp</TargetRegistryRoot>

Modified: vs-plugin/trunk/Nemerle.VsIntegration/Package/NemerleProjectPackage.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Package/NemerleProjectPackage.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Package/NemerleProjectPackage.cs	Sun Sep 24 05:01:12 2006
@@ -16,6 +16,7 @@
 using Nemerle.VsIntegration.Project;
 using Nemerle.VisualStudio.Shell;
 using Microsoft.Samples.VisualStudio.LanguageService;
+using Nemerle.VisualStudio.LanguageService;
 
 namespace Nemerle.VisualStudio.Package
 {

Modified: vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/ClassLibrary/ClassLibrary.nproj
==============================================================================

Modified: vs-plugin/trunk/Nemerle.VsIntegration/Utils.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Utils.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Utils.cs	Sun Sep 24 05:01:12 2006
@@ -8,6 +8,7 @@
 using Msbuild = Microsoft.Build.BuildEngine;
 using Nemerle.VisualStudio.Package;
 using Microsoft.VisualStudio.Package;
+using Nemerle.VisualStudio.LanguageService;
 
 namespace Nemerle
 {



More information about the svn mailing list