public ProjectHandler(NodeProviderBroker broker, ITemplateDirectory template_manager, List<Tag> tags, List<Filter> filters, string project_directory)
 {
     this.broker = broker;
     TemplateManager = template_manager;
     this.tags = tags;
     this.filters = filters;
     this.project_directory = project_directory;
     template_loader = new TemplateLoader(project_directory);
     parser = InitializeParser();
 }
Example #2
0
 public ProjectHandler(NodeProviderBroker broker, ITemplateDirectory template_manager, List <Tag> tags, List <Filter> filters, string project_directory)
 {
     this.broker            = broker;
     TemplateManager        = template_manager;
     this.tags              = tags;
     this.filters           = filters;
     this.project_directory = project_directory;
     template_loader        = new TemplateLoader(project_directory);
     parser = InitializeParser();
 }
 public ProjectHandler(NodeProviderBroker broker, IVsHierarchy hier, string project_directory)
 {
     this.broker = broker;
     template_loader = new TemplateLoader(project_directory);
     type_resolver = new TypeResolver(hier);
     TemplateDirectory = new TemplateDirectory(project_directory);
     parser = new TemplateManagerProvider()
             .WithTags(type_resolver.Tags)
             .WithFilters(type_resolver.Filters)
             .WithSetting(NDjango.Constants.EXCEPTION_IF_ERROR, false)
             .WithLoader(template_loader)
             .GetNewManager();
 }
Example #4
0
 public ProjectHandler(NodeProviderBroker broker, IVsHierarchy hier, string project_directory)
 {
     this.broker       = broker;
     template_loader   = new TemplateLoader(project_directory);
     type_resolver     = new TypeResolver(hier);
     TemplateDirectory = new TemplateDirectory(project_directory);
     parser            = new TemplateManagerProvider()
                         .WithTags(type_resolver.Tags)
                         .WithFilters(type_resolver.Filters)
                         .WithSetting(NDjango.Constants.EXCEPTION_IF_ERROR, false)
                         .WithLoader(template_loader)
                         .GetNewManager();
 }
        public void Create_CompletionSet_Variable()
        {
            var content = "{% for i in enum %} { {% endfor %}";

            var textBuffer = new Mock<ITextBuffer>();
            var buffer_properties = new Mock<PropertyCollection>().Object;
            var text_document = new Mock<ITextDocument>().Object;
            buffer_properties.AddProperty(typeof(ITextDocument), text_document);
            textBuffer.Setup<PropertyCollection>(t => t.Properties).Returns(buffer_properties);
            var current_snapshot = new Mock<ITextSnapshot>();
            current_snapshot.Setup<int>(s => s.Length).Returns(content.Length);
            current_snapshot.Setup<char[]>(s => s.ToCharArray(It.IsAny<int>(), It.IsAny<int>())).Returns((int pos, int len) => content.ToCharArray(pos, len));

            textBuffer.Setup<ITextSnapshot>(t => t.CurrentSnapshot).Returns(current_snapshot.Object);

            var broker = new NodeProviderBroker();

            var source = new Source(broker, textBuffer.Object);
            Assert.IsInstanceOf<Source>(source);

            var session = new Mock<ICompletionSession>();
            var session_properties = new Mock<PropertyCollection>().Object;
            session_properties.AddProperty(typeof(CompletionContext), CompletionContext.Variable);
            session.Setup<PropertyCollection>(s => s.Properties).Returns(session_properties);

            var tracking_point = new Mock<ITrackingPoint>();
            tracking_point.Setup<SnapshotPoint>(t => t.GetPoint(It.IsAny<ITextSnapshot>())).Returns((ITextSnapshot snapshot) => new SnapshotPoint(snapshot, 21));
            session.Setup<ITrackingPoint>(s => s.GetTriggerPoint(It.IsAny<ITextBuffer>())).Returns(tracking_point.Object);

            var completionSets = new List<CompletionSet>();

            //var node = broker.GetNodeProvider(textBuffer.Object).GetNodes(new SnapshotPoint(current_snapshot.Object, 21), n => true).FindLast(n => true);

            //Assert.IsNotNull(node);

            source.AugmentCompletionSession(session.Object, completionSets);

            Assert.AreEqual(1, completionSets.Count);
        }
Example #6
0
 private ProjectHandler CreateProjectHandler(NodeProviderBroker nodeProviderBroker, IVsHierarchy hier, string project_directory)
 {
     return(new ASPNETMVCProjectHandler(nodeProviderBroker, hier, project_directory));
 }
Example #7
0
 public ASPNETMVCProjectHandler(NodeProviderBroker broker, IVsHierarchy hier, string project_directory)
     : base(broker, hier, project_directory)
 {
 }
 public ASPNETMVCProjectHandler(NodeProviderBroker broker, IVsHierarchy hier, string project_directory)
     : base(broker, hier, project_directory)
 {
 }
Example #9
0
 private ProjectHandler CreateProjectHandler(NodeProviderBroker nodeProviderBroker, IVsHierarchy hier, string project_directory)
 {
     return new ASPNETMVCProjectHandler(nodeProviderBroker, hier, project_directory);
 }