• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IVsTextBuffer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GetDataBuffer

        public ITextBuffer GetDataBuffer(IVsTextBuffer bufferAdapter)
        {
            ITextBuffer tb = null;
            _vsTextBufferAdapters.TryGetValue(bufferAdapter, out tb);

            return tb;
        }
开发者ID:AlexanderSher,项目名称:RTVS-Old,代码行数:7,代码来源:VsEditorAdaptersFactoryServiceMock.cs


示例2: VsInteractiveWindowCommandFilter

        public VsInteractiveWindowCommandFilter(IVsEditorAdaptersFactoryService adapterFactory, IInteractiveWindow window, IVsTextView textViewAdapter, IVsTextBuffer bufferAdapter, IEnumerable<Lazy<IVsInteractiveWindowOleCommandTargetProvider, ContentTypeMetadata>> oleCommandTargetProviders, IContentTypeRegistryService contentTypeRegistry)
        {
            _window = window;
            _oleCommandTargetProviders = oleCommandTargetProviders;
            _contentTypeRegistry = contentTypeRegistry;

            this.textViewAdapter = textViewAdapter;

            // make us a code window so we'll have the same colors as a normal code window.
            IVsTextEditorPropertyContainer propContainer;
            ErrorHandler.ThrowOnFailure(((IVsTextEditorPropertyCategoryContainer)textViewAdapter).GetPropertyCategory(Microsoft.VisualStudio.Editor.DefGuidList.guidEditPropCategoryViewMasterSettings, out propContainer));
            propContainer.SetProperty(VSEDITPROPID.VSEDITPROPID_ViewComposite_AllCodeWindowDefaults, true);
            propContainer.SetProperty(VSEDITPROPID.VSEDITPROPID_ViewGlobalOpt_AutoScrollCaretOnTextEntry, true);

            // editor services are initialized in textViewAdapter.Initialize - hook underneath them:
            _preEditorCommandFilter = new CommandFilter(this, CommandFilterLayer.PreEditor);
            ErrorHandler.ThrowOnFailure(textViewAdapter.AddCommandFilter(_preEditorCommandFilter, out _editorCommandFilter));

            textViewAdapter.Initialize(
                (IVsTextLines)bufferAdapter,
                IntPtr.Zero,
                (uint)TextViewInitFlags.VIF_HSCROLL | (uint)TextViewInitFlags.VIF_VSCROLL | (uint)TextViewInitFlags3.VIF_NO_HWND_SUPPORT,
                new[] { new INITVIEW { fSelectionMargin = 0, fWidgetMargin = 0, fVirtualSpace = 0, fDragDropMove = 1 } });

            // disable change tracking because everything will be changed
            var textViewHost = adapterFactory.GetWpfTextViewHost(textViewAdapter);

            _preLanguageCommandFilter = new CommandFilter(this, CommandFilterLayer.PreLanguage);
            ErrorHandler.ThrowOnFailure(textViewAdapter.AddCommandFilter(_preLanguageCommandFilter, out _editorServicesCommandFilter));

            _textViewHost = textViewHost;
        }
开发者ID:ralfkang,项目名称:roslyn,代码行数:32,代码来源:VsInteractiveWindowCommandFilter.cs


示例3: GetNameOfLocation

        public int GetNameOfLocation(IVsTextBuffer pBuffer, int iLine, int iCol, out string pbstrName, out int piLineOffset)
        {
            pbstrName = null;
            piLineOffset = 0;
            return VSConstants.E_FAIL;

            //var model = _serviceProvider.GetService(typeof(SComponentModel)) as IComponentModel;
            //var service = model.GetService<IVsEditorAdaptersFactoryService>();
            //var buffer = service.GetDataBuffer(pBuffer);
            //IAlpaProjectEntry projEntry;
            //if (buffer.TryGetAlpaProjectEntry(out projEntry))
            //{
            //    var tree = projEntry.Tree;
            //    var name = FindNodeInTree(tree, tree.Body as SuiteStatement, iLine);
            //    if (name != null)
            //    {
            //        pbstrName = projEntry.Analysis.ModuleName + "." + name;
            //        piLineOffset = iCol;
            //    }
            //    else
            //    {
            //        pbstrName = projEntry.Analysis.ModuleName;
            //        piLineOffset = iCol;
            //    }
            //    return VSConstants.S_OK;
            //}

            //pbstrName = "";
            //piLineOffset = iCol;
            //return VSConstants.S_OK;
        }
开发者ID:wiinuk,项目名称:AlpaVsix,代码行数:31,代码来源:AlpaLanguageInfo.cs


示例4: PieScanner

        public PieScanner(IVsTextBuffer buffer)
        {
            m_buffer = buffer;

            grammar = new PieGrammar();
            parser = new Irony.Parsing.Parser(grammar);
            parser.Context.Mode = Irony.Parsing.ParseMode.VsLineScan;
        }
开发者ID:maleficus1234,项目名称:Pie,代码行数:8,代码来源:PieScanner.cs


示例5: TextStreamEventAdapter

        public TextStreamEventAdapter(IVsTextBuffer buffer)
        {
            if (buffer == null) throw new ArgumentNullException("buffer");

            var cpContainer = buffer as IConnectionPointContainer;
            Guid riid = typeof(IVsTextStreamEvents).GUID;
            cpContainer.FindConnectionPoint(ref riid, out _connectionPoint);

            _connectionPoint.Advise(this, out _connectionCookie);
        }
开发者ID:hxhlb,项目名称:wordlight,代码行数:10,代码来源:TextStreamEventAdapter.cs


示例6: ValidateBreakpointLocation

        public override int ValidateBreakpointLocation(IVsTextBuffer pBuffer, int iLine, int iCol, TextSpan[] pCodeSpan) {
            pCodeSpan[0] = default(TextSpan);
            pCodeSpan[0].iStartLine = iLine;
            pCodeSpan[0].iEndLine = iLine;

            // Returning E_NOTIMPL indicates that this language only supports entire-line breakpoints. Consequently,
            // VS debugger will highlight the entire line when the breakpoint is active and the corresponding option
            // ("Highlight entire source line for breakpoints and current statement") is set. If we returned S_OK,
            // we'd have to handle this ourselves.
            return VSConstants.E_NOTIMPL;
        }
开发者ID:Microsoft,项目名称:RTVS,代码行数:11,代码来源:RLanguageService.cs


示例7: GetPositionsOfSpan

        public static int GetPositionsOfSpan(IVsTextBuffer textStream, TextSpan ts, out int startPos, out int endPos) {
            int hr;

            startPos = 0;
            endPos = 0;

            hr = textStream.GetPositionOfLineIndex(ts.iStartLine, ts.iStartIndex, out startPos);
            if (hr == VSConstants.S_OK) {
                hr = textStream.GetPositionOfLineIndex(ts.iEndLine, ts.iEndIndex, out endPos);
            }

            return hr;
        }
开发者ID:AlexanderSher,项目名称:RTVS-Old,代码行数:13,代码来源:CompletionUtilities.cs


示例8: GetActiveView

        public int GetActiveView(int fMustHaveFocus, IVsTextBuffer pBuffer, out IVsTextView ppView)
        {
            string fileName = ((MockTextLines)pBuffer).FileName;

            if (_views.ContainsKey(fileName))
            {
                ppView = _views[fileName];
                return VSConstants.S_OK;
            }
            else
            {
                ppView = null;
                return VSConstants.E_INVALIDARG;
            }
        }
开发者ID:jonthegiant,项目名称:StyleCop,代码行数:15,代码来源:MockTextManager.cs


示例9: CreateCodeEditor

        private void CreateCodeEditor()
        {
            Guid clsidTextBuffer = typeof(VsTextBufferClass).GUID;
            Guid iidTextBuffer = VSConstants.IID_IUnknown;
            TextBuffer = (IVsTextBuffer)MySqlDataProviderPackage.Instance.CreateInstance(
                                 ref clsidTextBuffer,
                                 ref iidTextBuffer,
                                 typeof(object));
            if (TextBuffer == null)
                throw new Exception("Failed to create core editor");

            // first we need to site our buffer
            IObjectWithSite textBufferSite = TextBuffer as IObjectWithSite;
            if (textBufferSite != null)
            {
                textBufferSite.SetSite(psp);
            }

            // then we need to tell our buffer not to attempt to autodetect the
            // language settings
            IVsUserData userData = TextBuffer as IVsUserData;
            Guid g = EditorFactory.GuidVSBufferDetectLangSid;
            int result = userData.SetData(ref g, false);

            Guid clsidCodeWindow = typeof(VsCodeWindowClass).GUID;
            Guid iidCodeWindow = typeof(IVsCodeWindow).GUID;
            IVsCodeWindow pCodeWindow = (IVsCodeWindow)MySqlDataProviderPackage.Instance.CreateInstance(
                   ref clsidCodeWindow,
                   ref iidCodeWindow,
                   typeof(IVsCodeWindow));
            if (pCodeWindow == null)
                throw new Exception("Failed to create core editor");

            // Give the text buffer to the code window.                    
            // We are giving up ownership of the text buffer!                    
            pCodeWindow.SetBuffer((IVsTextLines)TextBuffer);

            CodeWindow = pCodeWindow;
        }
开发者ID:Top-Cat,项目名称:SteamBot,代码行数:39,代码来源:TextBufferEditor.cs


示例10: IsMappedLocation

 public int IsMappedLocation(IVsTextBuffer pBuffer, int iLine, int iCol) {
     return VSConstants.E_FAIL;
 }
开发者ID:mauricionr,项目名称:nodejstools,代码行数:3,代码来源:NodejsLanguageInfo.cs


示例11: GetNameOfLocation

 public int GetNameOfLocation(IVsTextBuffer pBuffer, int iLine, int iCol, out string pbstrName, out int piLineOffset) {
     pbstrName = null;
     piLineOffset = 0;
     return VSConstants.E_FAIL;
 }
开发者ID:mauricionr,项目名称:nodejstools,代码行数:5,代码来源:NodejsLanguageInfo.cs


示例12: ValidateBreakpointLocation

        public int ValidateBreakpointLocation(IVsTextBuffer pBuffer, int iLine, int iCol, TextSpan[] pCodeSpan) {
            // per the docs, even if we don't intend to validate, we need to set the span info:
            // http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.textmanager.interop.ivslanguagedebuginfo.validatebreakpointlocation.aspx
            // 
            // Caution
            // Even if you do not intend to support the ValidateBreakpointLocation method but your 
            // language does support breakpoints, you must implement this method and return a span 
            // that contains the specified line and column; otherwise, breakpoints cannot be set 
            // anywhere except line 1. You can return E_NOTIMPL to indicate that you do not otherwise 
            // support this method but the span must always be set. 

            // http://pytools.codeplex.com/workitem/787
            // We were previously returning S_OK here indicating to VS that we have in fact validated
            // the breakpoint.  Validating breakpoints actually interacts and effectively disables
            // the "Highlight entire source line for breakpoints and current statement" option as instead
            // VS highlights the validated region.  So we return E_NOTIMPL here to indicate that we have 
            // not validated the breakpoint, and then VS will happily respect the option when we're in 
            // design mode.
            pCodeSpan[0].iStartLine = iLine;
            pCodeSpan[0].iEndLine = iLine;
            return VSConstants.E_NOTIMPL;
        }
开发者ID:mauricionr,项目名称:nodejstools,代码行数:22,代码来源:NodejsLanguageInfo.cs


示例13: CreateSelectionAction

 public int CreateSelectionAction(IVsTextBuffer pBuffer, out IVsTextSelectionAction ppAction)
 {
     throw new Exception("The method or operation is not implemented.");
 }
开发者ID:jonthegiant,项目名称:StyleCop,代码行数:4,代码来源:MockTextManager.cs


示例14: UnregisterIndependentView

 public int UnregisterIndependentView(object pUnk, IVsTextBuffer pBuffer)
 {
     throw new Exception("The method or operation is not implemented.");
 }
开发者ID:jonthegiant,项目名称:StyleCop,代码行数:4,代码来源:MockTextManager.cs


示例15: GetDocumentBuffer

 public Microsoft.VisualStudio.Text.ITextBuffer GetDocumentBuffer(IVsTextBuffer bufferAdapter)
 {
     throw new NotImplementedException();
 }
开发者ID:briandonahue,项目名称:VsVim,代码行数:4,代码来源:MemoryLeakTest.cs


示例16: RegisterView

 public int RegisterView(IVsTextView pView, IVsTextBuffer pBuffer)
 {
     throw new Exception("The method or operation is not implemented.");
 }
开发者ID:jonthegiant,项目名称:StyleCop,代码行数:4,代码来源:MockTextManager.cs


示例17: UnregisterBuffer

 public int UnregisterBuffer(IVsTextBuffer pBuffer)
 {
     throw new Exception("The method or operation is not implemented.");
 }
开发者ID:jonthegiant,项目名称:StyleCop,代码行数:4,代码来源:MockTextManager.cs


示例18: SetDataBuffer

 public void SetDataBuffer(IVsTextBuffer bufferAdapter, Microsoft.VisualStudio.Text.ITextBuffer dataBuffer)
 {
     throw new NotImplementedException();
 }
开发者ID:briandonahue,项目名称:VsVim,代码行数:4,代码来源:MemoryLeakTest.cs


示例19: AdjustFileChangeIgnoreCount

 public int AdjustFileChangeIgnoreCount(IVsTextBuffer pBuffer, int fIgnore)
 {
     throw new Exception("The method or operation is not implemented.");
 }
开发者ID:jonthegiant,项目名称:StyleCop,代码行数:4,代码来源:MockTextManager.cs


示例20: GetProximityExpressions

        /// <summary>
        /// Called by debugger to get the list of expressions for the Autos debugger tool window.
        /// </summary>
        /// <remarks>
        /// MSDN docs specify that <paramref name="iLine"/> and <paramref name="iCol"/> specify the beginning of the span,
        /// but they actually specify the end of it (going <paramref name="cLines"/> lines back).
        /// </remarks>
        public int GetProximityExpressions(IVsTextBuffer pBuffer, int iLine, int iCol, int cLines, out IVsEnumBSTR ppEnum) {
            var model = _serviceProvider.GetService(typeof(SComponentModel)) as IComponentModel;
            var service = model.GetService<IVsEditorAdaptersFactoryService>();
            var buffer = service.GetDataBuffer(pBuffer);
            IPythonProjectEntry projEntry;
            if (buffer.TryGetPythonProjectEntry(out projEntry)) {
                int startLine = Math.Max(iLine - cLines + 1, 0);
                if (startLine <= iLine) {
                    var ast = projEntry.Tree;
                    var walker = new ProximityExpressionWalker(ast, startLine, iLine);
                    ast.Walk(walker);
                    var exprs = walker.GetExpressions();
                    ppEnum = new EnumBSTR(exprs.ToArray());
                    return VSConstants.S_OK;
                }
            }

            ppEnum = null;
            return VSConstants.E_FAIL;
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:27,代码来源:PythonLanguageInfo.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IVsTextLines类代码示例发布时间:2022-05-24
下一篇:
C# IVsSolution类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap