internal IServiceProvider _serviceProvider = null; // imported via MEF

        public IIntellisenseController TryCreateIntellisenseController(ITextView textView, IList<ITextBuffer> subjectBuffers) {
            IntellisenseController controller;
            if (!textView.Properties.TryGetProperty<IntellisenseController>(typeof(IntellisenseController), out controller)) {
                controller = new IntellisenseController(this, textView, _serviceProvider);
            }

            foreach (var buffer in subjectBuffers) {
                buffer.GetAnalyzer().AddBuffer(buffer);
            }
            return controller;
        }
 internal static IntellisenseController GetOrCreateController(IComponentModel model, ITextView textView, IServiceProvider serviceProvider) {
     IntellisenseController controller;
     if (!textView.Properties.TryGetProperty<IntellisenseController>(typeof(IntellisenseController), out controller)) {
         var intellisenseControllerProvider = (
            from export in model.DefaultExportProvider.GetExports<IIntellisenseControllerProvider, IContentTypeMetadata>()
            from exportedContentType in export.Metadata.ContentTypes
            where exportedContentType == NodejsConstants.Nodejs && export.Value.GetType() == typeof(IntellisenseControllerProvider)
            select export.Value
         ).First();
         controller = new IntellisenseController((IntellisenseControllerProvider)intellisenseControllerProvider, textView, serviceProvider);
     }
     return controller;
 }
        internal IServiceProvider _serviceProvider = null;                   // imported via MEF

        public IIntellisenseController TryCreateIntellisenseController(ITextView textView, IList <ITextBuffer> subjectBuffers)
        {
            IntellisenseController controller;

            if (!textView.Properties.TryGetProperty <IntellisenseController>(typeof(IntellisenseController), out controller))
            {
                controller = new IntellisenseController(this, textView, _serviceProvider);
            }

            foreach (var buffer in subjectBuffers)
            {
                buffer.GetAnalyzer().AddBuffer(buffer);
            }
            return(controller);
        }
        internal static IntellisenseController GetOrCreateController(IComponentModel model, ITextView textView, IServiceProvider serviceProvider)
        {
            IntellisenseController controller;

            if (!textView.Properties.TryGetProperty <IntellisenseController>(typeof(IntellisenseController), out controller))
            {
                var intellisenseControllerProvider = (
                    from export in model.DefaultExportProvider.GetExports <IIntellisenseControllerProvider, IContentTypeMetadata>()
                    from exportedContentType in export.Metadata.ContentTypes
                    where exportedContentType == NodejsConstants.Nodejs && export.Value.GetType() == typeof(IntellisenseControllerProvider)
                    select export.Value
                    ).First();
                controller = new IntellisenseController((IntellisenseControllerProvider)intellisenseControllerProvider, textView, serviceProvider);
            }
            return(controller);
        }
Exemplo n.º 5
0
        public void ReplWindowCreated(IReplWindow window)
        {
            var textView   = window.TextView;
            var editFilter = new EditFilter(
                textView,
                _editorOperationsFactory.GetEditorOperations(textView),
                _editorOptionsFactory.GetOptions(textView),
                _compModel.GetService <IIntellisenseSessionStackMapService>().GetStackForTextView(textView),
                _compModel
                );
            IntellisenseController controller = IntellisenseControllerProvider.GetOrCreateController(_compModel, textView);

            controller.AttachKeyboardFilter();

            editFilter.AttachKeyboardFilter(_adaptersFactory.GetViewAdapter(window.TextView));
        }