Пример #1
0
 public int EnumFilenames(out VisualStudio.OLE.Interop.IEnumString ppEnumString)
 {
     // this method doesn't work.  no matter what I do, EnumString throws
     // a null ref inside of Next
     ppEnumString = new EnumString(this.pathProvider);
     return VSConstants.E_NOTIMPL;
 }
Пример #2
0
 public void VsTextViewCreated(VisualStudio.TextManager.Interop.IVsTextView textViewAdapter)
 {
     ITextView textView = AdapterService.GetWpfTextView(textViewAdapter);
     if (textView != null) {
         BraceMatcher.WatchBraceHighlights(textView, IronRubyToolsPackage.ComponentModel);
     }
 }
Пример #3
0
 public override void TextViewCreated(IReplWindow window, VisualStudio.Text.Editor.ITextView view)
 {
     var adapterFactory = IronPythonToolsPackage.ComponentModel.GetService<IVsEditorAdaptersFactoryService>();
     new EditFilter(IronPythonToolsPackage.ComponentModel.GetService<IPythonAnalyzer>(), (IWpfTextView)view, adapterFactory.GetViewAdapter(view));
     window.UseSmartUpDown = IronPythonToolsPackage.Instance.OptionsPage.ReplSmartHistory;
     base.TextViewCreated(window, view);
 }
Пример #4
0
 public void DismissAllSessions(VisualStudio.Text.Editor.ITextView textView) {
     foreach (var session in _stackMap.GetStackForTextView(textView).Sessions) {
         if (session is ISignatureHelpSession) {
             session.Dismiss();
         }
     }
 }
Пример #5
0
        public ISignatureHelpSession TriggerSignatureHelp(VisualStudio.Text.Editor.ITextView textView) {
            ObservableCollection<ISignature> sets = new ObservableCollection<ISignature>();
            var session = new MockSignatureHelpSession(
                textView,
                sets,
                textView.TextBuffer.CurrentSnapshot.CreateTrackingPoint(
                    textView.Caret.Position.BufferPosition.Position,
                    PointTrackingMode.Negative
                )
            );

            foreach (var provider in _sigProviders) {
                foreach (var targetContentType in provider.Metadata.ContentTypes) {
                    if (textView.TextBuffer.ContentType.IsOfType(targetContentType)) {
                        var source = provider.Value.TryCreateSignatureHelpSource(textView.TextBuffer);
                        if (source != null) {
                            source.AugmentSignatureHelpSession(session, sets);
                        }
                    }
                }
            }

            if (session.Signatures.Count > 0 && !session.IsDismissed) {
                _stackMap.GetStackForTextView(textView).PushSession(session);
            }

            return session;
        }
Пример #6
0
 public static void RenderCompleteDiagramToView(VisualStudio visualStudio, ref ArchView view)
 {
     var modelGen = new DiagramGenerator(visualStudio.Solution);
     var tree = modelGen.GenerateDiagram(DiagramDefinition.RootDefault);
     var viewModel = LayerMapper.TreeModelToArchViewModel(tree,true,true);
     view.Diagram.RenderModel(viewModel);
 }
 public VisualStudio.TextManager.Interop.IVsTextBuffer GetBufferAdapter(VisualStudio.Text.ITextBuffer textBuffer) {
     MockVsTextLines textLines;
     if (!textBuffer.Properties.TryGetProperty<MockVsTextLines>(typeof(MockVsTextLines), out textLines)) {
         textBuffer.Properties[typeof(MockVsTextLines)] = textLines = new MockVsTextLines(_serviceProvider, (MockTextBuffer)textBuffer);
     }
     return textLines;
 }
Пример #8
0
 public bool IsSignatureHelpActive(VisualStudio.Text.Editor.ITextView textView) {
     foreach (var session in _stackMap.GetStackForTextView(textView).Sessions) {
         if (session is ISignatureHelpSession) {
             return true;
         }
     }
     return false;
 }
 public NormalCompletionAnalysis(VsProjectAnalyzer vsProjectAnalyzer, ITextSnapshot snapshot, VisualStudio.Text.ITrackingSpan applicableSpan, VisualStudio.Text.ITextBuffer textBuffer, GetMemberOptions options)
     : base(applicableSpan, textBuffer) {
     _analyzer = vsProjectAnalyzer;
     _snapshot = snapshot;
     _applicableSpan = applicableSpan;
     _textBuffer = textBuffer;
     _options = options;
 }
 public RequireCompletionAnalysis(VsProjectAnalyzer vsProjectAnalyzer, ITextSnapshot snapshot, VisualStudio.Text.ITrackingSpan applicableSpan, VisualStudio.Text.ITextBuffer textBuffer, bool quote)
     : base(applicableSpan, textBuffer) {
     _analyzer = vsProjectAnalyzer;
     _snapshot = snapshot;
     _applicableSpan = applicableSpan;
     _textBuffer = textBuffer;
     _quote = quote;
 }
Пример #11
0
        internal IPythonAnalyzer PythonAnalyzer = null; // Set by MEF

        #endregion Fields

        #region Methods

        public void VsTextViewCreated(VisualStudio.TextManager.Interop.IVsTextView textViewAdapter)
        {
            // TODO: We should probably only track text views in Python projects or loose files.
            ITextView textView = AdapterService.GetWpfTextView(textViewAdapter);
            if (textView != null) {
                PythonAnalyzer.AnalyzeTextView(textView);
            }
        }
Пример #12
0
 public ReadOnlyCollection<ISignatureHelpSession> GetSessions(VisualStudio.Text.Editor.ITextView textView) {
     List<ISignatureHelpSession> res = new List<ISignatureHelpSession>();
     foreach (var session in _stackMap.GetStackForTextView(textView).Sessions) {
         if (session is ISignatureHelpSession) {
             res.Add(session as ISignatureHelpSession);
         }
     }
     return new ReadOnlyCollection<ISignatureHelpSession>(res);
 }
Пример #13
0
        protected override void GotoSource(VisualStudio.Shell.Interop.VSOBJGOTOSRCTYPE gotoType)
        {
            // We do not support the "Goto Reference"
            if (VSOBJGOTOSRCTYPE.GS_REFERENCE == gotoType)
            {
                return;
            }

            base.OpenSourceFile();
        }
        public override int? EditFilterQueryStatus(ref VisualStudio.OLE.Interop.OLECMD cmd, IntPtr pCmdText) {
            var activeView = CommonPackage.GetActiveTextView(_serviceProvider);
            if (activeView != null && activeView.TextBuffer.ContentType.IsOfType(PythonCoreConstants.ContentType)) {
                cmd.cmdf = (uint)(OLECMDF.OLECMDF_ENABLED | OLECMDF.OLECMDF_SUPPORTED);
            } else {
                cmd.cmdf = (uint)(OLECMDF.OLECMDF_INVISIBLE);
            }

            return VSConstants.S_OK;
        }
Пример #15
0
 private static void RefactoringSetup(TestWorkspace workspace, CodeRefactoringProvider provider, List<CodeAction> refactorings, out ICodeActionEditHandlerService editHandler, out EditorLayerExtensionManager.ExtensionManager extensionManager, out VisualStudio.Text.ITextBuffer textBuffer)
 {
     var document = GetDocument(workspace);
     var span = document.GetSyntaxRootAsync().Result.Span;
     var context = new CodeRefactoringContext(document, span, (a) => refactorings.Add(a), CancellationToken.None);
     provider.ComputeRefactoringsAsync(context).Wait();
     var action = refactorings.Single();
     editHandler = workspace.ExportProvider.GetExportedValue<ICodeActionEditHandlerService>();
     extensionManager = document.Project.Solution.Workspace.Services.GetService<IExtensionManager>() as EditorLayerExtensionManager.ExtensionManager;
     textBuffer = document.GetTextAsync().Result.Container.GetTextBuffer();
 }
Пример #16
0
        public override int? EditFilterQueryStatus(ref VisualStudio.OLE.Interop.OLECMD cmd, IntPtr pCmdText) {
            var view = CommonPackage.GetActiveTextView(_serviceProvider);
            var analyzer = view?.GetAnalyzerAtCaret(_serviceProvider);
            var pythonCaret = view?.GetPythonCaret();
            if (view != null && analyzer != null && pythonCaret.HasValue) {
                cmd.cmdf = (uint)(OLECMDF.OLECMDF_ENABLED | OLECMDF.OLECMDF_SUPPORTED);
            } else {
                cmd.cmdf = (uint)(OLECMDF.OLECMDF_INVISIBLE);
            }

            return VSConstants.S_OK;
        }
Пример #17
0
        protected override int QueryStatusCommand(uint itemid, ref Guid pguidCmdGroup, uint cCmds, VisualStudio.OLE.Interop.OLECMD[] prgCmds, IntPtr pCmdText) {
            if (pguidCmdGroup == GuidList.guidOfficeSharePointCmdSet) {
                for (int i = 0; i < prgCmds.Length; i++) {
                    // Report it as supported so that it's not routed any
                    // further, but disable it and make it invisible.
                    prgCmds[i].cmdf = (uint)(OLECMDF.OLECMDF_SUPPORTED | OLECMDF.OLECMDF_INVISIBLE);
                }
                return VSConstants.S_OK;
            }

            return base.QueryStatusCommand(itemid, ref pguidCmdGroup, cCmds, prgCmds, pCmdText);
        }
Пример #18
0
 public void VsTextViewCreated(VisualStudio.TextManager.Interop.IVsTextView textViewAdapter) {
     // TODO: We should probably only track text views in Python projects or loose files.
     ITextView textView = AdapterService.GetWpfTextView(textViewAdapter);
     
     if (textView != null) {
         var analyzer = textView.GetAnalyzer(_serviceProvider);
         if (analyzer != null) {
             var monitorResult = analyzer.MonitorTextBuffer(textView, textView.TextBuffer);
             textView.Closed += TextView_Closed;
         }
     }
 }
Пример #19
0
        public override int? EditFilterQueryStatus(ref VisualStudio.OLE.Interop.OLECMD cmd, IntPtr pCmdText)
        {
            var activeView = CommonPackage.GetActiveTextView();
            if (activeView != null && activeView.TextBuffer.ContentType.IsOfType(RubyCoreConstants.ContentType)) {
                if (activeView.Selection.IsEmpty || activeView.Selection.Mode == TextSelectionMode.Box) {
                    cmd.cmdf = (uint)(OLECMDF.OLECMDF_SUPPORTED);
                } else {
                    cmd.cmdf = (uint)(OLECMDF.OLECMDF_ENABLED | OLECMDF.OLECMDF_SUPPORTED);
                }
            } else {
                cmd.cmdf = (uint)(OLECMDF.OLECMDF_INVISIBLE);
            }

            return VSConstants.S_OK;
        }
Пример #20
0
        public int? GetDesiredIndentation(VisualStudio.Text.ITextSnapshotLine line) {
            var dte = (EnvDTE.DTE)NodejsPackage.GetGlobalService(typeof(EnvDTE.DTE));

            var props = dte.get_Properties("TextEditor", "Node.js");
            switch ((EnvDTE._vsIndentStyle)(int)props.Item("IndentStyle").Value) {
                case EnvDTE._vsIndentStyle.vsIndentStyleNone:
                    return null;
                case EnvDTE._vsIndentStyle.vsIndentStyleDefault:
                    return DoBlockIndent(line);
                case EnvDTE._vsIndentStyle.vsIndentStyleSmart:
                    return DoSmartIndent(line);
            }

            return null;
        }
Пример #21
0
        /// On Press
        public override async void OnClick(object sender, EventArgs e)
        {
            var dte = ServiceProvider.GetService(typeof(DTE)) as DTE;
            var solution = _vsWorkspace.CurrentSolution;
            Action action = async () =>
            {
                var vs = new VisualStudio(dte, solution);
                await Lib.DevArch.RenderAllArchDiagramsToFiles(vs);
            };

//#if DEBUG
            action();
//#else
            RunSafe(action);
//#endif
        }
 public void VsTextViewCreated(VisualStudio.TextManager.Interop.IVsTextView textViewAdapter) {
     var textView = _adaptersFactory.GetWpfTextView(textViewAdapter);            
     var editFilter = new EditFilter(
         _serviceProvider,
         textView,
         _editorOperationsFactory.GetEditorOperations(textView),
         _editorOptionsFactory.GetOptions(textView),
         _compModel.GetService<IIntellisenseSessionStackMapService>().GetStackForTextView(textView),
         _compModel
     );
     IntellisenseController controller;
     if (textView.Properties.TryGetProperty<IntellisenseController>(typeof(IntellisenseController), out controller)) {
         controller.AttachKeyboardFilter();
     }
     editFilter.AttachKeyboardFilter(textViewAdapter);
 }
Пример #23
0
        public static async Task RenderAllArchDiagramsToFiles(VisualStudio visualStudio)
        {
            var modelGen = new DiagramGenerator(visualStudio.Solution);
            var parseResults = modelGen.GetDiagramDefinitions().ToList();
            var resultLogger = new ParseResultLogger(visualStudio.DevArchOutputWindow(), parseResults);
            resultLogger.PrintErrors();

            var definitions = parseResults.Where(x => x.Succeed).SelectList(x => x.Definition);
            foreach (var modelDef in definitions)
            {
                var tree = modelGen.GenerateDiagram(modelDef);
                if (!tree.Childs.Any())
                    throw new NoClassesFoundException();
                await BitmapRenderer.RenderTreeToBitmapAsync(tree,modelDef.DependencyDown, modelDef.Output, modelDef.HideAnonymousLayers);
                resultLogger.PrintCreated(modelDef.Output.Path);
            }
           resultLogger.PrintSuccess();
        }
Пример #24
0
        public override int? EditFilterQueryStatus(ref VisualStudio.OLE.Interop.OLECMD cmd, IntPtr pCmdText) {
            var activeView = CommonPackage.GetActiveTextView(_serviceProvider);
            if (activeView != null && activeView.TextBuffer.ContentType.IsOfType(PythonCoreConstants.ContentType)) {
                var analyzer = activeView.GetAnalyzer(_serviceProvider);

                if (activeView.Selection.IsEmpty ||
                    activeView.Selection.Mode == TextSelectionMode.Box ||
                    analyzer == null ||
                    !IsRealInterpreter(analyzer.InterpreterFactory)) {
                    cmd.cmdf = (uint)(OLECMDF.OLECMDF_SUPPORTED);
                } else {
                    cmd.cmdf = (uint)(OLECMDF.OLECMDF_ENABLED | OLECMDF.OLECMDF_SUPPORTED);
                }
            } else {
                cmd.cmdf = (uint)(OLECMDF.OLECMDF_INVISIBLE);
            }

            return VSConstants.S_OK;
        }
Пример #25
0
 public void VsTextViewCreated(VisualStudio.TextManager.Interop.IVsTextView textViewAdapter) {
     // TODO: We should probably only track text views in Python projects or loose files.
     ITextView textView = AdapterService.GetWpfTextView(textViewAdapter);
     
     if (textView != null) {
         var analyzer = _serviceProvider.GetProjectFromFile(textView.GetFilePath())?.GetAnalyzer();
         if (analyzer != null) {
             var monitorResult = analyzer.MonitorTextBufferAsync(textView.TextBuffer)
                 .ContinueWith(
                     task => {
                         textView.Closed += TextView_Closed;
                         lock(task.Result) {
                             task.Result.AttachedViews++;
                         }
                     }
                 );
         }
     }
 }
Пример #26
0
        internal override async void BuildAsync(uint vsopts, string config, VisualStudio.Shell.Interop.IVsOutputWindowPane output, string target, Action<MSBuildResult, string> uiThreadCallback) {
            try {
                await CheckForLongPaths();
            } catch (Exception) {
                uiThreadCallback(MSBuildResult.Failed, target);
                return;
            }

            // BuildAsync can throw on the sync path before invoking the callback. If it does, we must still invoke the callback here,
            // because by this time there's no other way to propagate the error to the caller.
            try {
                base.BuildAsync(vsopts, config, output, target, uiThreadCallback);
            } catch (Exception) {
                uiThreadCallback(MSBuildResult.Failed, target);
            }
        }
Пример #27
0
 public int OpenStandardEditor(uint grfOpenStandard, string pszMkDocument, ref Guid rguidLogicalView, string pszOwnerCaption, IVsUIHierarchy pHier, uint itemid, IntPtr punkDocDataExisting, VisualStudio.OLE.Interop.IServiceProvider psp, out IVsWindowFrame ppWindowFrame) {
     throw new NotImplementedException();
 }
Пример #28
0
 public int OpenDocumentViaProjectWithSpecific(string pszMkDocument, uint grfEditorFlags, ref Guid rguidEditorType, string pszPhysicalView, ref Guid rguidLogicalView, out VisualStudio.OLE.Interop.IServiceProvider ppSP, out IVsUIHierarchy ppHier, out uint pitemid, out IVsWindowFrame ppWindowFrame) {
     throw new NotImplementedException();
 }
Пример #29
0
 public int OpenDocumentViaProject(string pszMkDocument, ref Guid rguidLogicalView, out VisualStudio.OLE.Interop.IServiceProvider ppSP, out IVsUIHierarchy ppHier, out uint pitemid, out IVsWindowFrame ppWindowFrame) {
     throw new NotImplementedException();
 }
Пример #30
0
 public int IsDocumentInAProject(string pszMkDocument, out IVsUIHierarchy ppUIH, out uint pitemid, out VisualStudio.OLE.Interop.IServiceProvider ppSP, out int pDocInProj) {
     throw new NotImplementedException();
 }