[svn] r7804: nemerle/trunk/ncc/codedom/NemerleCodeCompiler.n nemerle/trunk/ncc/codedom/NemerleCodeGenerato...

pbludov svnadmin at nemerle.org
Thu Oct 11 11:48:53 CEST 2007


Log:
Incomplete support for Asp.Net

Author: pbludov
Date: Thu Oct 11 11:48:36 2007
New Revision: 7804

Added:
   vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/ContainedLanguage/
   vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/ContainedLanguage/NemerleIntellisenseProvider.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Project/WANemerleProjectFactory.cs
   vs-plugin/trunk/Nemerle.VsIntegration/RegistrationAttributes/ProvideIntellisenseProviderAttribute.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebApplication/
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebApplication/Default.aspx
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebApplication/Default.aspx.n
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebApplication/Web.config
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebApplication/WebApplication.nproj
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebApplication/WebApplication.vstemplate
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebApplication/__TemplateIcon.ico   (contents, props changed)
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebService/
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebService/Service1.asmx
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebService/Service1.asmx.n
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebService/Web.config
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebService/WebService.nproj
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebService/WebService.vstemplate
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebService/__TemplateIcon.ico   (contents, props changed)
   vs-plugin/trunk/Nemerle.VsIntegration/Web/
   vs-plugin/trunk/Nemerle.VsIntegration/Web/NemerleCodeBehindCodeGenerator.cs
Modified:
   nemerle/trunk/ncc/codedom/NemerleCodeCompiler.n
   nemerle/trunk/ncc/codedom/NemerleCodeGenerator.n
   nemerle/trunk/tools/reflector-addon/src/LanguageWriter.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/NemerleCodeParser.n
   vs-plugin/trunk/Nemerle.VsIntegration/   (props changed)
   vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VisualStudio.csproj
   vs-plugin/trunk/Nemerle.VsIntegration/NemerleConstants.cs
   vs-plugin/trunk/Nemerle.VsIntegration/NemerlePackage.cs

Modified: nemerle/trunk/ncc/codedom/NemerleCodeCompiler.n
==============================================================================
--- nemerle/trunk/ncc/codedom/NemerleCodeCompiler.n	(original)
+++ nemerle/trunk/ncc/codedom/NemerleCodeCompiler.n	Thu Oct 11 11:48:36 2007
@@ -136,6 +136,8 @@
                   help = "Specify file to compile",
                   handler = fun (s) { files = s :: files })
           ];
+
+      unless (options.CompilerOptions == null)
       Getopt.Parse (Message.Error, opts,
               List.FromArray (Regex.Split (options.CompilerOptions, @"\s")).Filter (fun (t) {t.Length > 0}));
 

Modified: nemerle/trunk/ncc/codedom/NemerleCodeGenerator.n
==============================================================================
--- nemerle/trunk/ncc/codedom/NemerleCodeGenerator.n	(original)
+++ nemerle/trunk/ncc/codedom/NemerleCodeGenerator.n	Thu Oct 11 11:48:36 2007
@@ -1116,9 +1116,8 @@
     protected override OutputMemberAccessModifier (attributes : MemberAttributes) : void
     {
       def output = Output;
-      def accessMask = attributes %& MemberAttributes.AccessMask;
       
-      match (accessMask)
+      match (attributes %& MemberAttributes.AccessMask)
       {
         | MemberAttributes.Public => 
           output.Write("public ");
@@ -1135,7 +1134,8 @@
         | MemberAttributes.FamilyOrAssembly => 
           output.Write("protected internal ");
 
-        | _ =>
+        | other =>
+          unless (other :> int == 0)
           throw NotSupportedException("Unsupported access attribute");
       }
     }
@@ -1153,7 +1153,7 @@
           output.Write("abstract ");
 
         | MemberAttributes.Final => 
-          output.Write("sealed ");
+          () // Suppress `virtual' modifier.
 
         | MemberAttributes.Static => // TODO: is static mutually exclusive with other flags?
           output.Write("static ");
@@ -1161,7 +1161,14 @@
         | MemberAttributes.Override => 
           output.Write("override ");
 
-        | _ => ()
+        | _ =>
+          match (attributes %& MemberAttributes.AccessMask)
+          {
+            | MemberAttributes.Private =>
+              () // `private virtual' modifier is supported by the CLI, but is not supported by the compiler.
+            | _ =>
+              output.Write("virtual ");
+          }
       }
     }
 

Modified: nemerle/trunk/tools/reflector-addon/src/LanguageWriter.n
==============================================================================
--- nemerle/trunk/tools/reflector-addon/src/LanguageWriter.n	(original)
+++ nemerle/trunk/tools/reflector-addon/src/LanguageWriter.n	Thu Oct 11 11:48:36 2007
@@ -342,16 +342,16 @@
       WriteKeyword(
         match ((thenPresent, elsePresent))
         {
-        | (true, false)  => "when";
+        | (true, false)
+        | (false, false) => "when";
         | (false, true)  => "unless";
         | (true, true)   => "if";
-        | (false, false) => throw NotSupportedException("Condition statement without a body");
         });
 
       Write(" (");
       WriteExpression(value.Condition);
       Write(")");
-      WriteBlockStatement(if (thenPresent) value.Then; else value.Else);
+      WriteBody(if (thenPresent) value.Then; else value.Else);
       when (thenPresent && elsePresent)
       {
         WriteKeyword("else");

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/NemerleCodeParser.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/NemerleCodeParser.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/NemerleCodeParser.n	Thu Oct 11 11:48:36 2007
@@ -27,25 +27,230 @@
 {
   // now CodeDomParser only parses files from Project.CompileUnits
   // it is not thread-safe at the moment!
-  public class NemerleCodeParser : ICodeParser
-  {
+
+  /// <summary>
+  /// Provides an implementation of the <see cref="T:System.CodeDom.Compiler.ICodeParser"/> interface.
+  /// </summary>
+  public class NemerleCodeParser : ManagerClass, ICodeParser
+  {
+    /// <summary>
+    /// Initializes a new instance of the <see cref="T:Nemerle.Compiler.NemerleCodeParser"/> class.
+    /// </summary>
+    public this ()
+    {
+      base (CompilationOptions());
+      InitCompiler ();
+      LoadExternalLibraries ();
+    }
+
     // now needed only for AsObject
     protected mutable _manager : ManagerClass;
 
     // TODO: do we need to make it type-safe
     protected mutable _currentMethod : MethodBuilder;
 
-    public this(manager: ManagerClass = null)
+    /// <summary>
+    /// Compiles the specified text stream into a <see cref="T:System.CodeDom.CodeCompileUnit"/>
+    ///.</summary>
+    /// <param name="codeStream">A <see cref="T:System.IO.TextReader"/>
+    /// that is used to read the code to be parsed.</param>
+    /// <returns>
+    /// A <see cref="T:System.CodeDom.CodeCompileUnit"/> containing the code
+    /// model produced from parsing the code.
+    /// </returns>
+    public Parse(codeStream: TextReader) : CodeCompileUnit
+    {
+      def oldMan   = ManagerClass.Instance;
+      def topDecls = 
+        try
+        {
+          def lexer = LexerString (this, codeStream.ReadToEnd(), Location.Default);
+          ParsingPipeline (lexer);
+        }
+        finally
     {
-      _manager = if (manager != null) manager
-                 else ManagerClass.Instance;
+          ManagerClass.Instance = oldMan;
     }
 
-    // AKhropov: TODO
-    public Parse(codeStream: TextReader) : CodeCompileUnit
+      def unit = CodeCompileUnit();
+
+      mutable lastNamespace;
+      mutable codeDomNamespace;
+
+      topDecls.Iter (fun(decl: TopDeclaration) {
+      | TopDeclaration.Class as cls =>
+
+        unless (cls.ParsedName.context.CurrentNamespace.Equals(lastNamespace))
     {
-      _ = codeStream;
-      throw NotImplementedException("Psrsing of text files is not implemented!");
+          lastNamespace = cls.ParsedName.context.CurrentNamespace;
+          codeDomNamespace = ToCodeNamespace(cls.ParsedName.context.CurrentNamespace);
+          _ = unit.Namespaces.Add(codeDomNamespace);
+        }
+
+        _ = codeDomNamespace.Types.Add(ToCodeTypeDeclaration(cls));
+
+      | _ =>
+        throw NotSupportedException($"$decl is not supported");
+      });
+
+      unit;
+    }
+
+    protected virtual ToCodeNamespace(ns : NamespaceTree.Node) : CodeNamespace
+    {
+      CodeNamespace(ns.GetDisplayName());
+    }
+
+    protected virtual ToCodeTypeDeclaration(cls : TopDeclaration.Class) : CodeTypeDeclaration
+    {
+      def ty = CodeTypeDeclaration(cls.Name);
+      ty.BaseTypes.AddRange(cls.t_extends.Map(ToCodeTypeReference).ToArray());
+      ty.TypeParameters.AddRange(ToCodeTypeParameters(cls.typarms).ToArray());
+      ty.Members.AddRange(cls.decls.Map(ToCodeTypeMember).ToArray());
+      ty;
+    }
+
+    protected virtual ToCodeTypeReference(expr : PExpr) : CodeTypeReference
+    {
+      CodeTypeReference(expr.ToString());
+    }
+
+    protected virtual ToCodeTypeParameter(tyvar : Splicable) : CodeTypeParameter
+    {
+      CodeTypeParameter(tyvar.GetName().Id);
+    }
+
+    protected virtual ToCodeTypeParameters(typarms : Typarms) : list [CodeTypeParameter]
+    {
+      def toCodeTypeParameter(tyvar : Splicable) : CodeTypeParameter
+      {
+        def tyParm = ToCodeTypeParameter(tyvar);
+        typarms.constraints
+          .Filter(c => c.tyvar.Equals(tyvar))
+          .Iter  (c => _ = tyParm.Constraints.Add(ToCodeTypeReference(c.ty)));
+        tyParm;
+      }
+
+      typarms.tyvars.Map(toCodeTypeParameter);
+    }
+
+    protected virtual ToMemberAttributes(attrs : NemerleAttributes) : MemberAttributes
+    {
+      mutable memberAttrs: MemberAttributes;
+
+      when(attrs %&& NemerleAttributes.Static)  memberAttrs |= MemberAttributes.Static;
+      when(attrs %&& NemerleAttributes.Public)  memberAttrs |= MemberAttributes.Public;
+      when(attrs %&& NemerleAttributes.Private) memberAttrs |= MemberAttributes.Private;
+
+      if(attrs %&& NemerleAttributes.Internal && attrs %&& NemerleAttributes.Protected)
+        memberAttrs |= MemberAttributes.FamilyOrAssembly
+      else
+      {
+        when(attrs %&& NemerleAttributes.Internal)  memberAttrs |= MemberAttributes.Assembly;
+        when(attrs %&& NemerleAttributes.Protected) memberAttrs |= MemberAttributes.Family;
+      }
+
+      when(attrs %&& NemerleAttributes.New)      memberAttrs |= MemberAttributes.New;
+      when(attrs %&& NemerleAttributes.Override) memberAttrs |= MemberAttributes.Override;
+      when(attrs %&& NemerleAttributes.Sealed)   memberAttrs |= MemberAttributes.Final;
+
+      memberAttrs;
+    }
+
+    protected virtual ToCodeMemberField(field : ClassMember.Field) : CodeMemberField
+    {
+      CodeMemberField (ToCodeTypeReference (field.ty), field.Name);
+    }
+
+    protected virtual ToCodeMemberMethod(func : ClassMember.Function) : CodeMemberMethod
+    {
+      def codeMethod =
+        match(func.Name)
+        {
+          | ".ctor"  => CodeConstructor()
+          | ".cctor" => CodeTypeConstructor()
+          | "Main" when func.Attributes %&& NemerleAttributes.Static
+                     => CodeEntryPointMethod()
+          | _        => CodeMemberMethod()
+        };
+
+      codeMethod.Name = func.Name;
+      codeMethod.ReturnType = ToCodeTypeReference(func.header.ret_type);
+      //TODO: codeMethod.ReturnTypeCustomAttributes.AddRange(???.ToArray());
+      codeMethod.Parameters.AddRange(func.header.parms.Map(ToCodeParameterDeclarationExpression).ToArray());
+      codeMethod.ImplementationTypes.AddRange(func.implemented.Map(ToCodeTypeReference).ToArray());
+      //TODO: codeMethod.PrivateImplementationType = ???
+      codeMethod.TypeParameters.AddRange(ToCodeTypeParameters(func.header.typarms).ToArray());
+      codeMethod.Statements.AddRange(ToStatements(func.Body).ToArray());
+
+      codeMethod;
+    }
+
+    protected virtual ToCodeParameterDeclarationExpression(parm : Parsetree.Fun_parm) : CodeParameterDeclarationExpression
+    {
+      def codeParam = CodeParameterDeclarationExpression(ToCodeTypeReference(parm.ty), parm.Name);
+      codeParam.CustomAttributes.AddRange(parm.modifiers.GetCustomAttributes().Map(ToCodeAttributeDeclaration).ToArray());
+      //codeParam.Direction = ???
+      codeParam;
+    }
+
+    protected virtual ToCodeMemberProperty(prop : ClassMember.Property) : CodeMemberProperty
+    {
+      def codeProperty = CodeMemberProperty();
+      codeProperty.Name = prop.Name;
+      //TODO: codeProperty.ImplementationTypes.AddRange(???(ToCodeTypeReference).ToArray());
+      //TODO: codeProperty.PrivateImplementationType = ???
+      //TODO: codeProperty.Parameters = ???
+      match (prop.get)
+      {
+      | Some (m) => codeProperty.GetStatements.AddRange(ToStatements(m.Body).ToArray());
+      | None     => ()
+      }
+
+      match (prop.set)
+      {
+      | Some (m) => codeProperty.SetStatements.AddRange(ToStatements(m.Body).ToArray());
+      | None     => ()
+      }
+
+      codeProperty;
+    }
+
+    protected virtual ToCodeMemberEvent(evt : ClassMember.Event) : CodeMemberEvent
+    {
+      def codeEvent = CodeMemberEvent();
+      codeEvent.Name = evt.Name;
+      codeEvent.Type = ToCodeTypeReference(evt.ty);
+      //TODO: codeProperty.ImplementationTypes.AddRange(???(ToCodeTypeReference).ToArray());
+      //TODO: codeProperty.PrivateImplementationType = ???
+
+      codeEvent;
+    }
+
+    protected virtual ToCodeTypeMember(member : ClassMember) : CodeTypeMember
+    {
+      def codeMember =
+        match (member)
+        {
+        | ClassMember.TypeDeclaration as tyDecl
+          when tyDecl.td is TopDeclaration.Class => ToCodeTypeDeclaration(tyDecl.td :> TopDeclaration.Class);
+        | ClassMember.Field    as field => ToCodeMemberField(field);
+        | ClassMember.Function as func  => ToCodeMemberMethod(func);
+        | ClassMember.Property as prop  => ToCodeMemberProperty(prop);
+        | ClassMember.Event    as evt   => ToCodeMemberEvent(evt);
+        //| ClassMember.EnumOption as enm => null;
+        | _ => throw NotSupportedException($"$member not supported");
+        }
+
+      codeMember.Attributes = ToMemberAttributes (member.Attributes);
+      codeMember.CustomAttributes.AddRange(member.modifiers.GetCustomAttributes().Map(ToCodeAttributeDeclaration).ToArray());
+
+      codeMember;
+    }
+
+    protected virtual ToCodeAttributeDeclaration(attr : PExpr) : CodeAttributeDeclaration
+    {
+      CodeAttributeDeclaration(ToCodeTypeReference(attr));
     }
 
     protected ProcessTypeDeclaration(typeDecl: TypeBuilder) : CodeTypeDeclaration
@@ -89,7 +294,7 @@
       
       //TODO: adds usings directives
 
-      //AddToNamespace(cls, codeClass);
+      //AddToCodeNamespace(cls, codeClass);
 
       //TODO: Add Location ?
 
@@ -225,17 +430,10 @@
         {
           | Constructor when method.IsStatic => CodeTypeConstructor()
           | Constructor => CodeConstructor()
-          | _ when method.Name == "Main" => CodeEntryPointMethod()
-          | _ when method.Name == ".ctor" =>  // TODO
-            throw CodeDomSerializerException($"Didn't expect that method: $method",
-                                               CodeLinePragma(method.Location.File, method.Location.Line)); 
-            /*
-            if(method.Attributes %&& NemerleAttributes.Static)
-              CodeTypeConstructor();
-            else
-              CodeConstructor();
-            */
-          | _ => CodeMemberMethod()
+          | Method      when method.IsStatic
+            && method.Name == "Main"         => CodeEntryPointMethod()
+          | Method                           => CodeMemberMethod()
+          | other                            => throw NotSupportedException($"Unsupported method kind: `$other'");
         };
 
       methodDecl.Attributes = CodeDomHelper.GetMemberAttributes(method.Attributes, false);
@@ -447,17 +645,46 @@
               yield CodeAssignStatement(ToExpression(expr1), ToExpression(<[ $expr1 + $expr2 ]>))
           }
 
+        | <[ $expr1 -= $expr2 ]> => 
+          match (expr1)
+          {
+            | <[ $obj.$member ]> when member.TypedObject is IEvent =>
+              yield CodeRemoveEventStatement(ToExpression(obj), 
+                member.TypedObject.Name, ToExpression(expr2))
+                
+            | _ =>
+              yield CodeAssignStatement(ToExpression(expr1), ToExpression(<[ $expr1 - $expr2 ]>))
+          }
+
         | <[ $target = $source ]> =>
           yield CodeAssignStatement(ToExpression(target), ToExpression(source))
 
-        | <[ mutable $_ = $val ]> | <[ def $_ = $val ]> =>
+        | <[ mutable $expr = $val ]> with isMutable = true
+        | <[ def $expr = $val ]>     with isMutable = false =>
 
-          def variable = (expr.TypedObject :> TExpr.DefValIn).name;
+          def (expr, tyRef) = 
+            match (expr)
+            {
+            | PExpr.TypeEnforcement (expr, ty) => (expr, ToCodeTypeReference (ty));
+            | _ => (expr, CodeTypeReference ());
+            }
 
-          if (val != null)
-            yield CodeVariableDeclarationStatement(ToTypeRef(variable.Type), variable.Name, ToExpression(val))
-          else
-            yield CodeVariableDeclarationStatement(ToTypeRef(variable.Type), variable.Name)
+          def name =
+            match (expr)
+            {
+            | PExpr.Ref (name) => name.Id;
+            | _                => throw NotSupportedException($"$expr not supported");
+            }
+
+          def statement = 
+            match (val)
+            {
+            | null => CodeVariableDeclarationStatement(tyRef, name);
+            | _    => CodeVariableDeclarationStatement(tyRef, name, ToExpression(val))
+            }
+
+          statement.UserData["mutable"] = isMutable;
+          yield statement;
 
         | <[ when ($cond) $expr ]> =>
           yield CodeConditionStatement(ToExpression(cond), ToStatements(expr).ToArray())

Added: vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/ContainedLanguage/NemerleIntellisenseProvider.cs
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/ContainedLanguage/NemerleIntellisenseProvider.cs	Thu Oct 11 11:48:36 2007
@@ -0,0 +1,348 @@
+using System;
+using System.CodeDom;
+using System.CodeDom.Compiler;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
+using System.Runtime.InteropServices;
+
+using Microsoft.VisualStudio.Shell.Interop;
+using Microsoft.VisualStudio.TextManager.Interop;
+using ErrorHandler = Microsoft.VisualStudio.ErrorHandler;
+using VSConstants = Microsoft.VisualStudio.VSConstants;
+
+namespace Nemerle.VisualStudio.LanguageService.ContainedLanguage
+{
+	/// <summary>
+	/// This class is used to store the information about one specific instance
+	/// of EnvDTE.FileCodeModel.
+	/// </summary>
+	internal class FileCodeModelInfo {
+		private readonly EnvDTE.FileCodeModel codeModel;
+		private readonly uint itemId;
+		internal FileCodeModelInfo(EnvDTE.FileCodeModel codeModel, uint itemId) {
+			this.codeModel = codeModel;
+			this.itemId = itemId;
+		}
+
+		internal EnvDTE.FileCodeModel FileCodeModel {
+			[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+			get { return codeModel; }
+		}
+
+		internal uint ItemId {
+			[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+			get { return itemId; }
+		}
+	}
+
+	/// <summary>
+	/// This class implements an intellisense provider for Web projects.
+	/// An intellisense provider is a specialization of a language service where it is able to
+	/// run as a contained language. The main language service and main editor is usually the
+	/// HTML editor / language service, but a specific contained language is hosted for fragments
+	/// like the "script" tags.
+	/// This object must be COM visible because it will be Co-Created by the host language.
+	/// </summary>
+	[ComVisible(true)]
+	[Guid(NemerleConstants.IntellisenseProviderGuidString)]
+	public sealed class NemerleIntellisenseProvider : IVsIntellisenseProject, IDisposable {
+
+		private class SourceFileInfo {
+			private readonly string fileName;
+			private readonly uint itemId;
+			private IVsIntellisenseProjectHost hostProject;
+			private EnvDTE.FileCodeModel fileCode;
+			private CodeDomProvider codeProvider;
+
+			public SourceFileInfo(string name, uint id) {
+				fileName = name;
+				itemId = id;
+			}
+
+			public IVsIntellisenseProjectHost HostProject {
+				get { return hostProject; }
+				set {
+					if (hostProject != value) {
+						fileCode = null;
+					}
+					hostProject = value;
+				}
+			}
+
+			public CodeDomProvider CodeProvider {
+				get { return codeProvider; }
+				set {
+					if (value != codeProvider) {
+						fileCode = null;
+					}
+					codeProvider = value;
+				}
+			}
+
+			public EnvDTE.FileCodeModel FileCodeModel {
+				get {
+					// Don't build the object more than once.
+					if (null != fileCode) {
+						return fileCode;
+					}
+					// Verify that the host project is set.
+					if (null == hostProject) {
+						throw new InvalidOperationException();
+					}
+
+					// Get the hierarchy from the host project.
+					object propValue;
+					ErrorHandler.ThrowOnFailure(hostProject.GetHostProperty((uint)HOSTPROPID.HOSTPROPID_HIERARCHY, out propValue));
+					IVsHierarchy hierarchy = propValue as IVsHierarchy;
+					if (null == hierarchy) {
+						return null;
+					}
+
+					// Try to get the extensibility object for the item.
+					// NOTE: here we assume that the __VSHPROPID.VSHPROPID_ExtObject property returns a VSLangProj.VSProjectItem
+					// or a EnvDTE.ProjectItem object. No other kind of extensibility is supported.
+					propValue = null;
+					ErrorHandler.ThrowOnFailure(hierarchy.GetProperty(itemId, (int)__VSHPROPID.VSHPROPID_ExtObject, out propValue));
+					EnvDTE.ProjectItem projectItem = null;
+					VSLangProj.VSProjectItem vsprojItem = propValue as VSLangProj.VSProjectItem;
+					if (null == vsprojItem) {
+						projectItem = propValue as EnvDTE.ProjectItem;
+					} else {
+						projectItem = vsprojItem.ProjectItem;
+					}
+					if (null == projectItem) {
+						return null;
+					}
+
+					// TODO: implement this
+					//fileCode = new CodeDomFileCodeModel(projectItem.DTE, projectItem, codeProvider, fileName);
+
+					return fileCode;
+				}
+			}
+
+			public uint ItemId {
+				get { return this.itemId; }
+			}
+
+			public string Name {
+				[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+				get { return fileName; }
+			}
+		}
+
+		private class FileCodeModelEnumerator : IEnumerable<FileCodeModelInfo> {
+			private List<SourceFileInfo> filesInfo;
+			private IVsIntellisenseProjectHost host;
+			private CodeDomProvider codeProvider;
+			public FileCodeModelEnumerator(IEnumerable<SourceFileInfo> files, IVsIntellisenseProjectHost hostProject, CodeDomProvider provider) {
+				filesInfo = new List<SourceFileInfo>(files);
+				host = hostProject;
+				codeProvider = provider;
+			}
+
+			public IEnumerator<FileCodeModelInfo> GetEnumerator() {
+				foreach (SourceFileInfo info in filesInfo) {
+					info.HostProject = host;
+					info.CodeProvider = codeProvider;
+					FileCodeModelInfo codeInfo = new FileCodeModelInfo(info.FileCodeModel, info.ItemId);
+					yield return codeInfo;
+				}
+			}
+
+			System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() {
+				return (System.Collections.IEnumerator)this.GetEnumerator();
+			}
+		}
+
+		private IVsIntellisenseProjectHost hostProject;
+		//private NemerleContainedLanguageFactory languageFactory;
+		private List<string> references;
+		private Dictionary<uint, SourceFileInfo> files;
+		//private NemerleProvider NemerleProvider;
+
+		public NemerleIntellisenseProvider() {
+			System.Diagnostics.Debug.WriteLine("\n\tNemerleIntellisenseProvider created\n");
+			references = new List<string>();
+			files = new Dictionary<uint, SourceFileInfo>();
+		}
+
+		public int AddAssemblyReference(string bstrAbsPath) {
+			string path = bstrAbsPath.ToUpper(CultureInfo.CurrentCulture);
+			if (!references.Contains(path)) {
+				references.Add(path);
+				//if (null != NemerleProvider) {
+				//	NemerleProvider.AddReference(path);
+				//}
+			}
+			return VSConstants.S_OK;
+		}
+
+		public void Dispose() {
+			Dispose(true);
+		}
+
+		private void Dispose(bool disposing) {
+			if (disposing) {
+				Close();
+			}
+			GC.SuppressFinalize(this);
+		}
+
+		public int AddFile(string bstrAbsPath, uint itemid) {
+			if (VSConstants.S_OK != IsCompilableFile(bstrAbsPath)) {
+				return VSConstants.S_OK;
+			}
+			if (!files.ContainsKey(itemid)) {
+				files.Add(itemid, new SourceFileInfo(bstrAbsPath, itemid));
+			}
+			return VSConstants.S_OK;
+		}
+
+		public int AddP2PReference(object pUnk) {
+			// Not supported.
+			return VSConstants.E_NOTIMPL;
+		}
+
+		public int Close() {
+			this.hostProject = null;
+			//if (null != NemerleProvider) {
+			//	NemerleProvider.Dispose();
+			//	NemerleProvider = null;
+			//}
+			return VSConstants.S_OK;
+		}
+
+		public int GetCodeDomProviderName(out string pbstrProvider) {
+			pbstrProvider = null;
+			//pbstrProvider = NemerleConstants.NemerleCodeDomProviderName;
+			return VSConstants.E_NOTIMPL;
+		}
+
+		public int GetCompilerReference(out object ppCompilerReference) {
+			ppCompilerReference = null;
+			return VSConstants.E_NOTIMPL;
+		}
+
+		public int GetContainedLanguageFactory(out IVsContainedLanguageFactory ppContainedLanguageFactory) {
+			ppContainedLanguageFactory = null;
+			//if (null == languageFactory) {
+			//	languageFactory = new NemerleContainedLanguageFactory(this);
+			//}
+			//ppContainedLanguageFactory = languageFactory;
+			return VSConstants.E_NOTIMPL;
+		}
+
+		public int GetExternalErrorReporter(out IVsReportExternalErrors ppErrorReporter) {
+			// TODO: Handle the error reporter
+			ppErrorReporter = null;
+			return VSConstants.E_NOTIMPL;
+		}
+
+		public int GetFileCodeModel(object pProj, object pProjectItem, out object ppCodeModel) {
+			ppCodeModel = null;
+			return VSConstants.E_NOTIMPL;
+		}
+
+		public int GetProjectCodeModel(object pProj, out object ppCodeModel) {
+			ppCodeModel = null;
+			return VSConstants.E_NOTIMPL;
+		}
+
+		public int Init(IVsIntellisenseProjectHost pHost) {
+			this.hostProject = pHost;
+			return VSConstants.S_OK;
+		}
+
+		public int IsCompilableFile(string bstrFileName) {
+			string ext = System.IO.Path.GetExtension(bstrFileName);
+			if (0 == string.Compare(ext, NemerleConstants.FileExtension, StringComparison.OrdinalIgnoreCase)) {
+				return VSConstants.S_OK;
+			}
+			return VSConstants.S_FALSE;
+		}
+
+		public int IsSupportedP2PReference(object pUnk) {
+			// P2P references are not supported.
+			return VSConstants.S_FALSE;
+		}
+
+		public int IsWebFileRequiredByProject(out int pbReq) {
+			pbReq = 0;
+			return VSConstants.S_OK;
+		}
+
+		public int RefreshCompilerOptions() {
+			return VSConstants.S_OK;
+		}
+
+		public int RemoveAssemblyReference(string bstrAbsPath) {
+			string path = bstrAbsPath.ToUpper(CultureInfo.CurrentCulture);
+			if (references.Contains(path)) {
+				references.Remove(path);
+				//NemerleProvider = null;
+			}
+			return VSConstants.S_OK;
+		}
+
+		public int RemoveFile(string bstrAbsPath, uint itemid) {
+			if (files.ContainsKey(itemid)) {
+				files.Remove(itemid);
+			}
+			return VSConstants.S_OK;
+		}
+
+		public int RemoveP2PReference(object pUnk) {
+			return VSConstants.S_OK;
+		}
+
+		public int RenameFile(string bstrAbsPath, string bstrNewAbsPath, uint itemid) {
+			return VSConstants.S_OK;
+		}
+
+		public int ResumePostedNotifications() {
+			// No-Op
+			return VSConstants.S_OK;
+		}
+
+		public int StartIntellisenseEngine() {
+			// No-Op
+			return VSConstants.S_OK;
+		}
+
+		public int StopIntellisenseEngine() {
+			// No-Op
+			return VSConstants.S_OK;
+		}
+
+		public int SuspendPostedNotifications() {
+			// No-Op
+			return VSConstants.S_OK;
+		}
+
+		public int WaitForIntellisenseReady() {
+			// No-Op
+			return VSConstants.S_OK;
+		}
+
+		//internal NemerleProvider CodeDomProvider {
+		//	get {
+		//		if (null == NemerleProvider) {
+		//			NemerleProvider = new NemerleProvider();
+		//			foreach (string assembly in references) {
+		//				NemerleProvider.AddReference(assembly);
+		//			}
+		//		}
+		//		return NemerleProvider;
+		//	}
+		//}
+
+		//internal IEnumerable<FileCodeModelInfo> FileCodeModels {
+		//	get {
+		//		List<SourceFileInfo> allFiles = new List<SourceFileInfo>(files.Values);
+		//		return new FileCodeModelEnumerator(allFiles, hostProject, CodeDomProvider); 
+		//	}
+		//}
+	}
+}
\ No newline at end of file

Modified: vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VisualStudio.csproj
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VisualStudio.csproj	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VisualStudio.csproj	Thu Oct 11 11:48:36 2007
@@ -67,7 +67,6 @@
     <!-- Make the reference to binary. ReSharper not support 
          ProjectReference to Nemerle projects. 
     -->
-    <Reference Include="..\Nemerle.Compiler.Utils\bin\$(Configuration)\Nemerle.Compiler.Utils.dll" />
     <Reference Include="ISymWrapper" />
   </ItemGroup>
   <ItemGroup>
@@ -122,6 +121,15 @@
     <Compile Include="$(VisualStudioIntegration)\Common\Source\CSharp\RegistrationAttributes\WebSiteProjectRelatedFilesAttribute.cs">
       <Link>RegistrationAttributes\WebSiteProjectRelatedFilesAttribute.cs</Link>
     </Compile>
+    <Compile Include="$(VisualStudioIntegration)\Common\Source\CSharp\RegistrationAttributes\WAProvideLanguagePropertyAttribute.cs">
+      <Link>RegistrationAttributes\WAProvideLanguagePropertyAttribute.cs</Link>
+    </Compile>
+    <Compile Include="$(VisualStudioIntegration)\Common\Source\CSharp\RegistrationAttributes\WAProvideProjectFactoryAttribute.cs">
+      <Link>RegistrationAttributes\WAProvideProjectFactoryAttribute.cs</Link>
+    </Compile>
+    <Compile Include="$(VisualStudioIntegration)\Common\Source\CSharp\RegistrationAttributes\WAProvideProjectFactoryTemplateMappingAttribute.cs">
+      <Link>RegistrationAttributes\WAProvideProjectFactoryTemplateMappingAttribute.cs</Link>
+    </Compile>
     <Compile Include="GUI\AutoSizeListView.cs">
       <SubType>Component</SubType>
     </Compile>
@@ -222,20 +230,19 @@
     <ZipProject Include="Templates\Projects\MacroLibrary\Macro1.n" />
     <ZipProject Include="Templates\Projects\MacroLibrary\MacroLibrary.nproj" />
     <ZipProject Include="Templates\Projects\ClassLibrary\AssemblyInfo.n" />
-    <!--
+
     <ZipProject Include="Templates\Projects\Web\WebApplication\__TemplateIcon.ico" />
     <ZipProject Include="Templates\Projects\Web\WebApplication\Default.aspx" />
-    <ZipProject Include="Templates\Projects\Web\WebApplication\Default.aspx.py" />
+    <ZipProject Include="Templates\Projects\Web\WebApplication\Default.aspx.n" />
     <ZipProject Include="Templates\Projects\Web\WebApplication\Web.config" />
-    <ZipProject Include="Templates\Projects\Web\WebApplication\WebApplication.pyproj" />
+    <ZipProject Include="Templates\Projects\Web\WebApplication\WebApplication.nproj" />
     <ZipProject Include="Templates\Projects\Web\WebApplication\WebApplication.vstemplate" />
     <ZipProject Include="Templates\Projects\Web\WebService\WebService.vstemplate" />
     <ZipProject Include="Templates\Projects\Web\WebService\Service1.asmx" />
+    <ZipProject Include="Templates\Projects\Web\WebService\Service1.asmx.n" />
     <ZipProject Include="Templates\Projects\Web\WebService\__TemplateIcon.ico" />
-    <ZipProject Include="Templates\Projects\Web\WebService\WebService.pyproj" />
+    <ZipProject Include="Templates\Projects\Web\WebService\WebService.nproj" />
     <ZipProject Include="Templates\Projects\Web\WebService\Web.config" />
-    <ZipProject Include="Templates\Projects\Web\WebService\Service1.asmx.py" />
-    -->
   </ItemGroup>
   <ItemGroup>
     <EmbeddedResource Include="Resources.resx">
@@ -276,6 +283,7 @@
     <Compile Include="GUI\Options.Designer.cs">
       <DependentUpon>Options.cs</DependentUpon>
     </Compile>
+    <Compile Include="LanguageService\ContainedLanguage\NemerleIntellisenseProvider.cs" />
     <Compile Include="Project\NemerleOAProject.cs" />
     <Compile Include="Project\NemerleOAProperties.cs" />
     <Compile Include="Project\RDTFileTextMerger.cs" />
@@ -286,15 +294,18 @@
       <DependentUpon>AstToolControl.cs</DependentUpon>
     </Compile>
     <Compile Include="GUI\AstToolWindow.cs" />
+    <Compile Include="Project\WANemerleProjectFactory.cs" />
     <Compile Include="Properties\Settings.Designer.cs">
       <AutoGen>True</AutoGen>
       <DesignTimeSharedInput>True</DesignTimeSharedInput>
       <DependentUpon>Settings.settings</DependentUpon>
     </Compile>
+    <Compile Include="RegistrationAttributes\ProvideIntellisenseProviderAttribute.cs" />
     <Compile Include="RegistrationAttributes\SingleFileGeneratorSupportRegistrationAttribute.cs" />
     <None Include="app.config" />
     <Compile Include="Project\NemerleIdeBuildLogger.cs" />
     <Compile Include="StringOrInt.cs" />
+    <Compile Include="Web\NemerleCodeBehindCodeGenerator.cs" />
     <None Include="Properties\Settings.settings">
       <Generator>SettingsSingleFileGenerator</Generator>
       <LastGenOutput>Settings.Designer.cs</LastGenOutput>
@@ -322,6 +333,12 @@
   <ItemGroup>
     <Service Include="{B4F97281-0DBD-4835-9ED8-7DFB966E87FF}" />
   </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\Nemerle.Compiler.Utils\Nemerle.Compiler.Utils.nproj">
+      <Project>{DBC77173-9367-485F-B425-74E6D6AB3F82}</Project>
+      <Name>Nemerle.Compiler.Utils</Name>
+    </ProjectReference>
+  </ItemGroup>
   <PropertyGroup>
     <TargetRegistryRoot>Software\Microsoft\VisualStudio\8.0Exp</TargetRegistryRoot>
     <RegisterOutputPackage>true</RegisterOutputPackage>
@@ -338,6 +355,7 @@
   </PropertyGroup>
   <!-- This imports the files that make up the project base classes. -->
   <Import Project="$(ProjectBasePath)\ProjectBase.Files" />
+  <Import Project="$(ProjectBasePath)\WebProjectBase.Files" />
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
   <Import Project="$(VisualStudioIntegration)\Tools\Build\Microsoft.VsSDK.targets" />
   <ProjectExtensions>

Modified: vs-plugin/trunk/Nemerle.VsIntegration/NemerleConstants.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/NemerleConstants.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/NemerleConstants.cs	Thu Oct 11 11:48:36 2007
@@ -24,8 +24,10 @@
 		public const short  PLKResourceId     = 104;
 #endif
 
+		public const string LanguageId        = "Nemerle";
 		public const string LanguageName      = "Nemerle";
 		public const string FileExtension     = ".n";
+		public const string FileExtensionOnly = "n";
 		public const string ProjectExtension  = "nproj";
 		public const string ProductName       = "Nemerle Visual Studio Integration";
 		public const string ProductDetails    = "Nemerle Visual Studio Integration\r\nVersion 1.0";
@@ -45,10 +47,14 @@
 		public const string ProjectCmdSetGuidString                = "D6DDF8E8-9A9E-425C-AB18-7BBCC70A6489";
 		public const string LanguageIntellisenseProviderGuidString = "EDCC3B83-0BAD-11DB-BC1A-00112FDE8B61";
 		public const string ProjectFactoryGuidString               = "EDCC3B85-0BAD-11DB-BC1A-00112FDE8B61";
+		public const string WAProjectFactoryGuidString               = "B3918BC1-983B-430a-BCEF-8F4CD6871C58";
 		public const string FolderNodePropertiesGuidString         = "EDCC3B86-0BAD-11DB-BC1A-00112FDE8B61";
 		public const string ProjectNodePropertiesGuidString        = "EDCC3B87-0BAD-11DB-BC1A-00112FDE8B61";
 		public const string GeneralPropertyPageGuidString          = "EDCC3B88-0BAD-11DB-BC1A-00112FDE8B61";
 		public const string DebugPropertyPageGuidString            = "EDCC3B89-0BAD-11DB-BC1A-00112FDE8B61";
+		public const string NemerleCodeBehindCodeGeneratorGuidString = "B05EC44C-1DDC-4868-B53D-78F563834F27";
+		public const string CSharpCodeBehindEventBindingGuidString   = "349C5856-65DF-11DA-9384-00065B846F21";
+		public const string IntellisenseProviderGuidString           = "A8B57672-DC5E-4915-A31A-B1C428B29FE1";
 
 		public const string ProjectImageListName = "Resources.NemerleImageList.bmp";
 

Modified: vs-plugin/trunk/Nemerle.VsIntegration/NemerlePackage.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/NemerlePackage.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/NemerlePackage.cs	Thu Oct 11 11:48:36 2007
@@ -19,18 +19,7 @@
 {
 	#region Registration Attributes
 
-	//TODO: Add WebSiteProject support.
 	[RegistrationAttributes.SingleFileGeneratorSupportRegistration(typeof(NemerleProjectFactory))]
-	//[WebSiteProject(GlobalConstants.LanguageName , GlobalConstants.LanguageName)]
-	//[WebSiteProjectRelatedFiles("aspx", "n")]
-	//[WebSiteProjectRelatedFiles("master", "n")]
-	//[
-	//  LanguageIntellisenseProviderRegistration(
-	//    NemerleConstants.LanguageIntellisenseProviderGuidString, 
-	//    "NemerleCodeProvider",
-	//    GlobalConstants.LanguageName, ".n", 
-	//    GlobalConstants.LanguageName + ";" + GlobalConstants.LanguageName ,
-	//    GlobalConstants.LanguageName)]
 
 	[Guid(NemerleConstants.PackageGuidString)]
 	[ComVisible(true)]
@@ -75,13 +64,21 @@
 		// from including the working directory as a valid template path
 		@".\NullPath",
 		LanguageVsTemplate = NemerleConstants.LanguageName)]
+
+	[RegistrationAttributes.ProvideIntellisenseProvider(typeof(LanguageService.ContainedLanguage.NemerleIntellisenseProvider),
+		NemerleConstants.LanguageId + "CodeProvider",
+		NemerleConstants.LanguageName,
+		NemerleConstants.FileExtension, NemerleConstants.LanguageId, NemerleConstants.LanguageId)]
+	[ProvideObject(typeof(LanguageService.ContainedLanguage.NemerleIntellisenseProvider))]
+
 	[ProvideMenuResource(1000, 1)]
 	[ProvideObject           (typeof(GeneralPropertyPage))]
 	[ProvideObject           (typeof(DebugPropertyPage))]
 	[ProvideObject           (typeof(NemerleBuildPropertyPage))]
 	[ProvideEditorExtension  (typeof(NemerleEditorFactory), NemerleConstants.FileExtension, 32)]
 	
-	// Attention! This guids is a magic numbers provide by Microsoft. Don't change it.
+	// Attention! These guids are magic numbers provided by Microsoft. Don't change them.
+	//
 	[ProvideEditorLogicalView(typeof(NemerleEditorFactory), "{7651a702-06e5-11d1-8ebd-00a0c90f26ea}")]  //LOGVIEWID_Designer
 	[ProvideEditorLogicalView(typeof(NemerleEditorFactory), "{7651a701-06e5-11d1-8ebd-00a0c90f26ea}")]  //LOGVIEWID_Code
 
@@ -107,6 +104,19 @@
 	// This attribute registers a tool window exposed by this package.
 	[ProvideToolWindow(typeof(AstToolWindow))]
 
+	//The following attributes are specific to supporting Web Application Projects
+	//
+	[WebSiteProject(NemerleConstants.LanguageId , NemerleConstants.LanguageName)]
+	[WebSiteProjectRelatedFiles("aspx", NemerleConstants.FileExtensionOnly)]
+	[WebSiteProjectRelatedFiles("master", NemerleConstants.FileExtensionOnly)]
+	[WAProvideProjectFactory(typeof(WANemerleProjectFactory), NemerleConstants.LanguageName + " Web Application Project Templates", NemerleConstants.LanguageId, false, "Web", null)]
+	[WAProvideProjectFactoryTemplateMapping("{" + NemerleConstants.ProjectFactoryGuidString + "}", typeof(WANemerleProjectFactory))]
+	[WAProvideLanguageProperty(typeof(WANemerleProjectFactory), "CodeFileExtension", NemerleConstants.FileExtension)]
+	[WAProvideLanguageProperty(typeof(WANemerleProjectFactory), "TemplateFolder", NemerleConstants.LanguageId)]
+	[WAProvideLanguageProperty(typeof(WANemerleProjectFactory), "CodeBehindCodeGenerator", typeof(Web.NemerleCodeBehindCodeGenerator))]
+	[WAProvideLanguageProperty(typeof(WANemerleProjectFactory), "CodeBehindEventBinding", NemerleConstants.CSharpCodeBehindEventBindingGuidString)]
+	[ProvideObject            (typeof(Web.NemerleCodeBehindCodeGenerator))]
+
 	#endregion
 
 	public class NemerlePackage : ProjectPackage, IOleComponent, IVsInstalledProduct

Added: vs-plugin/trunk/Nemerle.VsIntegration/Project/WANemerleProjectFactory.cs
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Project/WANemerleProjectFactory.cs	Thu Oct 11 11:48:36 2007
@@ -0,0 +1,13 @@
+using System.Runtime.InteropServices;
+
+namespace Nemerle.VisualStudio.Project
+{
+	/// <summary>
+	/// This class is a 'fake' project factory that is used by WAP to register
+	/// WAP specific information about Nemerle projects.
+	/// </summary>
+	[Guid(NemerleConstants.WAProjectFactoryGuidString)]
+	public class WANemerleProjectFactory
+	{
+	}
+}
\ No newline at end of file

Added: vs-plugin/trunk/Nemerle.VsIntegration/RegistrationAttributes/ProvideIntellisenseProviderAttribute.cs
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.VsIntegration/RegistrationAttributes/ProvideIntellisenseProviderAttribute.cs	Thu Oct 11 11:48:36 2007
@@ -0,0 +1,144 @@
+using System;
+using System.Globalization;
+using Microsoft.VisualStudio.Shell;
+
+namespace Nemerle.VisualStudio.RegistrationAttributes
+{
+    /// <summary>
+    /// This attribute adds a intellisense provider for a specific language 
+    /// type. 
+    /// For Example:
+    ///   [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0Exp\Languages\IntellisenseProviders\
+    ///		[Custom_Provider]
+    /// 
+    /// </summary>
+    [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
+    public sealed class ProvideIntellisenseProviderAttribute : RegistrationAttribute {
+        private Type _providerType;
+        private string _providerName;
+        private string _addItemLanguageName; //AddItemLanguageName
+        private string _defaultExtension;//DefaultExtension
+        private string _shortLanguageName; //ShortLanguageName
+        private string _templateFolderName; //TemplateFolderName
+        private string _additionalExtensions = null; //AdditionalExtensions
+
+        /// <summary>
+        /// Creates a new Intellisense provider registration attribute.
+        /// </summary>
+        /// <param name="providerGuid">Provider Guid</param>
+        /// <param name="providerName">Provider Name</param>
+        /// <param name="addItemLanguageName">Add Item Language</param>
+        /// <param name="defaultExtension">Default extension</param>
+        /// <param name="shortLanguageName">Short Language Name</param>
+        /// <param name="templateFolderName">Template Folder Name</param>
+        public ProvideIntellisenseProviderAttribute(Type provider, string providerName, string addItemLanguageName, string defaultExtension, string shortLanguageName, string templateFolderName) {
+            if (null == provider) {
+                throw new ArgumentNullException("provider");
+            }
+            if (string.IsNullOrEmpty(providerName)) {
+                throw new ArgumentNullException("providerName");
+            }
+            _providerType = provider;
+            _providerName = providerName;
+            _addItemLanguageName = addItemLanguageName;
+            _defaultExtension = defaultExtension;
+            _shortLanguageName = shortLanguageName;
+            _templateFolderName = templateFolderName;
+        }
+
+        /// <summary>
+        /// Gets the Type of the intellisense provider.
+        /// </summary>
+        public Type Provider {
+            get { return _providerType; }
+        }
+
+        /// <summary>
+        /// Get the Guid representing the generator type
+        /// </summary>
+        public Guid ProviderGuid {
+            get { return _providerType.GUID; }
+        }
+
+        /// <summary>
+        /// Get the ProviderName
+        /// </summary>
+        public string ProviderName {
+            get { return _providerName; }
+        }
+
+        /// <summary>
+        /// Get item language
+        /// </summary>
+        public string AddItemLanguageName {
+            get { return _addItemLanguageName; }
+        }
+
+        /// <summary>
+        /// Get the Default extension
+        /// </summary>
+        public string DefaultExtension {
+            get { return _defaultExtension; }
+        }
+
+        /// <summary>
+        /// Get the short language name
+        /// </summary>
+        public string ShortLanguageName {
+            get { return _shortLanguageName; }
+        }
+
+        /// <summary>
+        /// Get the tempalte folder name
+        /// </summary>
+        public string TemplateFolderName {
+            get { return _templateFolderName; }
+        }
+
+        /// <summary>
+        /// Get/Set Additional extensions
+        /// </summary>
+        public string AdditionalExtensions {
+            get { return _additionalExtensions; }
+            set { _additionalExtensions = value; }
+        }
+
+
+        /// <summary>
+        /// Property that gets the provider base key name
+        /// </summary>
+        private string ProviderRegKey {
+            get { return string.Format(CultureInfo.InvariantCulture, @"Languages\IntellisenseProviders\{0}", ProviderName); }
+        }
+        /// <summary>
+        ///     Called to register this attribute with the given context.  The context
+        ///     contains the location where the registration inforomation should be placed.
+        ///     It also contains other information such as the type being registered and path information.
+        /// </summary>
+        public override void Register(RegistrationContext context) {
+            if (null == context) {
+                throw new ArgumentNullException("context");
+            }
+            using (Key childKey = context.CreateKey(ProviderRegKey)) {
+                childKey.SetValue("GUID", ProviderGuid.ToString("B"));
+                childKey.SetValue("AddItemLanguageName", AddItemLanguageName);
+                childKey.SetValue("DefaultExtension", DefaultExtension);
+                childKey.SetValue("ShortLanguageName", ShortLanguageName);
+                childKey.SetValue("TemplateFolderName", TemplateFolderName);
+                if (!string.IsNullOrEmpty(AdditionalExtensions)) {
+                    childKey.SetValue("AdditionalExtensions", AdditionalExtensions);
+                }
+            }
+        }
+
+        /// <summary>
+        /// Unregister this file extension.
+        /// </summary>
+        /// <param name="context"></param>
+        public override void Unregister(RegistrationContext context) {
+            if (null != context) {
+                context.RemoveKey(ProviderRegKey);
+            }
+        }
+    }
+}

Added: vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebApplication/Default.aspx
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebApplication/Default.aspx	Thu Oct 11 11:48:36 2007
@@ -0,0 +1,16 @@
+<%@ Page Language="Nemerle" AutoEventWireup="true" CodeFile="Default.aspx.n" Inherits="$safeprojectname$.Default" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" >
+<head runat="server">
+    <title>Untitled Page</title>
+</head>
+<body>
+    <form id="form1" runat="server">
+    <div>
+    
+    </div>
+    </form>
+</body>
+</html>

Added: vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebApplication/Default.aspx.n
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebApplication/Default.aspx.n	Thu Oct 11 11:48:36 2007
@@ -0,0 +1,8 @@
+using System.Web.UI;
+
+namespace $safeprojectname$
+{
+	public partial class Default : Page
+	{
+	}
+}
\ No newline at end of file

Added: vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebApplication/Web.config
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebApplication/Web.config	Thu Oct 11 11:48:36 2007
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+
+<configuration>
+
+  <appSettings/>
+  <connectionStrings/>
+
+  <system.web>
+    <!-- 
+      Set compilation debug="true" to insert debugging 
+      symbols into the compiled page. Because this 
+      affects performance, set this value to true only 
+      during development.
+    -->
+    <compilation debug="true" />
+    <!--
+      The <authentication> section enables configuration 
+      of the security authentication mode used by 
+      ASP.NET to identify an incoming user. 
+    -->
+    <authentication mode="Windows" />
+    <!--
+      The <customErrors> section enables configuration 
+      of what to do if/when an unhandled error occurs 
+      during the execution of a request. Specifically, 
+      it enables developers to configure html error pages 
+      to be displayed in place of a error stack trace.
+
+      <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
+          <error statusCode="403" redirect="NoAccess.htm" />
+          <error statusCode="404" redirect="FileNotFound.htm" />
+      </customErrors>
+    -->
+  </system.web>
+
+  <system.codedom>
+    <compilers>
+      <compiler language="n;Nemerle" extension=".n" type="Nemerle.Compiler.NemerleCodeProvider, Nemerle.Compiler" />
+    </compilers>
+  </system.codedom>
+</configuration>

Added: vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebApplication/WebApplication.nproj
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebApplication/WebApplication.nproj	Thu Oct 11 11:48:36 2007
@@ -0,0 +1,60 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <NoStdLib>true</NoStdLib>
+    <Nemerle Condition=" '$(Nemerle)' == '' ">$(ProgramFiles)\Nemerle</Nemerle>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>$guid1$</ProjectGuid>
+    <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{edcc3b85-0bad-11db-bc1a-00112fde8b61}</ProjectTypeGuids>
+    <OutputType>Library</OutputType>
+    <RootNamespace>$safeprojectname$</RootNamespace>
+    <AssemblyName>$safeprojectname$</AssemblyName>
+    <MainFile>Default.aspx</MainFile>
+    <UseIPExperimentalCompiler>true</UseIPExperimentalCompiler>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin</OutputPath>
+    <EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin</OutputPath>
+    <EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="mscorlib" />
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Web" />
+    <Reference Include="System.Xml" />
+    <Reference Include="System.Configuration" />
+    <Reference Include="System.Web.Services" />
+    <Reference Include="System.EnterpriseServices" />
+    <Reference Include="System.Web.Mobile" />
+    <Reference Include="$(Nemerle)\Nemerle.dll"/>
+    <Reference Include="$(Nemerle)\Nemerle.Compiler.dll"/>
+    <Reference Include="$(Nemerle)\Nemerle.Macros.dll"/>
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="Default.aspx"/>
+    <Content Include="Web.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Default.aspx.n">
+      <DependentUpon>Default.aspx</DependentUpon>
+    </Compile>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <Import Project="$(Nemerle)\Nemerle.MSBuild.targets" />
+  <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v8.0\WebApplications\Microsoft.WebApplication.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.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file

Added: vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebApplication/WebApplication.vstemplate
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebApplication/WebApplication.vstemplate	Thu Oct 11 11:48:36 2007
@@ -0,0 +1,25 @@
+<VSTemplate Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Project">
+  <TemplateData>
+    <Name>ASP.NET Web Application</Name>
+    <Description>A project for creating an application with a Web user interface</Description>
+    <Icon>__TemplateIcon.ico</Icon>
+    <ProjectType>Nemerle</ProjectType>
+    <ProjectSubType>Web</ProjectSubType>
+    <TemplateGroupID>Web</TemplateGroupID>
+    <TemplateID>WebApplication</TemplateID>
+    <SortOrder>1000</SortOrder>
+    <CreateNewFolder>true</CreateNewFolder>
+    <DefaultName>WebApplication</DefaultName>
+    <ProvideDefaultName>true</ProvideDefaultName>
+    <LocationField>Enabled</LocationField>
+    <EnableLocationBrowseButton>true</EnableLocationBrowseButton>
+    <NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
+  </TemplateData>
+  <TemplateContent>
+    <Project File="WebApplication.nproj" ReplaceParameters="true">
+      <ProjectItem OpenInEditor="true" OpenOrder="10" ReplaceParameters="true" TargetFileName="Default.aspx">Default.aspx</ProjectItem>
+      <ProjectItem ReplaceParameters="true" TargetFileName="Default.aspx.n">Default.aspx.n</ProjectItem>
+      <ProjectItem TargetFileName="Web.config">Web.config</ProjectItem>
+    </Project>
+  </TemplateContent>
+</VSTemplate>

Added: vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebApplication/__TemplateIcon.ico
==============================================================================
Binary file. No diff available.

Added: vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebService/Service1.asmx
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebService/Service1.asmx	Thu Oct 11 11:48:36 2007
@@ -0,0 +1 @@
+<%@ WebService Language="C#" CodeBehind="Service1.asmx.n" Class="$safeprojectname$.Service1" %>
\ No newline at end of file

Added: vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebService/Service1.asmx.n
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebService/Service1.asmx.n	Thu Oct 11 11:48:36 2007
@@ -0,0 +1,18 @@
+using System;
+using System.Web;
+using System.Web.Services;
+using System.Web.Services.Protocols;
+using System.ComponentModel;
+
+namespace $safeprojectname$
+{
+    [WebService(Namespace = "http://tempuri.org/")]
+    public class Service1 : WebService
+	{        
+        [WebMethod]
+        public HelloWorld() : string
+        {
+        	"Hello World"
+        }
+	}        
+}   

Added: vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebService/Web.config
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebService/Web.config	Thu Oct 11 11:48:36 2007
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+
+<configuration>
+
+  <appSettings/>
+  <connectionStrings/>
+
+  <system.web>
+    <!-- 
+      Set compilation debug="true" to insert debugging 
+      symbols into the compiled page. Because this 
+      affects performance, set this value to true only 
+      during development.
+    -->
+    <compilation debug="true" />
+    <!--
+      The <authentication> section enables configuration 
+      of the security authentication mode used by 
+      ASP.NET to identify an incoming user. 
+    -->
+    <authentication mode="Windows" />
+    <!--
+      The <customErrors> section enables configuration 
+      of what to do if/when an unhandled error occurs 
+      during the execution of a request. Specifically, 
+      it enables developers to configure html error pages 
+      to be displayed in place of a error stack trace.
+
+      <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
+          <error statusCode="403" redirect="NoAccess.htm" />
+          <error statusCode="404" redirect="FileNotFound.htm" />
+      </customErrors>
+    -->
+  </system.web>
+
+  <system.codedom>
+    <compilers>
+      <compiler language="n;Nemerle" extension=".n" type="Nemerle.Compiler.NemerleCodeProvider, Nemerle.Compiler" />
+    </compilers>
+  </system.codedom>
+</configuration>

Added: vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebService/WebService.nproj
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebService/WebService.nproj	Thu Oct 11 11:48:36 2007
@@ -0,0 +1,58 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <NoStdLib>true</NoStdLib>
+    <Nemerle Condition=" '$(Nemerle)' == '' ">$(ProgramFiles)\Nemerle</Nemerle>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>$guid1$</ProjectGuid>
+    <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{edcc3b85-0bad-11db-bc1a-00112fde8b61}</ProjectTypeGuids>
+    <OutputType>Library</OutputType>
+    <RootNamespace>$safeprojectname$</RootNamespace>
+    <AssemblyName>$safeprojectname$</AssemblyName>
+    <MainFile>Service1.asmx.n</MainFile>
+    <UseIPExperimentalCompiler>true</UseIPExperimentalCompiler>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\Debug</OutputPath>
+    <EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\Release</OutputPath>
+    <EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="mscorlib" />
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Web" />
+    <Reference Include="System.Xml" />
+    <Reference Include="System.Configuration" />
+    <Reference Include="System.Web.Services" />
+    <Reference Include="System.EnterpriseServices" />
+    <Reference Include="System.Web.Mobile" />
+    <Reference Include="$(Nemerle)\Nemerle.dll"/>
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="Service1.asmx"/>
+    <Content Include="Web.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Service1.asmx.n">
+      <DependentUpon>Service1.asmx</DependentUpon>
+    </Compile>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <Import Project="$(Nemerle)\Nemerle.MSBuild.targets" />
+  <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v8.0\WebApplications\Microsoft.WebApplication.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.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file

Added: vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebService/WebService.vstemplate
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebService/WebService.vstemplate	Thu Oct 11 11:48:36 2007
@@ -0,0 +1,25 @@
+<VSTemplate Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Project">
+  <TemplateData>
+    <Name>ASP.NET Web Service Application</Name>
+    <Description>A project for creating XML Web services</Description>
+    <Icon>__TemplateIcon.ico</Icon>
+    <ProjectType>Nemerle</ProjectType>
+    <ProjectSubType>Web</ProjectSubType>
+    <TemplateGroupID>Web</TemplateGroupID>
+    <TemplateID>WebService</TemplateID>
+    <SortOrder>1001</SortOrder>
+    <CreateNewFolder>true</CreateNewFolder>
+    <DefaultName>WebApplication</DefaultName>
+    <ProvideDefaultName>true</ProvideDefaultName>
+    <LocationField>Enabled</LocationField>
+    <EnableLocationBrowseButton>true</EnableLocationBrowseButton>
+    <NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
+  </TemplateData>
+  <TemplateContent>
+    <Project File="WebService.nproj" ReplaceParameters="true">
+      <ProjectItem ReplaceParameters="true" TargetFileName="Service1.asmx">Service1.asmx</ProjectItem>
+      <ProjectItem OpenInEditor="true" OpenOrder="10" ReplaceParameters="true" TargetFileName="Service1.asmx.n">Service1.asmx.n</ProjectItem>
+      <ProjectItem TargetFileName="Web.config">Web.config</ProjectItem>
+    </Project>
+  </TemplateContent>
+</VSTemplate>

Added: vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebService/__TemplateIcon.ico
==============================================================================
Binary file. No diff available.

Added: vs-plugin/trunk/Nemerle.VsIntegration/Web/NemerleCodeBehindCodeGenerator.cs
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Web/NemerleCodeBehindCodeGenerator.cs	Thu Oct 11 11:48:36 2007
@@ -0,0 +1,13 @@
+using System.Runtime.InteropServices;
+
+namespace Nemerle.VisualStudio.Web
+{
+	/// <summary>
+	/// This class is a dummy CodeBehindCodeGenerator that is used by WAP to register
+	/// WAP specific information about Nemerle projects.
+	/// </summary>
+	[Guid(NemerleConstants.NemerleCodeBehindCodeGeneratorGuidString)]
+	internal class NemerleCodeBehindCodeGenerator : Microsoft.VisualStudio.Package.Web.CodeBehindCodeGenerator
+	{
+	}
+}



More information about the svn mailing list