public ITagger <T> CreateTagger <T>(ITextView textView, ITextBuffer buffer) where T : ITag
        {
            // Only provide the smart tagger on the top-level buffer
            if (textView.TextBuffer != buffer)
            {
                return(null);
            }

            var generalOptions = Setting.getGeneralOptions(serviceProvider);

            if (generalOptions == null || !generalOptions.ResolveUnopenedNamespacesEnabled)
            {
                return(null);
            }

            var dte       = serviceProvider.GetService(typeof(SDTE)) as EnvDTE.DTE;
            var vsVersion = VisualStudioVersionModule.fromDTEVersion(dte.Version);

            if (vsVersion == VisualStudioVersion.VS2015)
            {
                return(null);
            }

            ITextDocument doc;

            if (textDocumentFactoryService.TryGetTextDocument(buffer, out doc))
            {
                var resolver = new UnopenedNamespaceResolver(doc, textView, undoHistoryRegistry.RegisterHistory(buffer),
                                                             fsharpVsLanguageService, serviceProvider, projectFactory);
                return(new ResolveUnopenedNamespaceSmartTagger(buffer, serviceProvider, resolver) as ITagger <T>);
            }

            return(null);
        }
Beispiel #2
0
        public GeneralOptionsPage()
        {
            var dte = Package.GetGlobalService(typeof(SDTE)) as DTE;
            var visualStudioVersion = VisualStudioVersionModule.fromDTEVersion(dte.Version);

            XmlDocEnabled                          = true;
            FormattingEnabled                      = true;
            HighlightUsageEnabled                  = true;
            HighlightPrintfUsageEnabled            = true;
            RenameRefactoringEnabled               = true;
            DepthColorizerEnabled                  = false;
            NavigateToEnabled                      = true;
            SyntaxColoringEnabled                  = true;
            InterfaceImplementationEnabled         = true;
            FolderOrganizationEnabled              = false;
            FindAllReferencesEnabled               = true;
            GenerateRecordStubEnabled              = true;
            UnionPatternMatchCaseGenerationEnabled = true;
            ResolveUnopenedNamespacesEnabled       = true;
            UnusedReferencesEnabled                = false;
            UnusedOpensEnabled                     = false;
            TaskListCommentsEnabled                = true;
            GoToMetadataEnabled                    = true;
            GenerateReferencesEnabled              = true;
            GoToSymbolSourceEnabled                = true;
            QuickInfoPanelEnabled                  = true;
            LinterEnabled                          = false;
            OutliningEnabled                       = false;
            PeekDefinitionEnabled                  = true;
            PeekDefinitionAvailable                =
                visualStudioVersion != VisualStudioVersion.Unknown &&
                visualStudioVersion != VisualStudioVersion.VS2012 &&
                visualStudioVersion != VisualStudioVersion.VS2013;
        }
Beispiel #3
0
        public ITagger <T> CreateTagger <T>(ITextView textView, ITextBuffer buffer) where T : ITag
        {
            // Only provide the smart tagger on the top-level buffer
            if (textView.TextBuffer != buffer)
            {
                return(null);
            }

            var generalOptions = Setting.getGeneralOptions(_serviceProvider);

            if (generalOptions == null || !generalOptions.GenerateRecordStubEnabled)
            {
                return(null);
            }
            var codeGenOptions = Setting.getCodeGenerationOptions(_serviceProvider);

            if (codeGenOptions == null)
            {
                return(null);
            }

            var dte       = _serviceProvider.GetService(typeof(SDTE)) as EnvDTE.DTE;
            var vsVersion = VisualStudioVersionModule.fromDTEVersion(dte.Version);

            if (vsVersion == VisualStudioVersion.VS2015)
            {
                return(null);
            }

            ITextDocument doc;

            if (_textDocumentFactoryService.TryGetTextDocument(buffer, out doc))
            {
                var generator =
                    new RecordStubGenerator(
                        doc,
                        textView,
                        _undoHistoryRegistry.RegisterHistory(buffer),
                        _fsharpVsLanguageService,
                        _projectFactory,
                        Setting.getDefaultMemberBody(codeGenOptions),
                        _openDocumentsTracker);

                return(new RecordStubGeneratorSmartTagger(buffer, generator) as ITagger <T>);
            }

            return(null);
        }
Beispiel #4
0
        public ITagger <T> CreateTagger <T>(ITextView textView, ITextBuffer buffer) where T : ITag
        {
            // Only provide the smart tagger on the top-level buffer
            if (textView.TextBuffer != buffer)
            {
                return(null);
            }

            var generalOptions = Setting.getGeneralOptions(serviceProvider);

            if (generalOptions == null || !generalOptions.InterfaceImplementationEnabled)
            {
                return(null);
            }
            var codeGenOptions = Setting.getCodeGenerationOptions(serviceProvider);

            if (codeGenOptions == null)
            {
                return(null);
            }

            var dte       = serviceProvider.GetService(typeof(SDTE)) as EnvDTE.DTE;
            var vsVersion = VisualStudioVersionModule.fromDTEVersion(dte.Version);

            if (vsVersion == VisualStudioVersion.VS2015)
            {
                return(null);
            }

            ITextDocument doc;

            if (textDocumentFactoryService.TryGetTextDocument(buffer, out doc))
            {
                var implementInterface =
                    new ImplementInterface(doc, textView,
                                           editorOptionsFactory, undoHistoryRegistry.RegisterHistory(buffer),
                                           fsharpVsLanguageService, serviceProvider, projectFactory,
                                           Setting.getInterfaceMemberIdentifier(codeGenOptions),
                                           Setting.getDefaultMemberBody(codeGenOptions));
                return(new ImplementInterfaceSmartTagger(buffer, implementInterface) as ITagger <T>);
            }

            return(null);
        }