示例#1
0
        internal override int QueryStatusOnNode(Guid cmdGroup, uint cmd, IntPtr pCmdText, ref QueryStatusResult result)
        {
            if (cmdGroup == Guids.NodejsNpmCmdSet)
            {
                switch (cmd)
                {
                case PkgCmdId.cmdidNpmUpdateModules:
                    if (_parent.IsCurrentStateASuppressCommandsMode())
                    {
                        result = QueryStatusResult.SUPPORTED;
                    }
                    else
                    {
                        if (AllChildren.Any())
                        {
                            result = QueryStatusResult.ENABLED | QueryStatusResult.SUPPORTED;
                        }
                        else
                        {
                            result = QueryStatusResult.SUPPORTED;
                        }
                    }
                    return(VSConstants.S_OK);

                case PkgCmdId.cmdidNpmInstallModules:
                case PkgCmdId.cmdidNpmInstallSingleMissingModule:
                case PkgCmdId.cmdidNpmUninstallModule:
                case PkgCmdId.cmdidNpmUpdateSingleModule:
                    result = QueryStatusResult.SUPPORTED | QueryStatusResult.INVISIBLE;
                    return(VSConstants.S_OK);
                }
            }

            return(base.QueryStatusOnNode(cmdGroup, cmd, pCmdText, ref result));
        }
示例#2
0
        protected override ImageMoniker GetIconMoniker(bool open)
        {
            if (!ItemNode.IsExcluded && AllChildren.Any(n => ModulePath.IsInitPyFile(n.Url)))
            {
                return(open ? KnownMonikers.PackageFolderOpened : KnownMonikers.PackageFolderClosed);
            }

            return(base.GetIconMoniker(open));
        }