コード例 #1
0
        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;
        }
コード例 #2
0
ファイル: AlpaLanguageInfo.cs プロジェクト: wiinuk/AlpaVsix
        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;
        }
コード例 #3
0
        public ITextBuffer GetDataBuffer(IVsTextBuffer bufferAdapter)
        {
            ITextBuffer tb = null;
            _vsTextBufferAdapters.TryGetValue(bufferAdapter, out tb);

            return tb;
        }
コード例 #4
0
ファイル: PieScanner.cs プロジェクト: maleficus1234/Pie
        public PieScanner(IVsTextBuffer buffer)
        {
            m_buffer = buffer;

            grammar = new PieGrammar();
            parser = new Irony.Parsing.Parser(grammar);
            parser.Context.Mode = Irony.Parsing.ParseMode.VsLineScan;
        }
コード例 #5
0
        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);
        }
コード例 #6
0
ファイル: RLanguageService.cs プロジェクト: Microsoft/RTVS
        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;
        }
コード例 #7
0
        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;
        }
コード例 #8
0
        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;
            }
        }
コード例 #9
0
ファイル: TextBufferEditor.cs プロジェクト: Top-Cat/SteamBot
        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;
        }
コード例 #10
0
ファイル: DocumentProvider.cs プロジェクト: XieShuquan/roslyn
        private void OnDocumentLoadCompleted(IVsTextBuffer shimTextBuffer, DocumentKey documentKeyOpt, string moniker)
        {
            AssertIsForeground();
            // This is called when IVsTextBufferDataEvents.OnLoadComplete() has been triggered for a
            // newly-created buffer.
            if (!_runningDocumentTable.TryGetCookieForInitializedDocument(moniker, out var docCookie))
            {
                return;
            }

            var textBuffer = _editorAdaptersFactoryService.GetDocumentBuffer(shimTextBuffer);
            if (textBuffer == null)
            {
                throw new InvalidOperationException("The IVsTextBuffer has been populated but the underlying ITextBuffer does not exist!");
            }

            if (documentKeyOpt == null)
            {
                // Non-Roslyn document.
                OnNonRoslynBufferOpened_NoLock(textBuffer, docCookie);
            }
            else
            {
                NewBufferOpened(docCookie, textBuffer, documentKeyOpt, IsCurrentContext(docCookie, documentKeyOpt));
            }
        }
コード例 #11
0
 public virtual int IsMappedLocation(IVsTextBuffer buffer, int line, int col);
コード例 #12
0
ファイル: EditorIntegration.cs プロジェクト: habbes/odata-lab
            public EditorInterfaces(ITextBuffer textBuffer, ITextDocument textDocument, IVsTextBuffer vsTextBuffer)
            {
                Contract.Assert(textBuffer != null);
                Contract.Assert(textDocument != null);
                Contract.Assert(vsTextBuffer != null);

                TextBuffer   = textBuffer;
                TextDocument = textDocument;
                VsTextBuffer = vsTextBuffer;
            }
コード例 #13
0
 public int GetNameOfLocation(IVsTextBuffer pBuffer, int iLine, int iCol, out string pbstrName, out int piLineOffset) {
     pbstrName = null;
     piLineOffset = 0;
     return VSConstants.E_FAIL;
 }
コード例 #14
0
 public int UnregisterIndependentView(object pUnk, IVsTextBuffer pBuffer)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #15
0
ファイル: MockTextManager.cs プロジェクト: sarvex/StyleCop
 public int UnregisterIndependentView(object pUnk, IVsTextBuffer pBuffer)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #16
0
ファイル: MockTextManager.cs プロジェクト: sarvex/StyleCop
 public int UnregisterBuffer(IVsTextBuffer pBuffer)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #17
0
ファイル: MockTextManager.cs プロジェクト: sarvex/StyleCop
 public int RegisterView(IVsTextView pView, IVsTextBuffer pBuffer)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #18
0
ファイル: MockTextManager.cs プロジェクト: sarvex/StyleCop
 public int NavigateToPosition(IVsTextBuffer pBuffer, ref Guid guidDocViewType, int iPos, int iLen)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #19
0
ファイル: MockTextManager.cs プロジェクト: sarvex/StyleCop
 public int NavigateToLineAndColumn(IVsTextBuffer pBuffer, ref Guid guidDocViewType, int iStartRow, int iStartIndex, int iEndRow, int iEndIndex)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #20
0
ファイル: MockTextManager.cs プロジェクト: sarvex/StyleCop
 public int IgnoreNextFileChange(IVsTextBuffer pBuffer)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #21
0
 public virtual int ValidateBreakpointLocation(IVsTextBuffer buffer, int line, int col, TextSpan[] pCodeSpan);
コード例 #22
0
 public int NavigateToLineAndColumn(IVsTextBuffer pBuffer, ref Guid guidDocViewType, int iStartRow, int iStartIndex, int iEndRow, int iEndIndex)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #23
0
 public int RegisterView(IVsTextView pView, IVsTextBuffer pBuffer)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #24
0
ファイル: MockTextManager.cs プロジェクト: sarvex/StyleCop
 public int AdjustFileChangeIgnoreCount(IVsTextBuffer pBuffer, int fIgnore)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #25
0
 public int CreateSelectionAction(IVsTextBuffer pBuffer, out IVsTextSelectionAction ppAction)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #26
0
ファイル: MockTextManager.cs プロジェクト: sarvex/StyleCop
 public int CreateSelectionAction(IVsTextBuffer pBuffer, out IVsTextSelectionAction ppAction)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #27
0
        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;
        }
コード例 #28
0
ファイル: MockTextManager.cs プロジェクト: sarvex/StyleCop
 public int EnumViews(IVsTextBuffer pBuffer, out IVsEnumTextViews ppEnum)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #29
0
 public int IsMappedLocation(IVsTextBuffer pBuffer, int iLine, int iCol) {
     return VSConstants.E_FAIL;
 }
コード例 #30
0
 public virtual int GetNameOfLocation(IVsTextBuffer buffer, int line, int col, out string name, out int lineOffset);
コード例 #31
0
 public virtual int GetLanguageID(IVsTextBuffer buffer, int line, int col, out Guid langId);
コード例 #32
0
 public int GetLanguageID(IVsTextBuffer pBuffer, int iLine, int iCol, out Guid pguidLanguageID)
 {
     pguidLanguageID = DebuggerConstants.guidLanguagePython;
     return(VSConstants.S_OK);
 }
コード例 #33
0
ファイル: MockVsTextManager.cs プロジェクト: zyxws012/PTVS
 public int GetActiveView2(int fMustHaveFocus, IVsTextBuffer pBuffer, uint grfIncludeViewFrameType, out IVsTextView ppView)
 {
     throw new NotImplementedException();
 }
コード例 #34
0
 public virtual int GetProximityExpressions(IVsTextBuffer buffer, int line, int col, int cLines, out IVsEnumBSTR ppEnum);
コード例 #35
0
ファイル: MemoryLeakTest.cs プロジェクト: briandonahue/VsVim
 public Microsoft.VisualStudio.Text.ITextBuffer GetDocumentBuffer(IVsTextBuffer bufferAdapter)
 {
     throw new NotImplementedException();
 }
コード例 #36
0
ファイル: PythonLanguageInfo.cs プロジェクト: omnimark/PTVS
        /// <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;
        }
コード例 #37
0
ファイル: MockVsTextManager.cs プロジェクト: zyxws012/PTVS
 public int GetBufferSccStatus3(IVsTextBuffer pBuffer, string pszFileName, out int pbCheckoutSucceeded, out int piStatusFlags)
 {
     throw new NotImplementedException();
 }
コード例 #38
0
 public int IsMappedLocation(IVsTextBuffer pBuffer, int iLine, int iCol)
 {
     return(VSConstants.E_FAIL);
 }
コード例 #39
0
ファイル: MemoryLeakTest.cs プロジェクト: briandonahue/VsVim
 public void SetDataBuffer(IVsTextBuffer bufferAdapter, Microsoft.VisualStudio.Text.ITextBuffer dataBuffer)
 {
     throw new NotImplementedException();
 }
コード例 #40
0
ファイル: MockVsTextManager.cs プロジェクト: zyxws012/PTVS
 public int NavigateToPosition2(IVsTextBuffer pBuffer, ref Guid guidDocViewType, int iPos, int iLen, uint grfIncludeViewFrameType)
 {
     throw new NotImplementedException();
 }
コード例 #41
0
ファイル: PythonLanguageInfo.cs プロジェクト: omnimark/PTVS
 public int GetLanguageID(IVsTextBuffer pBuffer, int iLine, int iCol, out Guid pguidLanguageID) {
     pguidLanguageID = DebuggerConstants.guidLanguagePython;
     return VSConstants.S_OK;
 }
コード例 #42
0
ファイル: MockVsTextManager.cs プロジェクト: zyxws012/PTVS
 public int AdjustFileChangeIgnoreCount(IVsTextBuffer pBuffer, int fIgnore)
 {
     throw new NotImplementedException();
 }
コード例 #43
0
 public int IgnoreNextFileChange(IVsTextBuffer pBuffer)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #44
0
ファイル: MockVsTextManager.cs プロジェクト: zyxws012/PTVS
 public int CreateSelectionAction(IVsTextBuffer pBuffer, out IVsTextSelectionAction ppAction)
 {
     throw new NotImplementedException();
 }
コード例 #45
0
 public int NavigateToPosition(IVsTextBuffer pBuffer, ref Guid guidDocViewType, int iPos, int iLen)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #46
0
ファイル: MockVsTextManager.cs プロジェクト: zyxws012/PTVS
 public int EnumViews(IVsTextBuffer pBuffer, out IVsEnumTextViews ppEnum)
 {
     throw new NotImplementedException();
 }
コード例 #47
0
 public int UnregisterBuffer(IVsTextBuffer pBuffer)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #48
0
ファイル: MockVsTextManager.cs プロジェクト: zyxws012/PTVS
 public int GetActiveView(int fMustHaveFocus, IVsTextBuffer pBuffer, out IVsTextView ppView)
 {
     throw new NotImplementedException();
 }
コード例 #49
0
 public int AdjustFileChangeIgnoreCount(IVsTextBuffer pBuffer, int fIgnore)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #50
0
ファイル: MockVsTextManager.cs プロジェクト: zyxws012/PTVS
 public int IgnoreNextFileChange(IVsTextBuffer pBuffer)
 {
     throw new NotImplementedException();
 }
コード例 #51
0
 public int EnumViews(IVsTextBuffer pBuffer, out IVsEnumTextViews ppEnum)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #52
0
ファイル: MockVsTextManager.cs プロジェクト: zyxws012/PTVS
 public int NavigateToLineAndColumn(IVsTextBuffer pBuffer, ref Guid guidDocViewType, int iStartRow, int iStartIndex, int iEndRow, int iEndIndex)
 {
     throw new NotImplementedException();
 }
コード例 #53
0
ファイル: LanguageService.cs プロジェクト: jda808/NPL
 /// <summary>
 /// add by LiXizhi, since we need to set breakpoint on it. 
 /// </summary>
 /// <param name="buffer"></param>
 /// <param name="line"></param>
 /// <param name="col"></param>
 /// <param name="pCodeSpan"></param>
 /// <returns></returns>
 public override int ValidateBreakpointLocation(IVsTextBuffer buffer, int line, int col, TextSpan[] pCodeSpan)
 {
     if (pCodeSpan != null)
     {
         // Make sure the span is set to at least the current
         // position by default.
         pCodeSpan[0].iStartLine = line;
         pCodeSpan[0].iStartIndex = col;
         pCodeSpan[0].iEndLine = line;
         pCodeSpan[0].iEndIndex = col;
     }
     return VSConstants.S_OK;
 }
コード例 #54
0
ファイル: MockVsTextManager.cs プロジェクト: zyxws012/PTVS
 public int NavigateToPosition(IVsTextBuffer pBuffer, ref Guid guidDocViewType, int iPos, int iLen)
 {
     throw new NotImplementedException();
 }
コード例 #55
0
 public int GetLanguageID(IVsTextBuffer pBuffer, int iLine, int iCol, out Guid pguidLanguageID) {
     pguidLanguageID = Guids.NodejsDebugLanguage;
     return VSConstants.S_OK;
 }
コード例 #56
0
ファイル: MockVsTextManager.cs プロジェクト: zyxws012/PTVS
 public int RegisterBuffer(IVsTextBuffer pBuffer)
 {
     throw new NotImplementedException();
 }
コード例 #57
0
 public int GetProximityExpressions(IVsTextBuffer pBuffer, int iLine, int iCol, int cLines, out IVsEnumBSTR ppEnum) {
     ppEnum = null;
     return VSConstants.E_FAIL;
 }
コード例 #58
0
ファイル: MockVsTextManager.cs プロジェクト: zyxws012/PTVS
 public int RegisterIndependentView(object pUnk, IVsTextBuffer pBuffer)
 {
     throw new NotImplementedException();
 }
コード例 #59
0
ファイル: EditorIntegration.cs プロジェクト: haxard/lab
            public EditorInterfaces(ITextBuffer textBuffer, ITextDocument textDocument, IVsTextBuffer vsTextBuffer)
            {
                Contract.Assert(textBuffer != null);
                Contract.Assert(textDocument != null);
                Contract.Assert(vsTextBuffer != null);

                TextBuffer = textBuffer;
                TextDocument = textDocument;
                VsTextBuffer = vsTextBuffer;
            }
コード例 #60
0
ファイル: MemoryLeakTest.cs プロジェクト: sh54/VsVim
 public void SetDataBuffer(IVsTextBuffer bufferAdapter, Microsoft.VisualStudio.Text.ITextBuffer dataBuffer)
 {
     throw new NotImplementedException();
 }