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 override int?EditFilterQueryStatus(ref VisualStudio.OLE.Interop.OLECMD cmd, IntPtr pCmdText) { var activeView = CommonPackage.GetActiveTextView(_serviceProvider); var empty = activeView.Selection.IsEmpty; Intellisense.VsProjectAnalyzer analyzer; if (activeView != null && (analyzer = activeView.GetAnalyzerAtCaret(_serviceProvider)) != null) { if (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 override int?EditFilterQueryStatus(ref VisualStudio.OLE.Interop.OLECMD cmd, IntPtr pCmdText) { var activeView = CommonPackage.GetActiveTextView(_serviceProvider); InterpreterConfiguration config; if ((config = activeView?.GetInterpreterConfigurationAtCaret(_serviceProvider)) != null) { if (activeView.Selection.Mode == TextSelectionMode.Box || config?.IsRunnable() != true) { 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 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); }
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); }
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); }