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; }
public void VsTextViewCreated(VisualStudio.TextManager.Interop.IVsTextView textViewAdapter) { ITextView textView = AdapterService.GetWpfTextView(textViewAdapter); if (textView != null) { BraceMatcher.WatchBraceHighlights(textView, IronRubyToolsPackage.ComponentModel); } }
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); }
public void DismissAllSessions(VisualStudio.Text.Editor.ITextView textView) { foreach (var session in _stackMap.GetStackForTextView(textView).Sessions) { if (session is ISignatureHelpSession) { session.Dismiss(); } } }
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; }
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; }
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; }
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); } }
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); }
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; }
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(); }
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; }
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); }
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; } } }
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; }
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; }
/// 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); }
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(); }
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; }
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++; } } ); } } }
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); } }
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(); }
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(); }
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(); }
public int IsDocumentInAProject(string pszMkDocument, out IVsUIHierarchy ppUIH, out uint pitemid, out VisualStudio.OLE.Interop.IServiceProvider ppSP, out int pDocInProj) { throw new NotImplementedException(); }