当前位置: 首页>>代码示例>>C#>>正文


C# IVsTextView类代码示例

本文整理汇总了C#中IVsTextView的典型用法代码示例。如果您正苦于以下问题:C# IVsTextView类的具体用法?C# IVsTextView怎么用?C# IVsTextView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IVsTextView类属于命名空间,在下文中一共展示了IVsTextView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TextViewCommandFilter

        /// <summary>
        /// Initializes a new instance of the <see cref="TextViewCommandFilter"/> class
        /// for the specified text view.
        /// </summary>
        /// <param name="textViewAdapter">The text view this command filter should attach to.</param>
        protected TextViewCommandFilter(IVsTextView textViewAdapter)
        {
            if (textViewAdapter == null)
                throw new ArgumentNullException("textViewAdapter");

            _textViewAdapter = textViewAdapter;
        }
开发者ID:modulexcite,项目名称:SHFB-1,代码行数:12,代码来源:TextViewCommandFilter.cs

示例2: ArgumentNullException

        int IVsCodeWindowManager.OnNewView(IVsTextView pView)
        {
            if (pView == null)
                throw new ArgumentNullException("pView");

            return OnNewView(pView);
        }
开发者ID:Kav2018,项目名称:JavaForVS,代码行数:7,代码来源:CodeWindowManager.cs

示例3: SurroundWith

 public SurroundWith(IVsTextView adapter, IWpfTextView textView, ICompletionBroker broker)
     : base(adapter, textView, GuidList.guidFormattingCmdSet, PkgCmdIDList.SurroundWith)
 {
     _broker = broker;
     _view = textView;
     _buffer = textView.TextBuffer;
 }
开发者ID:joeriks,项目名称:WebEssentials2013,代码行数:7,代码来源:SurroundWithTarget.cs

示例4: CommandFilter

        internal CommandFilter(IVsTextView textViewAdapter, IWpfTextView textView)
        {
            recorder = new Recorder();
            listening = false;

            this.textView = textView;
            textViewAdapter.AddCommandFilter(this, out nextFilter);

            // trying to get document path from TextBuffer
            ITextBuffer buffer = this.textView.TextBuffer;
            ITextDocument document;

            var result = buffer.Properties.TryGetProperty<ITextDocument>(
                typeof(ITextDocument), out document);

            if (result)
            {
                string documentFullPath = document.FilePath;
                recordFullPath = documentFullPath + ".rec";
            }
            else
            {
                // TODO: save to some folder
                recordFullPath = "document.rec";
            }

            // subscribe to RecorderControl event
            RecorderControl.RecordStateChanged += new EventHandler<RecordStateChangedArgs>(OnRecordStateChanged);
        }
开发者ID:dmitry-zakablukov,项目名称:WorkRecorderVSIX,代码行数:29,代码来源:CommandFilter.cs

示例5: RemoveWhitespaceOnSave

 public RemoveWhitespaceOnSave(IVsTextView textViewAdapter, IWpfTextView view, DTE2 dte, ITextDocument document)
 {
     textViewAdapter.AddCommandFilter(this, out _nextCommandTarget);
     _view = view;
     _dte = dte;
     _document = document;
 }
开发者ID:laurentkempe,项目名称:TrailingWhitespace,代码行数:7,代码来源:RemoveWhitespaceOnSave.cs

示例6: VsTextViewCreated

        public void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            var textView = EditorAdaptersFactoryService.GetWpfTextView(textViewAdapter);
            textView.Closed += TextviewClosed;

            // Both "Web Compiler" and "Bundler & Minifier" extensions add this property on their
            // generated output files. Generated output should be ignored from linting
            bool generated;
            if (textView.Properties.TryGetProperty("generated", out generated) && generated)
                return;

            if (TextDocumentFactoryService.TryGetTextDocument(textView.TextDataModel.DocumentBuffer, out _document))
            {
                Task.Run(async () =>
                {
                    if (!LinterService.IsFileSupported(_document.FilePath))
                        return;

                    _document.FileActionOccurred += DocumentSaved;
                    textView.Properties.AddProperty("lint_filename", _document.FilePath);

                    // Don't run linter again if error list already contains errors for the file.
                    if (!TableDataSource.Instance.HasErrors(_document.FilePath))
                    {
                        await LinterService.LintAsync(false, _document.FilePath);
                    }
                });
            }
        }
开发者ID:pgatilov,项目名称:WebAnalyzer,代码行数:29,代码来源:SourceFileCreationListener.cs

示例7: FindConfigLine

        private static bool FindConfigLine(IVsTextView configTextView, out int configLineIndex, out string configLineText)
        {
            configLineText = null;

            for (configLineIndex = 0;
                 String.IsNullOrWhiteSpace(configLineText);
                 configLineIndex++)
            {
                int hr = configTextView.GetTextStream(
                    configLineIndex,
                    0,
                    configLineIndex + 1,
                    0,
                    out configLineText);

                if (hr != VSConstants.S_OK || configLineText == null)
                {
                    break;
                }

                if (IsConfigLine(configLineText))
                {
                    return true;
                }
            }

            configLineIndex = -1;
            configLineText = null;
            return false;
        }
开发者ID:nstanard,项目名称:WebPackTaskRunner,代码行数:30,代码来源:TaskRunnerFileBindingsHelper.cs

示例8: VsTextViewCreated

        public void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            var view = textViewAdapter.ToITextView();
            var filePath = textViewAdapter.GetFilePath();

            var project = ProjectInfo.FindProject(filePath);
            if (project == null)
                return;

            var engine = project.Engine;
            if (engine.IsExtensionRegistered(Path.GetExtension(filePath))
                || engine.HasSourceChangedSubscribers(Location.GetFileIndex(filePath)))
            {
                //Trace.WriteLine("Opened: " + filePath);

                IVsTextLines vsTextLines = textViewAdapter.GetBuffer();
                var langSrv = NemerlePackage.GetGlobalService(typeof(NemerleLanguageService)) as NemerleLanguageService;
                if (langSrv == null)
                    return;
                var source = (NemerleSource)langSrv.GetOrCreateSource(vsTextLines);
              source.AddRef();
                project.AddEditableSource(source);

                if (!Utils.IsNemerleFileExtension(filePath))
                    view.TextBuffer.Changed += TextBuffer_Changed;
                view.Closed += view_Closed;
            }
        }
开发者ID:vestild,项目名称:nemerle,代码行数:28,代码来源:NemerleTextViewCreationListener.cs

示例9:

        void IVsTextViewCreationListener.VsTextViewCreated(IVsTextView vsView)
        {
            var view = _adaptersFactory.GetWpfTextView(vsView);
            if (view == null)
            {
                return;
            }

            var opt = _vim.GetBuffer(view);
            if (!opt.IsSome())
            {
                return;
            }

            var buffer = opt.Value;
            var broker = _displayWindowBrokerFactoryServcie.CreateDisplayWindowBroker(view);
            var result = VsCommandTarget.Create(buffer, vsView, _adapter, broker, _externalEditorManager);
            if (result.IsSuccess)
            {
                _filterMap.Add(buffer, result.Value);
            }

            // Try and install the IVsFilterKeys adapter.  This cannot be done synchronously here
            // because Venus projects are not fully initialized at this state.  Merely querying
            // for properties cause them to corrupt internal state and prevents rendering of the
            // view.  Occurs for aspx and .js pages
            Action install = () => VsFilterKeysAdapter.TryInstallFilterKeysAdapter(_adapter, _editorOptionsFactoryService, buffer);

            Dispatcher.CurrentDispatcher.BeginInvoke(install, null);
        }
开发者ID:bentayloruk,项目名称:VsVim,代码行数:30,代码来源:HostFactory.cs

示例10: VsTextViewCreated

        public void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            var textView = EditorAdaptersFactoryService.GetWpfTextView(textViewAdapter);

            textView.Options.SetOptionValue(DefaultOptions.IndentSizeOptionId, 2);
            textView.Options.SetOptionValue(DefaultOptions.ConvertTabsToSpacesOptionId, true);
        }
开发者ID:xoofx,项目名称:MarkdownEditor,代码行数:7,代码来源:EditorOptions.cs

示例11: VsTextViewCreated

 public void VsTextViewCreated(IVsTextView textViewAdapter)
 {
     var textView = EditorAdaptersFactoryService.GetWpfTextView(textViewAdapter);
     var completionModelManager = CompletionModelManagerProvider.GetCompletionModel(textView);
     textView.Properties.GetOrCreateSingletonProperty(() => new CompletionCommandHandlerTriggers(textViewAdapter, textView, completionModelManager));
     textView.Properties.GetOrCreateSingletonProperty(() => new CompletionCommandHandler(textViewAdapter, textView, completionModelManager));
 }
开发者ID:tgjones,项目名称:HlslTools,代码行数:7,代码来源:CompletionCommandHandlerProvider.cs

示例12: VsTextViewCreated

        public void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            IWpfTextView textView = editorFactory.GetWpfTextView(textViewAdapter);

            if (textView != null)
                AddCommandFilter(textViewAdapter, new MultiPointEditCommandFilter(textView));
        }
开发者ID:Cronwell,项目名称:MultiEdit,代码行数:7,代码来源:MultiPointEditFilterProvider.cs

示例13: VsTextViewCreated

 public void VsTextViewCreated(IVsTextView textViewAdapter)
 {
     var commandFilter = new EditorCommandFilter(serviceProvider: this.serviceProvider);
     IOleCommandTarget nextTarget;
     ErrorHandler.ThrowOnFailure(textViewAdapter.AddCommandFilter(commandFilter, out nextTarget));
     commandFilter.NextCommandTarget = nextTarget;
 }
开发者ID:jango2015,项目名称:VS-Macros,代码行数:7,代码来源:TextViewCreationListener.cs

示例14: VsCommandFilter

        void IVsTextViewCreationListener.VsTextViewCreated(IVsTextView vsView)
        {
            var view = _adaptersFactory.GetWpfTextView(vsView);
            if (view == null)
            {
                return;
            }

            var opt = _vim.GetBuffer(view);
            if (!opt.IsSome())
            {
                return;
            }

            var buffer = opt.Value;
            var filter = new VsCommandFilter(buffer, vsView, _serviceProvider);
            _filterMap.Add(buffer, filter);

            // Try and install the IVsFilterKeys adapter.  This cannot be done synchronously here
            // because Venus projects are not fully initialized at this state.  Merely querying
            // for properties cause them to corrupt internal state and prevents rendering of the
            // view.  Occurs for aspx and .js pages
            Action install = () =>
                {
                    VsFilterKeysAdapter.TryInstallFilterKeysAdapter(_adapter, _editorOptionsFactoryService, buffer);
                };

            Dispatcher.CurrentDispatcher.BeginInvoke(install, null);
        }
开发者ID:praveennet,项目名称:VsVim,代码行数:29,代码来源:HostFactory.cs

示例15: VsTextViewCreated

        public void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            var textView = EditorAdaptersFactoryService.GetWpfTextView(textViewAdapter);

            textView.Properties.GetOrCreateSingletonProperty(() => new GoToDefinitionCommandTarget(textViewAdapter, textView, GoToDefinitionProviderService, ServiceProvider));
            textView.Properties.GetOrCreateSingletonProperty(() => new OpenIncludeFileCommandTarget(textViewAdapter, textView, ServiceProvider, SourceTextFactory));
        }
开发者ID:Samana,项目名称:HlslTools,代码行数:7,代码来源:GoToDefinitionTextViewCreationListener.cs


注:本文中的IVsTextView类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。