Exemplo n.º 1
0
 private static void demo_Env_Properties()
 {
     vsc.Env.AllProperties()((EnvState props) => {
         string[] items = default;
         items = new string[8];
         {
             items[0] = strFmt("AppName\t\t\t{0}", props.AppName);
             items[1] = strFmt("AppRoot\t\t\t{0}", props.AppRoot);
             items[2] = strFmt("Language\t\t{0}", props.Language);
             items[3] = strFmt("MachineId\t\t{0}", props.MachineId);
             items[4] = strFmt("RemoteName\t\t{0}", props.RemoteName);
             items[5] = strFmt("SessionId\t\t{0}", props.SessionId);
             items[6] = strFmt("Shell\t\t\t{0}", props.Shell);
             items[7] = strFmt("UriScheme\t\t{0}", props.UriScheme);
             QuickPickOptions opts = default;
             opts = new QuickPickOptions();
             opts.IgnoreFocusOut = true;
             opts.PlaceHolder    = logLn(strFmt("Env has {0} properties", items.Length)) + ":";
             vsc.Window.ShowQuickPick(quickPickItemsFrom(items), opts, null)((QuickPickItem[] menuitems) => {
                 if ((null != menuitems))
                 {
                     logLn(menuitems[0].Label);
                 }
             });
         }
     });
 }
Exemplo n.º 2
0
 private static void demo_Languages_GetLanguages()
 {
     vsc.Languages.GetLanguages()((string[] items) => {
         QuickPickOptions opts = default;
         opts = new QuickPickOptions();
         opts.IgnoreFocusOut = true;
         opts.PlaceHolder    = strFmt("Retrieved {0} language ID(s)", items.Length);
         vsc.Window.ShowQuickPick(quickPickItemsFrom(items), opts, null)((QuickPickItem[] menuitems) => {
             if ((null != menuitems))
             {
                 logLn(menuitems[0].Label);
             }
         });
     });
 }
Exemplo n.º 3
0
        private static void demo_Window_ShowQuickPick()
        {
            QuickPickItem[] items = default;
            items                = new QuickPickItem[4];
            items[0]             = new QuickPickItem();
            items[0].Label       = "One";
            items[0].Description = "The first";
            items[0].Detail      = "Das erste";
            items[1]             = new QuickPickItem();
            items[1].Label       = "Two";
            items[1].Description = "The second";
            items[1].Detail      = "Das zweite";
            items[2]             = new QuickPickItem();
            items[2].Label       = "Three";
            items[2].Description = "The third";
            items[2].Detail      = "Das dritte";
            items[3]             = new QuickPickItem();
            items[3].Label       = "Four";
            items[3].Description = "The fourth";
            items[3].Detail      = "Das vierte";
            QuickPickOptions opts = default;

            opts = new QuickPickOptions();
            opts.IgnoreFocusOut     = true;
            opts.CanPickMany        = true;
            opts.MatchOnDescription = true;
            opts.MatchOnDetail      = true;
            opts.PlaceHolder        = "You have 42 seconds before auto-cancellation!";
            opts.OnDidSelectItem    = (QuickPickItem item) => {
                vsc.Window.SetStatusBarMessage(logLn(strFmt("Just selected: {0}", item.Label)), 4242);
                return(null);
            };
            vsc.Window.ShowQuickPick(items, opts, cancelIn(42))((QuickPickItem[] pickeditems) => {
                if ((null == pickeditems))
                {
                    vsc.Window.ShowWarningMessage(logLn("Cancelled pick input, not one to tick the boxes?"), null);
                }
                else
                {
                    vsc.Window.ShowInformationMessage(logLn(strFmt("You picked {0} item(s), good stuff!", pickeditems.Length)), null);
                }
            });
        }
Exemplo n.º 4
0
 private static void demo_Commands_GetCommands_and_ExecuteCommand()
 {
     vsc.Commands.GetCommands(false)((string[] items) => {
         QuickPickOptions opts = default;
         opts = new QuickPickOptions();
         opts.IgnoreFocusOut = true;
         opts.PlaceHolder    = strFmt("Retrieved {0} command ID(s), pick one to execute or escape now:", items.Length);
         vsc.Window.ShowQuickPick(quickPickItemsFrom(items), opts, null)((QuickPickItem[] item) => {
             if ((null == item))
             {
                 vsc.Window.ShowWarningMessage(logLn("Command selection cancelled, spooked?"), null);
             }
             else
             {
                 InputBoxOptions opts2 = default;
                 opts2 = new InputBoxOptions();
                 opts2.IgnoreFocusOut = true;
                 logLn(strFmt("cmdarg@opts2/{0}:\t{1}", "PlaceHolder", strFmt("Any param for `{0}` command? Else leave blank.", item[0].Label)));
                 opts2.PlaceHolder = strFmt("Any param for `{0}` command? Else leave blank.", item[0].Label);
                 vsc.Window.ShowInputBox(opts2, null)((string cmdarg) => {
                     if ((null == cmdarg))
                     {
                         vsc.Window.ShowWarningMessage(logLn("Don't be bashful.."), null);
                     }
                     else
                     {
                         logLn(strFmt("cmdarg <- {0}", cmdarg));
                         any[] cmdargs = default;
                         if ("" != cmdarg)
                         {
                             cmdargs    = new any[1];
                             cmdargs[0] = cmdarg;
                         }
                         vsc.Commands.ExecuteCommand(item[0].Label, cmdargs)((any ret) => {
                             vsc.Window.ShowInformationMessage(logLn(strFmt("Command result was: `{0}`, kudos!", ret)), null);
                         });
                     }
                 });
             }
         });
     });
 }
Exemplo n.º 5
0
 private static void demo_Workspace_Properties()
 {
     vsc.Workspace.AllProperties()((WorkspaceState props) => {
         string[] items = default;
         items = new string[3];
         {
             items[0] = strFmt("Name\t\t\t{0}", props.Name);
             items[1] = strFmt("WorkspaceFile\t\t{0}", props.WorkspaceFile);
             items[2] = strFmt("WorkspaceFolders\t{0}", props.WorkspaceFolders);
             QuickPickOptions opts = default;
             opts = new QuickPickOptions();
             opts.IgnoreFocusOut = true;
             opts.PlaceHolder    = logLn(strFmt("Workspace has {0} properties", items.Length)) + ":";
             vsc.Window.ShowQuickPick(quickPickItemsFrom(items), opts, null)((QuickPickItem[] menuitems) => {
                 if ((null != menuitems))
                 {
                     logLn(menuitems[0].Label);
                 }
             });
         }
     });
 }
Exemplo n.º 6
0
        private static void demosMenu()
        {
            string[] items = default;
            items = new[] { "demo_promptToExit", "demo_clipboard", "demo_Commands_GetCommands_and_ExecuteCommand", "demo_Commands_RegisterCommand", "demo_Languages_GetLanguages", "demo_Env_Properties", "demo_Workspace_Properties", "demo_Window_ShowOpenDialog", "demo_Window_ShowSaveDialog", "demo_Window_ShowWorkspaceFolderPick", "demo_Env_OpenExternal", "demo_Window_ShowQuickPick", "demo_Window_CreateQuickPick", "demo_Window_CreateInputBox", "demo_Window_CreateTerminal", "demo_Window_ShowInputBox" };
            QuickPickOptions opts = default;

            opts = new QuickPickOptions();
            opts.IgnoreFocusOut = true;
            opts.PlaceHolder    = "This menu can be re-opened any time via our custom status-bar item.";
            vsc.Window.ShowQuickPick(quickPickItemsFrom(items), opts, null)((QuickPickItem[] menuitems) => {
                if ((null != menuitems))
                {
                    if ("demo_promptToExit" == menuitems[0].Label)
                    {
                        logLn("Picked `demo_promptToExit` from main menu");
                        demo_promptToExit();
                    }
                    if ("demo_clipboard" == menuitems[0].Label)
                    {
                        logLn("Picked `demo_clipboard` from main menu");
                        demo_clipboard();
                    }
                    if ("demo_Commands_GetCommands_and_ExecuteCommand" == menuitems[0].Label)
                    {
                        logLn("Picked `demo_Commands_GetCommands_and_ExecuteCommand` from main menu");
                        demo_Commands_GetCommands_and_ExecuteCommand();
                    }
                    if ("demo_Commands_RegisterCommand" == menuitems[0].Label)
                    {
                        logLn("Picked `demo_Commands_RegisterCommand` from main menu");
                        demo_Commands_RegisterCommand();
                    }
                    if ("demo_Languages_GetLanguages" == menuitems[0].Label)
                    {
                        logLn("Picked `demo_Languages_GetLanguages` from main menu");
                        demo_Languages_GetLanguages();
                    }
                    if ("demo_Env_Properties" == menuitems[0].Label)
                    {
                        logLn("Picked `demo_Env_Properties` from main menu");
                        demo_Env_Properties();
                    }
                    if ("demo_Workspace_Properties" == menuitems[0].Label)
                    {
                        logLn("Picked `demo_Workspace_Properties` from main menu");
                        demo_Workspace_Properties();
                    }
                    if ("demo_Window_ShowOpenDialog" == menuitems[0].Label)
                    {
                        logLn("Picked `demo_Window_ShowOpenDialog` from main menu");
                        demo_Window_ShowOpenDialog();
                    }
                    if ("demo_Window_ShowSaveDialog" == menuitems[0].Label)
                    {
                        logLn("Picked `demo_Window_ShowSaveDialog` from main menu");
                        demo_Window_ShowSaveDialog();
                    }
                    if ("demo_Window_ShowWorkspaceFolderPick" == menuitems[0].Label)
                    {
                        logLn("Picked `demo_Window_ShowWorkspaceFolderPick` from main menu");
                        demo_Window_ShowWorkspaceFolderPick();
                    }
                    if ("demo_Env_OpenExternal" == menuitems[0].Label)
                    {
                        logLn("Picked `demo_Env_OpenExternal` from main menu");
                        demo_Env_OpenExternal();
                    }
                    if ("demo_Window_ShowQuickPick" == menuitems[0].Label)
                    {
                        logLn("Picked `demo_Window_ShowQuickPick` from main menu");
                        demo_Window_ShowQuickPick();
                    }
                    if ("demo_Window_CreateQuickPick" == menuitems[0].Label)
                    {
                        logLn("Picked `demo_Window_CreateQuickPick` from main menu");
                        demo_Window_CreateQuickPick();
                    }
                    if ("demo_Window_CreateInputBox" == menuitems[0].Label)
                    {
                        logLn("Picked `demo_Window_CreateInputBox` from main menu");
                        demo_Window_CreateInputBox();
                    }
                    if ("demo_Window_CreateTerminal" == menuitems[0].Label)
                    {
                        logLn("Picked `demo_Window_CreateTerminal` from main menu");
                        demo_Window_CreateTerminal();
                    }
                    if ("demo_Window_ShowInputBox" == menuitems[0].Label)
                    {
                        logLn("Picked `demo_Window_ShowInputBox` from main menu");
                        demo_Window_ShowInputBox();
                    }
                }
            });
        }